Package org.camunda.bpm.engine.impl.util
Class ScriptUtil
java.lang.Object
org.camunda.bpm.engine.impl.util.ScriptUtil
- Author:
- Sebastian Menski
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutableScript
getScript
(String language, String source, String resource, ExpressionManager expressionManager) Creates a newExecutableScript
from a source or resource.static ExecutableScript
getScript
(String language, String source, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) Creates a newExecutableScript
from a source or resource.static ScriptFactory
Returns the configured script factory in the context or a new one.static ExecutableScript
getScriptFormSource
(String language, String source, ExpressionManager expressionManager, ScriptFactory scriptFactory) Creates a newExecutableScript
from a source.static ExecutableScript
getScriptFromResource
(String language, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) Creates a newExecutableScript
from a resource.static ExecutableScript
getScriptFromResource
(String language, String resource, ScriptFactory scriptFactory) Creates a newExecutableScript
from a static resource.static ExecutableScript
getScriptFromResourceExpression
(String language, Expression resourceExpression, ScriptFactory scriptFactory) Creates a newExecutableScript
from a dynamic resource.static ExecutableScript
getScriptFromSource
(String language, String source, ScriptFactory scriptFactory) Creates a newExecutableScript
from a static source.static ExecutableScript
getScriptFromSourceExpression
(String language, Expression sourceExpression, ScriptFactory scriptFactory) Creates a newExecutableScript
from a dynamic source.static boolean
isDynamicScriptExpression
(String language, String value) Checks if the value is an expression for a dynamic script source or resource.
-
Constructor Details
-
ScriptUtil
public ScriptUtil()
-
-
Method Details
-
getScript
public static ExecutableScript getScript(String language, String source, String resource, ExpressionManager expressionManager) Creates a newExecutableScript
from a source or resource. It excepts static and dynamic sources and resources. Dynamic means that the source or resource is an expression which will be evaluated during execution.- Parameters:
language
- the language of the scriptsource
- the source code of the script or an expression which evaluates to the source coderesource
- the resource path of the script code or an expression which evaluates to the resource pathexpressionManager
- the expression manager to use to generate the expressions of dynamic scripts- Returns:
- the newly created script
- Throws:
NotValidException
- if language is null or empty or both of source and resource are null or empty
-
getScript
public static ExecutableScript getScript(String language, String source, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) Creates a newExecutableScript
from a source or resource. It excepts static and dynamic sources and resources. Dynamic means that the source or resource is an expression which will be evaluated during execution.- Parameters:
language
- the language of the scriptsource
- the source code of the script or an expression which evaluates to the source coderesource
- the resource path of the script code or an expression which evaluates to the resource pathexpressionManager
- the expression manager to use to generate the expressions of dynamic scriptsscriptFactory
- the script factory used to create the script- Returns:
- the newly created script
- Throws:
NotValidException
- if language is null or empty or both of source and resource are invalid
-
getScriptFormSource
public static ExecutableScript getScriptFormSource(String language, String source, ExpressionManager expressionManager, ScriptFactory scriptFactory) Creates a newExecutableScript
from a source. It excepts static and dynamic sources. Dynamic means that the source is an expression which will be evaluated during execution.- Parameters:
language
- the language of the scriptsource
- the source code of the script or an expression which evaluates to the source codeexpressionManager
- the expression manager to use to generate the expressions of dynamic scriptsscriptFactory
- the script factory used to create the script- Returns:
- the newly created script
- Throws:
NotValidException
- if language is null or empty or source is null
-
getScriptFromSource
public static ExecutableScript getScriptFromSource(String language, String source, ScriptFactory scriptFactory) Creates a newExecutableScript
from a static source.- Parameters:
language
- the language of the scriptsource
- the source code of the scriptscriptFactory
- the script factory used to create the script- Returns:
- the newly created script
- Throws:
NotValidException
- if language is null or empty or source is null
-
getScriptFromSourceExpression
public static ExecutableScript getScriptFromSourceExpression(String language, Expression sourceExpression, ScriptFactory scriptFactory) Creates a newExecutableScript
from a dynamic source. Dynamic means that the source is an expression which will be evaluated during execution.- Parameters:
language
- the language of the scriptsourceExpression
- the expression which evaluates to the source codescriptFactory
- the script factory used to create the script- Returns:
- the newly created script
- Throws:
NotValidException
- if language is null or empty or sourceExpression is null
-
getScriptFromResource
public static ExecutableScript getScriptFromResource(String language, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) Creates a newExecutableScript
from a resource. It excepts static and dynamic resources. Dynamic means that the resource is an expression which will be evaluated during execution.- Parameters:
language
- the language of the scriptresource
- the resource path of the script code or an expression which evaluates to the resource pathexpressionManager
- the expression manager to use to generate the expressions of dynamic scriptsscriptFactory
- the script factory used to create the script- Returns:
- the newly created script
- Throws:
NotValidException
- if language or resource are null or empty
-
getScriptFromResource
public static ExecutableScript getScriptFromResource(String language, String resource, ScriptFactory scriptFactory) Creates a newExecutableScript
from a static resource.- Parameters:
language
- the language of the scriptresource
- the resource path of the script codescriptFactory
- the script factory used to create the script- Returns:
- the newly created script
- Throws:
NotValidException
- if language or resource are null or empty
-
getScriptFromResourceExpression
public static ExecutableScript getScriptFromResourceExpression(String language, Expression resourceExpression, ScriptFactory scriptFactory) Creates a newExecutableScript
from a dynamic resource. Dynamic means that the source is an expression which will be evaluated during execution.- Parameters:
language
- the language of the scriptresourceExpression
- the expression which evaluates to the resource pathscriptFactory
- the script factory used to create the script- Returns:
- the newly created script
- Throws:
NotValidException
- if language is null or empty or resourceExpression is null
-
isDynamicScriptExpression
Checks if the value is an expression for a dynamic script source or resource.- Parameters:
language
- the language of the scriptvalue
- the value to check- Returns:
- true if the value is an expression for a dynamic script source/resource, otherwise false
-
getScriptFactory
Returns the configured script factory in the context or a new one.
-