From: Vance K. <va...@us...> - 2006-02-20 05:12:18
|
User: vancek Date: 06/02/19 21:12:16 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: delcare manageable entity display attribute if specified also define the getter/setter methods on this attribute Revision Changes Path 1.16 +62 -0 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- EntityEmbeddable.vsl 9 Feb 2006 07:05:10 -0000 1.15 +++ EntityEmbeddable.vsl 20 Feb 2006 05:12:16 -0000 1.16 @@ -120,7 +120,30 @@ #* *##end #**##end #end +#if (!$entityRelations.empty) + // ---- Manageable Display Attributes (Transient) ----- + +## +## For manageable entities where the display attribute differs from identifier +## we need to specify a labels attribute which is transient (specified by annotation) +## on getter. A display attribute differs from the identifier if modelled by +## the Unique stereotype. +## +#**##foreach ($associationEnd in $entityRelations) +#* *##set ($target = $associationEnd.otherEnd) +#* *##if ($target.navigable) +#* *##if ($target.type.manageable && $target.type.manageableDisplayAttribute.name != $target.type.identifer.name) +#* *##if ($target.many) + private java.util.Collection<${target.type.manageableDisplayAttribute.type.fullyQualifiedName}> ${target.labelName}; // Manageable display attribute +#* *##else + private $target.type.manageableDisplayAttribute.type.fullyQualifiedName ${target.labelName}; // Manageable display attribute +#* *##end +#* *##end +#* *##end +#**##end + +#end // --------------- Constructors ----------------- /** @@ -535,6 +558,45 @@ #* *##end #**##end #end +#foreach ($associationEnd in $entity.allEntityRelations) +#**##set ($target = $associationEnd.otherEnd) +#**##if($target.navigable) +## +## For manageable entities where the display attribute differs from identifier +## we need to specify a labels attribute which is transient (specified by annotation) +## on getter. A display attribute differs from the identifier if modelled by +## the Unique stereotype. +## +#* *##if ($target.type.manageable && $target.type.manageableDisplayAttribute.name != $target.type.identifer.name) +#* *##if ($velocityCount == 1) + // -------- Manageable Attribute Display ----------- + +#* *##end + /** + * Get the ${target.labelName} + * + * @return #if ($target.many)java.util.Collection<${target.type.manageableDisplayAttribute.type.fullyQualifiedName}>#else${target.type.manageableDisplayAttribute.type.fullyQualifiedName}#end + + */ + @javax.persistence.Transient + public #if ($target.many)java.util.Collection<${target.type.manageableDisplayAttribute.type.fullyQualifiedName}>#else${target.type.manageableDisplayAttribute.type.fullyQualifiedName}#end ${target.getterLabelName}() + { + return this.${target.labelName}; + } + + /** + * Set the ${target.labelName} + * + * @param ${target.labelName} + */ + public void ${target.setterLabelName} (#if ($target.many)java.util.Collection<${target.type.manageableDisplayAttribute.type.fullyQualifiedName}>#else${target.type.manageableDisplayAttribute.type.fullyQualifiedName}#end ${target.labelName}) + { + this.${target.labelName} = ${target.labelName}; + } + +#* *##end +#**##end +#end #if ($entity.genericFinders) // ----------- Generic Finder Methods -------------- |