$link

( documentation for Telosys generator version 3.3.0 )


This object provides all information about an entity link
Each link is retrieved from the entity class


Example :
   
   #foreach( $link in $entity.links )
    private $link.formattedFieldType(10) $link.formattedFieldName(12);
   #end

Attributes and methods
.attributes : List of '$linkAttribute' (origin-target association)

Returns a list of attributes pair defining the link
Each pair contains the owning side attribute and its corresponding reverse side attribute
Each link is supposed to contain at least 1 pair of attributes

.attributesCount : int

Returns the number of attributes used to define the link

Example :
   $link.attributesCount

Since : 2.1.0

.cardinality : String

Returns the cardinality of the link
eg : 'OneToMany', 'ManyToOne', 'OneToOne', 'ManyToMany'

.cascade : String

Returns the 'cascade type' ( 'ALL', 'MERGE', 'MERGE PERSIST', 'PERSIST REFRESH', 'REMOVE' )
A string containing all the selected cascade options

.entity : EntityInContext

Returns the entity to which the link belongs


Since : 3.3.0

.fetch : String

Returns the 'fetch type' ( 'DEFAULT' or 'EAGER' or 'LAZY' )

.fieldName : String

Returns the field name for the link (attribute name in the entity class)

.fieldType : String

Returns the type of the link
eg : Person, List, ...

.formattedFieldName(int n) : String

Returns the link's name with n trailing blanks

Parameters :
   n : the number of blanks to be added at the end of the name

.formattedFieldType(int n) : String

Returns the link's type with n trailing blanks
eg : List, List, Person, ...

Parameters :
   n : the number of blanks to be added at the end of the name

.getter : String

Returns the Java getter for the link e.g. 'getPerson' for link 'person'

.hasAttributeInPrimaryKey() : boolean

Returns TRUE if the link has one (or more) 'join column' in the entity Primary Key
( one of its 'origin attributes' is the Primary Key or a part of the Primary Key )

Since : 2.1.0

.hasJoinColumns() : boolean

Returns TRUE if the link has 'join columns' (at least one)

.hasJoinTable() : boolean

Returns TRUE if the link has a 'join table'

.hasMappedBy() : boolean

Returns TRUE if 'mappedBy' is defined

Since : 3.3.0

.id : String

Returns the unique id of the link in the repository (id used by the tool)
(not supposed to be used in a generated file)

.insertable : String

Returns the 'insertable' flag value as string
( 'true' or 'false' or 'undefined' )

Since : 3.3.0

.insertableIs(boolean value) : boolean

Returns true if 'insertable' flag equals the given value
The flag can be 'undefined' then then neither true nor false

Parameters :
   value : the boolean value

Since : 3.3.0

.isCardinalityManyToMany() : boolean

Returns TRUE if the link has a 'ManyToMany' cardinality

.isCardinalityManyToOne() : boolean

Returns TRUE if the link has a 'ManyToOne' cardinality

.isCardinalityOneToMany() : boolean

Returns TRUE if the link has a 'OneToMany' cardinality

.isCardinalityOneToOne() : boolean

Returns TRUE if the link has a 'OneToOne' cardinality

.isCascadeALL() : boolean

Returns true if the 'cascade options' is 'ALL'

.isCascadeMERGE() : boolean

Returns true if the 'cascade options' contains 'MERGE'

.isCascadePERSIST() : boolean

Returns true if the 'cascade options' contains 'PERSIST'

.isCascadeREFRESH() : boolean

Returns true if the 'cascade options' contains 'REFRESH'

.isCascadeREMOVE() : boolean

Returns true if the 'cascade options' contains 'REMOVE'

.isCollectionType() : boolean

Returns TRUE if the link is a collection
In other words, if its cardinality is 'OneToMany' or 'ManyToMany'

.isEmbedded() : boolean

Returns TRUE if the link is marked as 'embedded'

Since : 3.3.0

.isFetchDEFAULT() : boolean

Returns true if the 'fetch type' is 'DEFAULT'

.isFetchEAGER() : boolean

Returns true if the 'fetch type' is 'EAGER'

.isFetchLAZY() : boolean

Returns true if the 'fetch type' is 'LAZY'

.isOptionalFalse() : boolean

Returns true if the 'optional status' is 'FALSE'

.isOptionalTrue() : boolean

Returns true if the 'optional status' is 'TRUE'

.isOptionalUndefined() : boolean

Returns true if the 'optional status' is 'UNDEFINED'

.isOwningSide() : boolean

Returns TRUE if the link is the 'Owning Side' of the relationship between 2 entities

.isSelected() : boolean

Returns TRUE if the link is selected (checkbox checked in the GUI)

.isTransient() : boolean

Returns TRUE if the link is marked as 'transient'

Since : 3.3.0

.joinColumns : List

Returns the 'join columns' for the link

.joinTable : JoinTableInContext

Returns the 'join table' object for the link
NB : can be null if the link doesn't have a 'join table'
check existence before with 'hasJoinTable()'

.joinTableName : String

Returns the name of the 'join table' for the link
NB : can be null if the link doesn't have a 'join table'
check existence before with 'hasJoinTable()'

.mappedBy : String

Returns the name of the link in the 'owning side'
Typically for JPA 'mappedBy'
NB : can be null if 'mappedBy' is not defined
check existence before with 'hasMappedBy()'

.optional : String

Returns the 'optional status' for the link ( 'TRUE', 'FALSE' or 'UNDEFINED' )
Typically for JPA 'optional=true/false'

.setter : String

Returns the Java setter for the link e.g. 'setPerson' for link 'person'

.targetEntity : EntityInContext

Returns the entity referenced by the link


Since : 2.1.0

.targetEntityFullType : String

Returns the type of the entity referenced by the link
eg : 'my.package.Book', 'my.package.Customer', ...

.targetEntitySimpleType : String

Returns the type of the entity referenced by the link
eg : 'Book', 'Customer', ...

.targetTableName : String

Returns the name of the target table (table referenced by the link)

.updatable : String

Returns the 'updatable' flag value as string
( 'true' or 'false' or 'undefined' )

Since : 3.3.0

.updatableIs(boolean value) : boolean

Returns true if 'updatable' flag equals the given value
The flag can be 'undefined' then then neither true nor false

Parameters :
   value : the boolean value

Since : 3.3.0

.usesAttribute(AttributeInContext attribute) : boolean

Returns TRUE if the given attribute is used by the link

Parameters :
   attribute : the attribute to be checked