Package org.camunda.bpm.engine.impl.util
Class ScriptUtil
- java.lang.Object
-
- org.camunda.bpm.engine.impl.util.ScriptUtil
-
public final class ScriptUtil extends java.lang.Object
- Author:
- Sebastian Menski
-
-
Constructor Summary
Constructors Constructor Description ScriptUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ExecutableScript
getScript(java.lang.String language, java.lang.String source, java.lang.String resource, ExpressionManager expressionManager)
Creates a newExecutableScript
from a source or resource.static ExecutableScript
getScript(java.lang.String language, java.lang.String source, java.lang.String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory)
Creates a newExecutableScript
from a source or resource.static ScriptFactory
getScriptFactory()
Returns the configured script factory in the context or a new one.static ExecutableScript
getScriptFormSource(java.lang.String language, java.lang.String source, ExpressionManager expressionManager, ScriptFactory scriptFactory)
Creates a newExecutableScript
from a source.static ExecutableScript
getScriptFromResource(java.lang.String language, java.lang.String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory)
Creates a newExecutableScript
from a resource.static ExecutableScript
getScriptFromResource(java.lang.String language, java.lang.String resource, ScriptFactory scriptFactory)
Creates a newExecutableScript
from a static resource.static ExecutableScript
getScriptFromResourceExpression(java.lang.String language, Expression resourceExpression, ScriptFactory scriptFactory)
Creates a newExecutableScript
from a dynamic resource.static ExecutableScript
getScriptFromSource(java.lang.String language, java.lang.String source, ScriptFactory scriptFactory)
Creates a newExecutableScript
from a static source.static ExecutableScript
getScriptFromSourceExpression(java.lang.String language, Expression sourceExpression, ScriptFactory scriptFactory)
Creates a newExecutableScript
from a dynamic source.static boolean
isDynamicScriptExpression(java.lang.String language, java.lang.String value)
Checks if the value is an expression for a dynamic script source or resource.
-
-
-
Method Detail
-
getScript
public static ExecutableScript getScript(java.lang.String language, java.lang.String source, java.lang.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(java.lang.String language, java.lang.String source, java.lang.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(java.lang.String language, java.lang.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(java.lang.String language, java.lang.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(java.lang.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(java.lang.String language, java.lang.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(java.lang.String language, java.lang.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(java.lang.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
public static boolean isDynamicScriptExpression(java.lang.String language, java.lang.String value)
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
public static ScriptFactory getScriptFactory()
Returns the configured script factory in the context or a new one.
-
-