2222import org .telosys .tools .generic .model .Link ;
2323
2424/**
25- * Foreign Key pair of attributes ( origin attribute with referenced attribute )
25+ * Link attribute ( origin attribute with referenced attribute )
2626 *
2727 * @author Laurent Guerin
2828 *
2929 */
3030//-------------------------------------------------------------------------------------
3131@ VelocityObject (
32- // contextName = ContextName.FK_ATTRIBUTE ,
33- contextName = ContextName .LINK_ATTRIBUTE , // error fixed in v 4.0.1
32+ contextName = ContextName .LINK_ATTRIBUTE ,
3433 text = {
35- "Foreign Key attribute" ,
36- ""
34+ "A link uses one or more attributes to reference another entity. " ,
35+ "A 'link attribute' is one of these attributes, " ,
36+ "it defines the 'origin-->referenced' association at attribute level. "
3737 },
3838 since = "3.4.0" ,
3939 example = {
4040 "" ,
41- "#foreach( $fkAttribute in $fk .attributes )" ,
42- " $fkAttribute.xxx - $fkAttribute.xxx " ,
41+ "#foreach( $linkAttribute in $link .attributes )" ,
42+ " $linkAttribute.originAttributeName references $linkAttribute.referencedAttributeName " ,
4343 "#end"
4444 }
4545)
@@ -58,14 +58,18 @@ public class LinkAttributeInContext {
5858 //-------------------------------------------------------------------------------------
5959 /**
6060 * Constructor
61+ * @param modelInContext
62+ * @param entity
63+ * @param link
64+ * @param originAttributeName
65+ * @param referencedAttributeName
6166 */
6267 public LinkAttributeInContext ( ModelInContext modelInContext , EntityInContext entity , Link link ,
6368 String originAttributeName , String referencedAttributeName ) {
6469 super ();
6570
6671 this .linkName = link .getFieldName ();
6772 this .originEntityName = entity .getName ();
68- // this.referencedEntityName = link.getTargetEntityClassName();
6973 this .referencedEntityName = link .getReferencedEntityName ();
7074
7175 this .originAttributeName = originAttributeName ;
@@ -74,6 +78,12 @@ public LinkAttributeInContext( ModelInContext modelInContext, EntityInContext en
7478 this .modelInContext = modelInContext ;
7579 }
7680
81+ //-------------------------------------------------------------------------------------
82+ @ VelocityMethod (
83+ text ={
84+ "Returns the link name using the attribute (field name in the entity)"
85+ }
86+ )
7787 public String getLinkName () {
7888 return this .linkName ;
7989 }
0 commit comments