Class EntityModelImpl
java.lang.Object
ch.tocco.nice2.model.entity.api.DefaultModelBase
ch.tocco.nice2.model.entity.api.DefaultEntityModel
ch.tocco.nice2.model.entity.impl.entity.EntityModelImpl
- All Implemented Interfaces:
EntityModel, ModelElement, ModuleTracker
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAvailableLocale(Locale locale) voidaddDocumentation(String definingModule, String documentation) Adds documentation for theEntityModel, contributed by the definingAppModule.voidaddExtendingModule(String moduleName) final voidaddField(FieldModel niceField) Adds a field to this entity model.voidaddRelation(RelationModel relation) voidaddSearch(EntitySearchModel search) Adds anotherEntitySearchModelto thisEntityModel.Returns 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) 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'.@Nullable RelationModelgetRelationByName(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.@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 Boolean@Nullable BooleanbooleanhasRemovedField(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 notbooleanisLocalizedField(String baseName) Tells if there is a localized field with the given base name.booleanvoidremoveField(FieldModel toRemove) voidremoveRelation(RelationModel toRemove) voidreplaceRelation(RelationModel relation) voidsetBusinessUnitType(BusinessUnitType businessUnitType) voidsetContentReference(Boolean contentReference) Specify whether this entity can be a content reference source.voidsetDefiningModule(String name) voidsetEntityDocumentsModel(EntityDocumentsModel entityDocumentsModel) voidsetHasExportAction(Boolean hasExportAction) voidsetHasGenericActions(Boolean hasGenericActions) voidsetHasImportAction(Boolean hasImportAction) voidsetIndexPriority(Integer indexPriority) voidsetMarkable(Boolean markable) voidsetOutputCenter(boolean outputCenter) voidsetRelevantForExport(Boolean relevantForExport) voidsetResetInitialvaluesAction(Boolean resetInitialvaluesAction) Specify whether the reset initialvalues action is shown on this entity or notvoidsetUseAdminCreate(Boolean useAdminCreate) voidsetUseAdminDelete(Boolean useAdminDelete) voidsetUseEntityMergeAction(Boolean useEntityMergeAction) voidsetUseHistoryAction(Boolean useHistoryAction) voidsetUseMassMutationActions(Boolean useMassMutationActions) voidsetUseNiceFields(Boolean useNiceFields) voidsetUseRemoteFieldNewButton(Boolean useRemoteFieldNewButton) voidsetVisualisation(EntityVisualisationModel visualisation) voidsetWidgetEntityType(WidgetEntityType widgetEntityType) Set widget entity type (CMS).Methods inherited from class DefaultEntityModel
getEntityType, getFieldsByBaseType, getFieldsByType, getFieldsNames, getFieldsTargets, getFirstFieldOfBaseType, getFirstFieldOfType, getName, getTarget, hasField, hasRelation, isDisabled, setDisabled, setEntityType, setName, setTargetMethods inherited from class DefaultModelBase
getAdditionalToStringInfo, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface EntityModel
getEntityType, getFieldsByBaseType, getFieldsByType, getFieldsNames, getFieldsTargets, getFirstFieldOfBaseType, getFirstFieldOfType, getLabel, getName, getTarget, hasField, hasRelation, isDisabled, requireFieldByName, requireRelationByName, setDisabled, setEntityType, setName, setTarget
-
Constructor Details
-
EntityModelImpl
public EntityModelImpl()
-
-
Method Details
-
getExtendingModules
Description copied from interface:ModuleTrackerReturns a list of nice2 module names, that have contributed to this model element.- Specified by:
getExtendingModulesin interfaceModuleTracker
-
addExtendingModule
- Specified by:
addExtendingModulein interfaceModuleTracker
-
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.
-
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
-
getDefiningModule
Description copied from interface:ModuleTrackerReturns the name of the nice2 module, where this model element is defined.- Specified by:
getDefiningModulein interfaceModuleTracker
-
setDefiningModule
- Specified by:
setDefiningModulein interfaceModuleTracker
-
addField
Description copied from class:DefaultEntityModelAdds a field to this entity model.WARNING: This implementation currently does not check for duplicates, or fields with the same name. This is currently left up to you, but might change in the future.
- Specified by:
addFieldin interfaceEntityModel- Overrides:
addFieldin classDefaultEntityModel- Parameters:
niceField- The field to add.- Throws:
IllegalArgumentException- (unknown nice-field, unsupported property in nice-field)
-
getKey
- Specified by:
getKeyin interfaceEntityModel- Overrides:
getKeyin classDefaultEntityModel- Returns:
- The primary key field.
-
getFields
- Specified by:
getFieldsin interfaceEntityModel- Overrides:
getFieldsin classDefaultEntityModel- Returns:
- The fields including those part of the primary keys (see
EntityModel.getKey()).
-
getLocalizedFieldMapper
- Specified by:
getLocalizedFieldMapperin interfaceEntityModel
-
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- Overrides:
getFieldByNamein classDefaultEntityModel- 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:
-
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
-
addAvailableLocale
- Specified by:
addAvailableLocalein interfaceEntityModel
-
getAvailableLocales
- Specified by:
getAvailableLocalesin 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:
-
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- Overrides:
getRelationsin classDefaultEntityModel
-
getRemovedFields
Description copied from interface:EntityModelReturns all removed field models. Returns an empty collection if none exist.- Specified by:
getRemovedFieldsin 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
-
getRemovedRelations
Description copied from interface:EntityModelReturns all removed field models. Returns an empty collection if none exist.- Specified by:
getRemovedRelationsin 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
-
addRelation
- Specified by:
addRelationin interfaceEntityModel- Overrides:
addRelationin classDefaultEntityModel- Parameters:
relation- The relation.- See Also:
-
replaceRelation
- Specified by:
replaceRelationin interfaceEntityModel- See Also:
-
getRelationByName
Description copied from interface:EntityModelGet a relation by its name.- Specified by:
getRelationByNamein interfaceEntityModel- Overrides:
getRelationByNamein classDefaultEntityModel- Parameters:
name- The name.- Returns:
- The relation or null if this relation doesn't exists!
-
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.
-
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
-
getUseMassMutationActions
- Specified by:
getUseMassMutationActionsin interfaceEntityModel
-
setUseHistoryAction
- Specified by:
setUseHistoryActionin interfaceEntityModel
-
getUseHistoryAction
- Specified by:
getUseHistoryActionin interfaceEntityModel
-
setUseEntityMergeAction
- Specified by:
setUseEntityMergeActionin 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
-
setUseAdminCreate
- Specified by:
setUseAdminCreatein interfaceEntityModel
-
getUseAdminCreate
- Specified by:
getUseAdminCreatein interfaceEntityModel
-
setUseAdminDelete
- Specified by:
setUseAdminDeletein interfaceEntityModel
-
getUseAdminDelete
- Specified by:
getUseAdminDeletein interfaceEntityModel
-
setUseRemoteFieldNewButton
- Specified by:
setUseRemoteFieldNewButtonin interfaceEntityModel
-
getUseRemoteFieldNewButton
- Specified by:
getUseRemoteFieldNewButtonin interfaceEntityModel
-
setRelevantForExport
- Specified by:
setRelevantForExportin interfaceEntityModel
-
getRelevantForExport
- Specified by:
getRelevantForExportin interfaceEntityModel
-
hasGenericActions
- Specified by:
hasGenericActionsin interfaceEntityModel
-
setHasGenericActions
- Specified by:
setHasGenericActionsin interfaceEntityModel
-
isMarkable
- Specified by:
isMarkablein interfaceEntityModel
-
setMarkable
- Specified by:
setMarkablein interfaceEntityModel
-
getUseNiceFields
- Specified by:
getUseNiceFieldsin interfaceEntityModel
-
setUseNiceFields
- Specified by:
setUseNiceFieldsin 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
-
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:
-
getBusinessUnitType
- Specified by:
getBusinessUnitTypein interfaceEntityModel
-
setBusinessUnitType
- Specified by:
setBusinessUnitTypein 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
-