Package ch.tocco.nice2.model.entity.api
Class DefaultRelationModel
java.lang.Object
ch.tocco.nice2.model.entity.api.DefaultModelBase
ch.tocco.nice2.model.entity.api.DefaultRelationModel
- All Implemented Interfaces:
ModelElement
,ModuleTracker
,RelationModel
- Direct Known Subclasses:
RelationModelImpl
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.model.entity.api.RelationModel
RelationModel.DefaultComponentConfig
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
getLink()
getName()
Get the reverse-relation.getSelector
(String name) The source-entity.The source-entity.boolean
boolean
Tells if this model is the reverse-view or a relation.boolean
boolean
isToMany()
void
putSelector
(String name, Selector selector) void
void
setMany
(boolean many) void
void
setRequired
(boolean required) void
setReverse
(boolean reverse) void
setReverseRelation
(RelationModel reverse) void
setSourceEntity
(EntityModel sourceType) void
setTargetEntity
(EntityModel targetType) void
setValidator
(AndGroupValidator validator) Sets the primary validator which may contain real validation validators and other groups.Methods inherited from class ch.tocco.nice2.model.entity.api.DefaultModelBase
toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.model.entity.api.ModuleTracker
addExtendingModule, getDefiningModule, getExtendingModules, setDefiningModule
Methods inherited from interface ch.tocco.nice2.model.entity.api.RelationModel
addDocumentation, getDefaultComponentConfig, getDefaultValue, getDeleteBehavior, getDisplayOrder, getDocumentation, getLabel, isPropagatingLock, isSystemRelation, setAsSystemRelation, setDefaultComponentConfig, setDefaultValue, setDeleteBehavior, setDisplayOrder, setLabel, setPropagatingLock
-
Constructor Details
-
DefaultRelationModel
public DefaultRelationModel()
-
-
Method Details
-
getName
- Specified by:
getName
in interfaceRelationModel
- Overrides:
getName
in classDefaultModelBase
- Returns:
- The name of the Relation, for example "relPrincipalAddress".
-
getSourceEntity
Description copied from interface:RelationModel
The source-entity.Example: relation from 'Address' to 'Event' it's the 'Address'.
- Specified by:
getSourceEntity
in interfaceRelationModel
-
getTargetEntity
Description copied from interface:RelationModel
The source-entity.Example: relation from 'Address' to 'Event' it's the 'Event'.
- Specified by:
getTargetEntity
in interfaceRelationModel
-
isToMany
public boolean isToMany()- Specified by:
isToMany
in interfaceRelationModel
- Returns:
- Tells whether this is a to-one or a to-many relation.
-
isTargetRequired
public boolean isTargetRequired()- Specified by:
isTargetRequired
in interfaceRelationModel
-
getLink
- Specified by:
getLink
in interfaceRelationModel
-
getReverse
Description copied from interface:RelationModel
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.
- Specified by:
getReverse
in interfaceRelationModel
-
isReverse
public boolean isReverse()Description copied from interface:RelationModel
Tells if this model is the reverse-view or a relation.- Specified by:
isReverse
in interfaceRelationModel
- Returns:
- true if reverse-view
-
getAdditionalToStringInfo
- Overrides:
getAdditionalToStringInfo
in classDefaultModelBase
-
setSourceEntity
- Specified by:
setSourceEntity
in interfaceRelationModel
- Parameters:
sourceType
- the source-entity, non-null- See Also:
-
setTargetEntity
- Specified by:
setTargetEntity
in interfaceRelationModel
- Parameters:
targetType
- the target-entity, non-null- See Also:
-
setMany
public void setMany(boolean many) - Specified by:
setMany
in interfaceRelationModel
- Parameters:
many
- true/false- See Also:
-
setRequired
public void setRequired(boolean required) - Specified by:
setRequired
in interfaceRelationModel
- Parameters:
required
- true/false- See Also:
-
setLink
- Specified by:
setLink
in interfaceRelationModel
- Parameters:
link
- the link, non-null- See Also:
-
setReverseRelation
- Specified by:
setReverseRelation
in interfaceRelationModel
- Parameters:
reverse
- the the reverse relation.- See Also:
-
setReverse
public void setReverse(boolean reverse) - Specified by:
setReverse
in interfaceRelationModel
- Parameters:
reverse
- the reverse relation- See Also:
-
setName
- Specified by:
setName
in interfaceRelationModel
- Overrides:
setName
in classDefaultModelBase
- Parameters:
name
- The name of the relation.- See Also:
-
putSelector
- Specified by:
putSelector
in interfaceRelationModel
-
getSelector
- Specified by:
getSelector
in interfaceRelationModel
-
getSelectors
- Specified by:
getSelectors
in interfaceRelationModel
-
hasNonEmptyValidator
public boolean hasNonEmptyValidator()- Specified by:
hasNonEmptyValidator
in interfaceRelationModel
- Returns:
- Tells if this field model has a validator, a GroupValidator to be precise, which has at least one entry.
- See Also:
-
getValidator
- Specified by:
getValidator
in interfaceRelationModel
- Returns:
- Returns the outermost group validator which may be empty.
- See Also:
-
setValidator
Description copied from interface:RelationModel
Sets the primary validator which may contain real validation validators and other groups.Method for the startup process.
- Specified by:
setValidator
in interfaceRelationModel
- Parameters:
validator
- The group validator.
-