From: Vance K. <va...@us...> - 2006-06-27 11:13:19
|
User: vancek Date: 06/06/27 04:13:18 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EmbeddedValue.vsl andromda-ejb3/src/changes changes.xml andromda-ejb3/src/main/resources/META-INF/andromda cartridge.xml Added: andromda-ejb3/src/main/resources/templates/ejb3/config orm.xml.vsl Log: fix JIRA EJB-29 - use orm.xml to define the embedded value object implementation class as the embeddable class introduced orm.xml to over-write metadata annotations using deployment descriptor Revision Changes Path 1.3 +36 -36 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EmbeddedValue.vsl Index: EmbeddedValue.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EmbeddedValue.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- EmbeddedValue.vsl 26 Jun 2006 15:07:37 -0000 1.2 +++ EmbeddedValue.vsl 27 Jun 2006 11:13:17 -0000 1.3 @@ -10,8 +10,10 @@ /** $embeddedValue.getDocumentation(" * ") + * + * Migrated from using @javax.persistence.Embeddable annotation to mapping in orm.xml + * Still use the attribute annotations */ -...@ja...rsistence.Embeddable public abstract class $embeddedValue.name #if($embeddedValue.generalization) extends $embeddedValue.generalization.fullyQualifiedName @@ -28,19 +30,17 @@ * Creates a new instance of {@link ${embeddedValue.name}} * taking all properties. */ -#set ($parenthesis = "(") -#if ($embeddedValue.attributes.empty) -#set ($parenthesis = "()") -#end - public static $embeddedValue.name newInstance${parenthesis}#foreach ($attribute in $embeddedValue.attributes) -$attribute.getterSetterTypeName ${attribute.name}#if($velocityCount != $embeddedValue.attributes.size()),#else) -#end -#end +#**##set ($parenthesis = "(") +#**##if ($embeddedValue.attributes.empty) +#* *##set ($parenthesis = "()") +#**##end + public static $embeddedValue.name newInstance${parenthesis}#foreach ($attribute in $embeddedValue.attributes)$attribute.getterSetterTypeName ${attribute.name}#if($velocityCount != $embeddedValue.attributes.size()),#else)#end#end + { $embeddedValue.implementationName object = new ${embeddedValue.implementationName}(); -#foreach ($attribute in $embeddedValue.attributes) +#**##foreach ($attribute in $embeddedValue.attributes) object.${attribute.setterName}($attribute.name); -#end +#**##end object.initialize(); return object; } @@ -69,7 +69,7 @@ { } -#foreach ($attribute in $embeddedValue.attributes) +#**##foreach ($attribute in $embeddedValue.attributes) private $attribute.getterSetterTypeName $attribute.name; /** @@ -117,31 +117,31 @@ return this.${attribute.name}; } -#if ($embeddedValue.immutable) +#* *##if ($embeddedValue.immutable) // protected setter, if subclass methods need to normalize the $embeddedValue.name protected void ${attribute.setterName}(#if ($stringUtils.isNotBlank($attribute.lobType))${attribute.lobType}#else${attribute.getterSetterTypeName}#end $attribute.name) -#else +#* *##else $attribute.visibility void ${attribute.setterName}(#if ($stringUtils.isNotBlank($attribute.lobType))${attribute.lobType}#else${attribute.getterSetterTypeName}#end $attribute.name) -#end +#* *##end { this.${attribute.name} = $attribute.name; } -#end -#foreach ($operation in $embeddedValue.operations) -#set ($returnType = $operation.returnType) -#set ($signature = $operation.signature) +#**##end +#**##foreach ($operation in $embeddedValue.operations) +#* *##set ($returnType = $operation.returnType) +#* *##set ($signature = $operation.signature) /** $operation.getDocumentation(" * ") */ -#if ($operation.exceptionsPresent) +#* *##if ($operation.exceptionsPresent) $operation.visibility abstract $returnType.fullyQualifiedName $signature throws $operation.exceptionList; -#else +#* *##else $operation.visibility abstract $returnType.fullyQualifiedName $signature; -#end +#* *##end -#end +#**##end #end /** * Indicates if the argument is of the same type and all values are equal. 1.1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/orm.xml.vsl Index: orm.xml.vsl =================================================================== <?xml version="1.0" encoding="UTF-8"?> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd" version="1.0"> #foreach ($embeddable in $embeddables) <embeddable class="$embeddable.fullyQualifiedImplementationName"/> #end </entity-mappings> 1.15 +9 -0 cartridges/andromda-ejb3/src/changes/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/changes/changes.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -r1.14 -r1.15 --- changes.xml 27 Jun 2006 05:20:29 -0000 1.14 +++ changes.xml 27 Jun 2006 11:13:18 -0000 1.15 @@ -186,11 +186,20 @@ </action> <action dev="vancek" due-to="tlu" type="add"> Add support for embedded value object associations as well as attribute overrides. JIRA EJB-32. + NOTE: This is still partial support. The association mutators need to be added with appropriate + annotation to the embedded value object base abstract class. </action> <action dev="vancek" due-to="tlu" type="fix"> Fix problem when there are two embedded value objects of the same type in the same entity. Fix for both attribute and association overrides. JIRA EJB=33 </action> + <action dev="vancek" due-to="tlu" type="update"> + JIRA EJB-29 - the implementation class of the embedded value object was unused and the base class was abstract. + This is now fixed with the introduction of the orm.xml deployment descriptor. Currently, only + the embeddable classes are defined. As a result the @Embeddable annotation is removed from the base abstract + class and the embeddable implementation class is now the defined as the embeddable class using orm.xml rather + than metadata annotation. + </action> </release> </body> </document> \ No newline at end of file 1.27 +15 -1 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -u -w -r1.26 -r1.27 --- cartridge.xml 14 Jun 2006 08:08:47 -0000 1.26 +++ cartridge.xml 27 Jun 2006 11:13:18 -0000 1.27 @@ -357,6 +357,20 @@ <!-- Configuration Templates --> <template + path="templates/ejb3/config/orm.xml.vsl" + outputPattern="META-INF/orm.xml" + outlet="session-config" + overwrite="true" + outputToSingleFile="true" + outputOnEmptyElements="false"> + <modelElements> + <modelElement variable="embeddables"> + <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EmbeddedValueFacade"/> + </modelElement> + </modelElements> + </template> + + <template path="templates/ejb3/config/ejb-jar.xml.vsl" outputPattern="META-INF/ejb-jar.xml" outlet="session-config" |