Interface Relation

All Superinterfaces:
ModelElement
All Known Implementing Classes:
RelationImpl

public interface Relation extends ModelElement
A relation to an entity.
Author:
harald
  • 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

      List<String> 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.
      Example:
         @=~MyAnno
         will be applied to the implementation of the setter only.
       
      Returns:
      the annotations
    • getStereotypes

      List<String> 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
    • 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 tupe
    • 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 as getMethodName() but for nm relation.
      Returns:
      the list method name, null if default
    • validate

      void validate() throws ModelException
      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 methodnames.

      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

      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

      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