From: Wouter Z. <dra...@us...> - 2004-09-08 15:34:25
|
User: draftdog Date: 04/09/08 08:34:17 Modified: andromda-bpm4struts/src/templates StrutsForm.vsl Log: final fixes for the formfields, action parameter have validation while pagevariables and other preloadables are simple fields java and javax dependencies are now not imported but rendered fully qualified to avoid naming collisions with form fields Revision Changes Path 1.16 +9 -20 cartridges/andromda-bpm4struts/src/templates/StrutsForm.vsl Index: StrutsForm.vsl =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-bpm4struts/src/templates/StrutsForm.vsl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- StrutsForm.vsl 3 Sep 2004 21:41:11 -0000 1.15 +++ StrutsForm.vsl 8 Sep 2004 15:34:17 -0000 1.16 @@ -2,8 +2,8 @@ ## ## CONSTANTS ## -#set ($fields = $action.allFormFields) -#set ($preloadableFields = $action.preloadableFormFields) +#set ($fields = $action.actionFormFields) +#set ($actionParameters = $action.actionParameters) #set ($formBeanName = $action.formBeanName) #set ($formBeanClassName = $action.formBeanClassName) #set ($messageKey = $action.messageKey) @@ -11,6 +11,7 @@ ## MACROS ## #macro (renderValidation $field) +#if ($actionParameters.contains($field)) #set ($validatorTypes = $field.validatorTypes) #if (!$validatorTypes.empty) /** @@ -40,25 +41,19 @@ */ #end #end +#end ## ## START TEMPLATE ## package $action.formBeanPackageName; -import java.io.Serializable; - -import org.apache.struts.action.ActionMapping; -import org.apache.struts.validator.ValidatorForm; - -import javax.servlet.http.HttpServletRequest; - /** * @struts.form * name="$formBeanName" */ -public class $formBeanClassName extends ValidatorForm implements Serializable - #foreach ($interfaceName in $action.controllerCallInterfaceNames), $interfaceName#end - +public class $formBeanClassName + extends org.apache.struts.validator.ValidatorForm + implements java.io.Serializable { #set ($collectionPresent = false) #set ($arrayPresent = false) @@ -67,7 +62,7 @@ #if ($field.type.collectionType) #set ($collectionPresent = true) #end -#if ($field.type.arrayType || $field.backingListPresent) +#if ($field.type.arrayType || $field.selectable) #set ($arrayPresent = true) #end private $field.type.fullyQualifiedName $field.name; @@ -94,9 +89,7 @@ #set ($fieldType = $field.type.fullyQualifiedName) #set ($fieldName = $field.name) #if ($field.type.collectionType) -#if ($preloadableFields.contains($field)==false) #renderValidation($field) -#end public void ${field.setterName}($fieldType $fieldName) { this.$fieldName = $fieldName; @@ -127,9 +120,7 @@ return this.$fieldName; } -#if ($preloadableFields.contains($field)==false) #renderValidation($field) -#end public void ${field.setterName}(java.lang.String ${fieldName}) { if (${fieldName} == null || ${fieldName}.trim().length()==0) @@ -164,9 +155,7 @@ return this.${fieldName}DateFormatter; } #else -#if ($preloadableFields.contains($field)==false) #renderValidation($field) -#end public void ${field.setterName}($fieldType $fieldName) { this.$fieldName = $fieldName; @@ -235,7 +224,7 @@ #end #end - public void reset(ActionMapping mapping, HttpServletRequest request) + public void reset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { #foreach ($field in $fields) #if ($field.resetRequired) |