Dashboard > OSWorkflow > ... > Documentation > 3.5 Validators
  OSWorkflow Log In View a printable version of the current page.  
  3.5 Validators
Added by Cameron Braid, last edited by Hani Suleiman on Apr 20, 2004  (view change)
Labels: 
(None)

Just like 3.4 Functions, OSWorkflow allows for validators in three different forms: Java-based, BeanShell, and BSF. Java-based validators must implement the com.opensymphony.workflow.Validator interface (or in the case of remote-ejb's, the com.opensymphony.workflow.ValidatorRemote interface). With Java-based validators, throwing an InvalidInputException is all that is needed to mark an input as invalid and stop the workflow action from occuring.

But in BeanShell and BSF, things are a little different, since exceptions thrown in the scripts can't propogate out to the Java runtime environment. To get around this, any value returned in a BeanShell or BSF script will be used as the error message(s). The logic is as follows:

  • If the value returned is an InvalidInputException object, that object is immediately thrown to the client
  • If the value returned is a Map, that Map is used for the error/errorMessage pairs in the InvalidInputException
  • If the value returned is a String[], the even numbers are used as keys, and the odd numbers are used as values to construct a Map that can then be used in the above case.
  • Otherwise, the value is converted to a String and added as a generic error message.

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators