Interface RelationModel
- All Superinterfaces:
ModelElement,ModuleTracker
- All Known Implementing Classes:
DefaultRelationModel,RelationModelImpl
A relation is identified by it's source-entity and its name. So a relation
has no 'unique'-name. For example there can be a relation from 'Address' to 'Event' called
'relSubscribedTo'. And a relation from 'Address' to 'Newsletter' also called 'relSubscribedTo'.
So the getName() is only identifying together with the EntityModel.getName()
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocumentation(String definingModule, String documentation) Adds documentation for theRelationModel, contributed by the definingAppModule.intReturns the number of display priority.Returns the content of the documentation element of theRelationModeltag as aLinkedHashMap, divided by theAppModules extending the baseRelationModeland contributing the documentation.getLabel()The label of this relationgetLink()getName()Get the reverse-relation.getSelector(String name) The source-entity.The source-entity.booleanbooleanIf thegetSourceEntity()is locked, does this lock propagate over the relation to all target-entities?booleanTells if this model is the reverse-view or a relation.booleanbooleanbooleanisToMany()voidputSelector(String name, Selector selector) voidsetAsSystemRelation(boolean systemRelation) mark the relation as generated by the system system relation are ignored in GenerateMissingFormModelProvidervoidsetDefaultComponentConfig(RelationModel.DefaultComponentConfig componentConfig) set the default component config for this relationvoidvoidsetDeleteBehavior(DeleteBehavior deleteBehavior) voidsetDisplayOrder(int displayOrder) voidsetLabel(DisplayValue label) voidvoidsetMany(boolean sourceIsMany) voidvoidsetPropagatingLock(boolean isPropagatingLock) voidsetRequired(boolean sourceRequired) voidsetReverse(boolean reverse) voidsetReverseRelation(RelationModel reverse) voidsetSourceEntity(EntityModel sourceEntity) voidsetTargetEntity(EntityModel targetEntity) voidsetValidator(AndGroupValidator validator) Sets the primary validator which may contain real validation validators and other groups.Methods inherited from interface ch.tocco.nice2.model.entity.api.ModuleTracker
addExtendingModule, getDefiningModule, getExtendingModules, setDefiningModule
-
Method Details
-
getSourceEntity
EntityModel getSourceEntity()The source-entity.Example: relation from 'Address' to 'Event' it's the 'Address'.
-
getTargetEntity
EntityModel getTargetEntity()The source-entity.Example: relation from 'Address' to 'Event' it's the 'Event'.
-
getName
String getName()- Returns:
- The name of the Relation, for example "relPrincipalAddress".
-
isToMany
boolean isToMany()- Returns:
- Tells whether this is a to-one or a to-many relation.
-
isTargetRequired
boolean isTargetRequired() -
getLink
String getLink() -
getReverse
RelationModel getReverse()Get the reverse-relation.For example the relation is 'Address' to 'Event' called 'relSubscribedTo'. This getter will the return the reverse-relation, 'Event' to 'Address' called 'relSubcribers'
So in the end, the call "relation.getReverse().getReverse()" will return 'relation'. Its circular referncing.
-
isReverse
boolean isReverse()Tells if this model is the reverse-view or a relation.- Returns:
- true if reverse-view
-
setLink
- Parameters:
link- the link, non-null- Throws:
IllegalStateException- when trying to set this value after reading the mode.- See Also:
-
setMany
void setMany(boolean sourceIsMany) - Parameters:
sourceIsMany- true/false- Throws:
IllegalStateException- when trying to set this value after reading the mode.- See Also:
-
setRequired
void setRequired(boolean sourceRequired) - Parameters:
sourceRequired- true/false- Throws:
IllegalStateException- when trying to set this value after reading the mode.- See Also:
-
setName
- Parameters:
name- The name of the relation.- Throws:
IllegalStateException- when trying to set this value after reading the mode.- See Also:
-
setSourceEntity
- Parameters:
sourceEntity- the source-entity, non-null- Throws:
IllegalStateException- when trying to set this value after reading the mode.- See Also:
-
setTargetEntity
- Parameters:
targetEntity- the target-entity, non-null- Throws:
IllegalStateException- when trying to set this value after reading the mode.- See Also:
-
setReverseRelation
- Parameters:
reverse- the the reverse relation.- Throws:
IllegalStateException- when trying to set this value after reading the mode.- See Also:
-
setReverse
void setReverse(boolean reverse) - Parameters:
reverse- the reverse relation- Throws:
IllegalStateException- when trying to set this value after reading the mode.- See Also:
-
putSelector
-
getSelector
-
getSelectors
-
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
DisplayValue getLabel()The label of this relation- Returns:
- .
-
isPropagatingLock
boolean isPropagatingLock()If thegetSourceEntity()is locked, does this lock propagate over the relation to all target-entities?- Returns:
- .
-
getDeleteBehavior
DeleteBehavior getDeleteBehavior()- Returns:
- Returns a description how entities behave when they are deleted.
-
getDisplayOrder
int getDisplayOrder()Returns the number of display priority. The lower the higher ;-)- Returns:
- -1 means don't display, 0 means no config set (fall back to defaults),
>=1otherwise.
-
setDisplayOrder
void setDisplayOrder(int displayOrder) -
setLabel
- Parameters:
label- the label, non-null- Throws:
IllegalStateException- when trying to set this value after reading the mode. SeeModelElement
-
getDocumentation
LinkedHashMap<String,String> getDocumentation()Returns the content of the documentation element of theRelationModeltag as aLinkedHashMap, divided by theAppModules extending the baseRelationModeland contributing the documentation. The contents of the map are ordered according to the loading sequence of theAppModules.- Returns:
- The
LinkedHashMapcontaing theRelationModel's documentation tag.
-
addDocumentation
Adds documentation for theRelationModel, contributed by the definingAppModule.- Parameters:
definingModule- the string representation of theAppModulecontributing the documentationdocumentation- the documentation for theRelationModel
-
setPropagatingLock
void setPropagatingLock(boolean isPropagatingLock) - Parameters:
isPropagatingLock- do the related entitis get locked, if the source-entity is locked?- Throws:
IllegalStateException- when trying to set this value after reading the mode. SeeModelElement
-
setDeleteBehavior
- Parameters:
deleteBehavior- set the deletion-behavior, non-null- Throws:
IllegalStateException- when trying to set this value after reading the mode. SeeModelElement
-
setDefaultValue
-
getDefaultValue
DefaultValueDescriptor getDefaultValue() -
isSystemRelation
boolean isSystemRelation()- Returns:
- true if the relation is marked as generated by the system
-
setAsSystemRelation
void setAsSystemRelation(boolean systemRelation) mark the relation as generated by the system system relation are ignored in GenerateMissingFormModelProvider -
setDefaultComponentConfig
set the default component config for this relation -
getDefaultComponentConfig
Optional<RelationModel.DefaultComponentConfig> getDefaultComponentConfig()
-