jBPM :: Flow 6.2.0.CR1

org.jbpm.process.core.transformation
Class JavaScriptingDataTransformer

java.lang.Object
  extended by org.jbpm.process.core.transformation.JavaScriptingDataTransformer
All Implemented Interfaces:
org.kie.api.runtime.process.DataTransformer

public class JavaScriptingDataTransformer
extends Object
implements org.kie.api.runtime.process.DataTransformer

Implementation of DataTransformer that is based on standard Java scripting capabilities (javax.script). By default it uses Rhino scripting engine for JavaScript evaluation. But supports all scripting engine that are compliant with JSR 223. It's just a matter of placing them on classpath so Java itself can discover it and then new instance of this class will be registered for that engine.
Allows to pass custom properties to the engine via property file that should be placed on root of the classpath named 'FQCN of the script engine factory'.properties
When reading the properties file transformer recognizes three types of data:

return value of the expression is either:


Constructor Summary
JavaScriptingDataTransformer(ScriptEngineFactory factory)
           
 
Method Summary
 Object compile(String expression, Map<String,Object> parameters)
           
protected  Object evaluateExpression(Object expression, Map<String,Object> parameters)
           
protected  void registerAttributes()
           
 Object transform(Object expression, Map<String,Object> parameters)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaScriptingDataTransformer

public JavaScriptingDataTransformer(ScriptEngineFactory factory)
Method Detail

transform

public Object transform(Object expression,
                        Map<String,Object> parameters)
Specified by:
transform in interface org.kie.api.runtime.process.DataTransformer

compile

public Object compile(String expression,
                      Map<String,Object> parameters)
Specified by:
compile in interface org.kie.api.runtime.process.DataTransformer

evaluateExpression

protected Object evaluateExpression(Object expression,
                                    Map<String,Object> parameters)

registerAttributes

protected void registerAttributes()

jBPM :: Flow 6.2.0.CR1

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.