Class RelationImpl

    • Field Detail

      • DEFAULT

        public static final java.lang.String DEFAULT
        property default (if object non-composite lazy).
        See Also:
        Constant Field Values
      • RELATION

        public static final java.lang.String RELATION
        property relation = ...
        See Also:
        Constant Field Values
      • SELECT

        public static final java.lang.String SELECT
        property select = ...
        See Also:
        Constant Field Values
      • DELETE

        public static final java.lang.String DELETE
        property delete = ...
        See Also:
        Constant Field Values
      • METHOD

        public static final java.lang.String METHOD
        property method = ...
        See Also:
        Constant Field Values
      • COMMENT

        public static final java.lang.String COMMENT
        property comment = ...
        See Also:
        Constant Field Values
      • COMPOSITE

        public static final java.lang.String COMPOSITE
        composite relation flag.
        See Also:
        Constant Field Values
      • TRACKED

        public static final java.lang.String TRACKED
        tracked relation flag.
        See Also:
        Constant Field Values
      • REFERENCED

        public static final java.lang.String REFERENCED
        referenced relation flag.
        See Also:
        Constant Field Values
      • PROCESSED

        public static final java.lang.String PROCESSED
        processed relation flag.
        See Also:
        Constant Field Values
      • READONLY

        public static final java.lang.String READONLY
        readonly relation flag.
        See Also:
        Constant Field Values
      • WRITEONLY

        public static final java.lang.String WRITEONLY
        writeonly relation flag.
        See Also:
        Constant Field Values
      • NOMETHOD

        public static final java.lang.String NOMETHOD
        readonly + writeonly.
        See Also:
        Constant Field Values
      • SERIALIZED

        public static final java.lang.String SERIALIZED
        serialized relation flag.
        See Also:
        Constant Field Values
      • REMOTECLEAR

        public static final java.lang.String REMOTECLEAR
        clear-on-remote-save relation flag.
        See Also:
        Constant Field Values
      • REVERSED

        public static final java.lang.String REVERSED
        map list relation to reversed 1:1 object relation.
        See Also:
        Constant Field Values
      • SHALLOW

        public static final java.lang.String SHALLOW
        skip relation in snapshots or copies.
        See Also:
        Constant Field Values
      • IMMUTABLE

        public static final java.lang.String IMMUTABLE
        sets the relation to immutable after loading.
        See Also:
        Constant Field Values
      • CACHED

        public static final java.lang.String CACHED
        cached selection flag.
        See Also:
        Constant Field Values
      • CASCADE

        public static final java.lang.String CASCADE
        cascade delete flag.
        See Also:
        Constant Field Values
    • Constructor Detail

      • RelationImpl

        public RelationImpl​(Entity entity,
                            SourceInfo sourceInfo)
        Creates a relation.
        Parameters:
        entity - the entity this relation belongs to
        sourceInfo - the source info
    • Method Detail

      • getOrdinal

        public int getOrdinal()
        Description copied from interface: ModelElement
        Gets the ordinal along the inheritance path.
        Specified by:
        getOrdinal in interface ModelElement
        Returns:
        the ordinal, starting at 0
      • setOrdinal

        public void setOrdinal​(int ordinal)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • compareTo

        public int compareTo​(RelationImpl o)
        Specified by:
        compareTo in interface java.lang.Comparable<RelationImpl>
      • getEntity

        public Entity getEntity()
        Description copied from interface: Relation
        Gets the entity this relation belongs to.
        Specified by:
        getEntity in interface Relation
        Returns:
        the entity
      • getAnnotations

        public java.util.List<java.lang.String> getAnnotations()
        Description copied from interface: Relation
        list of annotations.
        Specified by:
        getAnnotations in interface Relation
        Returns:
        the annotations
      • setAnnotations

        public void setAnnotations​(java.util.List<java.lang.String> annotations)
      • getGetterSetterComment

        public java.lang.String getGetterSetterComment()
        Description copied from interface: Relation
        Gets the comment line for getter and setter.
        Specified by:
        getGetterSetterComment in interface Relation
        Returns:
        the comment
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getName

        public java.lang.String getName()
        Gets the name of this relation.
        If no explicit name set, it defaults to the className.
        Specified by:
        getName in interface ModelElement
        Returns:
        the name
      • setName

        public void setName​(java.lang.String name)
      • getSourceLine

        public RelationLine getSourceLine()
        Gets the source line.
        Returns:
        the line
      • setSourceLine

        public void setSourceLine​(RelationLine sourceLine)
        Sets the source line.
        Parameters:
        sourceLine - the line
      • createModelException

        public ModelException createModelException​(java.lang.String message)
        Creates a model exception.

        Refers to the source line if set, otherwise just the message.

        Parameters:
        message - the message
        Returns:
        the exception
      • getComment

        public java.lang.String getComment()
        Description copied from interface: Relation
        Gets the comment.
        Specified by:
        getComment in interface Relation
        Returns:
        the comment
      • getClassName

        public java.lang.String getClassName()
        Description copied from interface: Relation
        Gets the name of the related class.
        Specified by:
        getClassName in interface Relation
        Returns:
        the classname
      • getAccessScope

        public AccessScope getAccessScope()
        Description copied from interface: Relation
        Gets the access scope for generated methods.
        Specified by:
        getAccessScope in interface Relation
        Returns:
        the scope
      • getAttribute

        public Attribute getAttribute()
        Description copied from interface: Relation
        Gets the associated attribute.
        Specified by:
        getAttribute in interface Relation
        Returns:
        the attribute, null if ID of foreign entity
      • getForeignEntity

        public Entity getForeignEntity()
        Description copied from interface: Relation
        Gets the related entity.
        Specified by:
        getForeignEntity in interface Relation
        Returns:
        the foreign entity
      • getForeignAttribute

        public Attribute getForeignAttribute()
        Description copied from interface: Relation
        Gets the foreign attribute.
        Specified by:
        getForeignAttribute in interface Relation
        Returns:
        the attribute, null if ID of this entity
      • getForeignRelation

        public Relation getForeignRelation()
        Description copied from interface: Relation
        Gets the foreign (opposite) relation.
        Specified by:
        getForeignRelation in interface Relation
        Returns:
        the foreign relation, null if no such relation
      • getNmRelation

        public Relation getNmRelation()
        Description copied from interface: Relation
        Gets the N:M relation of the foreign entity.
        Specified by:
        getNmRelation in interface Relation
        Returns:
        the nm-relation, null if this is no nm-relation
      • getDefiningNmRelation

        public Relation getDefiningNmRelation()
        Description copied from interface: Relation
        Gets the relation of the entity defining the nm-relation.
        Specified by:
        getDefiningNmRelation in interface Relation
        Returns:
        the defining relation
      • isComposite

        public boolean isComposite()
        Description copied from interface: Relation
        Returns whether the relation points to components of a composite.
        Specified by:
        isComposite in interface Relation
        Returns:
        true if composite relation
      • isTracked

        public boolean isTracked()
        Description copied from interface: Relation
        Returns whether the modification state of the relation is available.
        Specified by:
        isTracked in interface Relation
        Returns:
        true if tracked object or tracked list
      • isReferenced

        public boolean isReferenced()
        Description copied from interface: Relation
        Returns whether the parent object is referenced by a variable.
        Specified by:
        isReferenced in interface Relation
        Returns:
        true if referenced
      • isProcessed

        public boolean isProcessed()
        Description copied from interface: Relation
        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.
        Specified by:
        isProcessed in interface Relation
        Returns:
        true if processed
      • isReadOnly

        public boolean isReadOnly()
        Description copied from interface: Relation
        Returns whether the relation is read only.
        Specified by:
        isReadOnly in interface Relation
        Returns:
        true if no setter method
      • isWriteOnly

        public boolean isWriteOnly()
        Description copied from interface: Relation
        Returns whether the relation is write-only.
        Specified by:
        isWriteOnly in interface Relation
        Returns:
        true if no getter method
      • isSerialized

        public boolean isSerialized()
        Description copied from interface: Relation
        Returns whether the relation is serialized.
        Used for non-composite relations to make them non-transient.
        Specified by:
        isSerialized in interface Relation
        Returns:
        true if serialized, false if transient
      • isClearOnRemoteSave

        public boolean isClearOnRemoteSave()
        Description copied from interface: Relation
        Returns whether the relation should be cleared before save.
        Used for non-composite serialized relations that should not be transmitted to the server.
        Specified by:
        isClearOnRemoteSave in interface Relation
        Returns:
        true if transient on save
      • isReversed

        public boolean isReversed()
        Description copied from interface: Relation
        Returns whether this is list relation with only one element.
        A.k.a. reversed 1:1 object relation.
        Specified by:
        isReversed in interface Relation
        Returns:
        true if reversed
      • isShallow

        public boolean isShallow()
        Description copied from interface: Relation
        Returns whether the relation should be skipped in snapshot and copy operations.
        Specified by:
        isShallow in interface Relation
        Returns:
        true if skip this relation, false to include (default)
      • setShallow

        public void setShallow​(boolean shallow)
      • isImmutable

        public boolean isImmutable()
        Description copied from interface: Relation
        Returns whether the relation should be set to immutable after loading.
        Specified by:
        isImmutable in interface Relation
        Returns:
        true if immutable
      • setImmutable

        public void setImmutable​(boolean immutable)
      • getCountAttribute

        public Attribute getCountAttribute()
        Description copied from interface: Relation
        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.
        Specified by:
        getCountAttribute in interface Relation
        Returns:
        the counter attribute, null if none
      • getMethodName

        public java.lang.String getMethodName()
        Description copied from interface: Relation
        Gets the name-part for select- and delete-methods.
        Specified by:
        getMethodName in interface Relation
        Returns:
        the method name, null if default from foreign entity name
      • getMethodArgs

        public java.util.List<MethodArgument> getMethodArgs()
        Description copied from interface: Relation
        Gets the effective method arguments for select- and delete-methods.
        Specified by:
        getMethodArgs in interface Relation
        Returns:
        the args, never null, at least 1 element
      • getNmName

        public java.lang.String getNmName()
        Description copied from interface: Relation
        Gets the name of the nm-relation.
        Specified by:
        getNmName in interface Relation
        Returns:
        the n:m relation name, null if this is not an n:m-relation
      • getLinkMethodName

        public java.lang.String getLinkMethodName()
        Description copied from interface: Relation
        Gets the name for the link method.
        Specified by:
        getLinkMethodName in interface Relation
        Returns:
        the link method, null if default
      • getLinkMethodIndex

        public java.lang.String getLinkMethodIndex()
        Description copied from interface: Relation
        Returns the optional link method index parameter.
        Specified by:
        getLinkMethodIndex in interface Relation
        Returns:
        the index parameter, null if no index
      • isSelectionCached

        public boolean isSelectionCached()
        Description copied from interface: Relation
        Returns whether the select method is a caching one.
        Specified by:
        isSelectionCached in interface Relation
        Returns:
        true if cached
      • getSelectionWurbletArguments

        public java.lang.String getSelectionWurbletArguments()
        Description copied from interface: Relation
        Gets the optional wurblet arguments.
        Only available for composite list relations.
        Specified by:
        getSelectionWurbletArguments in interface Relation
        Returns:
        the extra wurblet args
      • isDeletionFromMainClass

        public boolean isDeletionFromMainClass()
        Description copied from interface: Relation
        Returns whether delete method is invoked on main class instead of relation class.
        Specified by:
        isDeletionFromMainClass in interface Relation
        Returns:
        true if delete from main class
      • isDeletionCascaded

        public boolean isDeletionCascaded()
        Description copied from interface: Relation
        Returns whether deletion is cascaded to elements in lists.
        Specified by:
        isDeletionCascaded in interface Relation
        Returns:
        true if cascaded
      • setNmRelation

        public void setNmRelation​(Relation nmRelation)
      • setDefiningNmRelation

        public void setDefiningNmRelation​(Relation definingNmRelation)
      • setAttribute

        public void setAttribute​(Attribute attribute)
      • setForeignEntity

        public void setForeignEntity​(Entity foreignEntity)
      • setForeignAttribute

        public void setForeignAttribute​(Attribute foreignAttribute)
      • setForeignRelation

        public void setForeignRelation​(Relation foreignRelation)
      • setClassName

        public void setClassName​(java.lang.String className)
      • setComment

        public void setComment​(java.lang.String comment)
      • setComposite

        public void setComposite​(boolean composite)
      • setLinkMethodName

        public void setLinkMethodName​(java.lang.String linkMethodName)
      • setMethodArgs

        public void setMethodArgs​(java.util.List<MethodArgument> methodArgs)
      • setNmName

        public void setNmName​(java.lang.String nmName)
      • setNmMethodName

        public void setNmMethodName​(java.lang.String nmMethodName)
      • setMethodName

        public void setMethodName​(java.lang.String methodName)
      • setReadOnly

        public void setReadOnly​(boolean readOnly)
      • setReferenced

        public void setReferenced​(boolean referenced)
      • setProcessed

        public void setProcessed​(boolean processed)
      • setRelationType

        public void setRelationType​(RelationType relationType)
      • setSerialized

        public void setSerialized​(boolean serialized)
      • setClearOnRemoteSave

        public void setClearOnRemoteSave​(boolean clearOnRemoteSave)
      • setReversed

        public void setReversed​(boolean reversed)
      • setCountAttribute

        public void setCountAttribute​(Attribute countAttribute)
      • setTracked

        public void setTracked​(boolean tracked)
      • setWriteOnly

        public void setWriteOnly​(boolean writeOnly)
      • setSelectionType

        public void setSelectionType​(SelectionType selectionType)
      • setSelectionCached

        public void setSelectionCached​(boolean selectionCached)
      • setSelectionWurbletArguments

        public void setSelectionWurbletArguments​(java.lang.String selectionWurbletArguments)
      • setAccessScope

        public void setAccessScope​(AccessScope accessScope)
      • setDeletionCascaded

        public void setDeletionCascaded​(boolean deletionCascaded)
      • setDeletionFromMainClass

        public void setDeletionFromMainClass​(boolean deletionFromMainClass)
      • setLinkMethodIndex

        public void setLinkMethodIndex​(java.lang.String linkMethodIndex)
      • getVariableName

        public java.lang.String getVariableName()
        Gets the variable name.
        Specified by:
        getVariableName in interface Relation
        Returns:
        the variable name
      • getMethodNameSuffix

        public 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".
         
        Specified by:
        getMethodNameSuffix in interface Relation
        Returns:
        the suffix
      • getGetterName

        public java.lang.String getGetterName()
        Description copied from interface: Relation
        Gets the getter method name.
        Specified by:
        getGetterName in interface Relation
        Returns:
        the getter
      • getSetterName

        public java.lang.String getSetterName()
        Description copied from interface: Relation
        Gets the setter method name.
        Specified by:
        getSetterName in interface Relation
        Returns:
        the setter
      • getDeclaredJavaType

        public java.lang.String getDeclaredJavaType​(boolean withinForeignEntity)
        Description copied from interface: Relation
        Gets the declared java type of the relation.
        Specified by:
        getDeclaredJavaType in interface 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

        public java.lang.String getJavaType()
        Description copied from interface: Relation
        Gets the effective java type of the relation.

        Example: the effective type is ArrayList and the declared type is List.

        Specified by:
        getJavaType in interface Relation
        Returns:
        the effective java type
      • isDeepReference

        public boolean isDeepReference()
        Description copied from interface: Relation
        Returns whether this relation is a deep reference.
        Deep references point to components of another composite entity.
        Specified by:
        isDeepReference in interface Relation
        Returns:
        true if deep reference
      • setDeepReference

        public void setDeepReference​(boolean deepReference)