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-28 03:04:46
|
User: vancek Date: 06/01/27 19:04:40 Modified: andromda-ejb3/src/main/resources/META-INF/andromda metafacades.xml Log: added serviceImplementationOperationNamePattern and defaultServiceExceptionNamePattern properties. Revision Changes Path 1.9 +3 -1 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml Index: metafacades.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- metafacades.xml 26 Jan 2006 07:00:01 -0000 1.8 +++ metafacades.xml 28 Jan 2006 03:04:40 -0000 1.9 @@ -18,6 +18,7 @@ <property reference="persistenceContainerName" /> <property reference="persistenceContextUnitName" /> <property reference="securityRealm" /> + <property reference="allowDefaultServiceException"/> <!-- Entity EJB Metafacades --> <metafacade class="org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacadeLogicImpl"> <mapping> @@ -63,7 +64,6 @@ org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade </context> </mapping> - <property reference="entityDefaultAssociationOptional"/> <property reference="entityCompositeCascade"/> <property reference="entityAggergationCascade"/> <property reference="associationCollectionType"/> @@ -94,6 +94,7 @@ org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacade </context> </mapping> + <property reference="serviceImplementationOperationNamePattern"/> </metafacade> <metafacade class="org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogicImpl" contextRoot="true"> <mapping> @@ -106,6 +107,7 @@ <property reference="serviceImplementationNamePattern" /> <property reference="serviceListenerNamePattern" /> <property reference="serviceDelegateNamePattern" /> + <property reference="defaultServiceExceptionNamePattern"/> </metafacade> <metafacade class="org.andromda.cartridges.ejb3.metafacades.EJB3SessionAttributeFacadeLogicImpl"> <mapping> |
From: Vance K. <va...@us...> - 2006-01-28 03:03:19
|
User: vancek Date: 06/01/27 19:03:09 Modified: andromda-ejb3/src/main/resources/META-INF/andromda cartridge.xml Log: added DefaultServiceException template, renamed outlet for Interceptor template to session-impl, renamed outlet for Enumeration template to commons. Revision Changes Path 1.11 +18 -2 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- cartridge.xml 25 Jan 2006 02:52:07 -0000 1.10 +++ cartridge.xml 28 Jan 2006 03:03:08 -0000 1.11 @@ -19,6 +19,8 @@ <property reference="hibernateTreecacheMbeanObject"/> <property reference="serviceLocatorName"/> <property reference="ejb3TypesPackage"/> + <property reference="parameterRequiredCheck"/> + <property reference="xmlEncoding"/> <!-- Entity Bean Templates --> @@ -189,6 +191,20 @@ </template> <template + path="templates/ejb3/DefaultServiceException.vsl" + outputPattern="$generatedFile" + outlet="commons" + overwrite="true"> + <modelElements variable="service"> + <modelElement> + <type name="org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacade"> + <property name="allowDefaultServiceException"/> + </type> + </modelElement> + </modelElements> + </template> + + <template path="templates/ejb3/ejb-jar.xml.vsl" outputPattern="META-INF/ejb-jar.xml" outlet="session-config" @@ -265,7 +281,7 @@ <template path="templates/ejb3/Interceptor.vsl" outputPattern="$generatedFile" - outlet="interceptors" + outlet="session-impls" overwrite="false"> <modelElements variable="interceptor"> <modelElement> @@ -277,7 +293,7 @@ <template path="templates/ejb3/Enumeration.vsl" outputPattern="$generatedFile" - outlet="enumerations" + outlet="commons" overwrite="true"> <modelElements variable="enum"> <modelElement> |
From: Vance K. <va...@us...> - 2006-01-28 03:01:55
|
User: vancek Date: 06/01/27 19:01:49 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3SessionOperationFacadeLogicImpl.java Log: added service operation implementation facility Revision Changes Path 1.7 +48 -1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionOperationFacadeLogicImpl.java Index: EJB3SessionOperationFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionOperationFacadeLogicImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- EJB3SessionOperationFacadeLogicImpl.java 18 Jan 2006 09:23:55 -0000 1.6 +++ EJB3SessionOperationFacadeLogicImpl.java 28 Jan 2006 03:01:49 -0000 1.7 @@ -1,5 +1,6 @@ package org.andromda.cartridges.ejb3.metafacades; +import java.text.MessageFormat; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashSet; @@ -26,6 +27,12 @@ public class EJB3SessionOperationFacadeLogicImpl extends EJB3SessionOperationFacadeLogic { + /** + * The property used to specify the implementation operation name pattern + * on service beans. + */ + public static final String SERVICE_IMPLEMENTATION_OPERATION_NAME_PATTERN = + "serviceImplementationOperationNamePattern"; public EJB3SessionOperationFacadeLogicImpl (Object metaObject, String context) { @@ -276,4 +283,44 @@ return isTimeout; } + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionOperationFacadeLogic#handleGetImplementationName() + */ + protected String handleGetImplementationName() + { + return this.getImplementationOperationName(StringUtils.capitalize(this.getName())); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionOperationFacadeLogic#handleGetImplementationCall() + */ + protected String handleGetImplementationCall() + { + return this.getImplementationOperationName(StringUtils.capitalize(this.getCall())); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionOperationFacadeLogic#handleGetImplementationSignature() + */ + protected String handleGetImplementationSignature() + { + return this.getImplementationOperationName(StringUtils.capitalize(this.getSignature())); + } + + /** + * Retrieves the implementationOperatName by replacing the <code>replacement</code> in the {@link + * SERVICE_IMPLEMENTATION_OPERATION_NAME_PATTERN} + * + * @param replacement the replacement string for the pattern. + * @return the operation name + */ + private String getImplementationOperationName(String replacement) + { + String implementationNamePattern = + (String)this.getConfiguredProperty(SERVICE_IMPLEMENTATION_OPERATION_NAME_PATTERN); + + return MessageFormat.format( + implementationNamePattern, + new Object[] {StringUtils.trimToEmpty(replacement)}); + } } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-01-28 03:01:02
|
User: vancek Date: 06/01/27 19:00:55 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3SessionFacadeLogicImpl.java Log: added default exception facility Revision Changes Path 1.8 +54 -1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionFacadeLogicImpl.java Index: EJB3SessionFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionFacadeLogicImpl.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- EJB3SessionFacadeLogicImpl.java 25 Jan 2006 03:03:30 -0000 1.7 +++ EJB3SessionFacadeLogicImpl.java 28 Jan 2006 03:00:55 -0000 1.8 @@ -60,6 +60,12 @@ private static final String SERVICE_DELEGATE_NAME_PATTERN = "serviceDelegateNamePattern"; /** + * The property which stores the pattern defining the default service bean + * exception class name. + */ + private static final String SERVICE_DEFAULT_EXCEPTION_NAME_PATTERN = "defaultServiceExceptionNamePattern"; + + /** * The property that stores the persistence container name. */ public static final String PERSISTENCE_CONTAINER = "persistenceContainerName"; @@ -71,10 +77,15 @@ private static final String PERSISTENCE_CONTEXT_UNIT_NAME = "persistenceContextUnitName"; /** - * The default view type accessability for the session bean + * The default view type accessability for the session bean. */ public static final String SESSION_DEFAULT_VIEW_TYPE = "serviceViewType"; + /** + * The property that stores whether default service exceptions are permitted. + */ + public static final String ALLOW_DEFAULT_SERVICE_EXCEPTION = "allowDefaultServiceException"; + // ---------------- constructor ------------------------------- public EJB3SessionFacadeLogicImpl (Object metaObject, String context) @@ -788,4 +799,46 @@ return allRoles; } + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic#handleGetDefaultExceptionName() + */ + protected String handleGetDefaultExceptionName() + { + String defaultExceptionNamePattern = + (String)this.getConfiguredProperty(SERVICE_DEFAULT_EXCEPTION_NAME_PATTERN); + + return MessageFormat.format( + defaultExceptionNamePattern, + new Object[] {StringUtils.trimToEmpty(this.getName())}); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic# + * handleGetFullyQualifiedDefaultExceptionName() + */ + protected String handleGetFullyQualifiedDefaultExceptionName() + { + StringBuffer fullyQualifiedName = new StringBuffer("java.lang.RuntimeException"); + if (this.isAllowDefaultServiceException()) + { + fullyQualifiedName = new StringBuffer(); + if (StringUtils.isNotBlank(this.getPackageName())) + { + fullyQualifiedName.append(this.getPackageName()); + fullyQualifiedName.append('.'); + } + fullyQualifiedName.append(this.getDefaultExceptionName()); + } + return fullyQualifiedName.toString(); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic#handleIsAllowDefaultServiceException() + */ + protected boolean handleIsAllowDefaultServiceException() + { + return Boolean.valueOf( + String.valueOf(this.getConfiguredProperty(ALLOW_DEFAULT_SERVICE_EXCEPTION))).booleanValue(); + } + } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-01-28 02:59:52
|
User: vancek Date: 06/01/27 18:59:46 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3EntityAttributeFacadeLogicImpl.java Log: override isRequired to cater for inheritance, utilise isRequired in isColumnNullable using multiplicity if no tagged value exists. Revision Changes Path 1.7 +19 -1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityAttributeFacadeLogicImpl.java Index: EJB3EntityAttributeFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityAttributeFacadeLogicImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- EJB3EntityAttributeFacadeLogicImpl.java 25 Jan 2006 02:59:49 -0000 1.6 +++ EJB3EntityAttributeFacadeLogicImpl.java 28 Jan 2006 02:59:46 -0000 1.7 @@ -64,6 +64,24 @@ return (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_PERSISTENCE_FETCH_TYPE); } + /** + * Overridden to provide handling of inheritance. + * + * @see org.andromda.metafacades.uml.AttributeFacade#isRequired() + */ + public boolean isRequired() + { + boolean required = super.isRequired(); + if (this.getOwner() instanceof EJB3EntityFacade) + { + EJB3EntityFacade entity = (EJB3EntityFacade)this.getOwner(); + if (entity.isInheritanceSingleTable() && entity.getGeneralization() != null) + { + required = false; + } + } + return required; + } /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityAttributeFacadeLogic#handleIsEager() @@ -398,7 +416,7 @@ if (StringUtils.isBlank(nullableString)) { - nullable = (this.isIdentifier() || this.isUnique() ? false : true); + nullable = (this.isIdentifier() || this.isUnique() ? false : !this.isRequired()); } else { |
From: Vance K. <va...@us...> - 2006-01-28 02:57:50
|
User: vancek Date: 06/01/27 18:57:45 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3AssociationEndFacadeLogicImpl.java Log: override isRequired to check if the association end is optional using multiplicity rather than tagged value. Revision Changes Path 1.5 +29 -9 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java Index: EJB3AssociationEndFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- EJB3AssociationEndFacadeLogicImpl.java 26 Jan 2006 07:07:33 -0000 1.4 +++ EJB3AssociationEndFacadeLogicImpl.java 28 Jan 2006 02:57:44 -0000 1.5 @@ -28,11 +28,6 @@ { /** - * The property that stores the default entity association optional attribute for Many-to-One and One-to-One - */ - public static final String ENTITY_DEFAULT_ASSOCIATION_OPTIONAL = "entityDefaultAssociationOptional"; - - /** * The default composite association cascade property */ public static final String ENTITY_DEFAULT_COMPOSITE_CASCADE = "entityCompositeCascade"; @@ -227,6 +222,29 @@ } /** + * Overridden to provide handling of inheritance. + * + * @see org.andromda.metafacades.uml.AssociationEndFacade#isRequired() + */ + public boolean isRequired() + { + boolean required = super.isRequired(); + Object type = this.getOtherEnd().getType(); + + if ((type != null) && EJB3EntityFacade.class.isAssignableFrom(type.getClass())) + { + EJB3EntityFacade entity = (EJB3EntityFacade)type; + + if (entity.isInheritanceSingleTable() && (entity.getGeneralization() != null)) + { + required = false; + } + } + + return required; + } + + /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacade#getFetchType() * * This method is always called on the target association end. @@ -311,10 +329,12 @@ if (StringUtils.isBlank(optionalString)) { - optionalString = - String.valueOf(this.getConfiguredProperty(ENTITY_DEFAULT_ASSOCIATION_OPTIONAL)); + optional = !this.isRequired(); } + else + { optional = Boolean.valueOf(optionalString).booleanValue(); + } return optional; } |
From: Vance K. <va...@us...> - 2006-01-28 02:49:21
|
User: vancek Date: 06/01/27 18:49:15 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: added Globals.vm inclusion, session operations are no longer abstract; their implementation checks for null args, perform a preconditial call if required and call handle<operation name>; added an abstract operation handle<operation name> for every operation which is implemented in the subclass. Revision Changes Path 1.11 +69 -19 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.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- SessionBean.vsl 25 Jan 2006 02:55:17 -0000 1.10 +++ SessionBean.vsl 28 Jan 2006 02:49:15 -0000 1.11 @@ -1,5 +1,6 @@ // license-header java merge-point /* Autogenerated by AndroMDA (SessionBean.vsl) - do not edit */ +#parse("templates/ejb3/Globals.vm") #if ($stringUtils.isNotBlank($service.packageName)) package $service.packageName; #end @@ -278,9 +279,6 @@ // -------- Business Methods -------------- #**##foreach ($operation in $operations) -#* *##set ($visibility = $operation.visibility) -## Only public methods have transactions and are exported to the interfaces -#* *##if ($visibility == "public") /** $operation.getDocumentation(" * ") */ @@ -302,14 +300,66 @@ #* *##if ($operation.timeoutCallback) @javax.ejb.Timeout #* *##end -#* *##set ($returnType = $operation.returnType.fullyQualifiedName) + $operation.visibility $operation.returnType.fullyQualifiedName $operation.signature #* *##if ($operation.exceptionsPresent) - $visibility abstract $returnType $operation.signature $operation.throwsClause; + $operation.throwsClause +#* *##end + { +#* *##if ($requiredCheckEnabled) +#* *##foreach ($argument in $operation.arguments) +#* *##if ($argument.required && !$argument.type.primitive) + if ($argument.name == null) + { + throw new IllegalArgumentException( + "${service.fullyQualifiedServiceName}.${operation.signature} - '${argument.name}' can not be null"); + } +#* *##end +#* *##end +#* *##end +#if ($operation.constraintsPresent) + this.$operation.preconditionCall; +#end + try + { +#* *##set ($call = "this.${operation.implementationCall};") +#* *##if ($operation.returnTypePresent) + return $call #* *##else - $visibility abstract $returnType $operation.signature; + $call +#* *##end + } +#* *##foreach($exception in $operation.exceptions) + catch ($exception.fullyQualifiedName ex) + { + throw ex; + } +#* *##end +#* *##if ($service.allowDefaultServiceException) + catch (Throwable th) + { + throw new ${service.fullyQualifiedDefaultExceptionName}( + "Error performing '${service.fullyQualifiedName}.${operation.signature}' --> " + th, + th); + } #* *##end + } + +#* *##if ($operation.constraintsPresent) + /** + * Performs any precondition checks for {@link #${operation.call}}. + */ + private void $operation.preconditionSignature + { +#renderPreconditions($operation) + } #* *##end + /** + * Performs the core logic for {@link #${operation.getSignature(false)}} + */ + protected abstract $operation.returnType.fullyQualifiedName $operation.implementationSignature + throws java.lang.Exception; + #**##end #end } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-01-28 02:45:31
|
User: vancek Date: 06/01/27 18:45:26 Added: andromda-ejb3/src/main/resources/templates/ejb3 RenderPreconditions.vm Log: initial revision Revision Changes Path 1.1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/RenderPreconditions.vm Index: RenderPreconditions.vm =================================================================== ## ## This macro will render the appropriate java preconditions ## ## o $operation: the operation from which we are going to translate preconditions ## #macro (renderPreconditions $operation) #foreach ($precondition in $operation.preconditions) #set ($preconditionTranslation = $precondition.getTranslation("validation.Java")) #set ($preconditionDocumentation = $precondition.getDocumentation("",-1,false)) { $preconditionTranslation if (!constraintValid) throw new ${service.fullyQualifiedDefaultExceptionName}( "$escapeUtils.escapeJava($preconditionDocumentation)"); } #set ($preconditionDocumentation = false)## reset to make sure we do not reuse the documentation of previous preconditions #end #set ($precondition = false)## reset to make sure we do not reuse the last precondition #end |
From: Vance K. <va...@us...> - 2006-01-28 02:45:04
|
User: vancek Date: 06/01/27 18:44:57 Modified: andromda-ejb3/src/main/resources/templates/ejb3 Globals.vm Log: added requiredCheckEnabled and removed interface and homeInterface definitions Revision Changes Path 1.2 +1 -6 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/Globals.vm Index: Globals.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/Globals.vm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- Globals.vm 28 Dec 2005 00:32:55 -0000 1.1 +++ Globals.vm 28 Jan 2006 02:44:57 -0000 1.2 @@ -1,7 +1,2 @@ -#set ($ejbInterface = "javax.ejb.EJBLocalObject") -#set ($ejbHomeInterface = "javax.ejb.EJBLocalHome") -#if ($service.ejbRemoteView) -#set ($ejbInterface = "javax.ejb.EJBObject") -#set ($ejbHomeInterface = "javax.ejb.EJBHome") -#end +#set ($requiredCheckEnabled = $parameterRequiredCheck.equalsIgnoreCase('true')) #set ($ejbSecurityEnabled = $stringUtils.isNotBlank($securityRealm)) \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-01-28 02:44:06
|
User: vancek Date: 06/01/27 18:43:59 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: only add optional element of OneToOne annotation on the owning side of the association Revision Changes Path 1.9 +3 -1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- EntityEmbeddable.vsl 26 Jan 2006 06:58:43 -0000 1.8 +++ EntityEmbeddable.vsl 28 Jan 2006 02:43:59 -0000 1.9 @@ -329,6 +329,7 @@ ## MANY TO ONE RELATIONSHIP ## ## Default fetch type: EAGER +## Has optional feature ## /** * Get the ${target.name} @@ -397,6 +398,7 @@ ## ONE TO ONE RELATIONSHIP ## ## Default fetch type: EAGER +## Add the optional feature on the owning side of a One-to-One relationship ## /** * Get the ${target.name} @@ -404,7 +406,7 @@ * @return $target.getterSetterTypeName */ #* *##set ($argExists = false) - @javax.persistence.OneToOne(#if (!$target.optional)optional = false#set ($argExists = true)#end#if ($target.cascadeType)#if ($argExists), #end#**#cascade = {${target.cascadeType}}#set ($argExists = true)#end#if(!$associationEnd.owning)#if ($argExists), #end#**#mappedBy = "${associationEnd.name}"#set ($argExists = true)#end#if ($target.lazy)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.LAZY#end) + @javax.persistence.OneToOne(#if($associationEnd.owning)#if (!$target.optional)optional = false#set ($argExists = true)#end#end#if ($target.cascadeType)#if ($argExists), #end#**#cascade = {${target.cascadeType}}#set ($argExists = true)#end#if(!$associationEnd.owning)#if ($argExists), #end#**#mappedBy = "${associationEnd.name}"#set ($argExists = true)#end#if ($target.lazy)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.LAZY#end) #* *##if($associationEnd.owning) @javax.persistence.JoinColumn(name = "$stringUtils.upperCase(${target.name})"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end) #* *##end |
From: Vance K. <va...@us...> - 2006-01-28 02:42:32
|
User: vancek Date: 06/01/27 18:42:26 Added: andromda-ejb3/src/main/resources/templates/ejb3 DefaultServiceException.vsl Log: initial revision Revision Changes Path 1.1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/DefaultServiceException.vsl Index: DefaultServiceException.vsl =================================================================== // license-header java merge-point // // Attention: Generated code! Do not modify by hand! // Generated by: DefaultServiceException.vsl in andromda-ejb3-cartridge. // #set ($generatedFile = "${stringUtils.replace($service.fullyQualifiedDefaultExceptionName,'.','/')}.java") #if ($stringUtils.isNotBlank($service.packageName)) package $service.packageName; #end import org.apache.commons.beanutils.PropertyUtils; /** * The default exception thrown for unexpected errors occurring * within {@link $service.fullyQualifiedName}. */ public class $service.defaultExceptionName extends java.lang.RuntimeException { /** * The serial version UID of this class. Needed for serialization. */ private static final long serialVersionUID = ${service.serialVersionUID}L; /** * The default constructor for <code>$service.defaultExceptionName</code>. */ public ${service.defaultExceptionName}() {} /** * Constructs a new instance of <code>$service.defaultExceptionName</code>. * * @param throwable the parent Throwable */ public ${service.defaultExceptionName}(Throwable throwable) { super(findRootCause(throwable)); } /** * Constructs a new instance of <code>$service.defaultExceptionName</code>. * * @param message the throwable message. */ public ${service.defaultExceptionName}(String message) { super(message); } /** * Constructs a new instance of <code>$service.defaultExceptionName</code>. * * @param message the throwable message. * @param throwable the parent of this Throwable. */ public ${service.defaultExceptionName}(String message, Throwable throwable) { super(message, findRootCause(throwable)); } /** * Finds the root cause of the parent exception * by traveling up the exception tree */ private static Throwable findRootCause(Throwable th) { if (th != null) { // Reflectively get any exception causes. try { Throwable targetException = null; // java.lang.reflect.InvocationTargetException String exceptionProperty = "targetException"; if (PropertyUtils.isReadable(th, exceptionProperty)) { targetException = (Throwable)PropertyUtils.getProperty(th, exceptionProperty); } else { exceptionProperty = "causedByException"; //javax.ejb.EJBException if (PropertyUtils.isReadable(th, exceptionProperty)) { targetException = (Throwable)PropertyUtils.getProperty(th, exceptionProperty); } } if (targetException != null) { th = targetException; } } catch (Exception ex) { // just print the exception and continue ex.printStackTrace(); } if (th.getCause() != null) { th = th.getCause(); th = findRootCause(th); } } return th; } } |
From: Vance K. <va...@us...> - 2006-01-26 07:09:03
|
User: vancek Date: 06/01/25 23:08:57 Modified: andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip Log: removed relationType from EJB3AssociationEndFacade, added collectionType, list, map and set to EJB3AssociationEndFacade Revision Changes Path 1.10 +121 -146 cartridges/andromda-ejb3/src/main/uml/EJB3MetafacadeModel.xml.zip <<Binary file>> |
From: Vance K. <va...@us...> - 2006-01-26 07:07:40
|
User: vancek Date: 06/01/25 23:07:33 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3AssociationEndFacadeLogicImpl.java Log: added collection type constants, overriden getGetterSetterTypeName and added optional generics, added getSpecificCollectionType, getCollectionType, isList, isMap and isSet Revision Changes Path 1.4 +191 -8 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java Index: EJB3AssociationEndFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- EJB3AssociationEndFacadeLogicImpl.java 25 Jan 2006 02:57:29 -0000 1.3 +++ EJB3AssociationEndFacadeLogicImpl.java 26 Jan 2006 07:07:33 -0000 1.4 @@ -1,13 +1,17 @@ package org.andromda.cartridges.ejb3.metafacades; +import java.util.ArrayList; 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.ClassifierFacade; import org.andromda.metafacades.uml.TaggedValueFacade; -import org.apache.commons.lang.BooleanUtils; +import org.andromda.metafacades.uml.TypeMappings; +import org.andromda.metafacades.uml.UMLMetafacadeProperties; +import org.andromda.metafacades.uml.UMLProfile; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; @@ -39,6 +43,26 @@ public static final String ENTITY_DEFAULT_AGGREGATION_CASCADE = "entityAggergationCascade"; /** + * The namespace property storing default collection type for associations + */ + public static final String ASSOCIATION_COLLECTION_TYPE = "associationCollectionType"; + + /** + * A flag indicating whether or not specific (java.util.Set, java.util.List, + * etc) collection interfaces should be used in assocation mutators and + * accessors or whether the generic java.util.Collection interface should be + * used. + */ + public static final String SPECIFIC_COLLECTION_INTERFACES = "specificCollectionInterfaces"; + + /** + * The property that defines the default collection interface, this is the + * interface used if the property defined by + * {@link #SPECIFIC_COLLECTION_INTERFACES} is true. + */ + public static final String DEFAULT_COLLECTION_INTERFACE = "defaultCollectionInterface"; + + /** * Represents the EJB3 <code>ALL</code> cascade option and fully qualified representation. */ private static final String ENTITY_CASCADE_ALL = "ALL"; @@ -87,6 +111,39 @@ cascadeTable.put(ENTITY_CASCADE_REFRESH, ENTITY_CASCADE_REFRESH_FQN); } + /** + * Value for set + */ + private static final String COLLECTION_TYPE_SET = "set"; + + /** + * Value for map + */ + private static final String COLLECTION_TYPE_MAP = "map"; + + /** + * Value for list + */ + private static final String COLLECTION_TYPE_LIST = "list"; + + /** + * Value for collections + */ + private static final String COLLECTION_TYPE_COLLECTION = "collection"; + + /** + * Stores the valid collection types + */ + private static final Collection collectionTypes = new ArrayList(); + + static + { + collectionTypes.add(COLLECTION_TYPE_SET); + collectionTypes.add(COLLECTION_TYPE_MAP); + collectionTypes.add(COLLECTION_TYPE_LIST); + collectionTypes.add(COLLECTION_TYPE_COLLECTION); + } + // ---------------- constructor ------------------------------- public EJB3AssociationEndFacadeLogicImpl (Object metaObject, String context) @@ -96,21 +153,77 @@ // --------------- methods --------------------- + /** - * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacade#getRelationType() + * @see org.andromda.metafacades.uml.AssociationEndFacade#getGetterSetterTypeName() */ - protected java.lang.String handleGetRelationType() + public String getGetterSetterTypeName() + { + String getterSetterTypeName = null; + + if (this.isMany()) + { + final boolean specificInterfaces = + Boolean.valueOf( + ObjectUtils.toString(this.getConfiguredProperty(SPECIFIC_COLLECTION_INTERFACES))).booleanValue(); + + final TypeMappings mappings = this.getLanguageMappings(); + if (mappings != null) + { + if (this.isMap()) + { + getterSetterTypeName = mappings.getTo(UMLProfile.MAP_TYPE_NAME); + } + else if (specificInterfaces) + { + if (this.isSet()) { - String targetType; - if (this.isMany2Many() || this.isOne2Many()) + getterSetterTypeName = mappings.getTo(UMLProfile.SET_TYPE_NAME); + } + else if (this.isList()) + { + getterSetterTypeName = mappings.getTo(UMLProfile.LIST_TYPE_NAME); + } + } + else + { + getterSetterTypeName = + ObjectUtils.toString(this.getConfiguredProperty(DEFAULT_COLLECTION_INTERFACE)); + } + } + else { - targetType = "java.util.Collection"; + getterSetterTypeName = ObjectUtils.toString(this.getConfiguredProperty(DEFAULT_COLLECTION_INTERFACE)); + } } else { - targetType = this.getOtherEnd().getType().getFullyQualifiedName(); + final ClassifierFacade type = this.getType(); + if (type instanceof EJB3EntityFacade) + { + final String typeName = ((EJB3EntityFacade)type).getFullyQualifiedEntityName(); + if (StringUtils.isNotEmpty(typeName)) + { + getterSetterTypeName = typeName; + } } - return targetType; + } + + if (getterSetterTypeName == null) + { + getterSetterTypeName = super.getGetterSetterTypeName(); + } + else if (this.isMany()) + { + /** + * Set this association end's type as a template parameter if required + */ + if ("true".equals(this.getConfiguredProperty(UMLMetafacadeProperties.ENABLE_TEMPLATING))) + { + getterSetterTypeName = getterSetterTypeName + "<" + this.getType().getFullyQualifiedName() + ">"; + } + } + return getterSetterTypeName; } /** @@ -363,4 +476,74 @@ ObjectUtils.toString(this.getConfiguredProperty(ENTITY_DEFAULT_AGGREGATION_CASCADE))); } + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleGetCollectionType() + */ + protected String handleGetCollectionType() + { + String collectionType = this.getSpecificCollectionType(); + if (!collectionTypes.contains(collectionType)) + { + if (this.isOrdered()) + { + collectionType = COLLECTION_TYPE_LIST; + } + else + { + collectionType = + (String)this.getConfiguredProperty(ASSOCIATION_COLLECTION_TYPE); + } + } + return collectionType; + } + + /** + * Gets the collection type defined on this association end. + * + * @return the specific collection type. + */ + private String getSpecificCollectionType() + { + return ObjectUtils.toString( + this.findTaggedValue(EJB3Profile.TAGGEDVALUE_ASSOCIATION_COLLECTION_TYPE)); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleIsMap() + */ + protected boolean handleIsMap() + { + boolean isMap = this.getCollectionType().equalsIgnoreCase(COLLECTION_TYPE_MAP); + if (isMap && StringUtils.isBlank(this.getSpecificCollectionType())) + { + isMap = !this.isOrdered(); + } + return isMap; + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleIsList() + */ + protected boolean handleIsList() + { + boolean isList = this.getCollectionType().equalsIgnoreCase(COLLECTION_TYPE_LIST); + if (!isList && StringUtils.isBlank(this.getSpecificCollectionType())) + { + isList = this.isOrdered(); + } + return isList; + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleIsSet() + */ + protected boolean handleIsSet() + { + boolean isSet = this.getCollectionType().equalsIgnoreCase(COLLECTION_TYPE_SET); + if (isSet && StringUtils.isBlank(this.getSpecificCollectionType())) + { + isSet = !this.isOrdered(); + } + return isSet; + } } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-01-26 07:03:55
|
User: vancek Date: 06/01/25 23:03:47 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3 EJB3Profile.java Log: added TAGGEDVALUE_ASSOCIATION_COLLECTION_TYPE constant Revision Changes Path 1.8 +6 -0 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3Profile.java Index: EJB3Profile.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3Profile.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- EJB3Profile.java 23 Jan 2006 05:49:43 -0000 1.7 +++ EJB3Profile.java 26 Jan 2006 07:03:47 -0000 1.8 @@ -392,4 +392,10 @@ * container configuration name specific to JBoss. */ public static final String TAGGEDVALUE_EJB_CONTAINER_CONFIGURATION = profile.get("CONTAINER_CONFIGURATION"); + + /** + * Defines the association collection type + */ + public static final String TAGGEDVALUE_ASSOCIATION_COLLECTION_TYPE = profile.get("ASSOCIATION_COLLECTION_TYPE"); + } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-01-26 07:02:55
|
User: vancek Date: 06/01/25 23:02:49 Modified: andromda-ejb3/src/main/resources/META-INF/andromda profile.xml Log: added ASSOCIATION_COLLECTION_TYPE element for @andromda.persistence.collection.type tagged value Revision Changes Path 1.9 +14 -0 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/profile.xml Index: profile.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/profile.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- profile.xml 25 Jan 2006 02:54:49 -0000 1.8 +++ profile.xml 26 Jan 2006 07:02:47 -0000 1.9 @@ -661,6 +661,20 @@ Association End </appliedOnElement> </element> + <element name="ASSOCIATION_COLLECTION_TYPE"> + <documentation> + Used to define the mapping for EJB3 collections. + This value overrides the + <a href="namespace.html#associationCollectionType">namespace property</a>. + </documentation> + <value>@andromda.persistence.collection.type</value> + <appliedOnElement>Association ends between <![CDATA[<<Entity>>]]> classes</appliedOnElement> + <allowedValues> + <value>set</value> + <value>map</value> + <value>list</value> + </allowedValues> + </element> <element name="SERVICE_TYPE"> <documentation> Used at the class level of a service bean to |
From: Vance K. <va...@us...> - 2006-01-26 07:01:20
|
User: vancek Date: 06/01/25 23:01:13 Modified: andromda-ejb3/src/main/resources/META-INF/andromda namespace.xml Log: added specificCollectionInterfaces, defaultCollectionInterfaces and associationCollectionType property elements Revision Changes Path 1.9 +25 -0 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/namespace.xml Index: namespace.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/namespace.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- namespace.xml 25 Jan 2006 02:54:09 -0000 1.8 +++ namespace.xml 26 Jan 2006 07:01:12 -0000 1.9 @@ -556,6 +556,31 @@ storage of a string based enumeration literal. </documentation> </property> + <property name="specificCollectionInterfaces"> + <default>false</default> + <documentation> + A flag indicating whether or not specific collection interfaces will be used + in association end mutators and accessors (i.e. java.util.Set, java.util.List, etc). + If this is set to false, then the value of the + <a href="#defaultCollectionInterface">defaultCollectionInterface</a> + property will used to provide the collection interface. + </documentation> + </property> + <property name="defaultCollectionInterface"> + <default>java.util.Collection</default> + <documentation> + The default collection interface, this is the interface used with association end + accessors and mutators if the + <a href="#specificCollectionInterfaces">specificCollectionInterfaces</a> + flag is set to <code>false</code>. + </documentation> + </property> + <property name="associationCollectionType"> + <default>set</default> + <documentation> + Used to define the default mapping for EJB3 collections. + </documentation> + </property> <property name="securityRealm" required="false"> <documentation> Specifies the security domain to use |
From: Vance K. <va...@us...> - 2006-01-26 07:00:12
|
User: vancek Date: 06/01/25 23:00:03 Modified: andromda-ejb3/src/main/resources/META-INF/andromda metafacades.xml Log: added associationCollectionType, specificCollectionInterfaces and defaultCollectionInterfaces properties to EJB3AssociationEndFacade metafacade Revision Changes Path 1.8 +6 -3 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml Index: metafacades.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- metafacades.xml 25 Jan 2006 02:53:09 -0000 1.7 +++ metafacades.xml 26 Jan 2006 07:00:01 -0000 1.8 @@ -66,6 +66,9 @@ <property reference="entityDefaultAssociationOptional" /> <property reference="entityCompositeCascade" /> <property reference="entityAggergationCascade" /> + <property reference="associationCollectionType"/> + <property reference="specificCollectionInterfaces"/> + <property reference="defaultCollectionInterface"/> </metafacade> <metafacade class="org.andromda.cartridges.ejb3.metafacades.EJB3AssociationFacadeLogicImpl"> <mapping> |
From: Vance K. <va...@us...> - 2006-01-26 06:58:49
|
User: vancek Date: 06/01/25 22:58:43 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: refactored to use EJB3AssociationEndFacade.getterSetterTypeName rather than relationType - depending on the enableTemplating variable, it will render mutator and accessors with generics Revision Changes Path 1.8 +29 -18 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- EntityEmbeddable.vsl 26 Jan 2006 04:35:41 -0000 1.7 +++ EntityEmbeddable.vsl 26 Jan 2006 06:58:43 -0000 1.8 @@ -108,11 +108,10 @@ // --------- Relationship Definitions ----------- #**##foreach ($associationEnd in $entityRelations) -#**##**##if ($associationEnd.one2Many || $associationEnd.many2Many) - private $associationEnd.relationType<${associationEnd.otherEnd.type.name}> ${associationEnd.otherEnd.name}; -#**##**##else - private $associationEnd.relationType ${associationEnd.otherEnd.name}; -#**##**##end +#* *##set ($target = $associationEnd.otherEnd) +#* *##if ($target.navigable) + private $target.getterSetterTypeName ${target.name}; +#* *##end #**##end #end @@ -164,7 +163,7 @@ * @param $relation.otherEnd.name Value for the ${relation.otherEnd.name} relation role #* *##end */ - public #if (!$entity.requiresGeneralizationMapping && !$entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)#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 #if (!$entity.requiresGeneralizationMapping && !$entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)${relation.otherEnd.getterSetterTypeName} $relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end) { #* *##foreach ($attribute in $transform.filterUpdatableAttributes($instanceAttributes, $entity.compositePrimaryKeyPresent)) ${attribute.setterName}(${attribute.name}); @@ -333,12 +332,13 @@ ## /** * Get the ${target.name} - * @return $associationEnd.relationType + * + * @return $target.getterSetterTypeName */ #* *##set ($argExists = false) @javax.persistence.ManyToOne(#if (!$target.optional)optional = false#set ($argExists = true)#end#if ($target.cascadeType)#if ($argExists), #end#**#cascade = {${target.cascadeType}}#set ($argExists = true)#end#if ($target.lazy)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.LAZY#end) @javax.persistence.JoinColumn(name = "$stringUtils.upperCase(${target.name})"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end) - public $associationEnd.relationType ${target.getterName}() + public $target.getterSetterTypeName ${target.getterName}() { return this.${target.name}; } @@ -346,12 +346,14 @@ #* *##if(!$target.readOnly) /** * Set the ${target.name} + * * @param ${target.name} */ - public void ${target.setterName}($associationEnd.relationType ${target.name}) + public void ${target.setterName}($target.getterSetterTypeName ${target.name}) { this.${target.name} = ${target.name}; } + #* *##end #* *##elseif ($associationEnd.one2Many) ## @@ -363,7 +365,8 @@ ## /** * Get the ${target.name} Collection - * @return $associationEnd.relationType + * + * @return $target.getterSetterTypeName */ #* *##set ($argExists = false) @javax.persistence.OneToMany(#if ($target.cascadeType)cascade = {${target.cascadeType}}#set ($argExists = true)#end#if ($associationEnd.navigable)#if ($argExists) ,#end#**#mappedBy = "${associationEnd.name}"#set ($argExists = true)#end#if ($target.eager)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.EAGER#end) @@ -374,19 +377,21 @@ @javax.persistence.OrderBy #* *##end #* *##end - public $associationEnd.relationType<${target.type.name}> ${target.getterName}() + public $target.getterSetterTypeName ${target.getterName}() { return this.${target.name}; } /** * Set the ${target.name} + * * @param ${target.name} */ - public void ${target.setterName} (${associationEnd.relationType}<${target.type.name}> ${target.name}) + public void ${target.setterName} (${target.getterSetterTypeName} ${target.name}) { this.${target.name} = ${target.name}; } + #* *##elseif ($associationEnd.one2One) ## ## ONE TO ONE RELATIONSHIP @@ -395,14 +400,15 @@ ## /** * Get the ${target.name} - * @return $associationEnd.relationType + * + * @return $target.getterSetterTypeName */ #* *##set ($argExists = false) @javax.persistence.OneToOne(#if (!$target.optional)optional = false#set ($argExists = true)#end#if ($target.cascadeType)#if ($argExists), #end#**#cascade = {${target.cascadeType}}#set ($argExists = true)#end#if(!$associationEnd.owning)#if ($argExists), #end#**#mappedBy = "${associationEnd.name}"#set ($argExists = true)#end#if ($target.lazy)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.LAZY#end) #* *##if($associationEnd.owning) @javax.persistence.JoinColumn(name = "$stringUtils.upperCase(${target.name})"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end) #* *##end - public $associationEnd.relationType ${target.getterName}() + public $target.getterSetterTypeName ${target.getterName}() { return this.${target.name}; } @@ -410,12 +416,14 @@ #* *##if(!$target.readOnly) /** * Set the ${target.name} + * * @param ${target.name} */ - public void ${target.setterName}($associationEnd.relationType ${target.name}) + public void ${target.setterName}($target.getterSetterTypeName ${target.name}) { this.${target.name} = ${target.name}; } + #* *##end #* *##elseif ($associationEnd.many2Many) ## @@ -425,7 +433,8 @@ ## /** * Get the ${target.name} Collection - * @return $associationEnd.relationType + * + * @return $target.getterSetterTypeName */ #* *##set ($argExists = false) @javax.persistence.ManyToMany(#if ($target.cascadeType)cascade = {${target.cascadeType}}#set ($argExists = true)#end#if ($target.eager)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.EAGER#end) @@ -440,19 +449,21 @@ @javax.persistence.OrderBy #* *##end #* *##end - public $associationEnd.relationType<${target.type.name}> ${target.getterName}() + public $target.getterSetterTypeName ${target.getterName}() { return this.${target.name}; } /** * Set the ${target.name} + * * @param ${target.name} */ - public void ${target.setterName} (${associationEnd.relationType}<${target.type.name}> ${target.name}) + public void ${target.setterName} (${target.getterSetterTypeName} ${target.name}) { this.${target.name} = ${target.name}; } + #* *##end #**##end #end |
From: Vance K. <va...@us...> - 2006-01-26 06:53:21
|
User: vancek Date: 06/01/25 22:53:15 Modified: andromda-ejb3/src/main/resources/templates/ejb3 Entity.vsl Log: added constructor setting all attributes and relations Revision Changes Path 1.9 +20 -0 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.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- Entity.vsl 26 Jan 2006 04:36:42 -0000 1.8 +++ Entity.vsl 26 Jan 2006 06:53:14 -0000 1.9 @@ -57,8 +57,28 @@ { super($entity.getAttributesAsList($allAttributes, false, true, false)); } + #end +#set ($relations = $entity.allEntityRelations) +#if (!$relations.empty) +#**##if ($entity.syntheticCreateMethodAllowed) + /** + * Constructor with all POJO attribute values and CMR relations. + * +#* *##foreach($attribute in $transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent)) + * @param $attribute.name Value for the ${attribute.name} property +#* *##end +#* *##foreach ($relation in $relations) + * @param $relation.otherEnd.name Value for the ${relation.otherEnd.name} relation role +#* *##end + */ + public ${entity.entityName}($entity.getAttributesAsList($allAttributes, true, true, false)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)${relation.otherEnd.getterSetterTypeName} $relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end) + { + super($entity.getAttributesAsList($allAttributes, false, true, false)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)$relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end); + } +#**##end +#end #foreach ($operation in $entity.getCreateMethods(true)) #**##set ($opArguments = $transform.getArgumentsAsList(${operation.argumentNames})) /** |
From: Vance K. <va...@us...> - 2006-01-26 04:38:53
|
User: vancek Date: 06/01/25 20:38:47 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3FinderMethodFacadeLogicImpl.java Log: moved WHERE statement in getQuery method to avoid being included if there is no where clause Revision Changes Path 1.3 +5 -3 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3FinderMethodFacadeLogicImpl.java Index: EJB3FinderMethodFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3FinderMethodFacadeLogicImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- EJB3FinderMethodFacadeLogicImpl.java 25 Jan 2006 03:02:13 -0000 1.2 +++ EJB3FinderMethodFacadeLogicImpl.java 26 Jan 2006 04:38:47 -0000 1.3 @@ -62,17 +62,19 @@ queryString = "FROM " + this.getOwner().getName() + " AS " + variableName; if (this.getArguments().size() > 0) { - queryString = queryString + " WHERE"; - Collection parameters = this.getArguments(); + final 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()) { + if (ctr == 0) + { + queryString = queryString + " WHERE"; + } String parameter = "?"; if (this.isUseNamedParameters()) { |
From: Vance K. <va...@us...> - 2006-01-26 04:36:48
|
User: vancek Date: 06/01/25 20:36:42 Modified: andromda-ejb3/src/main/resources/templates/ejb3 Entity.vsl Log: added Table and EntityListener annotations Revision Changes Path 1.8 +2 -0 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.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- Entity.vsl 25 Jan 2006 02:46:35 -0000 1.7 +++ Entity.vsl 26 Jan 2006 04:36:42 -0000 1.8 @@ -19,6 +19,8 @@ @javax.persistence.Entity#if ($entity.accessType)(access = javax.persistence.AccessType.${entity.accessType})#end +...@ja...rsistence.Table(name = "${entity.tableName}") +...@ja...rsistence.EntityListener(${entity.fullyQualifiedEntityListenerName}.class) public#if ($entity.abstract) abstract#end class ${entity.entityName} extends ${entity.fullyQualifiedEntityEmbeddableName} implements java.io.Serializable |
From: Vance K. <va...@us...> - 2006-01-26 04:35:49
|
User: vancek Date: 06/01/25 20:35:42 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: fixed finder sql to use entity name rather than table name, moved Table and EntityListener annotations from embeddable superclass to inheriting entity class template, except for cases where this template generates the inheriting entity subclass Revision Changes Path 1.7 +11 -6 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- EntityEmbeddable.vsl 25 Jan 2006 02:50:46 -0000 1.6 +++ EntityEmbeddable.vsl 26 Jan 2006 04:35:41 -0000 1.7 @@ -37,14 +37,19 @@ @javax.persistence.Entity#if ($entity.accessType)(access = javax.persistence.AccessType.${entity.accessType})#end #end -...@ja...rsistence.EntityListener(${entity.fullyQualifiedEntityListenerName}.class) -## Include the Table annotation for a base class in inheritence hierarchy -## but not in the subclasses. +## +## Include the Table annotation for a base class in single table inheritence hierarchy +## but not in the subclasses. Include in all classes for joined and table per class +## inheritance hierarchies. ## If a class is manually specified as an embeddable superclass, add -## the Table annotation to the subclass. -#if (!$entity.requiresGeneralizationMapping && !$entity.embeddableSuperclass) +## the Table annotation to the subclass, not to the base superclass. +## +#if ($entity.requiresGeneralizationMapping && ($entity.embeddableSuperclassGeneralizationExists || $entity.inheritanceTablePerClass || $entity.inheritanceJoined)) @javax.persistence.Table(name = "${entity.tableName}") #end +#if ($entity.requiresGeneralizationMapping) +...@ja...rsistence.EntityListener(${entity.fullyQualifiedEntityListenerName}.class) +#end ## Only include the inheritance related annotations for inheritance mapping ## that doesn't involve embeddable superclass hierarchy. #if ($entity.requiresSpecializationMapping && !$entity.embeddableSuperclass) @@ -468,7 +473,7 @@ ## For inheriting classes, replace findAll with findAll${entity.name}s public static java.util.Collection<${entity.name}> findAll#if ($entity.requiresGeneralizationMapping)$stringUtils.capitalize(${entity.name})s#end(javax.persistence.EntityManager em) { - return em.createQuery("FROM ${entity.tableName} AS $stringUtils.uncapitalize(${entity.name})").getResultList(); + return em.createQuery("FROM ${entity.name} AS $stringUtils.uncapitalize(${entity.name})").getResultList(); } #**##end |
From: Vance K. <va...@us...> - 2006-01-25 03:04:45
|
User: vancek Date: 06/01/24 19:04:39 Modified: andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip Log: added isEnumerationTypeOrdinal and isEnumerationTypeString to EJB3FinderMethodArgumentFacade Revision Changes Path 1.9 +146 -150 cartridges/andromda-ejb3/src/main/uml/EJB3MetafacadeModel.xml.zip <<Binary file>> |
From: Vance K. <va...@us...> - 2006-01-25 03:03:37
|
User: vancek Date: 06/01/24 19:03:30 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3SessionFacadeLogicImpl.java Log: moved PERSISTENCE_CONTAINER and SESSION_DEFAULT_VIEW_TYPE from EJB3Globals to here Revision Changes Path 1.7 +12 -3 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionFacadeLogicImpl.java Index: EJB3SessionFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionFacadeLogicImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- EJB3SessionFacadeLogicImpl.java 18 Jan 2006 09:22:21 -0000 1.6 +++ EJB3SessionFacadeLogicImpl.java 25 Jan 2006 03:03:30 -0000 1.7 @@ -60,11 +60,20 @@ private static final String SERVICE_DELEGATE_NAME_PATTERN = "serviceDelegateNamePattern"; /** + * The property that stores the persistence container name. + */ + public static final String PERSISTENCE_CONTAINER = "persistenceContainerName"; + + /** * The property which stores the persistence context unit name associated with the default * Entity Manager. */ private static final String PERSISTENCE_CONTEXT_UNIT_NAME = "persistenceContextUnitName"; + /** + * The default view type accessability for the session bean + */ + public static final String SESSION_DEFAULT_VIEW_TYPE = "serviceViewType"; // ---------------- constructor ------------------------------- @@ -195,7 +204,7 @@ protected java.lang.String handleGetViewType() { return EJB3MetafacadeUtils.getViewType(this, - String.valueOf(this.getConfiguredProperty(EJB3Globals.SESSION_DEFAULT_VIEW_TYPE))); + String.valueOf(this.getConfiguredProperty(SESSION_DEFAULT_VIEW_TYPE))); } /** @@ -516,7 +525,7 @@ protected String handleGetPersistenceContainer() { return StringUtils.trimToEmpty( - ObjectUtils.toString(this.getConfiguredProperty(EJB3Globals.PERSISTENCE_CONTAINER))); + ObjectUtils.toString(this.getConfiguredProperty(PERSISTENCE_CONTAINER))); } /** |
From: Vance K. <va...@us...> - 2006-01-25 03:02:48
|
User: vancek Date: 06/01/24 19:02:42 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3MetafacadeUtils.java Log: fixed comments Revision Changes Path 1.4 +3 -1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3MetafacadeUtils.java Index: EJB3MetafacadeUtils.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3MetafacadeUtils.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- EJB3MetafacadeUtils.java 6 Jan 2006 13:57:39 -0000 1.3 +++ EJB3MetafacadeUtils.java 25 Jan 2006 03:02:41 -0000 1.4 @@ -5,11 +5,13 @@ import org.andromda.core.common.ExceptionUtils; import org.andromda.metafacades.uml.AttributeFacade; import org.andromda.metafacades.uml.ClassifierFacade; +import org.andromda.metafacades.uml.DependencyFacade; 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.collections.Transformer; import org.apache.commons.lang.StringUtils; import java.util.ArrayList; @@ -320,7 +322,7 @@ /** * Returns true/false based on whether or not synthetic or auto generated create methods should be allowed. * - * @param classifier the entity or session EJB. + * @param classifier The entity or session bean. * @return true/false */ static boolean allowSyntheticCreateMethod(ClassifierFacade classifier) |