Skip to content

Commit 9935c47

Browse files
committed
Velocity doc update for $linkAttribute
1 parent 409e0f7 commit 9935c47

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/main/java/org/telosys/tools/generator/context/LinkAttributeInContext.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@
2222
import 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

Comments
 (0)