Package ch.tocco.nice2.model.entity.api
Interface FieldModel
- All Superinterfaces:
ModelElement
,ModuleTracker
- All Known Implementing Classes:
DefaultFieldModel
,FieldModelImpl
The model of one
Entity Model's
field.
The backendData is of type FieldModelInfo.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDocumentation
(String definingModule, String documentation) Adds documentation for theFieldModel
, contributed by the definingAppModule
.Get the base field of a localized field.Returns the DefaultValueDescriptor.Returns the content of the documentation element of theFieldModel
tag as aLinkedHashMap
, divided by theAppModule
s extending the baseFieldModel
and contributing the documentation.@Nullable DisplayValue
getLabel()
getName()
Returns the entity field name; the name attribute of the field tag in xml.Returns the internal field name, eg db table field name; the target attribute of the field tag in xml.Type
<?> getType()
boolean
boolean
When a binary field is changed, a dialog is shown to the user to update all other binary fields which contain the same binary data.boolean
isKey()
Tells if this field is the or part of the primary key.boolean
Tells if this field is multilingual.boolean
boolean
Tells if the field accepts the null value to be stored in it.boolean
boolean
boolean
isUnique()
Tells if the field's values are unique (i.e.boolean
boolean
void
setBaseField
(FieldModel baseField) Set the base field for synthetic localized fields.void
setBinaryReplacementDisabled
(boolean disabled) void
setDefaultValue
(Object descriptor) void
setLabel
(DisplayValue display) void
setLocalized
(boolean flag) void
void
setNullable
(boolean nullable) void
setPrivilegedAccessOnly
(boolean privilegedAccessOnly) void
setSynthetic
(boolean synthetic) void
void
void
setUnique
(boolean unique) void
setValidator
(AndGroupValidator validator) Sets the primary validator which may contain real validation validators and other groups.void
setVirtual
(boolean virtual) void
setXssFilter
(boolean xssFilter) Methods inherited from interface ch.tocco.nice2.model.entity.api.ModuleTracker
addExtendingModule, getDefiningModule, getExtendingModules, setDefiningModule
-
Method Details
-
getName
String getName()Returns the entity field name; the name attribute of the field tag in xml. -
getTarget
String getTarget()Returns the internal field name, eg db table field name; the target attribute of the field tag in xml. -
isNullable
boolean isNullable()Tells if the field accepts the null value to be stored in it.Key fields
are never nullable. -
isUnique
boolean isUnique()Tells if the field's values are unique (i.e. a value may only exists once)- Returns:
- true if the field's values are unique
-
isKey
boolean isKey()Tells if this field is the or part of the primary key.It has nothing to do with indexed fields, nor with foreign keys.
-
isVirtual
boolean isVirtual() -
isSynthetic
boolean isSynthetic() -
getType
Type<?> getType()- Returns:
- Returns the nice Type object which for example represents a string.
-
getDefaultValue
Object getDefaultValue()Returns the DefaultValueDescriptor. This is the dynamic default value that can be defined on the entity as well as on the form.The reason that this signature returns 'Object' is because the interface cannot be seen.
- Returns:
- instance of DefaultValueDescriptor
-
setNullable
void setNullable(boolean nullable) - Parameters:
nullable
- true/false- Throws:
IllegalStateException
- when trying to set this value after reading the mode.- See Also:
-
setUnique
void setUnique(boolean unique) - Parameters:
unique
- true/false
-
setVirtual
void setVirtual(boolean virtual) -
setSynthetic
void setSynthetic(boolean synthetic) -
setName
- Parameters:
name
- the name, non-null- Throws:
IllegalStateException
- when trying to set this value after reading the mode.- See Also:
-
setTarget
- Parameters:
target
- the target- Throws:
IllegalStateException
- when trying to set this value after reading the mode.- See Also:
-
setType
- Parameters:
type
- the type- Throws:
IllegalStateException
- when trying to set this value after reading the mode.- See Also:
-
setDefaultValue
-
hasNonEmptyValidator
boolean hasNonEmptyValidator()- Returns:
- Tells if this field model has a validator, a GroupValidator to be precise, which has at least one entry.
- See Also:
-
getValidator
GroupValidator getValidator()- Returns:
- Returns the outermost group validator which may be empty.
- See Also:
-
setValidator
Sets the primary validator which may contain real validation validators and other groups.Method for the startup process.
- Parameters:
validator
- The group validator.
-
getLabel
- Returns:
- The label of this field.
-
setLabel
- Parameters:
display
- the display, non-null- Throws:
IllegalStateException
- when trying to set this value after reading the mode.- See Also:
-
getDocumentation
LinkedHashMap<String,String> getDocumentation()Returns the content of the documentation element of theFieldModel
tag as aLinkedHashMap
, divided by theAppModule
s extending the baseFieldModel
and contributing the documentation. The contents of the map are ordered according to the loading sequence of theAppModule
s.- Returns:
- The
LinkedHashMap
containg theFieldModel
's documentation tag.
-
addDocumentation
Adds documentation for theFieldModel
, contributed by the definingAppModule
.- Parameters:
definingModule
- the string representation of theAppModule
contributing the documentationdocumentation
- the documentation for theFieldModel
-
setLocalized
void setLocalized(boolean flag) - Parameters:
flag
-true
to make it a multilingual field,false
to not.
-
isLocalized
boolean isLocalized()Tells if this field is multilingual. If it is then this field model most likely has siblings; for every system language there is such a field model for the same field.- See Also:
-
setXssFilter
void setXssFilter(boolean xssFilter) -
isXssFilter
boolean isXssFilter() -
setBaseField
Set the base field for synthetic localized fields. -
getBaseField
Optional<FieldModel> getBaseField()Get the base field of a localized field. If the field we're currently working on is localized andgetBaseField()
doesn't return a field, then it might already be the base field.- Returns:
- the base field of the localized field.
- See Also:
-
isMandatory
boolean isMandatory()- Returns:
- true if a MandatoryValidator is registered for the underlying field and thus the field is mandatory
-
isBinaryReplacementDisabled
boolean isBinaryReplacementDisabled()When a binary field is changed, a dialog is shown to the user to update all other binary fields which contain the same binary data. If this boolean flag ist set to `true`, the dialog won't show up if this field is changed. The default value for this flag is `false`. -
setBinaryReplacementDisabled
void setBinaryReplacementDisabled(boolean disabled) -
isPrivilegedAccessOnly
boolean isPrivilegedAccessOnly() -
setPrivilegedAccessOnly
void setPrivilegedAccessOnly(boolean privilegedAccessOnly)
-