Business Logic / Metadata | org.jaffa.metadata |
The FieldMetaData object holds useful information for a domain field. The FieldMetaData class
itself is abstract and is extended by all the datatype specific classes as listed below.
The attributes provided by the base class are - name, datatype, labelToken, isMandatory.
Each datatype specific class can provide additional attributes as listed in the table.
MetaData Field Types
Jaffa Logical Datatype |
FieldMetaData Class |
Additional Attributes |
org.jaffa.datatypes.Defaults.BOOLEAN |
org.jaffa.metadata .BooleanFieldMetaData |
layout, pattern |
org.jaffa.datatypes.Defaults.STRING |
org.jaffa.metadata .StringFieldMetaData |
pattern, length, caseType |
org.jaffa.datatypes.Defaults.INTEGER |
org.jaffa.metadata .IntegerFieldMetaData |
layout, minValue, maxValue, intSize |
org.jaffa.datatypes.Defaults.DECIMAL |
org.jaffa.metadata .DecimalFieldMetaData |
layout, minValue, maxValue, intSize, fracSize |
org.jaffa.datatypes.Defaults.DATEONLY |
org.jaffa.metadata .DateOnlyFieldMetaData |
layout, minValue, maxValue |
org.jaffa.datatypes.Defaults.DATETIME |
org.jaffa.metadata .DateTimeFieldMetaData |
layout, minValue, maxValue |
org.jaffa.datatypes.Defaults.CURRENCY |
org.jaffa.metadata .CurrencyFieldMetaData |
layout, minValue, maxValue, intSize, fracSize |
org.jaffa.datatypes.Defaults.RAW |
org.jaffa.metadata .RawFieldMetaData |
|
The many uses of FieldMetaData inside Jaffa
- It declares the datatype for a domain field. The presentation layer uses this information
to perform datatype checks at the javascript level
- It provides the the name attribute, which is used by the JDBC Engine when generating SQL
- It provides a labelToken for the field. The presentation layer uses the labelToken to get
the appropriate label for a domain field, from a properties file. The labels are used in
screens and error messages.
- It provides default layouts, which can be overridden, to be used by the presentation layer,
for displaying data
- It can specify some basic validations to be performed on a field. The validations are
datatype specific. Some examples are ... pattern, length, caseType, minValue, maxValue, intSize, fracSize.
There can however be an overlap with the Dynamic Rules Engine, which can provide a similar capability.
The Persistence Engine uses both the FieldMetaData and the Dynamic Rules Engine for validating a domain
field. It is however recommeded to use the Dynamic Rules Engine for validations, since it is configurable,
customizable and much more powerful.
- The FieldMetaData can also be instantiated for dummy fields inside the FormBeans of the presentation layer. These can then be used to perform very basic validations within the presentation layer itself
|