You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(178) |
Feb
(169) |
Mar
(286) |
Apr
(117) |
May
(98) |
Jun
(68) |
Jul
(63) |
Aug
(121) |
Sep
(88) |
Oct
(124) |
Nov
(2) |
Dec
(111) |
| 2007 |
Jan
(224) |
Feb
(69) |
Mar
(10) |
Apr
(72) |
May
(7) |
Jun
(21) |
Jul
(33) |
Aug
(35) |
Sep
(12) |
Oct
(22) |
Nov
(5) |
Dec
(6) |
| 2008 |
Jan
(2) |
Feb
(10) |
Mar
(39) |
Apr
(58) |
May
(34) |
Jun
(9) |
Jul
(27) |
Aug
(10) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
|
From: Vance K. <va...@us...> - 2006-01-03 01:05:46
|
User: vancek
Date: 06/01/02 17:05:35
Modified: andromda-ejb3/src/main/resources/templates/ejb3
SessionBeanImpl.vsl
Log:
fixed to work with ejb3 session bean
Revision Changes Path
1.2 +48 -13 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBeanImpl.vsl
Index: SessionBeanImpl.vsl
===================================================================
RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBeanImpl.vsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- SessionBeanImpl.vsl 28 Dec 2005 00:32:55 -0000 1.1
+++ SessionBeanImpl.vsl 3 Jan 2006 01:05:35 -0000 1.2
@@ -11,30 +11,65 @@
public class ${service.serviceImplementationName}
extends ${service.serviceName}
{
-#foreach ($operation in $service.operations)
-#set ($returnType = $operation.returnType.fullyQualifiedName)
-#set ($signature = $operation.signature)
-#set ($visibility = $operation.visibility)
-## Public static methods are exposed on the home
-## interface instead of the component interface and must
-## be prepended with "ejbHome"
-#if ($visibility == "public" && $operation.static)
-#set ($signature = "ejbHome${stringUtils.capitalize($signature)}")
+ // --------------- Constructors ---------------
+
+## Default create method with no arguments.
+ public ${service.serviceImplementationName}()
+ {
+ super();
+ }
+#foreach ($operation in $service.getCreateMethods(false))
+
+ /**
+$operation.getDocumentation(" * ")
+ *
+ */
+ public ${service.serviceImplementationName}($operation.typedArgumentList)
+ {
+ // implementation
+ }
+#end
+## Autogenerated create method with all attributes. Only present for stateful beans.
+#set ($allAttributes = $service.allInstanceAttributes)
+#if (!$allAttributes.empty)
+
+ /**
+ * Constructor with all attribute values.
+#**##foreach($attribute in $allAttributes)
+ * @param $attribute.name Value for the ${attribute.name} property
+#**##end
+ */
+ public ${service.serviceImplementationName}(${service.getAttributesAsList($allAttributes, true, true)})
+ {
+#**##if(!$allAttributes.empty)
+ super($service.getAttributesAsList($allAttributes, false, true));
+#**##end
+ }
#end
+#set ($operations = $service.operations)
+#if (!$operations.empty)
+
+ // -------- Business Methods --------------
+
+#**##foreach ($operation in $operations)
+#* *##set ($returnType = $operation.returnType.fullyQualifiedName)
+#* *##set ($signature = $operation.signature)
+#* *##set ($visibility = $operation.visibility)
/**
* @see ${service.fullyQualifiedName}#${operation.getSignature(false)}
*/
$visibility $returnType $signature
-#if ($operation.exceptionsPresent)
+#* *##if ($operation.exceptionsPresent)
throws $operation.exceptionList
-#end
+#* *##end
{
//TODO: put your implementation here.
-#if ($operation.returnTypePresent)
+#* *##if ($operation.returnTypePresent)
// Dummy return value, just that the file compiles
return $operation.returnType.javaNullString;
-#end
+#* *##end
}
+#**##end
#end
}
|
|
From: Vance K. <va...@us...> - 2006-01-03 01:04:47
|
User: vancek
Date: 06/01/02 17:04:40
Modified: andromda-ejb3/src/main/resources/templates/ejb3
SessionBean.vsl
Log:
fixed to include ejb3 annotations
Revision Changes Path
1.2 +146 -363 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl
Index: SessionBean.vsl
===================================================================
RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- SessionBean.vsl 28 Dec 2005 00:32:55 -0000 1.1
+++ SessionBean.vsl 3 Jan 2006 01:04:39 -0000 1.2
@@ -5,422 +5,205 @@
#end
/**
- * Autogenerated EJB implementation class for the ${service.serviceName} session bean.
-$service.getDocumentation(" * ")
- *
-#if ($service.abstract)
- * @ejb.bean generate="false"
-#else
- * @ejb.bean generate="true"
-#end
- * name="$service.name"
- * type="$service.type"
- * view-type="$service.viewType"
- * jndi-name = "${service.jndiName}/Remote"
- * local-jndi-name = "${service.jndiName}/Local"
- *
- * @ejb.interface
- * local-class="${service.fullyQualifiedName}Local"
- * remote-class="${service.fullyQualifiedName}"
- * @ejb.home
- * local-class="${service.fullyQualifiedName}LocalHome"
- * remote-class="${service.fullyQualifiedName}Home"
- * @ejb.transaction type="$service.transactionType"
+ * Autogenerated EJB entity POJO class for the ${service.serviceName} session bean.
*
- * @ejb.util generate="physical"
- *
-#foreach($envEntry in $service.getEnvironmentEntries(true))
-#set ($value = $envEntry.defaultValue)
-## Add string delimiters if they are not already present
-#if (!$value.startsWith('"') || !$value.endsWith('"'))
-#set ($value = "$value")
-#end
- * @ejb.env-entry
- * name="$envEntry.name"
- * type="$envEntry.type.fullyQualifiedName"
- * value="$value"
- *
-#end
-#foreach ( $dependency in $service.sourceDependencies )
-#if ($dependency.hasStereotype("EntityRef") || $dependency.hasStereotype("ServiceRef"))
-#set ($reference = $dependency.targetElement)
- * @ejb.ejb-ref
- * ejb-name="${reference.name}"
- * view-type="$reference.viewType"
- * ref-name="ejb/${reference.name}BeanRef"
- *
-#end
-#if ($dependency.hasStereotype("ResourceRef"))
-#set ($reference = $dependency.targetElement)
-#set ($jndiRef = $dependency.findTaggedValue("@andromda.ejb.resource-ref.jndi-name"))
-#set ($resAuth = $dependency.findTaggedValue("@andromda.ejb.resource-ref.res-auth"))
-#if (!$resAuth)
-#set ($resAuth = "Container")
-#end
-#set ($resName = $dependency.name)
-#if (!$resName)
-#set ($resName = $reference.name)
-#end
- * @ejb.resource-ref
- * res-ref-name="resource/$resName"
- * res-type="${reference.fullyQualifiedName}"
- * res-auth="$resAuth"
- *
-#if ($jndiRef)
- * @jboss.resource-ref
- * res-ref-name = "resource/$resName"
- * jndi-name = "$jndiRef"
+$service.getDocumentation(" * ")
*
- * @weblogic.resource-description
- * res-ref-name= "resource/$resName"
- * jndi-name= "$jndiRef"
*
- * @websphere.bean
-#end
-#end
-#end
*/
+@javax.ejb.${service.type}
+#if ($service.transactionType)
+@javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${service.transactionType})
+#end
+@javax.ejb.CallbackListener(${service.fullyQualifiedServiceListenerName}.class)
+#if ($service.securityDomain)
+#**##if ($service.persistenceContainerJboss)
+@org.jboss.annotation.security.SecurityDomain("${service.securityDomain}")
+#**##end
+#end
+#if ($service.permitAll)
+@javax.annotation.security.PermitAll
+#elseif ($service.rolesAllowed)
+@javax.annotation.security.RolesAllowed({${service.rolesAllowed}})
+#end
public abstract class ${service.serviceName}
#if($service.generalization)
extends ${service.generalization.fullyQualifiedName}BeanImpl
#end
- implements javax.ejb.SessionBean
+ implements ${service.fullyQualifiedServiceLocalInterfaceName}, ${service.fullyQualifiedServiceRemoteInterfaceName}
{
- // ----------- constant definitions -----------
-#foreach($constant in $service.getConstants(true))
- private static final $constant.type.fullyQualifiedName $constant.name = $constant.defaultValue;
-#end
+ // ------ Session Context Injection ------
+ @javax.annotation.Resource
+ javax.ejb.SessionContext context;
- // -- accessors for environment entries --
-#foreach($envEntry in $service.getEnvironmentEntries(true))
- /**
- * Get <em>${envEntry.name}</em> environment entry.
-$envEntry.getDocumentation(" * ")
- *
-## Only expose the method to the component interface if it is public.
-#set ($visibility = $envEntry.visibility)
-#if($visibility == "public")
- * @ejb.interface-method
-#end
- */
- $visibility $envEntry.type.fullyQualifiedName ${envEntry.getterName}()
- {
- javax.naming.InitialContext initialContext = null;
- try
- {
- initialContext = new javax.naming.InitialContext();
- return (${envEntry.type.fullyQualifiedName}) initialContext.lookup("java:comp/env/$envEntry.name");
- }
- catch (javax.naming.NamingException cause)
- {
- RuntimeException ex = new IllegalStateException(
- "Cannot access environment entry \"$envEntry.name\".");
- // In order to set the exception cause on JDK 1.4
- // and stay JDK 1.3 compatible nonetheless, we need
- // a bit of reflection magic here...
- try
- {
- java.lang.reflect.Method initCause =
- ex.getClass().getMethod("initCause",
- new Class[] {Throwable.class});
- initCause.invoke(ex, new Object[] { cause });
- }
- catch (Throwable t)
- {
- // Ignore any errors here - we simply make do without the cause
- }
- throw ex;
- }
- finally
- {
- try
- {
- if (initialContext != null)
- {
- initialContext.close();
- }
- }
- catch (javax.naming.NamingException ignore)
- {
- // Silently ignore naming exceptions at cleanup time
- }
- }
- }
-#end
+ // ------ Persistence Context Definitions --------
- // -- accessors for constants --
-#foreach($constant in $service.getConstants(true))
+#set ($argExists = false)
/**
- * Get the <code>$constant.name</code> constant
-$constant.getDocumentation(" * ")
-#if ($constant.visibility == "public")
- *
- * @ejb.interface-method
-#end
- $constant.visibility $constant.type.fullyQualifiedName ${constant.getterName}()
- {
- return $constant.name;
- }
-
-## If the constant is public, expose it to the home interface as well
-#if($constant.visibility == "public")
+ * Inject persistence context #if ($service.persistenceContextUnitName)${service.persistenceContextUnitName}#end
- /**
- * Home interface method for accessing {@link #${attribute.getterName}}.
- * @ejb.home-method
- * @see #${constant.getterName}
*/
- public $constant.type.fullyQualifiedName ejbHomeGet${constant.name}()
- {
- return ${constant.getterName};
- }
-#end
-#end
+ @javax.persistence.PersistenceContext#if ($service.persistenceContextUnitName || $service.persistenceContextType)(#end#if ($service.persistenceContextUnitName)unitName = "${service.persistenceContextUnitName}"#set ($argExists = true)#end#if ($service.persistenceContextType)#if ($argExists),#end type = javax.persistence.PersistenceContextType.${service.persistenceContextType}#end#if ($service.persistenceContextUnitName || $service.persistenceContextType))#end
-#set ($instanceAttributes = $service.instanceAttributes)
-#if(!$instanceAttributes.empty)
- // --------------- attributes ---------------------
-#foreach ( $attribute in $instanceAttributes)
-#set ($visibility = $attribute.visibility)
- /** The $attribute.name property */
- private $attribute.type.fullyQualifiedName $attribute.name;
+ protected javax.persistence.EntityManager emanager;
+#foreach ($reference in $service.persistenceContextReferences)
+#**##set ($persistenceContext = $reference.targetElement)
+#**##set ($argExists = false)
/**
- * Get the ${attribute.name} property
-$attribute.getDocumentation(" * ")
- *
-#if ($attribute.transactionType)
- * @ejb.transaction type="$attribute.transactionType"
-#end
-#if($visibility == "public")
- * @ejb.interface-method
-#end
- */
- $visibility $attribute.type.fullyQualifiedName ${attribute.getterName}()
- {
- return $attribute.name;
- }
+ * Inject persistence context #if ($persistenceContext.persistenceContextUnitName)${persistenceContext.persistenceContextUnitName}#end
-## Only generate a setter if the attribute is not read-only
-## Note: It's no use to generate final fields for read-only attributes because
-## the fields are likely to be initialized in ejbActivate() or a similiar
-## method and not in the constructor.
-#if (!$attribute.readOnly)
- /**
- * Set the $attribute.name property
- * @param value the new value
-#if($visibility == "public")
- * @ejb.interface-method
-#end
-#if ($attribute.transactionType)
- * @ejb.transaction type="$attribute.transactionType"
-#end
*/
- $visibility void ${attribute.setterName}($attribute.type.fullyQualifiedName value)
- {
- this.$attribute.name = value;
- }
-
-#end
+ @javax.persistence.PersistenceContext#if ($persistenceContext.persistenceContextUnitName || $persistenceContext.persistenceContextType)(#end#if ($persistenceContext.persistenceContextUnitName)unitName = "${persistenceContext.persistenceContextUnitName}"#set ($argExists = true)#end#if ($persistenceContext.persistenceContextType)#if ($argExists),#end type = javax.persistence.PersistenceContextType.${persistenceContext.persistenceContextType}#end#if ($persistenceContext.persistenceContextUnitName || $persistenceContext.persistenceContextType))#end
+ protected javax.persistence.EntityManager ${persistenceContext.name};
#end
-#end
- // ---------------- business methods ----------------------
+#set ($references = $service.serviceReferences)
+#if (!$references.empty)
+#**##foreach ($dependency in $references)
+#* *##set ($reference = $dependency.targetElement)
+
+ // ------ EJB Injection Definitions --------
-#foreach ( $operation in $service.businessOperations)
-#set ($visibility = $operation.visibility)
/**
-$operation.getDocumentation(" * ")
-## Only public methods have transactions and are exported to the interfaces
-#if ($visibility == "public")
- * @ejb.interface-method
-#if ($operation.transactionType)
- * @ejb.transaction type="$operation.transactionType"
-#end
-#end
+ * Inject session EJB ${reference.name};
*/
-#set ($returnType = $operation.returnType.fullyQualifiedName)
-#if ($operation.exceptionsPresent)
- $visibility abstract $returnType $operation.signature throws $operation.exceptionList;
-#else
- $visibility abstract $returnType $operation.signature;
+ @javax.annotation.EJB
+ protected ${reference.fullyQualifiedServiceName} $stringUtils.uncapitalize(${reference.name});
+#**##end
#end
+#set ($constants = $service.getConstants(true))
+#if (!$constants.empty)
+ // ----------- Constant Definitions -----------
+
+#**##foreach($constant in $constants)
+ private static final $constant.type.fullyQualifiedName $constant.name = $constant.defaultValue;
+#**##end
#end
+#set ($instanceAttributes = $service.instanceAttributes)
+#if(!$instanceAttributes.empty)
- // ---------------- create methods --------------------
-## Handle explicitly defined create methods. Since we can't know
-## what the user intended to do with the arbitrary parameters to these methods,
-## we generate an abstract ejbCreate() and delegate the implementation to the user.
-#foreach ( $operation in $service.getCreateMethods(false))
+ // ------------ Attributes ------------------
- /**
-$operation.getDocumentation(" * ")
- *
- * @ejb.create-method
- */
- public abstract void ejbCreate($operation.typedArgumentList);
-
- public void ejbPostCreate($operation.typedArgumentList)
- {
- }
+#**##foreach ($attribute in $instanceAttributes)
+ /** The $attribute.name property */
+ private $attribute.type.fullyQualifiedName $attribute.name;
+#**##end
#end
-## Default create method with no arguments.
- /**
-## Only expose the method to the interface for concrete EJBs
-#if (!$service.abstract)
- * @ejb.create-method
-#end
- */
- public void ejbCreate() throws javax.ejb.CreateException
- {
- }
+ // --------------- Constructors ---------------
- public void ejbPostCreate() throws javax.ejb.CreateException
+## Default create method with no arguments.
+ public ${service.serviceName}()
{
+ super();
}
-
## Autogenerated create method with all attributes. Only present for stateful beans.
#set ($allAttributes = $service.allInstanceAttributes)
#if (!$allAttributes.empty)
+
/**
- * Create method with all attribute values.
-#set ($inheritedAttributes = $service.inheritedInstanceAttributes)
-#foreach($attribute in $allAttributes)
+ * Constructor with all attribute values.
+#**##set ($inheritedAttributes = $service.inheritedInstanceAttributes)
+#**##foreach($attribute in $allAttributes)
* @param $attribute.name Value for the ${attribute.name} property
-#end
- * @ejb.create-method
+#**##end
*/
- public void ejbCreate($transform.getAttributesAsList($allAttributes, true, true))
- throws javax.ejb.CreateException
+ public ${service.serviceName}($service.getAttributesAsList($allAttributes, true, true))
{
-#if(!$inheritedAttributes.empty)
- // Call ejbCreate method for the super type
- super.ejbCreate($transform.getAttributesAsList($inheritedAttributes, false, true));
-#end
-#foreach ( $attribute in $service.instanceAttributes)
+#**##if(!$inheritedAttributes.empty)
+ super($service.getAttributesAsList($inheritedAttributes, false, true));
+#**##end
+#**##foreach ($attribute in $service.instanceAttributes)
## Don't use a setter here - we may have none if the attribute is marked readonly
this.$attribute.name = $attribute.name;
-#end
- }
-
- public void ejbPostCreate($transform.getAttributesAsList($allAttributes, true, true))
- throws javax.ejb.CreateException
- {
-#if(!$inheritedAttributes.empty)
- // Call postCreate method for the super type
- super.ejbPostCreate($transform.getAttributesAsList($inheritedAttributes, false, true));
-#end
+#**##end
}
#end
+#if (!$constants.empty)
- // ---------------- accessor methods for bean references ---------------
+ // --------- Accessors for Constants ----------
-#foreach ( $dependency in $service.sourceDependencies )
-#if ($dependency.hasStereotype("EntityRef") || $dependency.hasStereotype("ServiceRef"))
-#set ($reference = $dependency.targetElement)
-#if ($reference.viewType == "local")
-#set ($homeInterfaceName = "${reference.name}LocalHome")
-#set ($fqHomeInterfaceName = "${reference.fullyQualifiedName}LocalHome")
+#**##foreach($constant in $constants)
+#* *##if ($constant.visibility == "public")
/**
- * Get the local home interface of the ${reference.name} bean.
- * The home interface is obtained from the initial context
- * by looking up the bean reference name.
- * @return local home interface for ${reference.name}.
+ * Get the <code>$constant.name</code> constant
+$constant.getDocumentation(" * ")
*/
- protected static ${fqHomeInterfaceName} get${homeInterfaceName}()
- throws javax.naming.NamingException
- {
- javax.naming.InitialContext initialContext = new javax.naming.InitialContext();
- try
- {
- // Local homes shouldn't be narrowed, as there is no RMI involved.
- ${fqHomeInterfaceName} home =
- (${fqHomeInterfaceName}) initialContext.lookup("java:/comp/env/ejb/${reference.name}BeanRef");
- return home;
- }
- finally
+ $constant.visibility $constant.type.fullyQualifiedName ${constant.getterName}()
{
- initialContext.close();
- }
+ return $constant.name;
}
+
+#* *##end
+#**##end
#end
-#if ($reference.viewType == "remote")
-#set ($homeInterfaceName = "${reference.name}Home")
-#set ($fqHomeInterfaceName = "${reference.fullyQualifiedName}Home")
+#if(!$instanceAttributes.empty)
+
+ // ------- Accessors for Attributes ----------
+
+#**##foreach ($attribute in $instanceAttributes)
+#* *##set ($visibility = $attribute.visibility)
+#* *##if ($visibility == "public")
/**
- * Get the remote home interface of the ${reference.name} bean.
- * The home interface is obtained from the initial context
- * by looking up the bean reference name.
- * @return remote home interface for ${reference.name}. Lookup using bean ref name.
+ * Get the ${attribute.name} property
+$attribute.getDocumentation(" * ")
*/
- protected static ${fqHomeInterfaceName} get${homeInterfaceName}()
- throws javax.naming.NamingException {
- javax.naming.InitialContext initialContext = new javax.naming.InitialContext();
- try
- {
- Object home =
- initialContext.lookup("java:/comp/env/ejb/${reference.name}BeanRef");
- return ($fqHomeInterfaceName)
- javax.rmi.PortableRemoteObject.narrow(home,
- ${fqHomeInterfaceName}.class);
- }
- finally
+#* *##if ($attribute.transactionType)
+ @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${attribute.transactionType})
+#* *##end
+ $visibility $attribute.type.fullyQualifiedName ${attribute.getterName}()
{
- initialContext.close();
- }
+ return $attribute.name;
}
-#end
-#end
-#if ($dependency.hasStereotype("ResourceRef"))
-#set ($reference = $dependency.targetElement)
-#set ($resClassName = "$referencedClass.fullyQualifiedName}")
-#set ($resName = $dependency.name)
-#if (!$resName)
-#set ($resName = $reference.name)
-#end
+## Only generate a setter if the attribute is not read-only
+#* *##if (!$attribute.readOnly)
+
/**
- * Get the ${resName} resource.
- * The resource is obtained by looking up
- * <code>java:/comp/env/resource/$resName</code> in JNDI
- * @return the ${resName} resource
+ * Set the $attribute.name property
+ * @param value the new value
*/
- protected static ${resClassName} get${stringUtils.capitalize($resName)}()
- throws javax.naming.NamingException
- {
- javax.naming.InitialContext initialContext =
- new javax.naming.InitialContext();
- try
- {
- Object resource =
- initialContext.lookup("java:/comp/env/resource/$resName");
- return ($resClassName) resource;
- }
- finally
- {
- initialContext.close();
- }
- }
-#end
-#end
-
- private javax.ejb.SessionContext context;
-
- public void setSessionContext(javax.ejb.SessionContext ctx)
- {
- context = ctx;
- }
-
- public void ejbRemove()
+#* *##if ($attribute.transactionType)
+ @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${attribute.transactionType})
+#* *##end
+ $visibility void ${attribute.setterName}($attribute.type.fullyQualifiedName value)
{
+ this.$attribute.name = value;
}
- public void ejbPassivate()
- {
- }
+#* *##end
+#* *##end
+#**##end
+#end
+#set ($operations = $service.businessOperations)
+#if (!$operations.empty)
+
+ // -------- Business Methods --------------
+
+#**##foreach ($operation in $operations)
+#* *##set ($visibility = $operation.visibility)
+#* *##if ($visibility == "public")
+ /**
+$operation.getDocumentation(" * ")
+## Only public methods have transactions and are exported to the interfaces
+ */
+#* *##if ($operation.transactionType)
+ @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${operation.transactionType})
+#* *##end
+#* *##if ($operation.permitAll)
+ @javax.annotation.security.PermitAll
+#* *##elseif ($operation.rolesAllowed)
+ @javax.annotation.security.RolesAllowed({${operation.rolesAllowed}})
+#* *##end
+#* *##set ($returnType = $operation.returnType.fullyQualifiedName)
+#* *##if ($operation.exceptionsPresent)
+ $visibility abstract $returnType $operation.signature throws $operation.exceptionList;
+#* *##else
+ $visibility abstract $returnType $operation.signature;
+#* *##end
- public void ejbActivate()
- {
- }
+#* *##end
+#**##end
+#end
}
\ No newline at end of file
|
|
From: Vance K. <va...@us...> - 2006-01-03 01:04:16
|
User: vancek
Date: 06/01/02 17:04:09
Modified: andromda-ejb3/src/main/resources/templates/ejb3
EntityImpl.vsl
Log:
moved getAttributesAsList from utils to session metafacade
Revision Changes Path
1.2 +2 -2 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityImpl.vsl
Index: EntityImpl.vsl
===================================================================
RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityImpl.vsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- EntityImpl.vsl 28 Dec 2005 00:32:55 -0000 1.1
+++ EntityImpl.vsl 3 Jan 2006 01:04:09 -0000 1.2
@@ -47,9 +47,9 @@
* @param $attribute.name Value for the ${attribute.name} property
#end
*/
- public ${entity.entityImplementationName}($transform.getAttributesAsList($allAttributes, true, true))
+ public ${entity.entityImplementationName}($entity.getAttributesAsList($allAttributes, true, true))
{
- super($transform.getAttributesAsList($allAttributes, false, true));
+ super($entity.getAttributesAsList($allAttributes, false, true));
}
#foreach ($operation in $entity.getCreateMethods(true))
|
|
From: Vance K. <va...@us...> - 2006-01-03 01:03:21
|
User: vancek
Date: 06/01/02 17:03:14
Modified: andromda-ejb3/src/main/resources/templates/ejb3 Entity.vsl
Log:
moved getAttributesAsList from utils to session metafacade
Revision Changes Path
1.2 +4 -4 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.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- Entity.vsl 28 Dec 2005 00:32:55 -0000 1.1
+++ Entity.vsl 3 Jan 2006 01:03:14 -0000 1.2
@@ -86,10 +86,10 @@
* @param $attribute.name Value for the ${attribute.name} property
#end
*/
- public ${entity.entityName}($transform.getAttributesAsList($allAttributes, true, true))
+ public ${entity.entityName}($entity.getAttributesAsList($allAttributes, true, true))
{
#if(!$inheritedAttributes.empty)
- super($transform.getAttributesAsList($inheritedAttributes, false, true));
+ super($entity.getAttributesAsList($inheritedAttributes, false, true));
#end
#foreach ($attribute in $transform.filterUpdatableAttributes($instanceAttributes))
${attribute.setterName}(${attribute.name});
@@ -108,10 +108,10 @@
* @param $relation.otherEnd.name Value for the ${relation.otherEnd.name} relation role
#* *##end
*/
- public ${entity.entityName}($transform.getAttributesAsList($allAttributes, true, true)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)#if ($relation.one2Many || $relation.many2Many)${relation.relationType}<${relation.otherEnd.type.name}> $relation.otherEnd.name#else${relation.relationType} $relation.otherEnd.name#end#if($velocityCount != $relations.size()), #end#end)
+ public ${entity.entityName}($entity.getAttributesAsList($allAttributes, true, true)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)#if ($relation.one2Many || $relation.many2Many)${relation.relationType}<${relation.otherEnd.type.name}> $relation.otherEnd.name#else${relation.relationType} $relation.otherEnd.name#end#if($velocityCount != $relations.size()), #end#end)
{
// Call suitable class constructor
- this($transform.getAttributesAsList($allAttributes, false, true));
+ this($entity.getAttributesAsList($allAttributes, false, true));
// Set the CMR relations
#* *##foreach ($relation in $relations)
|
|
From: Vance K. <va...@us...> - 2006-01-03 00:59:34
|
User: vancek Date: 06/01/02 16:59:29 Modified: andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip Log: fixed session metafacades Revision Changes Path 1.2 +112 -99 cartridges/andromda-ejb3/src/main/uml/EJB3MetafacadeModel.xml.zip <<Binary file>> |
|
From: Martin W. <ama...@us...> - 2006-01-01 18:25:15
|
User: amartinwest
Date: 06/01/01 10:25:05
Added: etc/cc-build mvn-cc-build.xml
Log:
add ant/maven script
Revision Changes Path
1.1 plugins/etc/cc-build/mvn-cc-build.xml
Index: mvn-cc-build.xml
===================================================================
<project name="maven2-build" default="default">
<echo message="basedir:${basedir}"/>
<property name="project.dir" value="${basedir}/../.."/>
<target name="default">
<exec dir="${project.dir}" executable="mvn" >
<arg value="clean"/>
</exec>
<exec dir="${project.dir}" executable="mvn" >
<arg value="install"/>
</exec>
</target>
</project>
|
|
From: Martin W. <ama...@us...> - 2006-01-01 18:25:10
|
User: amartinwest Date: 06/01/01 10:25:02 plugins/etc - New directory |
|
From: Martin W. <ama...@us...> - 2006-01-01 18:25:10
|
User: amartinwest Date: 06/01/01 10:25:02 plugins/etc/cc-build - New directory |
|
From: Martin W. <ama...@us...> - 2005-12-31 18:42:43
|
User: amartinwest
Date: 05/12/31 10:42:37
Modified: andromda-database pom.xml
Log:
Add metafacades dependency
Revision Changes Path
1.2 +7 -0 cartridges/andromda-database/pom.xml
Index: pom.xml
===================================================================
RCS file: /cvsroot/andromdaplugins/cartridges/andromda-database/pom.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- pom.xml 19 Dec 2005 05:14:09 -0000 1.1
+++ pom.xml 31 Dec 2005 18:42:36 -0000 1.2
@@ -22,6 +22,13 @@
<artifactId>andromda-meta-cartridge</artifactId>
<version>3.2-RC1-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.andromda.metafacades</groupId>
+ <artifactId>andromda-metafacades-uml</artifactId>
+ <version>3.2-RC1-SNAPSHOT</version>
+ <type>xml.zip</type>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
</plugin>
<plugin>
|
|
From: Vance K. <va...@us...> - 2005-12-28 00:33:05
|
User: vancek
Date: 05/12/27 16:32:57
Added: andromda-ejb3/conf/test andromda.xml
andromda-ejb3/src/test/mappings MergeMappings.xml
andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades
EJB3AssociationFacadeLogicImpl.java
EJB3FinderMethodFacadeLogicImpl.java
EJB3SessionAttributeFacadeLogicImpl.java
EJB3MetafacadeUtils.java
EJB3SessionOperationFacadeLogicImpl.java
EJB3AssociationEndFacadeLogicImpl.java
EJB3OperationFacadeLogicImpl.java
EJB3EntityFacadeLogicImpl.java
EJB3FinderMethodArgumentFacadeLogicImpl.java
EJB3EntityAttributeFacadeLogicImpl.java
EJB3SessionFacadeLogicImpl.java
andromda-ejb3/src/test/expected cartridge-output.zip
andromda-ejb3/src/main/resources/templates/ejb3
SessionBeanImpl.vsl EntityImpl.vsl SessionBean.vsl
SessionRemote.vsl Entity.vsl Globals.vm
SessionLocal.vsl EntityListener.vsl
andromda-ejb3/src/main/resources/META-INF/andromda
profile.xml cartridge.xml metafacades.xml
namespace.xml
andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3
EJB3Profile.java EJB3ScriptHelper.java
EJB3Globals.java
andromda-ejb3 pom.xml
andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip
andromda-ejb3/src/test/uml EJB3CartridgeTestModel.xml.zip
Log:
Initial revision - EJB3 cartridge.
Revision Changes Path
1.1 cartridges/andromda-ejb3/conf/test/andromda.xml
Index: andromda.xml
===================================================================
<andromda>
<properties>
<property name="failOnValidationErrors">false</property>
</properties>
<repositories>
<repository name="netBeansMDR">
<models>
<model>
<uri>${test.model.uri}</uri>
<moduleSearchLocations>
<location patterns="**/*.xml.zip">${settings.localRepository}/org/andromda/profiles</location>
</moduleSearchLocations>
<modelPackages>
<modelPackage process="false">org::andromda::metafacades::uml</modelPackage>
</modelPackages>
</model>
</models>
</repository>
</repositories>
<namespaces>
<namespace name="ejb3">
<properties>
<property name="overwrite">true</property>
<property name="languageMappingsUri">Java</property>
<property name="wrapperMappingsUri">JavaWrapper</property>
<property name="jdbcMappingsUri">JDBC</property>
<property name="sqlMappingsUri">Oracle9i</property>
<property name="entity-beans">${test.output.dir}</property>
<property name="entity-impls">${test.output.dir}</property>
<property name="session-beans">${test.output.dir}</property>
<property name="session-impls">${test.output.dir}</property>
<property name="value-objects">${test.output.dir}</property>
<property name="mergeMappingsUri">file:${pom.basedir}/src/test/mappings/MergeMappings.xml</property>
</properties>
</namespace>
</namespaces>
</andromda>
1.1 cartridges/andromda-ejb3/src/test/mappings/MergeMappings.xml
Index: MergeMappings.xml
===================================================================
<mappings name="EJBMergeMappings">
<mapping>
<from><![CDATA[// license-header java merge-point]]></from>
<to>
<![CDATA[
/**
* Example license header for Java files
*
* http://www.andromda.org/
*/
]]>
</to>
</mapping>
</mappings>
1.1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationFacadeLogicImpl.java
Index: EJB3AssociationFacadeLogicImpl.java
===================================================================
package org.andromda.cartridges.ejb3.metafacades;
import org.andromda.cartridges.ejb3.EJB3Profile;
/**
* MetafacadeLogic implementation for org.andromda.cartridges.ejb3.metafacades.EJB3AssociationFacade.
*
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationFacade
*/
public class EJB3AssociationFacadeLogicImpl
extends EJB3AssociationFacadeLogic
{
// ---------------- constructor -------------------------------
public EJB3AssociationFacadeLogicImpl (Object metaObject, String context)
{
super (metaObject, context);
}
// --------------- methods ---------------------
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationFacade#getTransactionType()
*/
protected java.lang.String handleGetTransactionType()
{
return (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_TRANSACTION_TYPE);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationFacadeLogic#handleGetTableName()
*/
public String getTableName()
{
String tableName = super.getTableName();
if (getName().toLowerCase().startsWith(tableName.toLowerCase()))
{
tableName = getRelationName().replaceAll("-", "_").toUpperCase();
}
return tableName;
}
}
1.1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3FinderMethodFacadeLogicImpl.java
Index: EJB3FinderMethodFacadeLogicImpl.java
===================================================================
package org.andromda.cartridges.ejb3.metafacades;
import java.util.Collection;
import java.util.Iterator;
import org.andromda.cartridges.ejb3.EJB3Globals;
import org.andromda.cartridges.ejb3.EJB3Profile;
import org.andromda.metafacades.uml.ParameterFacade;
import org.apache.commons.lang.StringUtils;
/**
* <p/>
* Represents an EJB finder method. </p>
*
* MetafacadeLogic implementation for org.andromda.cartridges.ejb3.metafacades.EJB3FinderMethodFacade.
*
* @see org.andromda.cartridges.ejb3.metafacades.EJB3FinderMethodFacade
*/
public class EJB3FinderMethodFacadeLogicImpl
extends EJB3FinderMethodFacadeLogic
{
// ---------------- constructor -------------------------------
public EJB3FinderMethodFacadeLogicImpl (Object metaObject, String context)
{
super (metaObject, context);
}
// --------------- methods ---------------------
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3FinderMethodFacade#getQuery()
*/
protected java.lang.String handleGetQuery()
{
// first see if there is a query stored as a constraint
String queryString = super.getQuery("query.EJB-QL");
// otherwise see if there is a query stored as a tagged value
if (StringUtils.isEmpty(queryString))
{
Object value = this.findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_QUERY);
queryString = (String)value;
if (queryString != null)
{
// remove any excess whitespace
queryString = queryString.replaceAll("[$\\s]+", " ");
}
}
// if there wasn't any stored query, create one by default.
if (StringUtils.isEmpty(queryString))
{
String variableName = StringUtils.uncapitalize(this.getOwner().getName());
queryString = "FROM " + this.getOwner().getName() + " AS " + variableName;
if (this.getArguments().size() > 0)
{
queryString = queryString + " WHERE";
Collection parameters = this.getArguments();
if (parameters != null && !parameters.isEmpty())
{
Iterator parameterIt = parameters.iterator();
for (int ctr = 0; parameterIt.hasNext(); ctr++)
{
EJB3FinderMethodArgumentFacade param = (EJB3FinderMethodArgumentFacade)parameterIt.next();
if (!param.isFirstResult() && !param.isMaxResults())
{
String parameter = "?";
if (this.isUseNamedParameters())
{
parameter = ":" + param.getName();
}
else
{
parameter = parameter + ctr;
}
queryString = queryString + " " + variableName + "." + param.getName() + " = " + parameter;
if (parameterIt.hasNext())
{
queryString = queryString + " AND";
}
}
}
}
}
}
return queryString;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3FinderMethodFacade#getTransactionType()
*/
protected java.lang.String handleGetTransactionType()
{
return (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_TRANSACTION_TYPE, true);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3FinderMethodFacadeLogic#handleIsUseNamedParameters()
*/
protected boolean handleIsUseNamedParameters()
{
return Boolean.valueOf(String.valueOf(
this.getConfiguredProperty(EJB3Globals.QUERY_USE_NAMED_PARAMETERS))).booleanValue();
}
}
1.1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionAttributeFacadeLogicImpl.java
Index: EJB3SessionAttributeFacadeLogicImpl.java
===================================================================
package org.andromda.cartridges.ejb3.metafacades;
import org.andromda.cartridges.ejb3.EJB3Profile;
/**
* MetafacadeLogic implementation for org.andromda.cartridges.ejb3.metafacades.EJB3SessionAttributeFacade.
*
* @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionAttributeFacade
*/
public class EJB3SessionAttributeFacadeLogicImpl
extends EJB3SessionAttributeFacadeLogic
{
// ---------------- constructor -------------------------------
public EJB3SessionAttributeFacadeLogicImpl (Object metaObject, String context)
{
super (metaObject, context);
}
// ---------------- methods -------------------------------
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionAttributeFacade#getTransactionType()
*/
protected java.lang.String handleGetTransactionType()
{
return (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_TRANSACTION_TYPE, true);
}
}
1.1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3MetafacadeUtils.java
Index: EJB3MetafacadeUtils.java
===================================================================
package org.andromda.cartridges.ejb3.metafacades;
import org.andromda.cartridges.ejb3.EJB3Profile;
import org.andromda.core.common.ExceptionUtils;
import org.andromda.metafacades.uml.AttributeFacade;
import org.andromda.metafacades.uml.ClassifierFacade;
import org.andromda.metafacades.uml.ModelElementFacade;
import org.andromda.metafacades.uml.OperationFacade;
import org.andromda.metafacades.uml.UMLProfile;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
/**
* Contains utilities for use with EJB metafacades.
*
* @author Chad Brandon
*/
class EJB3MetafacadeUtils
{
/**
* Gets all create methods for the given <code>classifier</code>.
*
* @param classifier The classifier from which to retries the create methods
* @param follow if true, all super type create methods are also retrieved
* @return Collection of create methods found.
*/
static Collection getCreateMethods(
ClassifierFacade classifier,
boolean follow)
{
final String methodName = "EJBMetafacadeUtils.getCreateMethods";
ExceptionUtils.checkNull(methodName, "classifer", classifier);
Collection retval = new ArrayList();
ClassifierFacade entity = classifier;
do
{
Collection ops = entity.getOperations();
for (final Iterator i = ops.iterator(); i.hasNext();)
{
final OperationFacade op = (OperationFacade)i.next();
if (op.hasStereotype(EJB3Profile.STEREOTYPE_CREATE_METHOD))
{
retval.add(op);
}
}
if (follow)
{
entity = (ClassifierFacade)entity.getGeneralization();
}
}
while (follow && entity != null);
return retval;
}
/**
* Gets the interface name for the passed in <code>classifier</code>. Returns 'LocalHome' if the mode element has
* the entity stereotype, returns 'Home' otherwise.
*
* @return the interface name.
*/
static String getHomeInterfaceName(ClassifierFacade classifier)
{
final String methodName = "EJBMetafacadeUtils.getHomeInterfaceName";
ExceptionUtils.checkNull(methodName, "classifer", classifier);
String homeInterfaceName;
if (classifier.hasStereotype(UMLProfile.STEREOTYPE_ENTITY))
{
homeInterfaceName = classifier.getName() + "LocalHome";
}
else
{
homeInterfaceName = classifier.getName() + "Home";
}
return homeInterfaceName;
}
/**
* Gets the view type for the passed in <code>classifier</code>. Returns 'local' if the model element has the entity
* stereotype, others checks there ejb tagged value and if there is no value defined, returns 'remote'.
*
* @return String the view type name.
*/
static String getViewType(ClassifierFacade classifier)
{
final String methodName = "EJBMetafacadeUtils.getViewType";
ExceptionUtils.checkNull(methodName, "classifer", classifier);
String viewType = "local";
if (classifier.hasStereotype(EJB3Profile.STEREOTYPE_SERVICE))
{
String viewTypeValue = (String)classifier.findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_VIEWTYPE);
// if the view type wasn't found, search all super classes
if (StringUtils.isEmpty(viewTypeValue))
{
viewType = (String)CollectionUtils.find(classifier.getAllGeneralizations(), new Predicate()
{
public boolean evaluate(Object object)
{
return ((ModelElementFacade)object).findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_VIEWTYPE) !=
null;
}
});
}
if (StringUtils.isNotEmpty(viewTypeValue))
{
viewType = viewTypeValue;
}
else
{
viewType = "remote";
}
}
return viewType.toLowerCase();
}
/**
* Gets all the inherited instance attributes, excluding the instance attributes directory from this
* <code>classifier</code>.
*
* @param classifer the ClassifierFacade from which to retrieve the inherited attributes.
* @return a list of ordered attributes.
*/
static List getInheritedInstanceAttributes(ClassifierFacade classifier)
{
final String methodName = "EJBMetafacadeUtils.getInheritedInstanceAttributes";
ExceptionUtils.checkNull(methodName, "classifer", classifier);
ClassifierFacade current = (ClassifierFacade)classifier.getGeneralization();
if (current == null)
{
return new ArrayList();
}
List retval = getInheritedInstanceAttributes(current);
if (current.getInstanceAttributes() != null)
{
retval.addAll(current.getInstanceAttributes());
}
return retval;
}
/**
* Gets all instance attributes including those instance attributes belonging to the <code>classifier</code> and any
* inherited ones.
*
* @param classifier the ClassifierFacade from which to retrieve the instance attributes.
* @return the list of all instance attributes.
*/
static List getAllInstanceAttributes(ClassifierFacade classifier)
{
final String methodName = "EJBMetafacadeUtils.getAllInstanceAttributes";
ExceptionUtils.checkNull(methodName, "classifer", classifier);
List retval = getInheritedInstanceAttributes(classifier);
retval.addAll(classifier.getInstanceAttributes());
return retval;
}
/**
* Gets all environment entries for the specified <code>classifier</code>. If <code>follow</code> is true, then a
* search up the inheritance hierachy will be performed and all super type environment entries will also be
* retrieved.
*
* @param classifier the classifier from which to retrieve the env-entries
* @param follow true/false on whether or not to 'follow' the inheritance hierarchy when retrieving the
* env-entries.
* @return the collection of enviroment entries
*/
static Collection getEnvironmentEntries(
ClassifierFacade classifier,
boolean follow)
{
final String methodName = "EJBMetafacadeUtils.getEnvironmentEntries";
ExceptionUtils.checkNull(methodName, "classifer", classifier);
Collection attributes = classifier.getStaticAttributes();
if (follow)
{
for (classifier = (ClassifierFacade)classifier.getGeneralization();
classifier != null; classifier = (ClassifierFacade)classifier.getGeneralization())
{
attributes.addAll(classifier.getStaticAttributes());
}
}
CollectionUtils.filter(attributes, new Predicate()
{
public boolean evaluate(Object object)
{
return ((AttributeFacade)object).hasStereotype(EJB3Profile.STEREOTYPE_ENV_ENTRY);
}
});
return attributes;
}
/**
* Gets all constants for the specified <code>classifier</code>. If <code>follow</code> is true, then a search up
* the inheritance hierachy will be performed and all super type constants will also be retrieved.
*
* @param classifier the classifier from which to retrieve the constants
* @param follow true/false on whether or not to 'follow' the inheritance hierarchy when retrieving the
* constants.
* @return the collection of enviroment entries
*/
static Collection getConstants(
ClassifierFacade classifier,
boolean follow)
{
final String methodName = "EJBMetafacadeUtils.getEnvironmentEntries";
ExceptionUtils.checkNull(methodName, "classifer", classifier);
Collection attributes = classifier.getStaticAttributes();
if (follow)
{
for (classifier = (ClassifierFacade)classifier.getGeneralization();
classifier != null; classifier = (ClassifierFacade)classifier.getGeneralization())
{
attributes.addAll(classifier.getStaticAttributes());
}
}
CollectionUtils.filter(attributes, new Predicate()
{
public boolean evaluate(Object object)
{
return !((AttributeFacade)object).hasStereotype(EJB3Profile.STEREOTYPE_ENV_ENTRY);
}
});
return attributes;
}
/**
* Returns true/false based on whether or not synthetic or auto generated create methods should be allowed.
*
* @param classifier the entity or session EJB.
* @return true/false
*/
static boolean allowSyntheticCreateMethod(ClassifierFacade classifier)
{
final String methodName = "EJBMetafacadeUtils.allowSyntheticCreateMethod";
ExceptionUtils.checkNull(methodName, "classifer", classifier);
return !classifier.isAbstract() && classifier.findTaggedValue(
EJB3Profile.TAGGEDVALUE_EJB_NO_SYNTHETIC_CREATE_METHOD) == null;
}
/**
* Creates a fully qualified name from the given <code>packageName</code>,
* <code>name</code>, and <code>suffix</code>.
*
* @param packageName the name of the model element package.
* @param name the name of the model element.
* @param suffix the suffix to append.
* @return the new fully qualified name.
*/
static String getFullyQualifiedName(
String packageName,
String name,
String suffix)
{
StringBuffer fullyQualifiedName = new StringBuffer(StringUtils.trimToEmpty(packageName));
if (StringUtils.isNotBlank(packageName))
{
fullyQualifiedName.append('.');
}
fullyQualifiedName.append(StringUtils.trimToEmpty(name));
fullyQualifiedName.append(StringUtils.trimToEmpty(suffix));
return fullyQualifiedName.toString();
}
}
1.1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionOperationFacadeLogicImpl.java
Index: EJB3SessionOperationFacadeLogicImpl.java
===================================================================
package org.andromda.cartridges.ejb3.metafacades;
/**
* MetafacadeLogic implementation for org.andromda.cartridges.ejb3.metafacades.EJB3SessionOperationFacade.
*
* @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionOperationFacade
*/
public class EJB3SessionOperationFacadeLogicImpl
extends EJB3SessionOperationFacadeLogic
{
public EJB3SessionOperationFacadeLogicImpl (Object metaObject, String context)
{
super (metaObject, context);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionOperationFacade#getViewType()
*/
protected java.lang.String handleGetViewType()
{
// TODO: put your implementation here.
return null;
}
}
1.1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java
Index: EJB3AssociationEndFacadeLogicImpl.java
===================================================================
package org.andromda.cartridges.ejb3.metafacades;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Iterator;
import org.andromda.cartridges.ejb3.EJB3Globals;
import org.andromda.cartridges.ejb3.EJB3Profile;
import org.andromda.metafacades.uml.TaggedValueFacade;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
/**
* <p/>
* Represents an EJB association end. </p>
* MetafacadeLogic implementation for org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacade.
*
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacade
*/
public class EJB3AssociationEndFacadeLogicImpl
extends EJB3AssociationEndFacadeLogic
{
/**
* Represents the EJB3 <code>ALL</code> cascade option and fully qualified representation.
*/
private static final String ENTITY_CASCADE_ALL = "ALL";
private static final String ENTITY_CASCADE_ALL_FQN = "javax.persistence.CascadeType.ALL";
/**
* Represents the EJB3 <code>PERSIST</code> cascade option.
*/
private static final String ENTITY_CASCADE_PERSIST = "PERSIST";
private static final String ENTITY_CASCADE_PERSIST_FQN = "javax.persistence.CascadeType.PERSIST";
/**
* Represents the EJB3 <code>MERGE</code> cascade option.
*/
private static final String ENTITY_CASCADE_MERGE = "MERGE";
private static final String ENTITY_CASCADE_MERGE_FQN = "javax.persistence.CascadeType.MERGE";
/**
* Represents the EJB3 <code>REMOVE</code> cascade option.
*/
private static final String ENTITY_CASCADE_REMOVE = "REMOVE";
private static final String ENTITY_CASCADE_REMOVE_FQN = "javax.persistence.CascadeType.REMOVE";
/**
* Represents the EJB3 <code>REFRESH</code> cascade option.
*/
private static final String ENTITY_CASCADE_REFRESH = "REFRESH";
private static final String ENTITY_CASCADE_REFRESH_FQN = "javax.persistence.CascadeType.REFRESH";
/**
* Represents the value used to represents NO cascade option.
*/
private static final String ENTITY_CASCADE_NONE = "NONE";
/**
* Stores the cascade map of fully qualified cascade types
*/
private static final Hashtable cascadeTable = new Hashtable();
static
{
cascadeTable.put(ENTITY_CASCADE_ALL, ENTITY_CASCADE_ALL_FQN);
cascadeTable.put(ENTITY_CASCADE_PERSIST, ENTITY_CASCADE_PERSIST_FQN);
cascadeTable.put(ENTITY_CASCADE_MERGE, ENTITY_CASCADE_MERGE_FQN);
cascadeTable.put(ENTITY_CASCADE_REMOVE, ENTITY_CASCADE_REMOVE_FQN);
cascadeTable.put(ENTITY_CASCADE_REFRESH, ENTITY_CASCADE_REFRESH_FQN);
}
// ---------------- constructor -------------------------------
public EJB3AssociationEndFacadeLogicImpl (Object metaObject, String context)
{
super (metaObject, context);
}
// --------------- methods ---------------------
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacade#getRelationType()
*/
protected java.lang.String handleGetRelationType()
{
String targetType;
if (this.isMany2Many() || this.isOne2Many())
{
targetType = "java.util.Collection";
}
else
{
targetType = this.getOtherEnd().getType().getFullyQualifiedName();
}
return targetType;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacade#getFetchType()
*
* This method is always called on the target association end.
* If a fetch type tagged value is not found on the target end, then compare the association
* relationship from the source end to indicate the default fetch types.
* <ul>
* <li>One-2-Many and Many-2-Many defaults to LAZY loading</li>
* <li>Many-2-One and One-2-One default to EAGER loading</li>
* </ul>
*/
protected String handleGetFetchType()
{
String fetchType = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_PERSISTENCE_FETCH_TYPE);
if (StringUtils.isBlank(fetchType))
{
if (this.getOtherEnd().isOne2Many() || this.getOtherEnd().isMany2Many())
{
fetchType = EJB3Profile.FETCHTYPE_LAZY;
}
else
{
fetchType = EJB3Profile.FETCHTYPE_EAGER;
}
}
return fetchType;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleIsEager()
*/
protected boolean handleIsEager()
{
boolean isEager = false;
if (StringUtils.isNotBlank(this.getFetchType()))
{
if (this.getFetchType().equalsIgnoreCase(EJB3Profile.FETCHTYPE_EAGER))
{
isEager = true;
}
}
return isEager;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleIsLazy()
*/
protected boolean handleIsLazy()
{
boolean isLazy = false;
if (StringUtils.isNotBlank(this.getFetchType()))
{
if (this.getFetchType().equalsIgnoreCase(EJB3Profile.FETCHTYPE_LAZY))
{
isLazy = true;
}
}
return isLazy;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleIsOwning()
*/
protected boolean handleIsOwning()
{
boolean owning = false;
if (this.isAggregation() || this.isComposition())
{
owning = true;
}
return owning;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleIsOptional()
*/
protected boolean handleIsOptional()
{
boolean optional = true;
String optionalString = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_PERSISTENCE_OPTIONAL);
if (StringUtils.isBlank(optionalString))
{
optionalString =
String.valueOf(this.getConfiguredProperty(EJB3Globals.ENTITY_DEFAULT_ASSOCIATION_OPTIONAL));
}
optional = Boolean.valueOf(optionalString).booleanValue();
return optional;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleGetOrderByClause()
*/
protected String handleGetOrderByClause()
{
return (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_PERSISTENCE_ORDERBY);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleGetColumnDefinition()
*/
protected String handleGetColumnDefinition()
{
return (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_PERSISTENCE_COLUMN_DEFINITION);
}
/**
* Returns true if the tagged name exists for this association end.
*
* @param name The tagged name to lookup.
* @return boolean True if the tagged name exists. False otherwise.
*
* @see org.andromda.cartridges.ejb3.metafacades.
* EJB3AssociationEndFacadeLogic#handleHasTaggedValue(java.lang.String)
*/
protected boolean handleHasTaggedValue(String name)
{
boolean exists = false;
if (StringUtils.isNotBlank(name))
{
// trim to remove leading/trailing spaces
name = StringUtils.trimToEmpty(name);
// loop over tagged values and matche the argument tagged value name
for (final Iterator iter = this.getTaggedValues().iterator(); iter.hasNext(); )
{
final TaggedValueFacade taggedValue = (TaggedValueFacade)iter.next();
// return with true on the first match found
if (name.equals(taggedValue.getName()))
{
exists = true;
break;
}
}
}
return exists;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleGetCascadeType()
*/
protected String handleGetCascadeType()
{
String cascade = null;
final Collection taggedValues = this.findTaggedValues(EJB3Profile.TAGGEDVALUE_PERSISTENCE_CASCADE_TYPE);
if (taggedValues != null && !taggedValues.isEmpty())
{
StringBuffer buf = null;
for (final Iterator iter = taggedValues.iterator(); iter.hasNext(); )
{
if (buf == null)
{
buf = new StringBuffer();
}
else
{
buf.append(", ");
}
final String value = (String)iter.next();
if (StringUtils.isNotBlank(value))
{
buf.append(cascadeTable.get(value));
}
}
cascade = buf.toString();
}
else if (this.isChild())
{
cascade = (String)cascadeTable.get(ENTITY_CASCADE_REMOVE);
if (this.getOtherEnd() != null)
{
if (this.getOtherEnd().isComposition())
{
if (StringUtils.isBlank(this.getCompositionCascadeType()))
{
if (this.getType() instanceof EJB3EntityFacade)
{
EJB3EntityFacade entity = (EJB3EntityFacade)this.getType();
cascade = (entity.getDefaultCascadeType().equalsIgnoreCase(ENTITY_CASCADE_NONE) ?
null : (String)cascadeTable.get(entity.getDefaultCascadeType()));
}
}
else
{
cascade = (this.getCompositionCascadeType().equalsIgnoreCase(ENTITY_CASCADE_NONE) ?
null : (String)cascadeTable.get(this.getCompositionCascadeType()));
}
}
else if (this.getOtherEnd().isAggregation())
{
if (StringUtils.isBlank(this.getAggregationCascadeType()))
{
if (this.getType() instanceof EJB3EntityFacade)
{
EJB3EntityFacade entity = (EJB3EntityFacade)this.getType();
cascade = (entity.getDefaultCascadeType().equalsIgnoreCase(ENTITY_CASCADE_NONE) ?
null : (String)cascadeTable.get(entity.getDefaultCascadeType()));
}
}
else
{
cascade = (this.getAggregationCascadeType().equalsIgnoreCase(ENTITY_CASCADE_NONE) ?
null : (String)cascadeTable.get(this.getAggregationCascadeType()));
}
}
}
}
else if (this.isComposition())
{
/**
* On the composite side of the relationship, always enforce no cascade delete
* property indicating no cascadable propogation - overriding a default cascade
* value
*/
cascade = null;
}
else if (this.isAggregation())
{
/**
* On the aggregation side of the relationship, always enforce no cascade delete
* property indicating no cascadable propogation - overriding a default cascade
* value
*/
cascade = null;
}
return cascade;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleGetCompositionCascadeType()
*/
protected String handleGetCompositionCascadeType()
{
return StringUtils.trimToEmpty(
ObjectUtils.toString(this.getConfiguredProperty(EJB3Globals.ENTITY_DEFAULT_COMPOSITE_CASCADE)));
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleGetAggregationCascadeType()
*/
protected String handleGetAggregationCascadeType()
{
return StringUtils.trimToEmpty(
ObjectUtils.toString(this.getConfiguredProperty(EJB3Globals.ENTITY_DEFAULT_AGGREGATION_CASCADE)));
}
}
1.1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3OperationFacadeLogicImpl.java
Index: EJB3OperationFacadeLogicImpl.java
===================================================================
package org.andromda.cartridges.ejb3.metafacades;
import org.andromda.cartridges.ejb3.EJB3Globals;
import org.andromda.cartridges.ejb3.EJB3Profile;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
/**
* MetafacadeLogic implementation for org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacade.
*
* @see org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacade
*/
public class EJB3OperationFacadeLogicImpl
extends EJB3OperationFacadeLogic
{
// ---------------- constructor -------------------------------
public EJB3OperationFacadeLogicImpl (Object metaObject, String context)
{
super (metaObject, context);
}
// ---------------- methods -------------------------------
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacade#getTransactionType()
*/
protected java.lang.String handleGetTransactionType()
{
String transType = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_TRANSACTION_TYPE, true);
if (StringUtils.isNotBlank(transType))
{
if (StringUtils.equalsIgnoreCase(transType, EJB3Globals.TRANSACTION_TYPE_MANDATORY))
{
transType = "MANDATORY";
}
else if (StringUtils.equalsIgnoreCase(transType, EJB3Globals.TRANSACTION_TYPE_NEVER))
{
transType = "NEVER";
}
else if (StringUtils.equalsIgnoreCase(transType, EJB3Globals.TRANSACTION_TYPE_NOT_SUPPORTED))
{
transType = "NOT_SUPPORTED";
}
else if (StringUtils.equalsIgnoreCase(transType, EJB3Globals.TRANSACTION_TYPE_REQUIRED))
{
transType = "REQUIRED";
}
else if (StringUtils.equalsIgnoreCase(transType, EJB3Globals.TRANSACTION_TYPE_REQUIRES_NEW))
{
transType = "REQUIRES_NEW";
}
else if (StringUtils.equalsIgnoreCase(transType, EJB3Globals.TRANSACTION_TYPE_SUPPORTS))
{
transType = "SUPPORTS";
}
}
else
{
transType = StringUtils.trimToEmpty(
ObjectUtils.toString(this.getConfiguredProperty(EJB3Globals.TRANSACTION_TYPE)));
}
return transType;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacade#isBusinessOperation()
*/
protected boolean handleIsBusinessOperation()
{
return !this.hasStereotype(EJB3Profile.STEREOTYPE_CREATE_METHOD) &&
!this.hasStereotype(EJB3Profile.STEREOTYPE_FINDER_METHOD) &&
!this.hasStereotype(EJB3Profile.STEREOTYPE_SELECT_METHOD);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacade#isSelectMethod()
*/
protected boolean handleIsSelectMethod()
{
return this.hasStereotype(EJB3Profile.STEREOTYPE_SELECT_METHOD);
}
}
1.1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java
Index: EJB3EntityFacadeLogicImpl.java
===================================================================
package org.andromda.cartridges.ejb3.metafacades;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import org.andromda.cartridges.ejb3.EJB3Globals;
import org.andromda.cartridges.ejb3.EJB3Profile;
import org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacade;
import org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade;
import org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacade;
import org.andromda.core.common.ExceptionRecorder;
import org.andromda.metafacades.uml.AttributeFacade;
import org.andromda.metafacades.uml.ClassifierFacade;
import org.andromda.metafacades.uml.DependencyFacade;
import org.andromda.metafacades.uml.MetafacadeUtils;
import org.andromda.metafacades.uml.OperationFacade;
import org.andromda.metafacades.uml.TypeMappings;
import org.andromda.metafacades.uml.UMLMetafacadeProperties;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
/**
* MetafacadeLogic implementation for org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade.
*
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade
*/
public class EJB3EntityFacadeLogicImpl
extends EJB3EntityFacadeLogic
{
/**
* The default entity access type
*/
public static final String ENTITY_ACCESS_TYPE = "entityAccessType";
/**
* The default entity association cascade property
*/
public static final String ENTITY_DEFAULT_CASCADE = "entityDefaultCascade";
/**
* Stores the default entity inheritance strategy
*/
private static final String ENTITY_INHERITANCE_STRATEGY = "entityInheritanceStrategy";
/**
* Stores the default entity discriminator type used in the inheritance annotation
*/
private static final String ENTITY_DISCRIMINATOR_TYPE = "entityDiscriminatorType";
/**
* Stores the default entity discriminator column name used in the DiscriminatorColumn annotation
*/
private static final String ENTITY_DISCRIMINATOR_COLUMN_NAME = "entityDiscriminatorColumnName";
/**
* Value for one table per root class
*/
private static final String INHERITANCE_STRATEGY_TABLE_PER_CLASS = "TABLE_PER_CLASS";
/**
* Value for a single table for the hierarchy
*/
private static final String INHERITANCE_STRATEGY_SINGLE_TABLE = "SINGLE_TABLE";
/**
* Value for joined subclass
*/
private static final String INHERITANCE_STRATEGY_JOINED_SUBLCASS = "JOINED";
/**
* Stores the valid inheritance strategies
*/
private static final Collection inheritanceStrategies = new ArrayList();
static
{
inheritanceStrategies.add(INHERITANCE_STRATEGY_TABLE_PER_CLASS);
inheritanceStrategies.add(INHERITANCE_STRATEGY_SINGLE_TABLE);
inheritanceStrategies.add(INHERITANCE_STRATEGY_JOINED_SUBLCASS);
}
/**
* Value for string based discriminator type
*/
public static final String DISCRIMINATORTYPE_STRING = "STRING";
/**
* Value for char based discriminator type
*/
public static final String DISCRIMINATORTYPE_CHAR = "CHAR";
/**
* Value for integer based discriminator type
*/
public static final String DISCRIMINATORTYPE_INTEGER = "INTEGER";
/**
* Stores the valid discriminator types
*/
private static final Collection discriminatorTypes = new ArrayList();
static
{
discriminatorTypes.add(DISCRIMINATORTYPE_STRING);
discriminatorTypes.add(DISCRIMINATORTYPE_CHAR);
discriminatorTypes.add(DISCRIMINATORTYPE_INTEGER);
}
/**
* The property which stores the pattern defining the entity name.
*/
public static final String ENTITY_NAME_PATTERN = "entityNamePattern";
/**
* The property which stores the pattern defining the entity implementation name.
*/
public static final String ENTITY_IMPLEMENTATION_NAME_PATTERN = "entityImplementationNamePattern";
/**
* The property that stores the pattern defining the entity listener class name.
*/
public static final String ENTITY_LISTENER_NAME_PATTERN = "entityListenerNamePattern";
/**
* The property that stores the pattern defining the entity embeddable super class name.
*/
public static final String ENTITY_EMBEDDABLE_NAME_PATTERN = "entityEmbeddableNamePattern";
// ---------------- constructor -------------------------------
public EJB3EntityFacadeLogicImpl (Object metaObject, String context)
{
super (metaObject, context);
}
// --------------- methods ---------------------
public Collection handleGetIdentifiers()
{
Collection identifiers = new ArrayList();
for (final Iterator iter = this.getSourceDependencies().iterator(); iter.hasNext();)
{
final DependencyFacade dep = (DependencyFacade)iter.next();
if (dep.hasStereotype(EJB3Profile.STEREOTYPE_IDENTIFIER))
{
identifiers = ((ClassifierFacade)dep.getTargetElement()).getInstanceAttributes();
MetafacadeUtils.filterByStereotype(identifiers, EJB3Profile.STEREOTYPE_IDENTIFIER);
return identifiers;
}
}
// No PK dependency found - try a PK attribute
if (super.getIdentifiers() != null && !super.getIdentifiers().isEmpty())
{
AttributeFacade attr = (AttributeFacade)super.getIdentifiers().iterator().next();
identifiers.add(attr);
return identifiers;
}
// Still nothing found - recurse up the inheritance tree
EJB3EntityFacade decorator = (EJB3EntityFacade)this.getGeneralization();
return decorator.getIdentifiers();
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#isSyntheticCreateMethodAllowed()
*/
protected boolean handleIsSyntheticCreateMethodAllowed()
{
return EJB3MetafacadeUtils.allowSyntheticCreateMethod(this);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getAllEntityRelations()
*/
protected java.util.Collection handleGetAllEntityRelations()
{
// Only concrete entities may have EJB relations. Return
// an empty collection for everything else
if (this.isAbstract())
{
return Collections.EMPTY_LIST;
}
Collection result = new ArrayList();
result.addAll(getEntityRelations());
ClassifierFacade classifier = (ClassifierFacade)this.getGeneralization();
while (classifier != null && classifier instanceof EJB3EntityFacade && classifier.isAbstract())
{
EJB3EntityFacade entity = (EJB3EntityFacade)classifier;
result.addAll(entity.getEntityRelations());
classifier = (ClassifierFacade)classifier.getGeneralization();
}
return result;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getJndiName()
*/
protected java.lang.String handleGetJndiName()
{
StringBuffer jndiName = new StringBuffer();
String jndiNamePrefix = StringUtils.trimToEmpty(this.getJndiNamePrefix());
if (StringUtils.isNotEmpty(jndiNamePrefix))
{
jndiName.append(jndiNamePrefix);
jndiName.append("/");
}
jndiName.append("ejb/");
jndiName.append(this.getFullyQualifiedName());
return jndiName.toString();
}
/**
* Gets the <code>jndiNamePrefix</code> for this EJB.
*
* @return the EJB Jndi name prefix.
*/
protected String getJndiNamePrefix()
{
String prefix = null;
if (this.isConfiguredProperty(EJB3Globals.JNDI_NAME_PREFIX))
{
prefix = (String)this.getConfiguredProperty(EJB3Globals.JNDI_NAME_PREFIX);
}
return prefix;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getViewType()
*/
protected java.lang.String handleGetViewType()
{
return EJB3MetafacadeUtils.getViewType(this);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getAllInstanceAttributes()
*/
protected java.util.List handleGetAllInstanceAttributes()
{
return EJB3MetafacadeUtils.getAllInstanceAttributes(this);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getInheritedInstanceAttributes()
*/
protected java.util.List handleGetInheritedInstanceAttributes()
{
return EJB3MetafacadeUtils.getInheritedInstanceAttributes(this);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getHomeInterfaceName()
*/
protected java.lang.String handleGetHomeInterfaceName()
{
return EJB3MetafacadeUtils.getHomeInterfaceName(this);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getValueDependencies()
*
* NOTE: This is not required since ValueObject no longer exist and replaced with POJOs
*/
protected java.util.Collection handleGetValueDependencies()
{
Collection dependencies = super.getSourceDependencies();
CollectionUtils.filter(dependencies, new Predicate()
{
public boolean evaluate(Object object)
{
boolean isValueRef = false;
if (object instanceof DependencyFacade)
{
DependencyFacade dep = (DependencyFacade)object;
isValueRef = dep.getStereotypeNames().contains(EJB3Profile.STEREOTYPE_VALUE_REF)
&& dep.getTargetElement().hasExactStereotype(EJB3Profile.STEREOTYPE_VALUE_OBJECT);
}
return isValueRef;
}
});
return dependencies;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getEntityRelations()
*/
protected java.util.Collection handleGetEntityRelations()
{
Collection result = new ArrayList();
for (final Iterator endIt = this.getAssociationEnds().iterator(); endIt.hasNext();)
{
final EJB3AssociationEndFacade associationEnd = (EJB3AssociationEndFacade)endIt.next();
ClassifierFacade target = associationEnd.getOtherEnd().getType();
if (target instanceof EJB3EntityFacade && associationEnd.getOtherEnd().isNavigable())
{
// Check the integrity constraint
Object value = associationEnd.getOtherEnd().getAssociation().findTaggedValue(
EJB3Profile.TAGGEDVALUE_GENERATE_CMR);
String generateCmr = value == null ? null : value.toString();
if (target.isAbstract() && !"false".equalsIgnoreCase(generateCmr))
{
throw new IllegalStateException("Relation '" + associationEnd.getAssociation().getName() +
"' has the abstract target '" +
target.getName() +
"'. Abstract targets are not allowed in EJB.");
}
result.add(associationEnd);
}
}
return result;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getTransactionType()
*/
protected java.lang.String handleGetTransactionType()
{
String transactionType = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_TRANSACTION_TYPE);
if (StringUtils.isBlank(transactionType))
{
transactionType = transactionType =
String.valueOf(this.getConfiguredProperty(EJB3Globals.TRANSACTION_TYPE));
}
return transactionType;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getCreateMethods(boolean)
*/
protected java.util.Collection handleGetCreateMethods(boolean follow)
{
return EJB3MetafacadeUtils.getCreateMethods(this, follow);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getSelectMethods(boolean)
*/
protected java.util.Collection handleGetSelectMethods(boolean follow)
{
Collection retval = new ArrayList();
EJB3EntityFacade entity = null;
do
{
Collection ops = this.getOperations();
for (final Iterator i = ops.iterator(); i.hasNext();)
{
final OperationFacade op = (OperationFacade)i.next();
if (op.hasStereotype(EJB3Profile.STEREOTYPE_SELECT_METHOD))
{
retval.add(op);
}
}
if (follow)
{
entity = (EJB3EntityFacade)this.getGeneralization();
}
else
{
break;
}
}
while (entity != null);
return retval;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getEnvironmentEntries(boolean)
*/
protected java.util.Collection handleGetEnvironmentEntries(boolean follow)
{
return EJB3MetafacadeUtils.getEnvironmentEntries(this, follow);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getConstants(boolean)
*/
protected java.util.Collection handleGetConstants(boolean follow)
{
return EJB3MetafacadeUtils.getConstants(this, follow);
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#isOperationPresent(java.lang.String)
*/
protected boolean handleIsOperationPresent(java.lang.String op)
{
Collection collOps = this.getOperations();
for (final Iterator it = collOps.iterator(); it.hasNext();)
{
final OperationFacade operation = (OperationFacade)it.next();
if (operation.getName().equalsIgnoreCase(op))
{
return true;
}
}
return false;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#isAttributePresent(java.lang.String)
*/
protected boolean handleIsAttributePresent(java.lang.String att)
{
Collection collAttrib = this.getAttributes(true);
for (final Iterator it = collAttrib.iterator(); it.hasNext();)
{
final AttributeFacade attr = (AttributeFacade)it.next();
if (attr.getName().equalsIgnoreCase(att))
{
return true;
}
}
return false;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#isIdentifierPresent(java.lang.String)
*/
protected boolean handleIsIdentifierPresent(java.lang.String id)
{
Collection collIdentifier = this.getIdentifiers(true);
for (final Iterator it = collIdentifier.iterator(); it.hasNext();)
{
final AttributeFacade attr = (AttributeFacade)it.next();
if (attr.getName().equalsIgnoreCase(id))
{
return true;
}
}
return false;
}
/**
* @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade#getSqlType()
*/
protected java.lang.String handleGetSqlType()
{
String mpSql = this.getMappingsProperty(UMLMetafacadeProperties.SQL_MAPPINGS_URI).getMappings().getName();
if (mpSql.startsWith("Oracle"))
{
mpSql = "ORACLE";
}
return mpSql;
}
/**
* Gets a Mappings instance from a property registered under the given <code>propertyName</code>.
*
* @param propertyName the property name to register under.
* @return the Mappings instance.
*/
private TypeMappings getMappingsProperty(final String propertyName)
{
Object property = this.getConfiguredProperty(propertyName);
TypeMappings mappings = null;
String uri = null;
if (property instanceof String)
{
uri = (String)property;
try
{
mappings = TypeMappings.getInstance(uri);
this.setProperty(propertyName, mappings);
}
catch (Throwable th)
{
String errMsg = "Error getting '" + propertyName + "' --> '" + uri + "'";
logger.error(errMsg);
// don't throw the exception
ExceptionRecorder.instance().record(errMsg, th);
}
}
else
{
mappings = (TypeMappings)property;
}
return mappings;
}
/**
* @see org.andromda.metafacades.uml.EntityFacade#getBusinessOperations()
*/
public Collection getBusinessOperations()
{
Collection operations = super.getBusinessOperations();
CollectionUtils.filter(operations, new Predicate()
{
public boolean evaluate(Object object)
{
boolean businessOperation = false;
if (EJB3OperationFacade.class.isAssignableFrom(object
.getClass()))
{
businessOperation = ((EJB3OperationFacade) object)
.isBusinessOperation();
}
return businessOperation;
}
});
return operations;
}
/**
* @see org.andromda.metafacades.uml.EntityFacade#getEntityListenerName()
*/
protected String handleGetEntityListenerName()
{
String entityListenerPattern = (String)this.getConfiguredProperty(ENTITY_LISTENER_NAME_PATTERN);
return MessageFormat.format(
entityListenerPattern,
new Object[] {StringUtils.trimToEmpty(this.getName())});
}
/**
* @see org.andromda.metafacades.uml.EntityFacade#getEntityEmbeddableName()
*/
protected String handleGetEntityEmbeddableName()
{
String embeddableSuperclassName =
(String)this.getConfiguredProperty(ENTITY_EMBEDDABLE_NAME_PATTERN);
return MessageFormat.format(
embeddableSuperclassName,
new Object[] {StringUtils.trimToEmpty(this.getName())});
}
...
[truncated message content] |
|
From: Vance K. <va...@us...> - 2005-12-28 00:29:12
|
User: vancek
Date: 05/12/27 16:29:05
Modified: . pom.xml
Log:
Added andromda-ejb3 module element.
Revision Changes Path
1.4 +1 -0 cartridges/pom.xml
Index: pom.xml
===================================================================
RCS file: /cvsroot/andromdaplugins/cartridges/pom.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- pom.xml 19 Dec 2005 05:16:58 -0000 1.3
+++ pom.xml 28 Dec 2005 00:29:05 -0000 1.4
@@ -68,6 +68,7 @@
</build>
<modules>
<module>andromda-database</module>
+ <module>andromda-ejb3</module>
</modules>
<properties>
<build.src>${pom.basedir}/target/src</build.src>
|
|
From: Matthias B. <ma...@us...> - 2005-12-27 23:45:51
|
User: mattes3 Date: 05/12/27 15:45:45 Added: . .cvsignore Log: Added .project to prevent accidental commits. Revision Changes Path 1.1 CVSROOT/.cvsignore Index: .cvsignore =================================================================== .project |
|
From: Matthias B. <ma...@us...> - 2005-12-27 23:37:09
|
User: mattes3 Date: 05/12/27 15:37:02 Modified: . cvswrappers Log: Added *.pl as a text file type. Revision Changes Path 1.3 +1 -0 CVSROOT/cvswrappers Index: cvswrappers =================================================================== RCS file: /cvsroot/andromdaplugins/CVSROOT/cvswrappers,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- cvswrappers 20 Dec 2005 09:09:02 -0000 1.2 +++ cvswrappers 27 Dec 2005 23:37:01 -0000 1.3 @@ -54,3 +54,4 @@ *.txt -k 'kv' *.cmd -k 'kv' *.sh -k 'kv' +*.pl -k 'kv' |
|
From: Matthias B. <ma...@us...> - 2005-12-27 23:32:18
|
User: mattes3 Date: 05/12/27 15:32:12 Added: commitlogs .donotremove Log: Keep this file in order to keep this directory. Revision Changes Path 1.1 CVSROOT/commitlogs/.donotremove Index: .donotremove =================================================================== # Just here for the directory to live |