[ http://jira.andromda.org/browse/BPM-171?page=comments#action_11817 ]
     
Wouter Zoons commented on BPM-171:
----------------------------------

I think I have found an easy solution that requires neither of us to implement 
anything specific while at the same time not expecting the user to know 
bpm4struts internals

suppose 'christmas' and 'easter' are both form fields of type java.util.Date; 
currently one would try to do this in a validwhen constraint:

    christmas > easter

which wouldn't work because of the reasons you mentioned before, doing

    christmasAsDate > easterAsDate

isn't nice either because the 'AsDate' suffix is something bpm4struts specific, 
only a convenient accessor

but what if we made use of the Java API instead:

    christmas.time > easter.time

I know it looks kinda funny but think about it: using the Java API is fine 
because we're dealing with a tagged value here, which is PSM anyway .. assuming 
we're using Java is also okay because we're generating Struts code

since the .time property returns a primitive long value the comparison is 
bulletproof

what do you think ?



> validwhen doesn't work with java.util.Date
> ------------------------------------------
>
>          Key: BPM-171
>          URL: http://jira.andromda.org/browse/BPM-171
>      Project: Bpm4Struts Cartridge
>         Type: Bug
>     Reporter: Walter Itamar MourĂ£o
>     Assignee: Wouter Zoons
>  Attachments: testestruts.zip
>
> The validwhen validation doesn't work with the java.util.Date, since the 
> validator uses the toString method, and the java.util.Date.toString() doesn't 
> return a string suitable for comparison. Besides that, bpm4struts uses the 
> sufix AsDate in date fields, so the validwhen tries to use the String version 
> of the form attribute, which isn't suitable for comparison too.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Andromda-devel mailing list
Andromda-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-devel

Reply via email to