- All Superinterfaces:
ModelElement
- All Known Implementing Classes:
RelationImpl
A relation to an entity.
- Author:
- harald
-
Method Summary
Modifier and TypeMethodDescriptioncreateEmbedded(Entity embeddingEntity, String pathName, String columnPrefixPath) Creates an embedded copy of this relation.Gets the access scope for generated methods.Gets the list of annotations.
Annotations start with an @.Gets the associated attribute.Gets the name of the related class.Gets the prefix for the column names.
Only applicable to embedded entities!Gets the column prefix path for embedded relations.Gets the comment.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.getDeclaredJavaType(boolean withinForeignEntity) Gets the declared java type of the relation.Gets the relation of the entity defining the nm-relation.Gets the embedding entity.
Please notice that the embedding entity is determined by the specific relation path, andisEmbedded()just means that the relation is part of an embeddable entity.Gets the path of embedding entities.
The first entity is non-embedded.Gets the entity this relation belongs to.Gets the foreign attribute.Gets the related entity.Gets the foreign (opposite) relation.Gets the getter method name.Gets the comment line for getter and setter.Gets the effective java type of the relation.Returns the optional link method index parameter.Gets the name for the link method.Gets the effective method arguments for select- and delete-methods.Gets the name-part for select- and delete-methods.Gets the suffix to be used in method names.Same asgetMethodName()but for nm relation.Gets the name of the nm-relation.Gets the N:M relation of the foreign entity.Gets the access scope for the nm-method.
Defaults to the access scope of the relation.Gets the pathname.
The pathname is identical to the java name for non-embedded relations.
For embedded entities, the pathname consists of the dotted path from the parent entity to the embedded attribute.Gets the relation type.Gets the selection type.Gets the optional wurblet arguments.
Only available for composite list relations.Gets the setter method name.Gets the list of custom stereotypes.Gets the variable name.booleanReturns whether the blunt-method becomes part if the interface.booleanReturns whether the relation should be cleared before save.
Used for non-composite serialized relations that should not be transmitted to the server.booleanReturns whether the relation points to components of a composite.booleanReturns whether this relation is a deep reference.
Deep references point to components of another composite entity.booleanReturns whether deletion is cascaded to elements in lists.booleanReturns whether delete method is invoked on main class instead of relation class.booleanReturns whether the relation belongs to an embedded entity.booleanReturns whether the relation points to an embedded entity.booleanReturns whether the relation should be set to immutable after loading.booleanReturns whether the relation becomes part of the normtext.booleanReturns 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.booleanReturns whether the relation is read only.booleanReturns whether the parent object is referenced by a variable.booleanReturns whether this is list relation with only one element.
A.k.a.booleanReturns whether the select method is a caching one.booleanReturns whether the relation is serialized.
Used for non-composite relations to make them non-transient.booleanReturns whether the relation should be skipped in snapshot and copy operations.booleanReturns whether the modification state of the relation is available.booleanReturns whether the relation is write-only.voidvalidate()Validates the relation.Methods inherited from interface org.tentackle.model.ModelElement
getName, getOrdinal, getParent, getSourceInfo
-
Method Details
-
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
String getComment()Gets the comment.- Returns:
- the comment
-
getClassName
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
Gets the list of annotations.
Annotations start with an @. By default, they are applied to the getters of the interfaces only. However, the at-sign may be followed by one or two modifiers that changes the code generation:=: annotate setter only.+: annotate setter and getter.~: annotation is hidden, i.e. applied to the implementations instead of the interfaces.
@=~MyAnnowill be applied to the implementation of the setter only.- Returns:
- the annotations
-
getStereotypes
Gets the list of custom stereotypes.- Returns:
- the stereotypes
-
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
-
createEmbedded
Creates an embedded copy of this relation.- Parameters:
embeddingEntity- the embedding entitypathName- the logical pathnamecolumnPrefixPath- the column prefix path- Returns:
- the created relation
-
getEmbeddingEntity
Entity getEmbeddingEntity()Gets the embedding entity.
Please notice that the embedding entity is determined by the specific relation path, andisEmbedded()just means that the relation is part of an embeddable entity.- Returns:
- the embedding entity, null if not an embedded relation
-
getEmbeddingPath
Gets the path of embedding entities.
The first entity is non-embedded.- Returns:
- the embedding path (never empty), null if relation is not embedded
-
getPathName
String getPathName()Gets the pathname.
The pathname is identical to the java name for non-embedded relations.
For embedded entities, the pathname consists of the dotted path from the parent entity to the embedded attribute.- Returns:
- the pathname
-
getColumnPrefixPath
String getColumnPrefixPath()Gets the column prefix path for embedded relations.- Returns:
- the column path, null if not embedded
-
isEmbedding
boolean isEmbedding()Returns whether the relation points to an embedded entity.- Returns:
- true if embedded 1:1 relation
-
isEmbedded
boolean isEmbedded()Returns whether the relation belongs to an embedded entity.- Returns:
- true if embedded
-
getColumnPrefix
String getColumnPrefix()Gets the prefix for the column names.
Only applicable to embedded entities!- Returns:
- the column name prefix
-
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
-
isPartOfNormText
boolean isPartOfNormText()Returns whether the relation becomes part of the normtext.- Returns:
- true if add to normtext
-
isBluntDeclared
boolean isBluntDeclared()Returns whether the blunt-method becomes part if the interface.- Returns:
- true if declared in interface, false if only implementation generated
-
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 type
-
isSelectionCached
boolean isSelectionCached()Returns whether the select method is a caching one.- Returns:
- true if cached
-
getSelectionWurbletArguments
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
String getLinkMethodName()Gets the name for the link method.- Returns:
- the link method, null if default
-
getLinkMethodIndex
String getLinkMethodIndex()Returns the optional link method index parameter.- Returns:
- the index parameter, null if no index
-
getMethodName
String getMethodName()Gets the name-part for select- and delete-methods.- Returns:
- the method name, null if default from foreign entity name
-
getMethodArgs
List<MethodArgument> getMethodArgs()Gets the effective method arguments for select- and delete-methods.- Returns:
- the args, never null, at least 1 element
-
getNmName
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
String getNmMethodName()Same asgetMethodName()but for nm relation.- Returns:
- the list method name, null if default
-
getNmScope
AccessScope getNmScope()Gets the access scope for the nm-method.
Defaults to the access scope of the relation.- Returns:
- the access scope, never null
-
validate
Validates the relation.- Throws:
ModelException- if validation failed
-
getVariableName
String getVariableName()Gets the variable name.- Returns:
- the variable name
-
getMethodNameSuffix
String getMethodNameSuffix()Gets the suffix to be used in method names.Example:
"set" + getMethodNameSuffix() would return "setBlah" if the classname is "Blah" or the name is "blah".
- Returns:
- the suffix
-
getGetterName
String getGetterName()Gets the getter method name.- Returns:
- the getter
-
getSetterName
String getSetterName()Gets the setter method name.- Returns:
- the setter
-
getGetterSetterComment
String getGetterSetterComment()Gets the comment line for getter and setter.- Returns:
- the comment
-
getDeclaredJavaType
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
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
-