Class RelationLine


  • public class RelationLine
    extends MultiLine
    Describes the relation to other entities.

    Syntax:

     <class>: <property>=<value>[ <value> <value>], <property>=..., ...
     
    Properties:

    relation = <object|list|reversed> [composite] [tracked] [referenced] [processed] [readonly|writeonly|nomethod] [serialized] [remoteclear] [reversed] [shallow] [immutable]

    • object: single object association [1:1]. This is the default.
    • reversed: non-composite list relation that contains max. one object (reversed 1:1 object relation)
    • list: list of objects [1:N]. ([N:M] see below nm = ...)
    • composite: relation points to a component
    • tracked: modification state of object or list is tracked
    • referenced: set the parent reference on select and construction
    • processed: invokes a processXXX-method on initialization, after select and before save
    • readonly: don't generate set-method
    • writeonly: don't generate get-method
    • nomethod: don't generate set- and get-method (shorthand for readonly writeonly)
    • serialized (only if lazy and not composite): lazy non-composite references are transient by default. "serialized" makes them non-transient.
    • remoteclear: clear serialized relation before save (i.e. sending to server)
    • shallow: exclude this relation in snapshots or copies
    • immutable: set this relation immutable after initial load
    If the relation is associated to an attribute the readonly and writeonly flags are overwritten by the attribute.

    select = <always|eager|lazy> [cached] [| wurbletargs]

    • always: fetched on every get (default if cached)
    • eager: fetched in advance whenever the main class is fetched
    • lazy: fetched within the first get only (default if not cached)
    • cached: use caching select methods if possible (only for objects-relations)
    • wurbletargs: additional arguments passed to the PdoSelectList-wurblet (only for list-relations)
      Example: select = lazy | -pilePosition
    delete = [cascade]
    • cascade: composition is a list that contains compositions (only if model without integrity checks)
    link = <name-of-link-method> [index]
    • only for composite relations: special method to set the links in composite lists or objects in saveReferencingRelations.
      The methods arguments are fixed to (this).
    • [index] is an integer attribute of the referenced entity.
      If [index] is set, (this, ndx) is invoked with index beginning at 0 (only for lists).
    args = <foreign-attribute2>[<method> | <constant>] <foreign-attribute3>[<method> | <constant>]...
    • second and more arguments passed to selectBy- or deleteBy-method. Only applicable to list relations.
      Example: args = forCreditor[isCreditor()] lineType[CalculationLineType.ON_CALCULATION]
      The first argument cannot be overwritten. For lists it is <name-of-current-entity>Id[getId()]
      For object relations it is id[get<name-of-relation>Id()]
    method = <methodname>
    • methodname: is the part of the method names, i.e. select[By]<methodname>, delete[By]<methodname>, set<methodname>
      [By] is added for lists.
    name = <name>
    • name: name of the relation. Defaults to <class>.
      The getter- and setter-names are generated as follows:
      get<name> and set<name> (always first letter in uppercase) for object-relations and get<name>List, set<name>List for list-relations.
      If <name> is explicitly set, the methods will be named get<name> and set<name> regardless of the relation type.
    nm = <entity> [mnMethodName]
    • entity: name of opposite entity the N:M relation.
    • mnMethodName: optional method name to access the list of opposite entities.
    The relation must be a list relation.

    scope = <public|private|protected|package>

    • sets the scope of the generated setter/getter-methods. Defaults to public.
    count = <counter attribute>
    • sets the counter attribute. Must be numeric. Only available for composite non-reversed list relations.
    comment = <comment>
    • to include in getter/setter comment
    Author:
    harald
    • Constructor Detail

      • RelationLine

        public RelationLine​(Document document,
                            int offset,
                            LineType lineType)
        Creates a relation line.
        A relation line may span multiple lines.
        Parameters:
        document - the whole document
        offset - offset to first character within document
        lineType - the line type
    • Method Detail

      • getClassName

        public java.lang.String getClassName()
                                      throws ModelException
        Gets the classname.
        Returns:
        the classname, never null or empty
        Throws:
        ModelException - if not parsed
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.String> getProperties()
                                                                             throws ModelException
        Gets the properties.
        Returns:
        the properties
        Throws:
        ModelException - if not parsed