osworkflow / docs / Validators.html

<html><head><title>OSWorkflow Validators</title></head><body>
<ul class="star">
<li>Up to <a href="Documentation.html">Documentation</a></li>
<li>Back to <a href="Utility_Functions.html">Utility Functions</a></li>
<li>Forward to <a href="Registers.html">Registers</a></li>
</ul><p class="paragraph"></p>Just like <a href="Functions.html">Functions</a>, OSWorkflow allows for validators in three different forms: <b class="bold">Java-based</b>, <b class="bold">BeanShell</b>, and <b class="bold">BSF</b>. Java-based validators must implement the <b class="bold">com.opensymphony.workflow.Validator</b> interface (or in the case of <b class="bold">remote-ejb</b>'s, the <b class="bold">com.opensymphony.workflow.ValidatorRemote</b> 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.<p class="paragraph"></p>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:
<ul class="minus">
<li>If the value returned is an InvalidInputException object, that object is immediately thrown to the client</li>
<li>If the value returned is a Map, that Map is used for the error/errorMessage pairs in the InvalidInputException</li>
<li>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.</li>
<li>Otherwise, the value is converted to a String and added as a generic error message.</li>
</ul><p class="paragraph"></p></body></html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.