From: Chad B. <cwb...@us...> - 2005-09-15 21:30:00
|
User: cwbrandon Date: 05/09/15 14:29:55 Modified: lib/andromda-bootstrap/jars andromda-metafacades-uml-bootstrap.jar andromda-metafacades-uml14-bootstrap.jar andromda-java/src/test/expected cartridge-output.zip andromda-java/src/templates/java ValueObject.vsl uml/common/src/uml UMLMetafacadeModel.xml.zip andromda-jsf/src/java/org/andromda/cartridges/jsf/metafacades JSFParameterLogicImpl.java JSFAttributeLogicImpl.java andromda-jsf/src/templates/jsf/controllers Controller.java.vsl andromda-meta/src/test/expected cartridge-output.zip uml/uml14/src/java/org/andromda/metafacades/uml14 AttributeFacadeLogicImpl.java andromda-java/src/test/uml JavaCartridgeTestModel.xml.zip Log: add defaultValuePresent to the attribute facade, also improve default value support in the JSF cartridge's parameters Revision Changes Path 1.115 +70 -71 productbuild/lib/andromda-bootstrap/jars/andromda-metafacades-uml-bootstrap.jar <<Binary file>> 1.148 +440 -478 productbuild/lib/andromda-bootstrap/jars/andromda-metafacades-uml14-bootstrap.jar <<Binary file>> 1.28 +26 -21 cartridges/andromda-java/src/test/expected/cartridge-output.zip <<Binary file>> 1.18 +1 -1 cartridges/andromda-java/src/templates/java/ValueObject.vsl Index: ValueObject.vsl =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-java/src/templates/java/ValueObject.vsl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -r1.17 -r1.18 --- ValueObject.vsl 18 Jul 2005 16:22:11 -0000 1.17 +++ ValueObject.vsl 15 Sep 2005 21:29:51 -0000 1.18 @@ -63,7 +63,7 @@ } #foreach ($attribute in $class.attributes) - private $attribute.getterSetterTypeName $attribute.name; + private $attribute.getterSetterTypeName $attribute.name#if ($attribute.defaultValuePresent) = $attribute.defaultValue#end; /** $attribute.getDocumentation(" * ") 1.250 +1178 -1204metafacades/uml/common/src/uml/UMLMetafacadeModel.xml.zip <<Binary file>> 1.10 +19 -0 cartridges/andromda-jsf/src/java/org/andromda/cartridges/jsf/metafacades/JSFParameterLogicImpl.java Index: JSFParameterLogicImpl.java =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-jsf/src/java/org/andromda/cartridges/jsf/metafacades/JSFParameterLogicImpl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- JSFParameterLogicImpl.java 13 Sep 2005 00:31:32 -0000 1.9 +++ JSFParameterLogicImpl.java 15 Sep 2005 21:29:52 -0000 1.10 @@ -95,6 +95,25 @@ } /** + * Overridden to provide quotes around string types. + * + * @see org.andromda.metafacades.uml.ParameterFacade#getDefaultValue() + */ + public String getDefaultValue() + { + String defaultValue = super.getDefaultValue(); + if (StringUtils.isNotBlank(defaultValue)) + { + final ClassifierFacade type = this.getType(); + if (type != null && type.isStringType()) + { + defaultValue = "\"" + defaultValue + "\""; + } + } + return defaultValue; + } + + /** * Indicates whether or not we should normalize messages. * * @return true/false 1.14 +19 -0 cartridges/andromda-jsf/src/java/org/andromda/cartridges/jsf/metafacades/JSFAttributeLogicImpl.java Index: JSFAttributeLogicImpl.java =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-jsf/src/java/org/andromda/cartridges/jsf/metafacades/JSFAttributeLogicImpl.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -r1.13 -r1.14 --- JSFAttributeLogicImpl.java 13 Sep 2005 03:51:52 -0000 1.13 +++ JSFAttributeLogicImpl.java 15 Sep 2005 21:29:52 -0000 1.14 @@ -555,4 +555,23 @@ final ClassifierFacade type = this.getType(); return type != null && type.isTimeType() ? this.getFormPropertyId(ownerParameter) + "TimeFormatter" : null; } + + /** + * Overridden to provide quotes around string types. + * + * @see org.andromda.metafacades.uml.AttributeFacade#getDefaultValue() + */ + public String getDefaultValue() + { + String defaultValue = super.getDefaultValue(); + if (StringUtils.isNotBlank(defaultValue)) + { + final ClassifierFacade type = this.getType(); + if (type != null && type.isStringType()) + { + defaultValue = "\"" + defaultValue + "\""; + } + } + return defaultValue; + } } \ No newline at end of file 1.2 +60 -29 cartridges/andromda-jsf/src/templates/jsf/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-jsf/src/templates/jsf/controllers/Controller.java.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- Controller.java.vsl 8 Sep 2005 19:34:36 -0000 1.1 +++ Controller.java.vsl 15 Sep 2005 21:29:53 -0000 1.2 @@ -40,32 +40,7 @@ try { #end -#if (!$action.actionStates.empty) -#foreach ($actionState in $action.actionStates) -#set ($actionStateForward = $actionState.forward.name) -#foreach ($deferredOperation in $actionState.controllerCalls) - this.$deferredOperation.formCall; -#end -#end -#elseif (!$action.actionForwards.empty) -#set ($actionStateForward = $action.actionForwards.iterator().next().name) -#end - forward = "$actionStateForward"; -#foreach ($decisionTransition in $action.decisionTransitions) - final String value = java.lang.String.valueOf(this.${decisionTransition.operationCall.formCall}); -#foreach ($outcome in $decisionTransition.target.outgoing) -#set ($defaultOutcome = $outcome) - if (value.equals("$outcome.guard.name")) - { - return "$outcome.name"; - } -#end - // - if we have invalid return value from the controller we take the last forward - forward = "$defaultOutcome.name"; -#end -#if (!$action.formFields.empty && $action.formResetRequired) - form.reset(); -#end + forward = #processTransition($action) #if (!$deferredOperations.empty) } catch (final Throwable throwable) @@ -73,8 +48,6 @@ final String message = ${managedBeansPackage}.Messages.get( ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable), null); this.addErrorMessage(message); - // - set the forward to null so that we stay on the current view - forward = null; } #end #if (!$action.formFields.empty) @@ -90,6 +63,50 @@ return forward; } +#foreach ($actionState in $action.actionStates) + /** +$actionState.getDocumentation(" * ") + */ + private java.lang.String ${actionState.actionMethodName}(#if (!$action.formFields.empty)final $action.fullyQualifiedFormImplementationName form#end) + { + java.lang.String forward = null; +#if ($actionState.controllerCalls.empty) + forward = #processTransition($actionState.forward) +#else +#foreach ($controllerCall in $actionState.controllerCalls) +#if (!$action.actionFormFields.empty) + $controllerCall.formCall; +#else + // we pass an empty form implementation to the controller, we know there are no parameters on this operation because the + // cartridge would have issued a model validation error + ${controllerCall.name}(new ${controllerCall.interfaceName}()); +#end +#end + forward = #processTransition($actionState.forward) +#end + return forward; + } + +#end +#foreach ($decisionTransition in $action.decisionTransitions) + /** +$decisionTransition.getDocumentation(" * ") + */ + private java.lang.String __${decisionTransition.operationCall.name}(#if (!$action.formFields.empty)final $action.fullyQualifiedFormImplementationName form#end) + { + final String value = java.lang.String.valueOf($decisionTransition.operationCall.formCall); +#foreach ($outcome in $decisionTransition.target.outgoing) +#set ($defaultOutcome = $outcome) + if (value.equals("$outcome.guard.name")) + { + return #processTransition($outcome) + } +#end + // we take the last action in case we have an invalid return value from the controller + return #processTransition($defaultOutcome) + } + +#end #end #foreach ($serviceRef in $controller.serviceReferences) #if ($stringUtils.isNotBlank($serviceRef.targetElement.accessorImplementation)) @@ -283,3 +300,17 @@ } } } \ No newline at end of file +## +## This macro determines what to do when processing a transition +## +#macro (processTransition $transition) +#if (!$transition) +null; +#elseif ($transition.enteringFinalState || $transition.enteringView) +"$transition.name"; +#elseif ($transition.enteringDecisionPoint) +__${transition.operationCall.name}(#if (!$action.formFields.empty)form#end); +#else +${transition.target.actionMethodName}(#if (!$action.formFields.empty)form#end); +#end +#end 1.191 +214 -212 cartridges/andromda-meta/src/test/expected/cartridge-output.zip <<Binary file>> 1.50 +8 -0 metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/AttributeFacadeLogicImpl.java Index: AttributeFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromda/metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/AttributeFacadeLogicImpl.java,v retrieving revision 1.49 retrieving revision 1.50 diff -u -w -r1.49 -r1.50 --- AttributeFacadeLogicImpl.java 21 Jul 2005 21:10:38 -0000 1.49 +++ AttributeFacadeLogicImpl.java 15 Sep 2005 21:29:55 -0000 1.50 @@ -262,6 +262,14 @@ } /** + * @see org.andromda.metafacades.uml.AttributeFacade#isDefaultValuePresent() + */ + public boolean handleIsDefaultValuePresent() + { + return StringUtils.isNotBlank(this.getDefaultValue()); + } + + /** * Overridden to provide different handling of the name if this attribute represents a literal. * * @see org.andromda.metafacades.uml.ModelElementFacade#getName() 1.10 +58 -60 cartridges/andromda-java/src/test/uml/JavaCartridgeTestModel.xml.zip <<Binary file>> |