From: Vance K. <va...@us...> - 2006-06-14 04:55:22
|
User: vancek Date: 06/06/13 21:55:21 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBeanBase.vsl Entity.vsl EntityEmbeddable.vsl andromda-ejb3/src/main/resources/META-INF/andromda namespace.xml profile.xml andromda-ejb3/src/main/resources/templates/ejb3/config ejb-jar.xml.vsl andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3EntityFacadeLogicImpl.java Log: added initial JBoss Seam support Revision Changes Path 1.6 +44 -10 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBeanBase.vsl Index: SessionBeanBase.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBeanBase.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- SessionBeanBase.vsl 3 Jun 2006 15:39:42 -0000 1.5 +++ SessionBeanBase.vsl 14 Jun 2006 04:55:20 -0000 1.6 @@ -1,5 +1,8 @@ // license-header java merge-point -/* Autogenerated by AndroMDA (SessionBean.vsl) - do not edit */ +// +// Attention: Generated code! Do not modify by hand! +// Generated by: SessionBeanBase.vsl in andromda-ejb3-cartridge. +// #parse("templates/ejb3/Globals.vm") #if ($stringUtils.isNotBlank($service.packageName)) package $service.packageName; @@ -16,6 +19,15 @@ * $service.getDocumentation(" * ") */ +## +## Define the Seam component name for the class if JBoss Seam is enabled +## +#**##if ($service.seamComponent) +...@or...("${service.seamComponentName}") +#* *##if ($stringUtils.isNotBlank($service.seamComponentScopeType)) +...@or...ope(org.jboss.seam.ScopeType.${service.seamComponentScopeType}) +#* *##end +#**##end #if ($service.transactionManagement) @javax.ejb.TransactionManagement(javax.ejb.TransactionManagementType.${service.transactionManagement}) #end @@ -180,6 +192,19 @@ /** * The $attribute.name property */ +#* *##if ($service.seamComponent) +#* *##if ($attribute.seamComponentIn) + @org.jboss.seam.annotations.In#if (!$attribute.required)(required = false)#else#**#(create = true)#end + +#* *##end +#* *##if ($attribute.seamComponentOut) + @org.jboss.seam.annotations.Out#if (!$attribute.required)(required = false)#end + +#* *##end +#* *##if ($attribute.seamValidationValid) + @org.hibernate.validator.Valid +#* *##end +#* *##end protected $attribute.type.fullyQualifiedName $attribute.name; #**##end @@ -252,7 +277,6 @@ #**##foreach ($attribute in $instanceAttributes) #* *##set ($visibility = $attribute.visibility) -#* *##if ($visibility == "public") /** * Get the ${attribute.name} property $attribute.getDocumentation(" * ") @@ -285,7 +309,6 @@ #* *##end #* *##end -#**##end #end #if (!$entityReferences.empty) @@ -350,6 +373,17 @@ // Interceptor class exclusions are defined in ejb-jar.xm // @javax.interceptor.ExcludeClassInterceptors #* *##end +#* *##if ($service.seamComponent) +#* *##if ($operation.seamLifecycleCreate) + @org.jboss.seam.annotations.Create +#* *##elseif ($operation.seamLifecycleDestroy) + @org.jboss.seam.annotations.Destroy +#* *##end +#* *##if ($operation.seamValidationValidator) +#* *##set ($argExists = false) + @org.jboss.seam.annotations.IfInvalid(#if ($operation.seamValidationOutcome)outcome = ${operation.seamValidationOutcome}#set ($argExists = true)#end#if ($operation.seamValidationRefreshEntities)#if ($argExists), #end#**#refreshEntities = ${operation.seamValidationRefreshEntities}#end) +#* *##end +#* *##end $operation.visibility $operation.returnType.fullyQualifiedName $operation.signature #* *##if ($operation.exceptionsPresent) $operation.throwsClause 1.19 +15 -8 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.18 retrieving revision 1.19 diff -u -w -r1.18 -r1.19 --- Entity.vsl 15 May 2006 12:44:38 -0000 1.18 +++ Entity.vsl 14 Jun 2006 04:55:20 -0000 1.19 @@ -20,22 +20,29 @@ */ @javax.persistence.Entity +#if ($entity.seamComponent) +...@or...("${entity.seamComponentName}") +#**##if ($stringUtils.isNotBlank($entity.seamComponentScopeType)) +...@or...ope(org.jboss.seam.ScopeType.${entity.seamComponentScopeType}) +#**##end +#else +// Uncomment to enable seam component name +// @org.jboss.seam.annotations.Name("${entity.seamComponentName}") +// Uncomment to set specific component scope type +//@org.jboss.seam.annotations.Scope(org.jboss.seam.ScopeType.#if ($entity.stateless)STATELESS#else#**#CONVERSATION#end) +#end @javax.persistence.Table(name = "${entity.tableName}") #if ($entity.listenerEnabled) @javax.persistence.EntityListeners({${entity.fullyQualifiedEntityListenerName}.class}) #else -/** - * Uncomment to enable entity listener for ${entity.entityName} - * @javax.persistence.EntityListeners({${entity.fullyQualifiedEntityListenerName}.class}) - */ +// Uncomment to enable entity listener for ${entity.entityName} +// @javax.persistence.EntityListeners({${entity.fullyQualifiedEntityListenerName}.class}) #end #if ($entity.cacheEnabled) @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.${entity.cacheType}) #else -/** - * Uncomment to enable caching for ${entity.entityName} - * @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.${entity.cacheType}) - */ +// Uncomment to enable caching for ${entity.entityName} +// @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.${entity.cacheType}) #end #set ($finders = $entity.getQueryOperations(false)) #if (!$finders.empty) 1.31 +17 -0 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.30 retrieving revision 1.31 diff -u -w -r1.30 -r1.31 --- EntityEmbeddable.vsl 1 Jun 2006 14:40:47 -0000 1.30 +++ EntityEmbeddable.vsl 14 Jun 2006 04:55:20 -0000 1.31 @@ -41,6 +41,12 @@ @javax.persistence.MappedSuperclass #else @javax.persistence.Entity +#**##if ($entity.seamComponent) +...@or...("${entity.seamComponentName}") +#* *##if ($stringUtils.isNotBlank($entity.seamComponentScopeType)) +...@or...ope(org.jboss.seam.ScopeType.${entity.seamComponentScopeType}) +#* *##end +#**##end ## ## 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 @@ -426,6 +432,17 @@ #* *##if ($stringUtils.isNotBlank($attribute.enumerationType)) @javax.persistence.Enumerated(javax.persistence.EnumType.${attribute.enumerationType}) #* *##end +#* *##if ($entity.seamComponent) +## +## If JBoss Seam is enabled, add NotNull and Length annotations +## +#* *##if (!$attribute.columnNullable) + @org.hibernate.validator.NotNull +#* *##end +#* *##if ($attribute.columnLength) + @org.hibernate.validator.Length(max = $attribute.columnLength) +#* *##end +#* *##end #* *##end ## ## Override attribute type if attribute is a LOB and lob type is specified 1.23 +7 -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.22 retrieving revision 1.23 diff -u -w -r1.22 -r1.23 --- namespace.xml 30 Apr 2006 01:52:09 -0000 1.22 +++ namespace.xml 14 Jun 2006 04:55:21 -0000 1.23 @@ -1064,6 +1064,13 @@ locator class. </documentation> </property> + <property name="seamEnabled"> + <default>false</default> + <documentation> + Set to true to enable the JBoss Seam application + framework for Java EE 5. + </documentation> + </property> </propertyGroup> </properties> </namespace> \ No newline at end of file 1.30 +107 -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.29 retrieving revision 1.30 diff -u -w -r1.29 -r1.30 --- profile.xml 3 Jun 2006 15:36:47 -0000 1.29 +++ profile.xml 14 Jun 2006 04:55:21 -0000 1.30 @@ -430,6 +430,71 @@ <value>WebServiceOperation</value> <appliedOnElement>Service operation</appliedOnElement> </element> + <element name="SEAM_COMPONENT"> + <documentation> + Indicates this bean is a Seam component object. This + must be set before anything else is modelled on the class. + </documentation> + <value>Seam</value> + <appliedOnElement>Entity, Session and Java Beans</appliedOnElement> + </element> + <element name="SEAM_COMPONENT_IN"> + <documentation> + Indicates a Seam component attribute which is to be injected + from a context variable at the begining of each component method + invocation. + </documentation> + <value>In</value> + <appliedOnElement>Session and Java Bean Attribute</appliedOnElement> + </element> + <element name="SEAM_COMPONENT_OUT"> + <documentation> + Indicates a Seam component attribute which is to be outjected + to a context variable at the end of each component method + invocation. + </documentation> + <value>Out</value> + <appliedOnElement>Session and Java Bean Attribute</appliedOnElement> + </element> + <element name="SEAM_LIFECYCLE_CREATE"> + <documentation> + Indicates that the method is a Seam component lifecycle operation + and should be called when an instance of the component is instantiated by + Seam. + </documentation> + <value>Create</value> + <appliedOnElement>Session and Java Bean Operation</appliedOnElement> + </element> + <element name="SEAM_LIFECYCLE_DESTROY"> + <documentation> + Indicates that the method is a Seam component lifecycle operation + and should be called when the context ends and its context variables + are destroyed. + All SFSB components must define a Destroy method to guarantee + destruction of the SFSB when the context ends. + </documentation> + <value>Destroy</value> + <appliedOnElement>Session and Java Bean Operation</appliedOnElement> + </element> + <element name="SEAM_VALIDATION_VALID"> + <documentation> + Specifies that the Hibernate Validator should validate this and related + component attributes before an action listener Seam component method is + invoked. + </documentation> + <value>Valid</value> + <appliedOnElement>Session and Java Bean Attribute</appliedOnElement> + </element> + <element name="SEAM_VALIDATION_VALIDATOR"> + <documentation> + Specifies that the validator should validate all Seam components marked + with @Valid annotation before the method is invoked. Use of + tagged values for outcome when validation fails and for refreshing + entities when validation fails is provided. + </documentation> + <value>Validator</value> + <appliedOnElement>Session and Java Bean Operations</appliedOnElement> + </element> </elementGroup> <elementGroup name="Tagged Values"> <element name="ATTRIBUTE_PERSISTENCE_OPTIONAL"> @@ -1357,6 +1422,48 @@ <value>@andromda.webservice.operation.result.name</value> <appliedOnElement>Service and WebService</appliedOnElement> </element> + <element name="SEAM_COMPONENT_SCOPE_TYPE"> + <documentation> + The JBoss Seam component scope type. + The default for stateless session beans is STATELESS. + The default for entity beans and stateful session beans + is CONVERSATION. + </documentation> + <value>@andromda.seam.component.scope</value> + <appliedOnElement>Entity, Session and Java Beans</appliedOnElement> + <allowedValues> + <value>EVENT</value> + <value>PAGE</value> + <value>CONVERSATION</value> + <value>SESSION</value> + <value>BUSINESS_PROCESS</value> + <value>APPLICATION</value> + <value>STATELESS</value> + </allowedValues> + </element> + <element name="SEAM_COMPONENT_NAME"> + <documentation> + Override the default Seam component object name. + </documentation> + <value>@andromda.seam.component.name</value> + <appliedOnElement>Entity, Session and Java Beans</appliedOnElement> + </element> + <element name="SEAM_VALIDATION_OUTCOME"> + <documentation> + Returns the JSF outcome when validation fails. + </documentation> + <value>@andromda.seam.validation.outcome</value> + <appliedOnElement>Session and Java Bean Operation</appliedOnElement> + </element> + <element name="SEAM_VALIDATION_REFRESH_ENTITIES"> + <documentation> + Specifies whether invalid entities in the managed state + should be refreshed from the database when + validation fails. + </documentation> + <value>@andromda.seam.validation.refreshEntities</value> + <appliedOnElement>Session and Java Bean Operation</appliedOnElement> + </element> </elementGroup> </elements> </profile> \ No newline at end of file 1.6 +6 -0 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/ejb-jar.xml.vsl Index: ejb-jar.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/ejb-jar.xml.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- ejb-jar.xml.vsl 3 Jun 2006 15:36:47 -0000 1.5 +++ ejb-jar.xml.vsl 14 Jun 2006 04:55:21 -0000 1.6 @@ -221,6 +221,12 @@ </interceptor-binding> #**##end #end +#if (${seamEnabled} == 'true') + <interceptor-binding> + <ejb-name>*</ejb-name> + <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class> + </interceptor-binding> +#end </assembly-descriptor> </ejb-jar> \ No newline at end of file 1.24 +24 -2 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java Index: EJB3EntityFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -r1.23 -r1.24 --- EJB3EntityFacadeLogicImpl.java 15 May 2006 12:30:17 -0000 1.23 +++ EJB3EntityFacadeLogicImpl.java 14 Jun 2006 04:55:21 -0000 1.24 @@ -1592,5 +1592,27 @@ String.valueOf(this.getConfiguredProperty(EJB3Globals.HIBERNATE_USER_QUERY_CACHE))); } + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic#handleIsSeamComponent() + */ + protected boolean handleIsSeamComponent() + { + return EJB3MetafacadeUtils.isSeamComponent(this); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic#handleGetSeamComponentScopeType() + */ + protected String handleGetSeamComponentScopeType() + { + return EJB3MetafacadeUtils.getSeamComponentScopeType(this, false); + } + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic#handleGetSeamComponentName() + */ + protected String handleGetSeamComponentName() + { + return EJB3MetafacadeUtils.getSeamComponentName(this); + } } \ No newline at end of file |