org.enhydra.shark.scripting
Class JavaScriptEvaluator
java.lang.Object
org.enhydra.shark.scripting.JavaScriptEvaluator
- All Implemented Interfaces:
- Evaluator
public class JavaScriptEvaluator
- extends java.lang.Object
- implements Evaluator
Implementation of the Evaluator interface which evaluates the condition body as a java
script expression.
Method Summary |
protected java.lang.String |
adjustExpression(WMSessionHandle shandle,
java.lang.String expression,
java.util.Map context,
java.lang.String procId,
java.lang.String actId)
|
void |
configure(CallbackUtilities cus)
|
boolean |
evaluateCondition(WMSessionHandle shandle,
java.lang.String procId,
java.lang.String actId,
java.lang.String condition,
java.util.Map context)
Evaluate the condition using java script as the expression language. |
java.lang.Object |
evaluateExpression(WMSessionHandle shandle,
java.lang.String procId,
java.lang.String actId,
java.lang.String expr,
java.util.Map context,
java.lang.Class resultClass)
Evaluates the given expression. |
protected java.lang.String |
prepareContext(WMSessionHandle shandle,
org.mozilla.javascript.Scriptable scope,
java.lang.String expr,
java.util.Map context,
java.lang.String procId,
java.lang.String actId)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG_CHANNEL
protected static final java.lang.String LOG_CHANNEL
- See Also:
- Constant Field Values
cus
protected CallbackUtilities cus
JavaScriptEvaluator
public JavaScriptEvaluator()
configure
public void configure(CallbackUtilities cus)
throws java.lang.Exception
- Specified by:
configure
in interface Evaluator
- Throws:
java.lang.Exception
evaluateCondition
public boolean evaluateCondition(WMSessionHandle shandle,
java.lang.String procId,
java.lang.String actId,
java.lang.String condition,
java.util.Map context)
throws java.lang.Exception
- Evaluate the condition using java script as the expression language. This method
returns true if the condition is satisfied.
- Specified by:
evaluateCondition
in interface Evaluator
- Parameters:
condition
- The conditioncontext
- The context
- Returns:
- True if the condition is true
- Throws:
java.lang.Exception
evaluateExpression
public java.lang.Object evaluateExpression(WMSessionHandle shandle,
java.lang.String procId,
java.lang.String actId,
java.lang.String expr,
java.util.Map context,
java.lang.Class resultClass)
throws java.lang.Exception
- Evaluates the given expression.
- Specified by:
evaluateExpression
in interface Evaluator
- Parameters:
expr
- The expression Stringcontext
- The workflow contextresultClass
- Returned object should be the instance of this Java class
- Returns:
- The result of expression evaluation.
- Throws:
java.lang.Exception
prepareContext
protected java.lang.String prepareContext(WMSessionHandle shandle,
org.mozilla.javascript.Scriptable scope,
java.lang.String expr,
java.util.Map context,
java.lang.String procId,
java.lang.String actId)
throws java.lang.Exception
- Throws:
java.lang.Exception
adjustExpression
protected java.lang.String adjustExpression(WMSessionHandle shandle,
java.lang.String expression,
java.util.Map context,
java.lang.String procId,
java.lang.String actId)
throws java.lang.Exception
- Throws:
java.lang.Exception