22
22
import org .telosys .tools .generic .model .Link ;
23
23
24
24
/**
25
- * Foreign Key pair of attributes ( origin attribute with referenced attribute )
25
+ * Link attribute ( origin attribute with referenced attribute )
26
26
*
27
27
* @author Laurent Guerin
28
28
*
29
29
*/
30
30
//-------------------------------------------------------------------------------------
31
31
@ VelocityObject (
32
- // contextName = ContextName.FK_ATTRIBUTE ,
33
- contextName = ContextName .LINK_ATTRIBUTE , // error fixed in v 4.0.1
32
+ contextName = ContextName .LINK_ATTRIBUTE ,
34
33
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. "
37
37
},
38
38
since = "3.4.0" ,
39
39
example = {
40
40
"" ,
41
- "#foreach( $fkAttribute in $fk .attributes )" ,
42
- " $fkAttribute.xxx - $fkAttribute.xxx " ,
41
+ "#foreach( $linkAttribute in $link .attributes )" ,
42
+ " $linkAttribute.originAttributeName references $linkAttribute.referencedAttributeName " ,
43
43
"#end"
44
44
}
45
45
)
@@ -58,14 +58,18 @@ public class LinkAttributeInContext {
58
58
//-------------------------------------------------------------------------------------
59
59
/**
60
60
* Constructor
61
+ * @param modelInContext
62
+ * @param entity
63
+ * @param link
64
+ * @param originAttributeName
65
+ * @param referencedAttributeName
61
66
*/
62
67
public LinkAttributeInContext ( ModelInContext modelInContext , EntityInContext entity , Link link ,
63
68
String originAttributeName , String referencedAttributeName ) {
64
69
super ();
65
70
66
71
this .linkName = link .getFieldName ();
67
72
this .originEntityName = entity .getName ();
68
- // this.referencedEntityName = link.getTargetEntityClassName();
69
73
this .referencedEntityName = link .getReferencedEntityName ();
70
74
71
75
this .originAttributeName = originAttributeName ;
@@ -74,6 +78,12 @@ public LinkAttributeInContext( ModelInContext modelInContext, EntityInContext en
74
78
this .modelInContext = modelInContext ;
75
79
}
76
80
81
+ //-------------------------------------------------------------------------------------
82
+ @ VelocityMethod (
83
+ text ={
84
+ "Returns the link name using the attribute (field name in the entity)"
85
+ }
86
+ )
77
87
public String getLinkName () {
78
88
return this .linkName ;
79
89
}
0 commit comments