From: Chad B. <cwb...@us...> - 2004-01-12 00:48:40
|
User: cwbrandon Date: 04/01/11 16:48:39 Modified: andromda-ejb/src/decorators/manual/org/andromda/cartridges/ejb/metadecorators/uml14 Tag: V3x_MMD EJBFinderMethodDecoratorImpl.java andromda-ejb/src/java/org/andromda/cartridges/ejb Tag: V3x_MMD EJBCartridge.java andromda-ejb/src/templates Tag: V3x_MMD EntityLocalIntf.vsl EntityHome.vsl EntityBean.vsl EJBglobals.vm andromda-ejb Tag: V3x_MMD andromda-ejb.properties andromda-ejb/src/META-INF Tag: V3x_MMD andromda-cartridge.xml Added: andromda-ejb/src/decorators/manual/org/andromda/cartridges/ejb/metadecorators/uml14 Tag: V3x_MMD EJBEntityDecoratorImpl.java EJBPrimaryKeyDecoratorImpl.java EJBAssociationEndDecoratorImpl.java andromda-ejb/src/java/org/andromda/cartridges/ejb Tag: V3x_MMD EJBProfile.java Log: get the ejb cartridge to at least not fail during generation. Revision Changes Path No revision No revision 1.1.2.2 +38 -38 cartridges/andromda-ejb/src/decorators/manual/org/andromda/cartridges/ejb/metadecorators/uml14/Attic/EJBFinderMethodDecoratorImpl.java Index: EJBFinderMethodDecoratorImpl.java =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-ejb/src/decorators/manual/org/andromda/cartridges/ejb/metadecorators/uml14/Attic/EJBFinderMethodDecoratorImpl.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -w -r1.1.2.1 -r1.1.2.2 --- EJBFinderMethodDecoratorImpl.java 10 Jan 2004 15:18:22 -0000 1.1.2.1 +++ EJBFinderMethodDecoratorImpl.java 12 Jan 2004 00:48:38 -0000 1.1.2.2 @@ -3,26 +3,22 @@ import java.util.Collection; import java.util.Iterator; +import org.andromda.cartridges.ejb.EJBProfile; import org.apache.commons.lang.StringUtils; import org.omg.uml.foundation.core.Parameter; - - /** + * Metaclass decorator implementation for + * org.omg.uml.foundation.core.Operation. * - * Metaclass decorator implementation for org.omg.uml.foundation.core.Operation - * - * + * @author Chad Brandon */ -public class EJBFinderMethodDecoratorImpl extends EJBFinderMethodDecorator -{ - - private static final String TAGGED_VALUE_EJB_QUERY = "@andromda.ejb.query"; +public class EJBFinderMethodDecoratorImpl extends EJBFinderMethodDecorator { // ---------------- constructor ------------------------------- - public EJBFinderMethodDecoratorImpl (org.omg.uml.foundation.core.Operation metaObject) - { + public EJBFinderMethodDecoratorImpl( + org.omg.uml.foundation.core.Operation metaObject) { super (metaObject); } @@ -36,13 +32,14 @@ //first see if there is a query stored as a tagged value String queryString = StringUtils.trimToNull( - this.findTaggedValue(TAGGED_VALUE_EJB_QUERY)); + this.findTaggedValue(EJBProfile.TAGGEDVALUE_EJB_QUERY)); //if there wasn't any stored query, create one by default. if (StringUtils.isEmpty(queryString)) { queryString = "SELECT DISTINCT OBJECT(c) FROM " - + this.getOwner().getName() + " as c"; + + this.getOwner().getName() + + " as c"; if (this.getParameters().size() > 0) { queryString = queryString + " WHERE"; Collection parameters = this.getParameters(); @@ -50,9 +47,12 @@ Iterator parameterIt = parameters.iterator(); for (int ctr = 0; parameterIt.hasNext(); ctr++) { Parameter param = (Parameter)parameterIt.next(); - queryString = queryString - + " c." + param.getName() - + " = ?" + ctr; + queryString = + queryString + + " c." + + param.getName() + + " = ?" + + ctr; if (parameters.size() != ctr) { queryString = queryString + " AND"; } No revision No revision 1.1.2.1 +274 -0 cartridges/andromda-ejb/src/decorators/manual/org/andromda/cartridges/ejb/metadecorators/uml14/Attic/EJBEntityDecoratorImpl.java 1.1.2.1 +70 -0 cartridges/andromda-ejb/src/decorators/manual/org/andromda/cartridges/ejb/metadecorators/uml14/Attic/EJBPrimaryKeyDecoratorImpl.java 1.1.2.1 +87 -0 cartridges/andromda-ejb/src/decorators/manual/org/andromda/cartridges/ejb/metadecorators/uml14/Attic/EJBAssociationEndDecoratorImpl.java No revision No revision 1.1.2.2 +22 -3 cartridges/andromda-ejb/src/java/org/andromda/cartridges/ejb/Attic/EJBCartridge.java Index: EJBCartridge.java =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-ejb/src/java/org/andromda/cartridges/ejb/Attic/EJBCartridge.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -w -r1.1.2.1 -r1.1.2.2 --- EJBCartridge.java 7 Jan 2004 01:36:38 -0000 1.1.2.1 +++ EJBCartridge.java 12 Jan 2004 00:48:38 -0000 1.1.2.2 @@ -2,8 +2,11 @@ import java.util.Properties; +import org.andromda.cartridges.ejb.metadecorators.uml14.EJBEntityDecoratorImpl; +import org.andromda.cartridges.ejb.metadecorators.uml14.EJBFinderMethodDecoratorImpl; +import org.andromda.cartridges.ejb.metadecorators.uml14.EJBPrimaryKeyDecoratorImpl; +import org.andromda.cartridges.ejb.metadecorators.uml14.EJBAssociationEndDecoratorImpl; import org.andromda.cartridges.interfaces.DefaultAndroMDACartridge; -import org.andromda.core.metadecorators.ejb.EJBFinderMethodDecoratorImpl; import org.andromda.core.metadecorators.uml14.DecoratorFactory; /** @@ -21,8 +24,24 @@ df.registerDecoratorClass( "org.omg.uml.foundation.core.Operation$Impl", - "FinderMethod", + EJBProfile.STEREOTYPE_FINDER_METHOD, EJBFinderMethodDecoratorImpl.class.getName()); + + df.registerDecoratorClass( + "org.omg.uml.foundation.core.Attribute$Impl", + EJBProfile.STEREOTYPE_PRIMARY_KEY, + EJBPrimaryKeyDecoratorImpl.class.getName()); + + df.registerDecoratorClass( + "org.omg.uml.foundation.core.Classifier$Impl", + EJBProfile.STEREOTYPE_ENTITY, + EJBEntityDecoratorImpl.class.getName()); + + df.registerDecoratorClass( + "org.omg.uml.foundation.core.AssociationEnd$Impl", + null, + EJBAssociationEndDecoratorImpl.class.getName()); + df.setActiveNamespace (oldNamespace); } No revision No revision 1.1.2.1 +42 -0 cartridges/andromda-ejb/src/java/org/andromda/cartridges/ejb/Attic/EJBProfile.java No revision No revision 1.3.2.1 +2 -2 cartridges/andromda-ejb/src/templates/EntityLocalIntf.vsl Index: EntityLocalIntf.vsl =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-ejb/src/templates/EntityLocalIntf.vsl,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -w -r1.3 -r1.3.2.1 --- EntityLocalIntf.vsl 20 Aug 2003 18:51:36 -0000 1.3 +++ EntityLocalIntf.vsl 12 Jan 2004 00:48:39 -0000 1.3.2.1 @@ -82,8 +82,8 @@ // ------------- relations ------------------ -#foreach ( $assoc in $transform.getEntityRelations($class) ) -#set ($assocname = $transform.findEjbRelationName($assoc, $entityname)) +#foreach ( $assoc in $class.entityRelations) ) +#set ($assocname = $assoc.relationName) #set ($TargetRoleName = ${str.upperCaseFirstLetter($assoc.target.roleName)}) #set ($targetTypeName = $transform.getRelationTargetType($assoc)) 1.4.2.1 +1 -1 cartridges/andromda-ejb/src/templates/EntityHome.vsl Index: EntityHome.vsl =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-ejb/src/templates/EntityHome.vsl,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -r1.4 -r1.4.2.1 --- EntityHome.vsl 26 Nov 2003 20:12:28 -0000 1.4 +++ EntityHome.vsl 12 Jan 2004 00:48:39 -0000 1.4.2.1 @@ -121,7 +121,7 @@ */ public ${entityname} create($transform.getAttributesAsList2($allAttributes, true, true)) throws javax.ejb.CreateException; -#set ($relations = $transform.findEntityRelationsForSource($class)) +#set ($relations = $class.allEntityRelations) #if (!$relations.isEmpty()) /** 1.13.2.1 +15 -11 cartridges/andromda-ejb/src/templates/EntityBean.vsl Index: EntityBean.vsl =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-ejb/src/templates/EntityBean.vsl,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -w -r1.13 -r1.13.2.1 --- EntityBean.vsl 26 Nov 2003 20:12:28 -0000 1.13 +++ EntityBean.vsl 12 Jan 2004 00:48:39 -0000 1.13.2.1 @@ -2,7 +2,7 @@ ## Include global definitions. ## #parse("templates/EJBglobals.vm") ## Define project specific properties and macros ## -#set ($tablename = $str.toDatabaseAttributeName($entityname, '_')) +#set ($tablename = $str.toDatabaseAttributeName($class.name, '_')) ## ################################################################################## @@ -23,8 +23,11 @@ * type="CMP" cmp-version="2.x" * view-type="local" * local-jndi-name = "#ejbRefName($class)/Local" -#if (!$transform.hasComplexPrimaryKey($class)) - * primkey-field = "$transform.getSimplePkField($class).name" +##if (!$transform.hasComplexPrimaryKey($class)) +## * primkey-field = "$transform.getSimplePkField($class).name" +###end +#if (!$class.primaryKeyAttribute.complex) +* primkey-field = "$class.primaryKeyAttribute.name" #end * * @ejb.interface generate="false" local-class="${packagename}.${entityname}" @@ -259,9 +262,9 @@ ## If the class is abstract, generate abstract methods for all CMR relations so that they ## are accessible in the *BeanImpl class #if ($class.isAbstract()) -#foreach ( $assoc in $transform.getEntityRelations($class) ) +#foreach ( $assoc in $class.entityRelations) ) #if(!($transform.findTagValue($assoc.source.association, "@andromda.ejb.generateCMR") == "false")) -#set ($assocname = $transform.findEjbRelationName($assoc, $entityname)) +#set ($assocname = $assoc.relationName) #set ($TargetRoleName = ${str.upperCaseFirstLetter($assoc.target.roleName)}) #set ($targetTypeName = $transform.getRelationTargetType($assoc)) @@ -284,10 +287,10 @@ #end ## Generate the real CMR methods. -#foreach ( $assoc in $transform.findEntityRelationsForSource($class) ) +#foreach ( $assoc in $class.allEntityRelations ) ## relations not flagged as CMR are generated below under business methods #if(!($transform.findTagValue($assoc.source.association, "@andromda.ejb.generateCMR") == "false")) -#set ($assocname = $transform.findEjbRelationName($assoc, $entityname)) +#set ($assocname = $assoc.relationName) #set ($TargetRoleName = ${str.upperCaseFirstLetter($assoc.target.roleName)}) #set ($transactionType = $transform.findTagValue($assoc.source.association, "@andromda.ejb.transactionType")) #set ($targetTypeName = $transform.getRelationTargetType($assoc)) @@ -348,7 +351,7 @@ // ---------------- business and select methods ---------------------- ## Generate business methods for relations flagged as non-CMR even when the class ## is abstract. That way, we can implement them in the base class -#foreach ( $assoc in $transform.getEntityRelations($class) ) +#foreach ( $assoc in $class.entityRelations) ) #if($transform.findTagValue($assoc.source.association, "@andromda.ejb.generateCMR") == "false") #set ($transactionType = $transform.findTagValue($assoc.source.association, "@andromda.ejb.transactionType")) #set ($targetTypeName = $transform.getRelationTargetType($assoc)) @@ -516,8 +519,9 @@ ## breaking usability of the PIM with the Hibernate cartridge. ## (Matthias Bohlen) ## -#if (!$transform.hasComplexPrimaryKey($class)) -#set ($primKey = $transform.getSimplePkField($class)) +##if (!$transform.hasComplexPrimaryKey($class)) +#if (!$class.primaryKeyAttribute.complex) +#set ($primKey = $class.primaryKeyAttribute) #if ($transform.getFullyQualifiedName($primKey.type) == "java.lang.String") if ($primKey.name == null) { $primKey.name = new java.rmi.server.UID().toString(); @@ -559,7 +563,7 @@ super.ejbPostCreate($transform.getAttributesAsList2($inheritedAttributes, false, true)); #end } -#set ($relations = $transform.findEntityRelationsForSource($class)) +#set ($relations = $class.allEntityRelations) #if (!$relations.isEmpty()) #if (!$class.isAbstract() && !$transform.findTagValue($class, "@andromda.ejb.noSyntheticCreateMethod")) /** 1.1.2.1 +0 -6 cartridges/andromda-ejb/src/templates/EJBglobals.vm Index: EJBglobals.vm =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-ejb/src/templates/EJBglobals.vm,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -w -r1.1 -r1.1.2.1 --- EJBglobals.vm 12 Aug 2003 13:48:16 -0000 1.1 +++ EJBglobals.vm 12 Jan 2004 00:48:39 -0000 1.1.2.1 @@ -30,12 +30,6 @@ ## "java.lang.String" ## Empty if the current class is a <<Service>> ## -## $pkfieldname -## set to the name of the attribute stereotyped <<PrimaryKey>> if the primary -## key class has been defined from such an attribute. If not, this property -## is not set. -## Empty if the current class is a <<Service>> -## ## $beanparentclass ## the fully qualified classname of the parent class for the generated ## bean class. If this entity has a parent class in the UML model, this is No revision No revision 1.1.4.2 +1 -1 cartridges/andromda-ejb/andromda-ejb.properties Index: andromda-ejb.properties =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-ejb/andromda-ejb.properties,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -u -w -r1.1.4.1 -r1.1.4.2 --- andromda-ejb.properties 7 Jan 2004 01:34:02 -0000 1.1.4.1 +++ andromda-ejb.properties 12 Jan 2004 00:48:39 -0000 1.1.4.2 @@ -1 +1 @@ -andromda-ejb.classpath=../andromda-meta/dist/andromda-meta.jar +andromda-ejb.classpath=${andromda-ejb.home}/andromda-ejb.jar No revision No revision 1.8.2.1 +18 -14 cartridges/andromda-ejb/src/META-INF/andromda-cartridge.xml Index: andromda-cartridge.xml =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-ejb/src/META-INF/andromda-cartridge.xml,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -w -r1.8 -r1.8.2.1 --- andromda-cartridge.xml 20 Aug 2003 18:51:37 -0000 1.8 +++ andromda-cartridge.xml 12 Jan 2004 00:48:39 -0000 1.8.2.1 @@ -1,4 +1,8 @@ <cartridge name="ejb"> + + <!-- defines the class to use --> + <class name="org.andromda.cartridges.ejb.EJBCartridge"/> + <property name="persistence" value="ejb" /> <!-- these are the new, official stereotypes --> @@ -21,7 +25,7 @@ outputPattern="{0}/{1}Bean.java" outlet="entity-beans" overWrite="true" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" /> <template @@ -30,7 +34,7 @@ outputPattern="{0}/{1}.java" outlet="entity-beans" overWrite="true" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" /> <template @@ -39,7 +43,7 @@ outputPattern="{0}/{1}LocalHome.java" outlet="entity-beans" overWrite="true" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" /> <template @@ -48,7 +52,7 @@ outputPattern="{0}/{1}BeanImpl.java" outlet="entity-impls" overWrite="false" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" /> <!-- @@ -64,7 +68,7 @@ outputPattern="{0}/{1}Bean.java" outlet="session-beans" overWrite="true" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" /> <template @@ -73,7 +77,7 @@ outputPattern="{0}/{1}Local.java" outlet="session-beans" overWrite="true" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" generateEmptyFiles="false" /> @@ -83,7 +87,7 @@ outputPattern="{0}/{1}.java" outlet="session-beans" overWrite="true" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" generateEmptyFiles="false" /> @@ -93,7 +97,7 @@ outputPattern="{0}/{1}LocalHome.java" outlet="session-beans" overWrite="true" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" generateEmptyFiles="false" /> @@ -103,7 +107,7 @@ outputPattern="{0}/{1}Home.java" outlet="session-beans" overWrite="true" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" generateEmptyFiles="false" /> @@ -113,7 +117,7 @@ outputPattern="{0}/{1}BeanImpl.java" outlet="session-impls" overWrite="false" - transformClass="org.andromda.cartridges.ejb.EjbScriptHelper" + transformClass="org.andromda.cartridges.ejb.EJBScriptHelper" /> </cartridge> |