You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by "Srinivas Surapaneni (JIRA)" <de...@beehive.apache.org> on 2006/06/04 15:48:29 UTC

[jira] Created: (BEEHIVE-1118) form bean validations are not following the order

form bean validations are not following the order
-------------------------------------------------

         Key: BEEHIVE-1118
         URL: http://issues.apache.org/jira/browse/BEEHIVE-1118
     Project: Beehive
        Type: Bug

  Components: NetUI  
    Versions: 1.0.1    
    Reporter: Srinivas Surapaneni


I had a form bean with annotation based validations for each getter method in the form bean

When the validations are done, it is not following the order of the attributes

Ex:  I had date, serialNumber, sampleValue.  When the validations are done, it is always calling the validations on sampleValue followed by date and serial Number

Is there any way to specify the order of how the validations are being called

Here is the sampe form

@Jpf.FormBean(messageBundle="errors")
public class SampleForm implements Validatable, Serializable {
	String date;
	String serialNumber;
	String sampleValue;
	
	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.date}", position=0)}), validateDate=@Jpf.ValidateDate(messageKey="001.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.date}", position=0)}, pattern="mm/dd/yyyy", strict=false))
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	
	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.serial}", position=0)}))
	public String getSerialNumber() {
		return serialNumber;
	}
	public void setSerialNumber(String serialNumber) {
		this.serialNumber = serialNumber;
	}
	public void validate(ActionMapping mapping, HttpServletRequest request, ActionMessages errors) {
		System.out.println("In the validate method" + errors.size());
		
	}
	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.sample}", position=0)}), validateMinLength=@Jpf.ValidateMinLength(messageKey="003.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.sample}", position=0)}, chars=4))
	public String getSampleValue() {
		return sampleValue;
	}
	public void setSampleValue(String sampleValue) {
		this.sampleValue = sampleValue;
	}
	

	
	
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Resolved: (BEEHIVE-1118) form bean validations are not following the order

Posted by Andrew McCulloch <am...@gmail.com>.
Thanks Carlin,

Sorry that I have been a bit lazy into looking at the test failure from my
patch.  I will try to get to that soon, so that the compiler tests I created
can be included in the bvt suite.

On 7/17/06, Carlin Rogers (JIRA) <de...@beehive.apache.org> wrote:
>
>      [ http://issues.apache.org/jira/browse/BEEHIVE-1118?page=all ]
>
> Carlin Rogers resolved BEEHIVE-1118.
> ------------------------------------
>
>     Fix Version/s: v.next
>        Resolution: Fixed
>          Assignee: Julie Zhuo
>
> I committed part of the patch from Andrew. The svn change includes the fix
> for this bug as well as the updates of some validation tests in the NetUI
> BVT (testRecorder). The order of the rules follows the order in which they
> were declared so the validation error messages in the test recording needed
> to be rearranged. This commit does not include the compiler tests due to
> diffs on the order of the <msg> elements associated to a field rule. Thanks
> Andrew.
>
> http://svn.apache.org/viewvc?rev=422740&view=rev
>
> > form bean validations are not following the order
> > -------------------------------------------------
> >
> >                 Key: BEEHIVE-1118
> >                 URL: http://issues.apache.org/jira/browse/BEEHIVE-1118
> >             Project: Beehive
> >          Issue Type: Bug
> >          Components: NetUI
> >    Affects Versions: 1.0.1
> >            Reporter: Srinivas Surapaneni
> >         Assigned To: Julie Zhuo
> >             Fix For: v.next
> >
> >         Attachments: BEEHIVE-1118.patch
> >
> >
> > I had a form bean with annotation based validations for each getter
> method in the form bean
> > When the validations are done, it is not following the order of the
> attributes
> > Ex:  I had date, serialNumber, sampleValue.  When the validations are
> done, it is always calling the validations on sampleValue followed by date
> and serial Number
> > Is there any way to specify the order of how the validations are being
> called
> > Here is the sampe form
> > @Jpf.FormBean(messageBundle="errors")
> > public class SampleForm implements Validatable, Serializable {
> >       String date;
> >       String serialNumber;
> >       String sampleValue;
> >
> >       @Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired
> (messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${
> bundle.dstbundle.date}", position=0)}), validateDate=@Jpf.ValidateDate
> (messageKey="001.error", messageArgs={@Jpf.MessageArg(arg="${
> bundle.dstbundle.date}", position=0)}, pattern="mm/dd/yyyy",
> strict=false))
> >       public String getDate() {
> >               return date;
> >       }
> >       public void setDate(String date) {
> >               this.date = date;
> >       }
> >
> >       @Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired
> (messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.serial}",
> position=0)}))
> >       public String getSerialNumber() {
> >               return serialNumber;
> >       }
> >       public void setSerialNumber(String serialNumber) {
> >               this.serialNumber = serialNumber;
> >       }
> >       public void validate(ActionMapping mapping, HttpServletRequest
> request, ActionMessages errors) {
> >               System.out.println("In the validate method" + errors.size
> ());
> >
> >       }
> >       @Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired
> (messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${
> bundle.dstbundle.sample}", position=0)}), validateMinLength=@
> Jpf.ValidateMinLength(messageKey="003.error", messageArgs={@Jpf.MessageArg
> (arg="${bundle.dstbundle.sample}", position=0)}, chars=4))
> >       public String getSampleValue() {
> >               return sampleValue;
> >       }
> >       public void setSampleValue(String sampleValue) {
> >               this.sampleValue = sampleValue;
> >       }
> >
> >
> >
> > }
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
> http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>
>

[jira] Updated: (BEEHIVE-1118) form bean validations are not following the order

Posted by "Andrew McCulloch (JIRA)" <de...@beehive.apache.org>.
     [ http://issues.apache.org/jira/browse/BEEHIVE-1118?page=all ]

Andrew McCulloch updated BEEHIVE-1118:
--------------------------------------

    Attachment: BEEHIVE-1118.patch

Patch to maintain order of validation rules...

New files that must be added in svn are:
netui/test/src/compilerTests/testsuite/Jira1118/Jira1118/actionLevelValidate/Controller3.java
netui/test/src/compilerTests/testsuite/Jira1118/Jira1118/index.jsp
netui/test/src/compilerTests/testsuite/Jira1118/Jira1118/success.jsp
netui/test/src/compilerTests/testsuite/Jira1118/Jira1118/Controller.java
netui/test/src/compilerTests/testsuite/Jira1118/Jira1118/controllerLevelValidate/Controller2.java
netui/test/src/compilerTests/testsuite/Jira1118/expectedOutput/struts-config-Jira1118-actionLevelValidate.expected
netui/test/src/compilerTests/testsuite/Jira1118/expectedOutput/struts-config-Jira1118.expected
netui/test/src/compilerTests/testsuite/Jira1118/expectedOutput/pageflow-validation-Jira1118-actionLevelValidate.expected
netui/test/src/compilerTests/testsuite/Jira1118/expectedOutput/struts-config-Jira1118-controllerLevelValidate.expected
netui/test/src/compilerTests/testsuite/Jira1118/expectedOutput/pageflow-validation-Jira1118.expected
netui/test/src/compilerTests/testsuite/Jira1118/expectedOutput/pageflow-validation-Jira1118-controllerLevelValidate.expected
netui/src/compiler-core/org/apache/beehive/netui/compiler/model/validation/ValidatableEntity.java


> form bean validations are not following the order
> -------------------------------------------------
>
>          Key: BEEHIVE-1118
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-1118
>      Project: Beehive
>         Type: Bug

>   Components: NetUI
>     Versions: 1.0.1
>     Reporter: Srinivas Surapaneni
>  Attachments: BEEHIVE-1118.patch
>
> I had a form bean with annotation based validations for each getter method in the form bean
> When the validations are done, it is not following the order of the attributes
> Ex:  I had date, serialNumber, sampleValue.  When the validations are done, it is always calling the validations on sampleValue followed by date and serial Number
> Is there any way to specify the order of how the validations are being called
> Here is the sampe form
> @Jpf.FormBean(messageBundle="errors")
> public class SampleForm implements Validatable, Serializable {
> 	String date;
> 	String serialNumber;
> 	String sampleValue;
> 	
> 	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.date}", position=0)}), validateDate=@Jpf.ValidateDate(messageKey="001.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.date}", position=0)}, pattern="mm/dd/yyyy", strict=false))
> 	public String getDate() {
> 		return date;
> 	}
> 	public void setDate(String date) {
> 		this.date = date;
> 	}
> 	
> 	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.serial}", position=0)}))
> 	public String getSerialNumber() {
> 		return serialNumber;
> 	}
> 	public void setSerialNumber(String serialNumber) {
> 		this.serialNumber = serialNumber;
> 	}
> 	public void validate(ActionMapping mapping, HttpServletRequest request, ActionMessages errors) {
> 		System.out.println("In the validate method" + errors.size());
> 		
> 	}
> 	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.sample}", position=0)}), validateMinLength=@Jpf.ValidateMinLength(messageKey="003.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.sample}", position=0)}, chars=4))
> 	public String getSampleValue() {
> 		return sampleValue;
> 	}
> 	public void setSampleValue(String sampleValue) {
> 		this.sampleValue = sampleValue;
> 	}
> 	
> 	
> 	
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (BEEHIVE-1118) form bean validations are not following the order

Posted by "Andrew McCulloch (JIRA)" <de...@beehive.apache.org>.
    [ http://issues.apache.org/jira/browse/BEEHIVE-1118?page=comments#action_12419343 ] 

Andrew McCulloch commented on BEEHIVE-1118:
-------------------------------------------

I attached a patch for this issue.  It is a pretty simple fix (most of my changes are new tests).  There are 3 testRecorder tests that changed as well as 3 new test cases in the compiler bvts.  the actual code change is 1 line (changing a HashMap to a LinkedHashMap to maintain insertion order).

Please review it and let me know if it is helpful.

> form bean validations are not following the order
> -------------------------------------------------
>
>          Key: BEEHIVE-1118
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-1118
>      Project: Beehive
>         Type: Bug

>   Components: NetUI
>     Versions: 1.0.1
>     Reporter: Srinivas Surapaneni
>  Attachments: BEEHIVE-1118.patch
>
> I had a form bean with annotation based validations for each getter method in the form bean
> When the validations are done, it is not following the order of the attributes
> Ex:  I had date, serialNumber, sampleValue.  When the validations are done, it is always calling the validations on sampleValue followed by date and serial Number
> Is there any way to specify the order of how the validations are being called
> Here is the sampe form
> @Jpf.FormBean(messageBundle="errors")
> public class SampleForm implements Validatable, Serializable {
> 	String date;
> 	String serialNumber;
> 	String sampleValue;
> 	
> 	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.date}", position=0)}), validateDate=@Jpf.ValidateDate(messageKey="001.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.date}", position=0)}, pattern="mm/dd/yyyy", strict=false))
> 	public String getDate() {
> 		return date;
> 	}
> 	public void setDate(String date) {
> 		this.date = date;
> 	}
> 	
> 	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.serial}", position=0)}))
> 	public String getSerialNumber() {
> 		return serialNumber;
> 	}
> 	public void setSerialNumber(String serialNumber) {
> 		this.serialNumber = serialNumber;
> 	}
> 	public void validate(ActionMapping mapping, HttpServletRequest request, ActionMessages errors) {
> 		System.out.println("In the validate method" + errors.size());
> 		
> 	}
> 	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.sample}", position=0)}), validateMinLength=@Jpf.ValidateMinLength(messageKey="003.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.sample}", position=0)}, chars=4))
> 	public String getSampleValue() {
> 		return sampleValue;
> 	}
> 	public void setSampleValue(String sampleValue) {
> 		this.sampleValue = sampleValue;
> 	}
> 	
> 	
> 	
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (BEEHIVE-1118) form bean validations are not following the order

Posted by "Carlin Rogers (JIRA)" <de...@beehive.apache.org>.
     [ http://issues.apache.org/jira/browse/BEEHIVE-1118?page=all ]

Carlin Rogers resolved BEEHIVE-1118.
------------------------------------

    Fix Version/s: v.next
       Resolution: Fixed
         Assignee: Julie Zhuo

I committed part of the patch from Andrew. The svn change includes the fix for this bug as well as the updates of some validation tests in the NetUI BVT (testRecorder). The order of the rules follows the order in which they were declared so the validation error messages in the test recording needed to be rearranged. This commit does not include the compiler tests due to diffs on the order of the <msg> elements associated to a field rule. Thanks Andrew.

http://svn.apache.org/viewvc?rev=422740&view=rev

> form bean validations are not following the order
> -------------------------------------------------
>
>                 Key: BEEHIVE-1118
>                 URL: http://issues.apache.org/jira/browse/BEEHIVE-1118
>             Project: Beehive
>          Issue Type: Bug
>          Components: NetUI
>    Affects Versions: 1.0.1
>            Reporter: Srinivas Surapaneni
>         Assigned To: Julie Zhuo
>             Fix For: v.next
>
>         Attachments: BEEHIVE-1118.patch
>
>
> I had a form bean with annotation based validations for each getter method in the form bean
> When the validations are done, it is not following the order of the attributes
> Ex:  I had date, serialNumber, sampleValue.  When the validations are done, it is always calling the validations on sampleValue followed by date and serial Number
> Is there any way to specify the order of how the validations are being called
> Here is the sampe form
> @Jpf.FormBean(messageBundle="errors")
> public class SampleForm implements Validatable, Serializable {
> 	String date;
> 	String serialNumber;
> 	String sampleValue;
> 	
> 	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.date}", position=0)}), validateDate=@Jpf.ValidateDate(messageKey="001.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.date}", position=0)}, pattern="mm/dd/yyyy", strict=false))
> 	public String getDate() {
> 		return date;
> 	}
> 	public void setDate(String date) {
> 		this.date = date;
> 	}
> 	
> 	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.serial}", position=0)}))
> 	public String getSerialNumber() {
> 		return serialNumber;
> 	}
> 	public void setSerialNumber(String serialNumber) {
> 		this.serialNumber = serialNumber;
> 	}
> 	public void validate(ActionMapping mapping, HttpServletRequest request, ActionMessages errors) {
> 		System.out.println("In the validate method" + errors.size());
> 		
> 	}
> 	@Jpf.ValidatableProperty(validateRequired=@Jpf.ValidateRequired(messageKey="000.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.sample}", position=0)}), validateMinLength=@Jpf.ValidateMinLength(messageKey="003.error", messageArgs={@Jpf.MessageArg(arg="${bundle.dstbundle.sample}", position=0)}, chars=4))
> 	public String getSampleValue() {
> 		return sampleValue;
> 	}
> 	public void setSampleValue(String sampleValue) {
> 		this.sampleValue = sampleValue;
> 	}
> 	
> 	
> 	
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira