- java.lang.Object
-
- org.tentackle.model.parse.Line
-
- org.tentackle.model.parse.MultiLine
-
- org.tentackle.model.parse.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
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
- cascade: composition is a list that contains compositions (only if model without integrity checks)
- 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).
- 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 isid[get<name-of-relation>Id()]
- 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 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.
- entity: name of opposite entity the N:M relation.
- mnMethodName: optional method name to access the list of opposite entities.
scope = <public|private|protected|package>
- sets the scope of the generated setter/getter-methods. Defaults to public.
- sets the counter attribute. Must be numeric. Only available for composite non-reversed list relations.
- to include in getter/setter comment
- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description RelationLine(Document document, int offset, LineType lineType)Creates a relation line.
A relation line may span multiple lines.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetClassName()Gets the classname.java.util.Map<java.lang.String,java.lang.String>getProperties()Gets the properties.voidparse()Parses a line.-
Methods inherited from class org.tentackle.model.parse.Line
assertParsed, createModelException, createModelException, getDocument, getLength, getLineNumber, getLineType, getOffset, getSourceInfo, getText, setLength, toString
-
-
-
-
Method Detail
-
parse
public void parse() throws ModelExceptionDescription copied from class:LineParses a line.- Overrides:
parsein classMultiLine- Throws:
ModelException- if parsing failed
-
getClassName
public java.lang.String getClassName() throws ModelExceptionGets 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 ModelExceptionGets the properties.- Returns:
- the properties
- Throws:
ModelException- if not parsed
-
-