From: <wal...@us...> - 2013-12-11 20:14:56
|
Revision: 15377 http://sourceforge.net/p/andromda/svn/15377 Author: walterim Date: 2013-12-11 20:14:53 +0000 (Wed, 11 Dec 2013) Log Message: ----------- Enhanced support to operations in manageable services Modified Paths: -------------- trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringEntityLogicImpl.java trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringManageableEntityLogicImpl.java trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringServiceLogicImpl.java trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/SpringCrudService.vsl trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/SpringCrudServiceBase.vsl trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/applicationContext-manageable.xml.vsl trunk/cartridges/andromda-spring/src/test/expected/cartridge-outputUML2.zip Modified: trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringEntityLogicImpl.java =================================================================== --- trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringEntityLogicImpl.java 2013-12-11 20:14:14 UTC (rev 15376) +++ trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringEntityLogicImpl.java 2013-12-11 20:14:53 UTC (rev 15377) @@ -536,4 +536,14 @@ return "true".equalsIgnoreCase(richClient); } + /** + * Helper function + * + * @return searchUnique function name + */ + public String getSearchUniqueFunctionName(String attributeName) + { + return "searchUnique"+StringUtils.capitalize(attributeName); + } + } \ No newline at end of file Modified: trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringManageableEntityLogicImpl.java =================================================================== --- trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringManageableEntityLogicImpl.java 2013-12-11 20:14:14 UTC (rev 15376) +++ trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringManageableEntityLogicImpl.java 2013-12-11 20:14:53 UTC (rev 15377) @@ -2,9 +2,11 @@ import java.util.Collection; +import org.andromda.metafacades.uml.AttributeFacade; import org.andromda.metafacades.uml.ClassifierFacade; import org.andromda.metafacades.uml.EntityQueryOperation; import org.andromda.metafacades.uml.ManageableEntity; +import org.andromda.metafacades.uml.FilteredCollection; import org.andromda.metafacades.uml.OperationFacade; import org.andromda.metafacades.uml.UMLMetafacadeProperties; import org.apache.commons.collections.CollectionUtils; @@ -341,21 +343,22 @@ * * @return Allowed business operations. */ - public Collection<OperationFacade> getManageableBusinessOperations() + public Collection<SpringEntityOperation> getManageableDaoBusinessOperations() { - final Collection<OperationFacade> result=super.getBusinessOperations(); - CollectionUtils.filter(result, new Predicate() + Collection<SpringEntityOperation> result=super.getDaoBusinessOperations(); + result = new FilteredCollection<SpringEntityOperation>(result) { - @Override - public boolean evaluate(Object obj) + private static final long serialVersionUID = 34L; + public boolean evaluate(Object object) { - final OperationFacade operation=(OperationFacade)obj; + final SpringEntityOperation operation=(SpringEntityOperation)object; final ClassifierFacade returnType=operation.getReturnType(); return operation.getVisibility().equals("public") && (returnType.isDataType() || returnType.getFullyQualifiedName().equals(getFullyQualifiedName())); } - }); + }; + return result; } @@ -366,22 +369,22 @@ */ public Collection<EntityQueryOperation> getManageableQueryOperations() { - final Collection<EntityQueryOperation> result=super.getQueryOperations(); - CollectionUtils.filter(result, new Predicate() + Collection<EntityQueryOperation> result=super.getQueryOperations(); + result = new FilteredCollection<EntityQueryOperation>(result) { - @Override - public boolean evaluate(Object obj) + private static final long serialVersionUID = 34L; + public boolean evaluate(Object object) { - final EntityQueryOperation operation=(EntityQueryOperation)obj; + final EntityQueryOperation operation=(EntityQueryOperation)object; final ClassifierFacade returnType=operation.getReturnType(); - return operation.getVisibility().equals("public") && + return operation.getVisibility().equals("public") && (returnType.isDataType() || returnType.getFullyQualifiedName().equals(getFullyQualifiedName())); } - }); + }; return result; } - + /** * Helper function * Modified: trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringServiceLogicImpl.java =================================================================== --- trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringServiceLogicImpl.java 2013-12-11 20:14:14 UTC (rev 15376) +++ trunk/cartridges/andromda-spring/src/main/java/org/andromda/cartridges/spring/metafacades/SpringServiceLogicImpl.java 2013-12-11 20:14:53 UTC (rev 15377) @@ -468,7 +468,7 @@ Collection<OperationFacade> operations = this.getOperations(); if (!this.hasStereotype(UMLProfile.STEREOTYPE_WEBSERVICE)) { - operations = new FilteredCollection(operations) + operations = new FilteredCollection<OperationFacade>(operations) { private static final long serialVersionUID = 34L; public boolean evaluate(Object object) Modified: trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/SpringCrudService.vsl =================================================================== --- trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/SpringCrudService.vsl 2013-12-11 20:14:14 UTC (rev 15376) +++ trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/SpringCrudService.vsl 2013-12-11 20:14:53 UTC (rev 15377) @@ -139,7 +139,7 @@ public ${manageable.fullyQualifiedManageableValueObjectName} $searchUniqueMethod(final ${attribute.type.fullyQualifiedName} ${attribute.name}); #end #end -#foreach ($operation in $manageable.manageableBusinessOperations) +#foreach ($operation in $manageable.manageableDaoBusinessOperations) #if ($operation.returnType.dataType) #set ($returnType = $operation.getterSetterReturnTypeName) Modified: trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/SpringCrudServiceBase.vsl =================================================================== --- trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/SpringCrudServiceBase.vsl 2013-12-11 20:14:14 UTC (rev 15376) +++ trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/SpringCrudServiceBase.vsl 2013-12-11 20:14:53 UTC (rev 15377) @@ -288,7 +288,7 @@ } #end #end -#foreach ($operation in $manageable.manageableBusinessOperations) +#foreach ($operation in $manageable.manageableDaoBusinessOperations) #if ($operation.returnType.dataType) #set ($returnType = $operation.getterSetterReturnTypeName) Modified: trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/applicationContext-manageable.xml.vsl =================================================================== --- trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/applicationContext-manageable.xml.vsl 2013-12-11 20:14:14 UTC (rev 15376) +++ trunk/cartridges/andromda-spring/src/main/resources/templates/spring/crud/applicationContext-manageable.xml.vsl 2013-12-11 20:14:53 UTC (rev 15377) @@ -29,10 +29,17 @@ #if ($manageable.delete) ${manageable.fullyQualifiedManageableServiceName}.delete=PROPAGATION_REQUIRED #end -#foreach ($operation in $manageable.manageableBusinessOperations) +#foreach ($operation in $manageable.manageableDaoBusinessOperations) ${manageable.fullyQualifiedManageableServiceName}.${operation.name}=PROPAGATION_REQUIRED #end +#set ($attributes = $manageable.getAttributes(true, $manageable.usingAssignedIdentifier)) +#foreach ($attribute in $attributes) +#if ($attribute.unique) +#set ($searchUniqueMethod = "searchUnique${stringUtils.capitalise($attribute.name)}") + ${manageable.fullyQualifiedManageableServiceName}.${searchUniqueMethod}=PROPAGATION_REQUIRED #end +#end +#end </value> </property> </bean> @@ -44,11 +51,13 @@ <property name="proxyInterfaces"> <value>$manageable.fullyQualifiedManageableDaoName</value> </property> + #if (!$hibernateUtils.version4) <property name="interceptorNames"> <list> <value>hibernateInterceptor</value> </list> </property> +#end </bean> <!-- $manageable.manageableDaoName Implementation --> @@ -75,7 +84,9 @@ #if (!$ejbsEnabled) <value>manageableServiceTransactionInterceptor</value> #end +#if (!$hibernateUtils.version4) <value>hibernateInterceptor</value> +#end </list> </property> </bean> Modified: trunk/cartridges/andromda-spring/src/test/expected/cartridge-outputUML2.zip =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |