Class GroovyScriptExpressionExecutorCacheStrategy
- java.lang.Object
-
- org.bonitasoft.engine.expression.NonEmptyContentExpressionExecutorStrategy
-
- org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy
-
- All Implemented Interfaces:
SingleClassLoaderListener,ExpressionExecutorStrategy
- Direct Known Subclasses:
GroovyScriptConditionExpressionExecutorStrategy
public class GroovyScriptExpressionExecutorCacheStrategy extends NonEmptyContentExpressionExecutorStrategy implements SingleClassLoaderListener
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOERCION_SCRIPT_KEYstatic java.lang.StringGROOVY_SCRIPT_CACHE_NAMEstatic java.lang.StringSCRIPT_KEYstatic java.lang.StringSHELL_KEY-
Fields inherited from interface org.bonitasoft.engine.expression.ExpressionExecutorStrategy
CONTAINER_ID_KEY, CONTAINER_TYPE_KEY, DEFINITION_ID, INTERPRETER_GROOVY, KIND_BUSINESS_DATA, KIND_BUSINESS_DATA_REFERENCE, KIND_BUSINESS_OBJECT_DAO, KIND_CONSTANT, KIND_CONTRACT_INPUT, KIND_DOCUMENT, KIND_DOCUMENT_LIST, KIND_ENGINE_CONSTANT, KIND_INPUT, KIND_JAVA_METHOD_CALL, KIND_LIST, KIND_PARAMETER, KIND_PATTERN, KIND_QUERY_BUSINESS_DATA, KIND_READ_ONLY_CONDITION_SCRIPT_GROOVY, KIND_READ_ONLY_SCRIPT_GROOVY, KIND_TRANSIENT_VARIABLE, KIND_VARIABLE, KIND_XPATH_READ, NO_DEPENDENCY_EXPRESSION_EVALUATION_ORDER, TYPE_BUSINESS_DATA, TYPE_BUSINESS_DATA_REFERENCE, TYPE_BUSINESS_OBJECT_DAO, TYPE_CONSTANT, TYPE_CONTRACT_INPUT, TYPE_DOCUMENT, TYPE_DOCUMENT_LIST, TYPE_ENGINE_CONSTANT, TYPE_INPUT, TYPE_JAVA_METHOD_CALL, TYPE_LIST, TYPE_PARAMETER, TYPE_PATTERN, TYPE_QUERY_BUSINESS_DATA, TYPE_READ_ONLY_CONDITION_SCRIPT, TYPE_READ_ONLY_SCRIPT, TYPE_TRANSIENT_VARIABLE, TYPE_VARIABLE, TYPE_XPATH_READ
-
-
Constructor Summary
Constructors Constructor Description GroovyScriptExpressionExecutorCacheStrategy(CacheService cacheService, ClassLoaderService classLoaderService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectcoerceResult(groovy.lang.GroovyShell shell, java.lang.Object result, java.lang.String returnType)Execute a Groovy expression that coerce the result into the returnTypejava.util.List<java.lang.Object>evaluate(java.util.List<SExpression> expressions, java.util.Map<java.lang.String,java.lang.Object> context, java.util.Map<java.lang.Integer,java.lang.Object> resolvedExpressions, ContainerState containerState)java.lang.Objectevaluate(SExpression expression, java.util.Map<java.lang.String,java.lang.Object> context, java.util.Map<java.lang.Integer,java.lang.Object> resolvedExpressions, ContainerState containerState)ExpressionKindgetExpressionKind()booleanmustPutEvaluatedExpressionInContext()Should we put the evaluated expressions of this strategy in the evaluation context?voidonDestroy(java.lang.ClassLoader oldClassLoader)voidonUpdate(java.lang.ClassLoader newClassLoader)-
Methods inherited from class org.bonitasoft.engine.expression.NonEmptyContentExpressionExecutorStrategy
validate
-
-
-
-
Field Detail
-
GROOVY_SCRIPT_CACHE_NAME
public static final java.lang.String GROOVY_SCRIPT_CACHE_NAME
- See Also:
- Constant Field Values
-
SCRIPT_KEY
public static final java.lang.String SCRIPT_KEY
- See Also:
- Constant Field Values
-
COERCION_SCRIPT_KEY
public static final java.lang.String COERCION_SCRIPT_KEY
- See Also:
- Constant Field Values
-
SHELL_KEY
public static final java.lang.String SHELL_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GroovyScriptExpressionExecutorCacheStrategy
public GroovyScriptExpressionExecutorCacheStrategy(CacheService cacheService, ClassLoaderService classLoaderService)
-
-
Method Detail
-
evaluate
public java.lang.Object evaluate(SExpression expression, java.util.Map<java.lang.String,java.lang.Object> context, java.util.Map<java.lang.Integer,java.lang.Object> resolvedExpressions, ContainerState containerState) throws SExpressionEvaluationException
- Specified by:
evaluatein interfaceExpressionExecutorStrategy- Parameters:
expression- the expression to evaluatecontext- map containing the result of the evaluation of dependencies and also informations about the context of evaluation given byExpressionExecutorStrategy.CONTAINER_ID_KEYandExpressionExecutorStrategy.CONTAINER_TYPE_KEY- Returns:
- the result of the evaluation of the expression of appropriate type
- Throws:
SExpressionEvaluationException
-
onUpdate
public void onUpdate(java.lang.ClassLoader newClassLoader)
- Specified by:
onUpdatein interfaceSingleClassLoaderListener
-
onDestroy
public void onDestroy(java.lang.ClassLoader oldClassLoader)
- Specified by:
onDestroyin interfaceSingleClassLoaderListener
-
getExpressionKind
public ExpressionKind getExpressionKind()
- Specified by:
getExpressionKindin interfaceExpressionExecutorStrategy
-
evaluate
public java.util.List<java.lang.Object> evaluate(java.util.List<SExpression> expressions, java.util.Map<java.lang.String,java.lang.Object> context, java.util.Map<java.lang.Integer,java.lang.Object> resolvedExpressions, ContainerState containerState) throws SExpressionEvaluationException, SExpressionDependencyMissingException
- Specified by:
evaluatein interfaceExpressionExecutorStrategy- Throws:
SExpressionEvaluationExceptionSExpressionDependencyMissingException
-
coerceResult
protected java.lang.Object coerceResult(groovy.lang.GroovyShell shell, java.lang.Object result, java.lang.String returnType) throws java.lang.ClassNotFoundException, SCacheExceptionExecute a Groovy expression that coerce the result into the returnType- Parameters:
shell- , the Groovy shell use for script evaluationresult- , the evaluation resultreturnType- , expected expression return type- Returns:
- the result with the expected type or a
GroovyCastExceptionif the coercion fails - Throws:
java.lang.ClassNotFoundExceptionSCacheException
-
mustPutEvaluatedExpressionInContext
public boolean mustPutEvaluatedExpressionInContext()
Description copied from interface:ExpressionExecutorStrategyShould we put the evaluated expressions of this strategy in the evaluation context?- Specified by:
mustPutEvaluatedExpressionInContextin interfaceExpressionExecutorStrategy
-
-