From: Vance K. <va...@us...> - 2006-01-06 13:46:16
|
User: vancek Date: 06/01/06 05:46:07 Modified: andromda-ejb3/src/main/resources/templates/ejb3 Entity.vsl Log: fixed comments and removed transaction annotation from entity bean Revision Changes Path 1.3 +55 -54 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/Entity.vsl Index: Entity.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/Entity.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- Entity.vsl 3 Jan 2006 01:03:14 -0000 1.2 +++ Entity.vsl 6 Jan 2006 13:46:06 -0000 1.3 @@ -44,28 +44,40 @@ { private static final long serialVersionUID = ${entity.serialVersionUID}L; +#set ($constants = $entity.getConstants(true)) +#if (!$constants.empty) - // ----------- constant definitions ------------- -#foreach($constant in $entity.getConstants(true)) + // ----------- Constant Definitions ------------- + +#**##foreach($constant in $constants) @javax.persistence.Transient private static final $constant.type.fullyQualifiedName $constant.name = $constant.defaultValue; +#**##end #end +#set ($attributes = $entity.attributes) +#if (!$attributes.empty) - // ----------- attribute definitions ------------ -#foreach ( $attribute in $entity.attributes) + // ----------- Attribute Definitions ------------ + +#**##foreach ($attribute in $attributes) private $attribute.type.fullyQualifiedName $attribute.name; +#**##end #end +#set ($entityRelations = $entity.allEntityRelations) +#if (!$entityRelations.empty) - // --------- relationship definitions ----------- -#foreach ($associationEnd in $entity.allEntityRelations) -#**##if ($associationEnd.one2Many || $associationEnd.many2Many) + // --------- Relationship Definitions ----------- + +#**##foreach ($associationEnd in $entityRelations) +#**##**##if ($associationEnd.one2Many || $associationEnd.many2Many) private $associationEnd.relationType<${associationEnd.otherEnd.type.name}> ${associationEnd.otherEnd.name}; -#**##else +#**##**##else private $associationEnd.relationType ${associationEnd.otherEnd.name}; +#**##**##end #**##end #end - // --------------- constructors ----------------- + // --------------- Constructors ----------------- public ${entity.entityName}() { @@ -138,7 +150,7 @@ } #end - // --------- accessors for constants ---------- + // --------- Constant Accessors ---------- #foreach($constant in $entity.getConstants(true)) /** * Get the <code>$constant.name</code> constant @@ -149,9 +161,11 @@ return $constant.name; } #end +#if (!$attributes.empty) + + // -------- Attribute Accessors ---------- - // -------- attribute getters/setters ---------- -#foreach ($attribute in $entity.attributes) +#**##foreach ($attribute in $entity.attributes) #**##set ($visibility = $attribute.visibility) /** * Get the $attribute.name property. @@ -174,9 +188,6 @@ ## LOB type is specified - also sepcify FetchType if set to EAGER since default fetch type for LOB annotation is LAZY @javax.persistence.Lob(type = javax.persistence.LobType.${attribute.lobType}#if ($attribute.eager), fetch = javax.persistence.FetchType.EAGER#end) #**##end -#**##if ($attribute.transactionType) - @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${attribute.transactionType}) -#**##end @javax.persistence.Column(name = "${attribute.columnName}"#if ($attribute.unique), unique = ${attribute.unique}#end#if (!$attribute.columnNullable), nullable = ${attribute.columnNullable}#end#if ($attribute.columnLength), length = ${attribute.columnLength}#end#if ($attribute.columnDefinition), columnDefinition = "${attribute.columnDefinition}"#end#if ($attribute.columnPrecision), precision = ${attribute.columnPrecision}#end#if ($attribute.columnScale), scale = ${attribute.columnScale}#end) ## Only add the fetch type property for LAZY hints - default is EAGER #**##if ($attribute.lazy) @@ -199,9 +210,10 @@ } #**##end +#**##end #end - // ------------- relations ------------------ + // ------------- Relations ------------------ #foreach ($associationEnd in $entity.allEntityRelations) #**##set ($target = $associationEnd.otherEnd) @@ -219,9 +231,6 @@ #* *##set ($argExists = false) @javax.persistence.ManyToOne(#if (!$target.optional)optional = false#set ($argExists = true)#end#if ($target.cascadeType)#if ($argExists), #end#**#cascade = {${target.cascadeType}}#set ($argExists = true)#end#if ($target.lazy)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.LAZY#end) @javax.persistence.JoinColumn(name = "$stringUtils.upperCase(${target.name})"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end) -#* *##if ($associationEnd.association.transactionType) - @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${$associationEnd.association.transactionType}) -#* *##end public $associationEnd.relationType ${target.getterName}() { return this.${target.name}; @@ -251,9 +260,6 @@ */ #* *##set ($argExists = false) @javax.persistence.OneToMany(#if ($target.cascadeType)cascade = {${target.cascadeType}}#set ($argExists = true)#end#if ($associationEnd.navigable)#if ($argExists) ,#end#**#mappedBy="${associationEnd.name}"#set ($argExists = true)#end#if ($target.eager)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.EAGER#end) -#* *##if ($associationEnd.association.transactionType) - @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${$associationEnd.association.transactionType}) -#* *##end #* *##if ($target.hasTaggedValue("@andromda.persistence.orderBy")) #* *##if ($stringUtils.isNotEmpty(${target.orderByClause})) @javax.persistence.OrderBy("${target.orderByClause}") @@ -289,9 +295,6 @@ #* *##if($associationEnd.owning) @javax.persistence.JoinColumn(name = "$stringUtils.upperCase(${target.name})"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end) #* *##end -#* *##if ($associationEnd.association.transactionType) - @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${$associationEnd.association.transactionType}) -#* *##end public $associationEnd.relationType ${target.getterName}() { return this.${target.name}; @@ -323,9 +326,6 @@ #* *##if(($associationEnd.owning) && ${associationEnd.association.tableName}) @javax.persistence.JoinTable(table = @javax.persistence.Table(name = "${associationEnd.association.tableName}")) #* *##end -#* *##if ($associationEnd.association.transactionType) - @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${$associationEnd.association.transactionType}) -#* *##end #* *##if ($target.hasTaggedValue("@andromda.persistence.orderBy")) #* *##if ($stringUtils.isNotEmpty(${target.orderByClause})) @javax.persistence.OrderBy("${target.orderByClause}") @@ -350,7 +350,7 @@ #**##end #end - // ----------------- finder method ------------------ + // ----------------- Finder Method ------------------ #foreach ($finder in $entity.getQueryOperations(true)) #**##set ($returnType = $finder.returnType.fullyQualifiedName) @@ -397,17 +397,17 @@ } #end## finder operations - // --------------- business methods ----------------- +#set ($businessOperations = $entity.businessOperations) +#if (!$businessOperations.empty) + + // --------------- Business Methods ----------------- -#foreach ($operation in $entity.businessOperations) +#**##foreach ($operation in ) #**##set ($signature = $operation.signature) #**##set ($visibility = $operation.visibility.toString()) /** $operation.getDocumentation(" * ") */ -#**##if ($operation.transactionType) - @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${operation.transactionType}) -#**##end #**##set ($returnType = $operation.returnType.fullyQualifiedName) #**##if ($operation.exceptionsPresent) $visibility abstract $returnType $signature @@ -415,5 +415,6 @@ #**##else $visibility abstract $returnType $signature; #**##end +#**##end #end } \ No newline at end of file |