Class TemplateEntityModel
java.lang.Object
ch.tocco.nice2.persist.entity.spi.template.TemplateEntityModel
- All Implemented Interfaces:
NiceActionHolder,EntityModel,ModelElement,ModuleTracker
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EntityModelstatic final Predicate<FieldModel> static final Predicate<FieldModel> static final Predicate<FieldModel> static final String -
Constructor Summary
ConstructorsConstructorDescriptionTemplateEntityModel(EntityModel baseEntityModel, EntityModel entityTemplateModel) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAvailableLocale(Locale locale) voidaddDocumentation(String definingModule, String documentation) Adds documentation for theEntityModel, contributed by the definingAppModule.voidaddExtendingModule(String moduleName) voidaddField(FieldModel field) Adds a nice-field to this entity model.voidaddRelation(RelationModel relation) voidaddSearch(EntitySearchModel search) Adds anotherEntitySearchModelto thisEntityModel.boolean@Nullable ActionsModelReturns the name of the nice2 module, where this model element is defined.Returns the content of the documentation element of theEntityModeltag as aLinkedHashMap, divided by theAppModules extending the baseEntityModeland contributing the documentation.Returns a list of nice2 module names, that have contributed to this model element.@Nullable FieldModelgetFieldByName(String name) Get a field by its name.@Nullable FieldModelgetFieldByName(String name, String locale) Get a possibly multilingual field by base name and locale.@Nullable FieldModelgetFieldByName(String name, Locale locale) getFieldsByBaseType(String baseType) Returns all fields that have the specified data type as base type.getFieldsByType(String type) Returns all fields of the data type specified.getFieldsNames(List<FieldModel> fields) Example: myEntityModel.getFieldsNames( myEntityModel.getKeys() )getFieldsTargets(List<FieldModel> fields) Example: myEntityModel.getFieldsTargets( myEntityModel.getKeys() )@Nullable FieldModelgetFirstFieldOfBaseType(String baseType) @Nullable FieldModelgetFirstFieldOfType(String type) version, createts, updateuser ...Collection<ch.tocco.nice2.persist.entity.spi.template.ForwardingRelationModel> Will be used as order for indexing entities.getKey()@Nullable FieldModelgetLocalizedField(String baseName, Locale locale) Returns one field model for the field that is of type 'localized'.getLocalizedFields(String baseName) Returns all field models (one per system language) for the field that is of type 'localized'.getName()It's the "name" attribute of the entityModel tag.@Nullable ch.tocco.nice2.persist.entity.spi.template.ForwardingRelationModelgetRelationByName(String name) Get a relation by its name.Get all relations FROM this entity TO other entities; only one way.Returns all removed field models.Returns all removed field models.Get a description for how to search in this entity.It's the "target" attribute of the entityModel tag.Returns only those fields of the base entity that belong to the template (i.e.@Nullable Boolean@Nullable Boolean@Nullable BooleanGet an object which describes the visualisation of this entity.Get the entity widget entity type (CMS).Determine whether this entity can be a content reference source.@Nullable BooleanbooleanIncluded are key fields, but not relations.@Nullable BooleaninthashCode()@Nullable BooleanbooleanhasRelation(String relName) booleanhasRemovedField(String name) Does this Entity-Model contain a removed field?
A possibility to ask the configuration if something got removed.booleanhasRemovedRelation(String name) Does this Entity-Model contain a removed relation?
A possibility to ask the configuration if something got removed.Determine wheter the reset initialvalues action is shown on this entity or notbooleanbooleanisLocalizedField(String baseName) Tells if there is a localized field with the given base name.booleanvoidremoveField(FieldModel toRemove) voidremoveRelation(RelationModel toRemove) voidreplaceRelation(RelationModel relation) voidsetActions(ActionsModel actions) voidvoidsetContentReference(Boolean contentReference) Specify whether this entity can be a content reference source.voidsetDefiningModule(String moduleName) voidsetDisabled(boolean disabled) Sets if this entity is disabled and thus ignored.voidsetEntityDocumentsModel(EntityDocumentsModel entityDocumentsModel) voidsetEntityType(EntityType entityType) voidsetHasExportAction(Boolean hasExportAction) voidsetHasGenericActions(Boolean hasGenericActions) voidsetHasImportAction(Boolean hasImportAction) voidsetIndexPriority(Integer indexPriority) voidsetMarkable(Boolean markable) voidvoidsetOutputCenter(boolean outputCenter) voidsetRelevantForExport(Boolean relevantForExport) voidsetResetInitialvaluesAction(Boolean resetInitialvaluesAction) Specify whether the reset initialvalues action is shown on this entity or notvoidvoidsetUseAdminCreate(Boolean useAdminCreate) voidsetUseAdminDelete(Boolean useAdminDelete) voidsetUseEntityMergeAction(Boolean useEntityMergeAction) voidsetUseHistoryAction(Boolean useMassMutationAction) voidsetUseMassMutationActions(Boolean useMassMutationActions) voidsetUseNiceFields(Boolean useNiceFields) voidsetUseRemoteFieldNewButton(Boolean useRemoteFieldNewButton) voidsetVisualisation(EntityVisualisationModel visualisation) voidsetWidgetEntityType(WidgetEntityType widgetEntityType) Set widget entity type (CMS).toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.tocco.nice2.model.entity.api.EntityModel
getLabel, requireFieldByName, requireRelationByName
-
Field Details
-
TEMPLATE_FIELD_PREFIX
- See Also:
-
noKeys
-
noLocalizedBaseFields
-
noXmlData
-
baseEntityModel
-
-
Constructor Details
-
TemplateEntityModel
-
-
Method Details
-
getName
Description copied from interface:EntityModelIt's the "name" attribute of the entityModel tag.- Specified by:
getNamein interfaceEntityModel- Returns:
- The entity name of this entity, for example "Address".
-
getBaseModel
-
getEntityTemplateModel
-
getRelationByName
@Nullable public @Nullable ch.tocco.nice2.persist.entity.spi.template.ForwardingRelationModel getRelationByName(String name) Description copied from interface:EntityModelGet a relation by its name.- Specified by:
getRelationByNamein interfaceEntityModel- Parameters:
name- The name.- Returns:
- The relation or null if this relation doesn't exists!
-
getRelations
Description copied from interface:EntityModelGet all relations FROM this entity TO other entities; only one way. There seems to be no method for the opposite yet.- Specified by:
getRelationsin interfaceEntityModel
-
getForwardRelations
public Collection<ch.tocco.nice2.persist.entity.spi.template.ForwardingRelationModel> getForwardRelations() -
getKey
- Specified by:
getKeyin interfaceEntityModel- Returns:
- The primary key field.
-
getFields
- Specified by:
getFieldsin interfaceEntityModel- Returns:
- The fields including those part of the primary keys (see
EntityModel.getKey()).
-
getTemplateFields
Returns only those fields of the base entity that belong to the template (i.e. without the primary key of the base entity). -
getFieldByName
Description copied from interface:EntityModelGet a field by its name. Note: If the field is multilingual then provide the complete name for the strategy in use, which may look something like "somename" or "somename_fr".- Specified by:
getFieldByNamein interfaceEntityModel- Parameters:
name- The complete field's name (including possible localized suffix), not empty.- Returns:
- The field, or
nullif this field doesn't exists! - See Also:
-
getFieldsByType
Description copied from interface:EntityModelReturns all fields of the data type specified.- Specified by:
getFieldsByTypein interfaceEntityModel- Returns:
- May be empty.
-
getFieldsByBaseType
Description copied from interface:EntityModelReturns all fields that have the specified data type as base type.- Specified by:
getFieldsByBaseTypein interfaceEntityModel- Returns:
- May be empty.
-
getTarget
Description copied from interface:EntityModelIt's the "target" attribute of the entityModel tag.- Specified by:
getTargetin interfaceEntityModel- Returns:
- The internal target of this entity, eg the table name.
-
hasRelation
- Specified by:
hasRelationin interfaceEntityModel- Parameters:
relName- The relation name to look for, eg "relFoo".- Returns:
- Tells if this model has a relation by that name.
- See Also:
-
toString
-
isMarkable
- Specified by:
isMarkablein interfaceEntityModel
-
setMarkable
- Specified by:
setMarkablein interfaceEntityModel
-
getIndexPriority
Description copied from interface:EntityModelWill be used as order for indexing entities. Also describes order when displaying results (higher value is higher in list). Possible values: * -1: not indexed * 0: indexed, but not visible in searching in "full-system-search". used for lookup entities for example. * 1..n: indexed- Specified by:
getIndexPriorityin interfaceEntityModel
-
setIndexPriority
- Specified by:
setIndexPriorityin interfaceEntityModel- See Also:
-
addRelation
- Specified by:
addRelationin interfaceEntityModel- Parameters:
relation- The relation.- See Also:
-
replaceRelation
- Specified by:
replaceRelationin interfaceEntityModel- See Also:
-
removeField
- Specified by:
removeFieldin interfaceEntityModel- Parameters:
toRemove- the field to remove- Throws:
IllegalStateException- when try to change the model after finished model-readingIllegalArgumentException- when the field is not removable (not there)
-
removeRelation
- Specified by:
removeRelationin interfaceEntityModel- Parameters:
toRemove- the field to remove
-
setUseMassMutationActions
- Specified by:
setUseMassMutationActionsin interfaceEntityModel
-
setUseHistoryAction
- Specified by:
setUseHistoryActionin interfaceEntityModel
-
setUseEntityMergeAction
- Specified by:
setUseEntityMergeActionin interfaceEntityModel
-
setUseAdminCreate
- Specified by:
setUseAdminCreatein interfaceEntityModel
-
setUseAdminDelete
- Specified by:
setUseAdminDeletein interfaceEntityModel
-
setUseRemoteFieldNewButton
- Specified by:
setUseRemoteFieldNewButtonin interfaceEntityModel
-
setRelevantForExport
- Specified by:
setRelevantForExportin interfaceEntityModel
-
setDisabled
public void setDisabled(boolean disabled) Description copied from interface:EntityModelSets if this entity is disabled and thus ignored.- Specified by:
setDisabledin interfaceEntityModel- Parameters:
disabled- if disabled
-
setTarget
- Specified by:
setTargetin interfaceEntityModel- Parameters:
target- targent-name, non-null
-
setEntityType
- Specified by:
setEntityTypein interfaceEntityModel- Parameters:
entityType- The type of entity.
-
addField
Description copied from interface:EntityModelAdds a nice-field to this entity model. WARNING: All key fields need to be added first! If you try to add a regular field first then you'll get a strange ClassCastException to Long. Note: a field "removed" (disabled) by removeField() cannot be re-added here.- Specified by:
addFieldin interfaceEntityModel- Parameters:
field- The field model
-
setName
- Specified by:
setNamein interfaceEntityModel- Parameters:
name- the name, non-null
-
addDocumentation
Description copied from interface:EntityModelAdds documentation for theEntityModel, contributed by the definingAppModule.- Specified by:
addDocumentationin interfaceEntityModel- Parameters:
definingModule- the string representation of theAppModulecontributing the documentationdocumentation- the documentation for theEntityModel
-
setActions
- Specified by:
setActionsin interfaceNiceActionHolder
-
addExtendingModule
- Specified by:
addExtendingModulein interfaceModuleTracker
-
setDefiningModule
- Specified by:
setDefiningModulein interfaceModuleTracker
-
getFieldByName
Description copied from interface:EntityModelGet a possibly multilingual field by base name and locale.This is a shortcut for doing:
EntityModel.getFieldByName( EntityModel.getLocalizedFieldMapper().getFieldName(name, locale) );- Specified by:
getFieldByNamein interfaceEntityModel- Parameters:
name- The field's base name, not empty.locale- Currently the 2-digit lowercase ISO-639 language code only, eg "fr" for French.- Returns:
- The field, or
nullif this field doesn't exists (either at all or in that locale) - See Also:
-
getFieldByName
- Specified by:
getFieldByNamein interfaceEntityModel
-
isLocalizedField
Description copied from interface:EntityModelTells if there is a localized field with the given base name.- Specified by:
isLocalizedFieldin interfaceEntityModel- Parameters:
baseName- The field's base name as specified in the entity xml file, without language part.- Returns:
trueIf there is such a field and it is a localized one,falseif there is no such field at all, or if it is not localized.- See Also:
-
getLocalizedFields
Description copied from interface:EntityModelReturns all field models (one per system language) for the field that is of type 'localized'.- Specified by:
getLocalizedFieldsin interfaceEntityModel- Parameters:
baseName- The field's base name as specified in the entity xml file, without language part.- Returns:
- key = 2 letter iso language code in lower case. Not empty, no null values within.
- Throws:
IllegalArgumentException- If the field is not localized,check first.- See Also:
-
getLocalizedField
Description copied from interface:EntityModelReturns one field model for the field that is of type 'localized'.- Specified by:
getLocalizedFieldin interfaceEntityModel- Parameters:
baseName- The field's base name as specified in the entity xml file, without language part.locale- The desired language, must be one of the configured system languages (2 letter lower case iso code).- Returns:
nullif there is no such field, or if it is not localized, or if there is no such language.- See Also:
-
addAvailableLocale
- Specified by:
addAvailableLocalein interfaceEntityModel
-
getAvailableLocales
- Specified by:
getAvailableLocalesin interfaceEntityModel
-
getLocalizedFieldMapper
- Specified by:
getLocalizedFieldMapperin interfaceEntityModel
-
hasRemovedField
Description copied from interface:EntityModelDoes this Entity-Model contain a removed field?
A possibility to ask the configuration if something got removed. This is imported to remove dependent stuff.
For example the field 'username' is removed on an entity. The form-system needs to know that this field is removed that the field is also removed in the form.- Specified by:
hasRemovedFieldin interfaceEntityModel- Parameters:
name- the name- Returns:
- true if this field got removed during the configuration-reading-process
-
getRemovedFields
Description copied from interface:EntityModelReturns all removed field models. Returns an empty collection if none exist.- Specified by:
getRemovedFieldsin interfaceEntityModel
-
hasRemovedRelation
Description copied from interface:EntityModelDoes this Entity-Model contain a removed relation?
A possibility to ask the configuration if something got removed. This is importet to remove dependend stuff.
For example we remove the Field 'username' on an entity. Then the form-system need to know that this it's removed explictly and no spelling-error in the form-configuration. Then the form-system can remove the field aswell which would normally show this entity-field.- Specified by:
hasRemovedRelationin interfaceEntityModel- Parameters:
name- the name- Returns:
- true if this field got removed during the configuration-reading-process
-
getRemovedRelations
Description copied from interface:EntityModelReturns all removed field models. Returns an empty collection if none exist.- Specified by:
getRemovedRelationsin interfaceEntityModel
-
getVisualisation
Description copied from interface:EntityModelGet an object which describes the visualisation of this entity.- Specified by:
getVisualisationin interfaceEntityModel- Returns:
- The visualisation.
-
setVisualisation
- Specified by:
setVisualisationin interfaceEntityModel
-
getSearch
Description copied from interface:EntityModelGet a description for how to search in this entity.- Specified by:
getSearchin interfaceEntityModel- Returns:
- The search behavior.
-
addSearch
Description copied from interface:EntityModelAdds anotherEntitySearchModelto thisEntityModel.- Specified by:
addSearchin interfaceEntityModel- Parameters:
search- The search model.
-
getUseMassMutationActions
- Specified by:
getUseMassMutationActionsin interfaceEntityModel
-
getUseHistoryAction
- Specified by:
getUseHistoryActionin interfaceEntityModel
-
getUseEntityMergeAction
- Specified by:
getUseEntityMergeActionin interfaceEntityModel
-
setHasImportAction
- Specified by:
setHasImportActionin interfaceEntityModel
-
hasImportAction
- Specified by:
hasImportActionin interfaceEntityModel
-
setHasExportAction
- Specified by:
setHasExportActionin interfaceEntityModel
-
hasExportAction
- Specified by:
hasExportActionin interfaceEntityModel
-
getUseAdminCreate
- Specified by:
getUseAdminCreatein interfaceEntityModel
-
getUseAdminDelete
- Specified by:
getUseAdminDeletein interfaceEntityModel
-
getUseRemoteFieldNewButton
- Specified by:
getUseRemoteFieldNewButtonin interfaceEntityModel
-
getRelevantForExport
- Specified by:
getRelevantForExportin interfaceEntityModel
-
setHasGenericActions
- Specified by:
setHasGenericActionsin interfaceEntityModel
-
hasGenericActions
- Specified by:
hasGenericActionsin interfaceEntityModel
-
getUseNiceFields
- Specified by:
getUseNiceFieldsin interfaceEntityModel
-
setUseNiceFields
- Specified by:
setUseNiceFieldsin interfaceEntityModel
-
setBusinessUnitType
- Specified by:
setBusinessUnitTypein interfaceEntityModel
-
getBusinessUnitType
- Specified by:
getBusinessUnitTypein interfaceEntityModel
-
getEntityDocumentsModel
- Specified by:
getEntityDocumentsModelin interfaceEntityModel
-
setEntityDocumentsModel
- Specified by:
setEntityDocumentsModelin interfaceEntityModel
-
isOutputCenter
public boolean isOutputCenter()- Specified by:
isOutputCenterin interfaceEntityModel
-
setOutputCenter
public void setOutputCenter(boolean outputCenter) - Specified by:
setOutputCenterin interfaceEntityModel
-
getWidgetEntityType
Description copied from interface:EntityModelGet the entity widget entity type (CMS).- Specified by:
getWidgetEntityTypein interfaceEntityModel- Returns:
- the widget entity type.
-
setWidgetEntityType
Description copied from interface:EntityModelSet widget entity type (CMS).- Specified by:
setWidgetEntityTypein interfaceEntityModel- Parameters:
widgetEntityType- The widget entity type.
-
hasContentReference
Description copied from interface:EntityModelDetermine whether this entity can be a content reference source.- Specified by:
hasContentReferencein interfaceEntityModel- Returns:
- true, if the entity can be a content reference source, else false.
-
setContentReference
Description copied from interface:EntityModelSpecify whether this entity can be a content reference source.- Specified by:
setContentReferencein interfaceEntityModel
-
hasResetInitialvaluesAction
Description copied from interface:EntityModelDetermine wheter the reset initialvalues action is shown on this entity or not- Specified by:
hasResetInitialvaluesActionin interfaceEntityModel
-
setResetInitialvaluesAction
Description copied from interface:EntityModelSpecify whether the reset initialvalues action is shown on this entity or not- Specified by:
setResetInitialvaluesActionin interfaceEntityModel
-
getDocumentation
Description copied from interface:EntityModelReturns the content of the documentation element of theEntityModeltag as aLinkedHashMap, divided by theAppModules extending the baseEntityModeland contributing the documentation. The contents of the map are ordered according to the loading sequence of theAppModules.- Specified by:
getDocumentationin interfaceEntityModel- Returns:
- The
LinkedHashMapcontains theEntityModel's documentation tag.
-
getEntityType
- Specified by:
getEntityTypein interfaceEntityModel- Returns:
- The entity type.
-
isDisabled
public boolean isDisabled()- Specified by:
isDisabledin interfaceEntityModel- Returns:
- Tells if this entity is disabled and thus ignored.
-
getFieldsTargets
Description copied from interface:EntityModelExample: myEntityModel.getFieldsTargets( myEntityModel.getKeys() )- Specified by:
getFieldsTargetsin interfaceEntityModel- Parameters:
fields- The fields to loop.- Returns:
- The targets of the passed in fields.
-
getFieldsNames
Description copied from interface:EntityModelExample: myEntityModel.getFieldsNames( myEntityModel.getKeys() )- Specified by:
getFieldsNamesin interfaceEntityModel- Parameters:
fields- The fields to loop.- Returns:
- The names of the passed in fields.
-
hasField
Description copied from interface:EntityModelIncluded are key fields, but not relations.- Specified by:
hasFieldin interfaceEntityModel- Parameters:
fieldName- The field name to look for.- Returns:
- Tells if this model has a field by that name.
- See Also:
-
getFirstFieldOfType
Description copied from interface:EntityModelversion, createts, updateuser ...- Specified by:
getFirstFieldOfTypein interfaceEntityModel- Returns:
- The first field as returned by getFieldsByType(), or null.
-
getFirstFieldOfBaseType
- Specified by:
getFirstFieldOfBaseTypein interfaceEntityModel- Returns:
- The first field as returned by getFieldsByBaseType(), or null.
-
getActions
- Specified by:
getActionsin interfaceNiceActionHolder
-
getExtendingModules
Description copied from interface:ModuleTrackerReturns a list of nice2 module names, that have contributed to this model element.- Specified by:
getExtendingModulesin interfaceModuleTracker
-
getDefiningModule
Description copied from interface:ModuleTrackerReturns the name of the nice2 module, where this model element is defined.- Specified by:
getDefiningModulein interfaceModuleTracker
-
equals
-
hashCode
public int hashCode()
-