-
- All Superinterfaces:
ModelElement
- All Known Implementing Classes:
RelationImpl
public interface Relation extends ModelElement
A relation to an entity.- Author:
- harald
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AccessScopegetAccessScope()Gets the access scope for generated methods.java.util.List<java.lang.String>getAnnotations()list of annotations.AttributegetAttribute()Gets the associated attribute.java.lang.StringgetClassName()Gets the name of the related class.java.lang.StringgetComment()Gets the comment.AttributegetCountAttribute()Returns the attribute that holds the number of elements of a 1:N relation.
Applies only to composite non-reversed list relations.
If set, this column gets the number of elements in the list when the PDO is persisted.java.lang.StringgetDeclaredJavaType(boolean withinForeignEntity)Gets the declared java type of the relation.RelationgetDefiningNmRelation()Gets the relation of the entity defining the nm-relation.EntitygetEntity()Gets the entity this relation belongs to.AttributegetForeignAttribute()Gets the foreign attribute.EntitygetForeignEntity()Gets the related entity.RelationgetForeignRelation()Gets the foreign (opposite) relation.java.lang.StringgetGetterName()Gets the getter method name.java.lang.StringgetGetterSetterComment()Gets the comment line for getter and setter.java.lang.StringgetJavaType()Gets the effective java type of the relation.java.lang.StringgetLinkMethodIndex()Returns the optional link method index parameter.java.lang.StringgetLinkMethodName()Gets the name for the link method.java.util.List<MethodArgument>getMethodArgs()Gets the effective method arguments for select- and delete-methods.java.lang.StringgetMethodName()Gets the name-part for select- and delete-methods.java.lang.StringgetMethodNameSuffix()Gets the suffix to be used in methodnames.java.lang.StringgetNmMethodName()Same asgetMethodName()but for nm relation.java.lang.StringgetNmName()Gets the name of the nm-relation.RelationgetNmRelation()Gets the N:M relation of the foreign entity.RelationTypegetRelationType()Gets the relation type.SelectionTypegetSelectionType()Gets the selection type.java.lang.StringgetSelectionWurbletArguments()Gets the optional wurblet arguments.
Only available for composite list relations.java.lang.StringgetSetterName()Gets the setter method name.java.lang.StringgetVariableName()Gets the variable name.booleanisClearOnRemoteSave()Returns whether the relation should be cleared before save.
Used for non-composite serialized relations that should not be transmitted to the server.booleanisComposite()Returns whether the relation points to components of a composite.booleanisDeepReference()Returns whether this relation is a deep reference.
Deep references point to components of another composite entity.booleanisDeletionCascaded()Returns whether deletion is cascaded to elements in lists.booleanisDeletionFromMainClass()Returns whether delete method is invoked on main class instead of relation class.booleanisImmutable()Returns whether the relation should be set to immutable after loading.booleanisProcessed()Returns whether a process-method is invoked after initialization, select and before save.
The method has the same name as the getter with "get" replaced by "process" and must be provided by the application.
This flag applies to composite relations only.booleanisReadOnly()Returns whether the relation is read only.booleanisReferenced()Returns whether the parent object is referenced by a variable.booleanisReversed()Returns whether this is list relation with only one element.
A.k.a.booleanisSelectionCached()Returns whether the select method is a caching one.booleanisSerialized()Returns whether the relation is serialized.
Used for non-composite relations to make them non-transient.booleanisShallow()Returns whether the relation should be skipped in snapshot and copy operations.booleanisTracked()Returns whether the modification state of the relation is available.booleanisWriteOnly()Returns whether the relation is write-only.voidvalidate()Validates the relation.-
Methods inherited from interface org.tentackle.model.ModelElement
getName, getOrdinal, getParent, getSourceInfo
-
-
-
-
Method Detail
-
getEntity
Entity getEntity()
Gets the entity this relation belongs to.- Returns:
- the entity
-
getForeignEntity
Entity getForeignEntity()
Gets the related entity.- Returns:
- the foreign entity
-
getAttribute
Attribute getAttribute()
Gets the associated attribute.- Returns:
- the attribute, null if ID of foreign entity
-
getForeignAttribute
Attribute getForeignAttribute()
Gets the foreign attribute.- Returns:
- the attribute, null if ID of this entity
-
getForeignRelation
Relation getForeignRelation()
Gets the foreign (opposite) relation.- Returns:
- the foreign relation, null if no such relation
-
getNmRelation
Relation getNmRelation()
Gets the N:M relation of the foreign entity.- Returns:
- the nm-relation, null if this is no nm-relation
-
getDefiningNmRelation
Relation getDefiningNmRelation()
Gets the relation of the entity defining the nm-relation.- Returns:
- the defining relation
-
getComment
java.lang.String getComment()
Gets the comment.- Returns:
- the comment
-
getClassName
java.lang.String getClassName()
Gets the name of the related class.- Returns:
- the classname
-
getAccessScope
AccessScope getAccessScope()
Gets the access scope for generated methods.- Returns:
- the scope
-
getAnnotations
java.util.List<java.lang.String> getAnnotations()
list of annotations.- Returns:
- the annotations
-
getRelationType
RelationType getRelationType()
Gets the relation type.- Returns:
- list or object
-
isComposite
boolean isComposite()
Returns whether the relation points to components of a composite.- Returns:
- true if composite relation
-
isTracked
boolean isTracked()
Returns whether the modification state of the relation is available.- Returns:
- true if tracked object or tracked list
-
isReferenced
boolean isReferenced()
Returns whether the parent object is referenced by a variable.- Returns:
- true if referenced
-
isProcessed
boolean isProcessed()
Returns whether a process-method is invoked after initialization, select and before save.
The method has the same name as the getter with "get" replaced by "process" and must be provided by the application.
This flag applies to composite relations only.- Returns:
- true if processed
-
isReadOnly
boolean isReadOnly()
Returns whether the relation is read only.- Returns:
- true if no setter method
-
isWriteOnly
boolean isWriteOnly()
Returns whether the relation is write-only.- Returns:
- true if no getter method
-
isSerialized
boolean isSerialized()
Returns whether the relation is serialized.
Used for non-composite relations to make them non-transient.- Returns:
- true if serialized, false if transient
-
isClearOnRemoteSave
boolean isClearOnRemoteSave()
Returns whether the relation should be cleared before save.
Used for non-composite serialized relations that should not be transmitted to the server.- Returns:
- true if transient on save
-
isReversed
boolean isReversed()
Returns whether this is list relation with only one element.
A.k.a. reversed 1:1 object relation.- Returns:
- true if reversed
-
isShallow
boolean isShallow()
Returns whether the relation should be skipped in snapshot and copy operations.- Returns:
- true if skip this relation, false to include (default)
-
isImmutable
boolean isImmutable()
Returns whether the relation should be set to immutable after loading.- Returns:
- true if immutable
-
getCountAttribute
Attribute getCountAttribute()
Returns the attribute that holds the number of elements of a 1:N relation.
Applies only to composite non-reversed list relations.
If set, this column gets the number of elements in the list when the PDO is persisted. This avoids an initial select when the list is accessed the first time and the list is empty.- Returns:
- the counter attribute, null if none
-
getSelectionType
SelectionType getSelectionType()
Gets the selection type.- Returns:
- the selection tupe
-
isSelectionCached
boolean isSelectionCached()
Returns whether the select method is a caching one.- Returns:
- true if cached
-
getSelectionWurbletArguments
java.lang.String getSelectionWurbletArguments()
Gets the optional wurblet arguments.
Only available for composite list relations.- Returns:
- the extra wurblet args
-
isDeletionFromMainClass
boolean isDeletionFromMainClass()
Returns whether delete method is invoked on main class instead of relation class.- Returns:
- true if delete from main class
-
isDeletionCascaded
boolean isDeletionCascaded()
Returns whether deletion is cascaded to elements in lists.- Returns:
- true if cascaded
-
getLinkMethodName
java.lang.String getLinkMethodName()
Gets the name for the link method.- Returns:
- the link method, null if default
-
getLinkMethodIndex
java.lang.String getLinkMethodIndex()
Returns the optional link method index parameter.- Returns:
- the index parameter, null if no index
-
getMethodName
java.lang.String getMethodName()
Gets the name-part for select- and delete-methods.- Returns:
- the method name, null if default from foreign entity name
-
getMethodArgs
java.util.List<MethodArgument> getMethodArgs()
Gets the effective method arguments for select- and delete-methods.- Returns:
- the args, never null, at least 1 element
-
getNmName
java.lang.String getNmName()
Gets the name of the nm-relation.- Returns:
- the n:m relation name, null if this is not an n:m-relation
-
getNmMethodName
java.lang.String getNmMethodName()
Same asgetMethodName()but for nm relation.- Returns:
- the list method name, null if default
-
validate
void validate() throws ModelExceptionValidates the relation.- Throws:
ModelException- if validation failed
-
getVariableName
java.lang.String getVariableName()
Gets the variable name.- Returns:
- the variable name
-
getMethodNameSuffix
java.lang.String getMethodNameSuffix()
Gets the suffix to be used in methodnames.Example:
"set" + getMethodNameSuffix() would return "setBlah" if the classname is "Blah" or the name is "blah".
- Returns:
- the suffix
-
getGetterName
java.lang.String getGetterName()
Gets the getter method name.- Returns:
- the getter
-
getSetterName
java.lang.String getSetterName()
Gets the setter method name.- Returns:
- the setter
-
getGetterSetterComment
java.lang.String getGetterSetterComment()
Gets the comment line for getter and setter.- Returns:
- the comment
-
getDeclaredJavaType
java.lang.String getDeclaredJavaType(boolean withinForeignEntity)
Gets the declared java type of the relation.- Parameters:
withinForeignEntity- true if we need the type from within the foreign entity, else from within the relation's entity- Returns:
- the declared java type
-
getJavaType
java.lang.String getJavaType()
Gets the effective java type of the relation.Example: the effective type is ArrayList and the declared type is List.
- Returns:
- the effective java type
-
isDeepReference
boolean isDeepReference()
Returns whether this relation is a deep reference.
Deep references point to components of another composite entity.- Returns:
- true if deep reference
-
-