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] [normtext] [blunt]

  • 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 (default if related entity's type is embedded)
  • 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
  • normtext: add the toString value of this relation to the normtext. If this is a list, add toStrings of all PDOs.
  • blunt: the blunt-method becomes part of the persistence interface.
If the relation is associated to an attribute the readonly and writeonly flags are overwritten by the attribute.

select = <always|eager|lazy|embedded> [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)
  • embedded: fetched by parent (default if related entity's type is embedded)
  • 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. For example: setBlah. set alone will be replaced by the corresponding method name according to the model.
    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).
    [index] may be a path to an attribute of an embedded entity, as well.
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 = <relationname>
  • relationname: 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.
prefix = <columnprefix>
  • columnprefix: the prefix to add to the column names of the related embedded PDO.
    Only applicable to embedded relations!
    Defaults to lowercase of <relationname> plus an underline.
    For nested embedded PDOs, the prefixes are concatenated accordingly.
nm = <entity> [mnMethodName] [nmScope]
  • entity: name of opposite entity the N:M relation.
  • mnMethodName: optional method name to access the list of opposite entities.
  • mnScope: optional access scope of the nm-method (defaults to scope = ...). Can be used to hide the technical methods via scope=private from the interfaces and making the nm-method public.
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 Details

    • 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 Details