org.enhydra.shark.scripting
Class JavaScriptEvaluator

java.lang.Object
  extended byorg.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.


Constructor Summary
JavaScriptEvaluator()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaScriptEvaluator

public JavaScriptEvaluator()
Method Detail

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 condition
context - 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 String
context - The workflow context
resultClass - Returned object should be the instance of this Java class
Returns:
The result of expression evaluation.
Throws:
java.lang.Exception