From: Eric C. <ecr...@us...> - 2006-09-28 01:12:55
|
User: ecrutchfield Date: 06/09/27 18:12:54 Modified: andromda-aspdotnet/src/main/resources/META-INF/andromda namespace.xml metafacades.xml andromda-aspdotnet/src/main/java/org/andromda/cartridges/aspdotnet/metafacades AspActionLogicImpl.java andromda-aspdotnet/src/main/resources/templates/aspdotnet/uicontrollers UIPController.cs.vsl Controller.cs.vm andromda-aspdotnet/src/test/expected cartridge-output.zip andromda-aspdotnet/src/main/uml AspDotNetMetafacadeModelv4.xml.zip andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005 webformBase.cs.vsl andromda-aspdotnet/src/test/uml AspCartridgeTestModel1.xml.zip andromda-aspdotnet/src/main/java/org/andromda/cartridges/aspdotnet CommonProperties.java Added: andromda-aspdotnet/src/main/java/org/andromda/cartridges/aspdotnet/metafacades AspBackendServiceLogicImpl.java Log: fix bug with final state transitions and add support in the controller for session objects and services Revision Changes Path 1.3 +16 -0 cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/namespace.xml Index: namespace.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/namespace.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- namespace.xml 25 Sep 2006 19:25:00 -0000 1.2 +++ namespace.xml 28 Sep 2006 01:12:53 -0000 1.3 @@ -237,6 +237,22 @@ refer to the documentation of that class for more information. This format is case-sensitive. </documentation> </property> + <property name="servicePackageNamePattern"> + <default>{0}</default> + <documentation> + The name of the package in which to create the service files. <code>{0}</code> + can be used to denote the package in which the service has been modeled. + </documentation> + </property> + <property name="serviceAccessorPattern" required="false"> + <documentation> + The pattern to use when calling the backend code for <![CDATA[<<Service>>]]> lookups. + For calling services you would use following pattern: + <ul> + <li><strong>NSpring</strong>: <code>${application.package}.ServiceLocator.Get{1}()</code></li> + </ul> + </documentation> + </property> </propertyGroup> </properties> 1.3 +7 -0 cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/metafacades.xml Index: metafacades.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/metafacades.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- metafacades.xml 25 Sep 2006 19:25:00 -0000 1.2 +++ metafacades.xml 28 Sep 2006 01:12:53 -0000 1.3 @@ -110,4 +110,11 @@ </mapping> <!-- property reference="actionFormKey"/ --> </metafacade> + <metafacade class="org.andromda.cartridges.aspdotnet.metafacades.AspBackendServiceLogicImpl"> + <mapping> + <stereotype>SERVICE</stereotype> + </mapping> + <property reference="serviceAccessorPattern"/> + <property reference="servicePackageNamePattern"/> + </metafacade> </metafacades> \ No newline at end of file 1.3 +9 -1 cartridges/andromda-aspdotnet/src/main/java/org/andromda/cartridges/aspdotnet/metafacades/AspActionLogicImpl.java Index: AspActionLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/java/org/andromda/cartridges/aspdotnet/metafacades/AspActionLogicImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- AspActionLogicImpl.java 25 Sep 2006 19:24:05 -0000 1.2 +++ AspActionLogicImpl.java 28 Sep 2006 01:12:54 -0000 1.3 @@ -1,7 +1,7 @@ package org.andromda.cartridges.aspdotnet.metafacades; -import java.util.ArrayList; import java.util.Collection; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.andromda.cartridges.aspdotnet.AspProfile; @@ -27,6 +27,14 @@ } /** + * @see org.andromda.cartridges.aspdotnet.metafacades.AspAction#isFinalStateTarget() + */ + protected boolean handleIsFinalStateTarget() + { + return this.getTarget() instanceof AspFinalState; + } + + /** * @see org.andromda.cartridges.aspdotnet.metafacades.AspAction#isHyperlink() */ protected boolean handleIsHyperlink() 1.1 cartridges/andromda-aspdotnet/src/main/java/org/andromda/cartridges/aspdotnet/metafacades/AspBackendServiceLogicImpl.java Index: AspBackendServiceLogicImpl.java =================================================================== package org.andromda.cartridges.aspdotnet.metafacades; import org.andromda.cartridges.aspdotnet.CommonProperties; /** * MetafacadeLogic implementation for org.andromda.cartridges.aspdotnet.metafacades.AspBackendService. * * @see org.andromda.cartridges.aspdotnet.metafacades.AspBackendService */ public class AspBackendServiceLogicImpl extends AspBackendServiceLogic { public AspBackendServiceLogicImpl (Object metaObject, String context) { super (metaObject, context); } /** * @see org.andromda.cartridges.aspdotnet.metafacades.AspBackendService#getAccessorImplementation() */ protected java.lang.String handleGetAccessorImplementation() { String accessorImplementation = String.valueOf( getConfiguredProperty(CommonProperties.SERVICE_ACCESSOR_PATTERN)); return accessorImplementation.replaceAll("\\{0\\}", getPackageName()).replaceAll("\\{1\\}", getName()); } /** * @see org.andromda.metafacades.uml.ModelElementFacade#getFullyQualifiedName() */ public java.lang.String getFullyQualifiedName() { String packageName = String.valueOf( getConfiguredProperty(CommonProperties.SERVICE_PACKAGE_NAME_PATTERN)); return packageName.replaceAll("\\{0\\}", super.getPackageName()) + "." + this.getName(); } } 1.3 +51 -10 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/uicontrollers/UIPController.cs.vsl Index: UIPController.cs.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/uicontrollers/UIPController.cs.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- UIPController.cs.vsl 25 Sep 2006 19:08:22 -0000 1.2 +++ UIPController.cs.vsl 28 Sep 2006 01:12:54 -0000 1.3 @@ -40,7 +40,7 @@ /// </summary> public void StartUseCase() { - HttpContext.Current.Response.Redirect(this.${stringUtils.capitalize(${controller.useCase.normalizedName})}()); + this.${stringUtils.capitalize(${controller.useCase.normalizedName})}(); } ## @@ -87,19 +87,13 @@ /// <summary> $action.getDocumentation(" /// ", 80, false) /// </summary> - public virtual string ${stringUtils.capitalize(${action.triggerName})}() + public virtual void ${stringUtils.capitalize(${action.triggerName})}() { -#if ($action.finalStateTarget) -#set ($targetUseCase = $action.target.targetUseCase) - $targetUseCase.controller.fullyQualifiedName nextController = new ${targetUseCase.controller.fullyQualifiedName}(); - return nextController.StartUseCase(); -#else string forward = String.Empty; ${action.fullyQualifiedFormImplementationName} form = this.${action.formImplementationPropertyName}; forward = #processTransition($action) this.${action.formImplementationPropertyName} = form; - return forward; -#end + HttpContext.Current.Response.Redirect(forward); } #foreach ($actionState in $action.actionStates) @@ -131,5 +125,52 @@ #end #endregion +#if (!$controller.serviceReferences.isEmpty()) + #region Service references +#foreach ($serviceRef in $controller.serviceReferences) +#if ($stringUtils.isNotBlank($serviceRef.targetElement.accessorImplementation)) + /// <summary> + /// Returns a reference to the $serviceRef.name back-end service. + /// </summary> + protected $serviceRef.targetElement.fullyQualifiedName ${serviceRef.getterName}() + { + try + { + return $serviceRef.targetElement.accessorImplementation; + } + catch (Exception ex) + { + throw new InvalidOperationException(ex); + } + } + +#end +#end + #endregion +#end + +#if(!$controller.sessionObjects.isEmpty()) + #region Session Object references +#foreach ($sessionObject in $controller.sessionObjects) +#set ($targetElement = $sessionObject.targetElement) + /// <summary> +$sessionObject.getDocumentation(" /// ", 80, false) + /// </summary> + public $targetElement.fullyQualifiedName ${stringUtils.capitalize($sessionObject.name)} + { + get + { + return HttpContext.Current.Session["${sessionObject.fullyQualifiedName}"] as $targetElement.fullyQualifiedName; + } + + set + { + HttpContext.Current.Session["${sessionObject.fullyQualifiedName}"] = value; + } + } + +#end + #endregion +#end } } \ No newline at end of file 1.3 +1 -1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/uicontrollers/Controller.cs.vm Index: Controller.cs.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/uicontrollers/Controller.cs.vm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- Controller.cs.vm 25 Sep 2006 19:05:18 -0000 1.2 +++ Controller.cs.vm 28 Sep 2006 01:12:54 -0000 1.3 @@ -6,7 +6,7 @@ null; #elseif ($transition.enteringFinalState) #set ($targetUseCase = $transition.target.targetUseCase) -this.${targetUseCase.normalizedName}(); +"~/target/src/${targetUseCase.fullyQualifiedPath}/${targetUseCase.normalizedName}UC.aspx"; #elseif ($transition.enteringView) "~/target/src/${transition.target.fullyQualifiedPath}/${transition.target.normalizedName}.aspx"; #elseif ($transition.enteringDecisionPoint) 1.2 +122 -122 cartridges/andromda-aspdotnet/src/test/expected/cartridge-output.zip <<Binary file>> 1.3 +127 -132 cartridges/andromda-aspdotnet/src/main/uml/AspDotNetMetafacadeModelv4.xml.zip <<Binary file>> 1.3 +1 -1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/webformBase.cs.vsl Index: webformBase.cs.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/webformBase.cs.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- webformBase.cs.vsl 25 Sep 2006 19:11:21 -0000 1.2 +++ webformBase.cs.vsl 28 Sep 2006 01:12:54 -0000 1.3 @@ -113,7 +113,7 @@ //we need to take the parameters for the given action and persist them across views #populateFormProperties() - Response.Redirect(this.Controller.${webform.normalizedName}$stringUtils.capitalize(${action.actionMethodName})()); + this.Controller.${webform.normalizedName}$stringUtils.capitalize(${action.actionMethodName})(); } #end 1.2 +164 -167 cartridges/andromda-aspdotnet/src/test/uml/AspCartridgeTestModel1.xml.zip <<Binary file>> 1.3 +11 -0 cartridges/andromda-aspdotnet/src/main/java/org/andromda/cartridges/aspdotnet/CommonProperties.java Index: CommonProperties.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/java/org/andromda/cartridges/aspdotnet/CommonProperties.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- CommonProperties.java 25 Sep 2006 19:25:03 -0000 1.2 +++ CommonProperties.java 28 Sep 2006 01:12:54 -0000 1.3 @@ -105,4 +105,15 @@ public static final String INPUT_TABLE = "table"; public static final String WEB_MENU_GROUP = "@andromda.presentation.web.menu.group"; + + /** + * The namespace property used to identify the pattern used to construct the backend service's accessor. + */ + public static final String SERVICE_ACCESSOR_PATTERN = "serviceAccessorPattern"; + + /** + * The namespace property used to identify the pattern used to construct the backend service's package name. + */ + public static final String SERVICE_PACKAGE_NAME_PATTERN = "servicePackageNamePattern"; + } |