@PublicAPI public class FlowScript extends Script<FlowAction>
This class wraps information around a Script
to determine which FlowAction
is attached to this script.
When using the action type FlowActionType.REPLICATE
, the value of the
replicateRunsVariable
determines the number of parallel runs.
FlowAction
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
branchSelectionVariable
Name of the variable to set in the script to determine
which one of the IF or ELSE branch is selected in an IF
control flow action
|
static String |
elseBranchSelectedVariable
Value to set
branchSelectionVariable to
signify the ELSE branch should be selected |
static String |
ifBranchSelectedVariable
Value to set
branchSelectionVariable to
signify the IF branch should be selected |
static String |
loopVariable
Name of the boolean variable to set in the script to determine
if a LOOP action is enabled or if the execution should continue
|
static String |
replicateRunsVariable
Name of the Integer variable to set in the script to determine
the number of parallel runs of a REPLICATE action
|
static String |
resultVariable
Name of the variable that will be set in the script's environment
to contain the result of the Task executed along this script
|
ARGUMENTS_NAME, DEFAULT_OUTPUT_MAX_SIZE, id, logger, MD5, parameters, script, scriptEngineLookupName, url
Constructor and Description |
---|
FlowScript()
Hibernate default constructor,
use
createContinueFlowScript() ,
createLoopFlowScript(Script, String) or
createReplicateFlowScript(Script) to
create a FlowScript |
FlowScript(FlowScript fl)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
static FlowScript |
createContinueFlowScript() |
static FlowScript |
createIfFlowScript(Script<?> script,
String targetIf,
String targetElse,
String targetCont)
Creates a Control Flow Script configured to perform an IF control flow action
|
static FlowScript |
createIfFlowScript(String script,
String targetIf,
String targetElse,
String targetCont)
Creates a Control Flow Script configured to perform an IF control flow action
the code will be run using a javascript engine
|
static FlowScript |
createIfFlowScript(String script,
String engine,
String targetIf,
String targetElse,
String targetCont)
Creates a Control Flow Script configured to perform an IF control flow action
|
static FlowScript |
createLoopFlowScript(Script<?> script,
String target)
Creates a Control Flow Script configured to perform a LOOP control flow action
|
static FlowScript |
createLoopFlowScript(String script,
String target)
Creates a Control Flow Script configured to perform a LOOP control flow action
the code will be run using a javascript engine
|
static FlowScript |
createLoopFlowScript(String script,
String engine,
String target)
Creates a Control Flow Script configured to perform a LOOP control flow action
|
static FlowScript |
createReplicateFlowScript(Script<?> script)
Creates a Control Flow Script configured to perform a REPLICATE control flow action
|
static FlowScript |
createReplicateFlowScript(String script)
Creates a Control Flow Script configured to perform a REPLICATE control flow action
the code will be run using a javascript engine
|
static FlowScript |
createReplicateFlowScript(String script,
String engine)
Creates a Control Flow Script configured to perform a Replicate control flow action
|
String |
getActionContinuation()
If the Action type (see
getActionType() ) of this FlowScript
is FlowActionType.IF , the targetContinuation is the Task on which both
if and else branches will join after either one has been executed. |
String |
getActionTarget()
If the Action type (see
getActionType() ) of this FlowScript
is FlowActionType.LOOP , the target is the entry point of the next loop iteration. |
String |
getActionTargetElse()
If the Action type (see
getActionType() ) of this FlowScript
is FlowActionType.IF , the targetElse is the branch executed when
the If condition fails. |
String |
getActionType()
The Action Type does not have any effect on the execution of the script,
but will be used after the execution to determine what Control Flow Action
should be performed on the TaskFlow.
|
protected String |
getDefaultScriptName() |
String |
getId()
String identifying the script.
|
protected Reader |
getReader()
The reader used to read the script.
|
protected ScriptResult<FlowAction> |
getResult(Object evalResult,
Bindings bindings)
Return the variable awaited from the script execution
|
protected void |
prepareSpecialBindings(Bindings bindings)
Specify the variable awaited from the script execution
|
void |
setActionContinuation(String target)
If the Action type (see
getActionType() ) of this FlowScript
is FlowActionType.IF , the targetContinuation is the Task on which both
if and else branches will join after either one has been executed. |
void |
setActionContinuation(Task target)
If the Action type (see
getActionType() ) of this FlowScript
is FlowActionType.IF , the targetContinuation is the Task on which both
if and else branches will join after either one has been executed. |
void |
setActionTarget(String target)
If the Action type (see
getActionType() ) of this FlowScript
is FlowActionType.LOOP , the target is the entry point of the next loop iteration. |
void |
setActionTarget(Task target)
If the Action type (see
getActionType() ) of this FlowScript
is FlowActionType.LOOP , the target is the entry point of the next loop iteration. |
void |
setActionTargetElse(String target)
If the Action type (see
getActionType() ) of this FlowScript
is FlowActionType.IF , the targetElse is the branch executed when
the If condition fails. |
void |
setActionTargetElse(Task target)
If the Action type (see
getActionType() ) of this FlowScript
is FlowActionType.IF , the targetElse is the branch executed when
the If condition fails. |
void |
setActionType(FlowActionType type)
The Action Type does not have any effect on the execution of the script,
but will be used after the execution to determine what Control Flow Action
should be performed on the TaskFlow.
|
void |
setActionType(String actionType)
The Action Type does not have any effect on the execution of the script,
but will be used after the execution to determine what Control Flow Action
should be performed on the TaskFlow.
|
createScriptEngine, digest, display, equals, execute, execute, fetchScript, fetchScriptWithExceptionHandling, fetchUrlIfNeeded, getEngineName, getParameters, getScript, getScriptName, getScriptUrl, hashCode, overrideDefaultScriptName, prepareBindings, readFile, setScript, toString
public static final String resultVariable
public static final String loopVariable
public static final String replicateRunsVariable
public static final String branchSelectionVariable
public static final String ifBranchSelectedVariable
branchSelectionVariable
to
signify the IF branch should be selectedpublic static final String elseBranchSelectedVariable
branchSelectionVariable
to
signify the ELSE branch should be selectedpublic FlowScript()
createContinueFlowScript()
,
createLoopFlowScript(Script, String)
or
createReplicateFlowScript(Script)
to
create a FlowScriptpublic FlowScript(FlowScript fl) throws InvalidScriptException
fl
- Source scriptInvalidScriptException
protected String getDefaultScriptName()
getDefaultScriptName
in class Script<FlowAction>
public static FlowScript createContinueFlowScript() throws InvalidScriptException
InvalidScriptException
public static FlowScript createLoopFlowScript(String script, String target) throws InvalidScriptException
script
- code of the Javascript scripttarget
- target of the LOOP actionInvalidScriptException
public static FlowScript createLoopFlowScript(String script, String engine, String target) throws InvalidScriptException
script
- code of the scriptengine
- engine running the scripttarget
- target of the LOOP actionInvalidScriptException
public static FlowScript createLoopFlowScript(Script<?> script, String target) throws InvalidScriptException
script
- the script to executetarget
- target of the LOOP actionInvalidScriptException
public static FlowScript createIfFlowScript(String script, String targetIf, String targetElse, String targetCont) throws InvalidScriptException
script
- code of the Javascript scripttargetIf
- IF branchtargetElse
- ELSE branchtargetCont
- CONTINUATION branch, can be nullInvalidScriptException
public static FlowScript createIfFlowScript(String script, String engine, String targetIf, String targetElse, String targetCont) throws InvalidScriptException
script
- code of the scriptengine
- engine running the scripttargetIf
- IF branchtargetElse
- ELSE branchtargetCont
- CONTINUATION branch, can be nullInvalidScriptException
public static FlowScript createIfFlowScript(Script<?> script, String targetIf, String targetElse, String targetCont) throws InvalidScriptException
script
- the script to executetargetIf
- IF branchtargetElse
- ELSE branchtargetCont
- CONTINUATION branch, can be nullInvalidScriptException
public static FlowScript createReplicateFlowScript(String script) throws InvalidScriptException
script
- code of the Javascript scriptInvalidScriptException
public static FlowScript createReplicateFlowScript(String script, String engine) throws InvalidScriptException
script
- code of the scriptengine
- engine running the scriptInvalidScriptException
public static FlowScript createReplicateFlowScript(Script<?> script) throws InvalidScriptException
script
- the script to executeInvalidScriptException
public void setActionType(String actionType)
actionType
- the String representation of the new ActionType of this script,FlowActionType.parse(String)
public void setActionType(FlowActionType type)
type
- the ActionType of this script,public String getActionType()
FlowActionType.parse(String)
public void setActionTarget(String target)
getActionType()
) of this FlowScript
is FlowActionType.LOOP
, the target is the entry point of the next loop iteration.
If the Action type is FlowActionType.IF
, the target is the branch executed when
the If condition succeeds.
This value has no effect on the execution of the script
target
- the main target of the action of this script.public void setActionTarget(Task target)
getActionType()
) of this FlowScript
is FlowActionType.LOOP
, the target is the entry point of the next loop iteration.
If the Action type is FlowActionType.IF
, the target is the branch executed when
the If condition succeeds.
This value has no effect on the execution of the script
target
- the main target of the action of this script.public String getActionTarget()
getActionType()
) of this FlowScript
is FlowActionType.LOOP
, the target is the entry point of the next loop iteration.
If the Action type is FlowActionType.IF
, the target is the branch executed when
the If condition succeeds.
This value has no effect on the execution of the script
public void setActionTargetElse(String target)
getActionType()
) of this FlowScript
is FlowActionType.IF
, the targetElse is the branch executed when
the If condition fails.
This value has no effect on the execution of the script
target
- the Else target of the action of this scriptpublic void setActionTargetElse(Task target)
getActionType()
) of this FlowScript
is FlowActionType.IF
, the targetElse is the branch executed when
the If condition fails.
This value has no effect on the execution of the script
target
- the Else target of the action of this scriptpublic String getActionTargetElse()
getActionType()
) of this FlowScript
is FlowActionType.IF
, the targetElse is the branch executed when
the If condition fails.
This value has no effect on the execution of the script
public void setActionContinuation(String target)
getActionType()
) of this FlowScript
is FlowActionType.IF
, the targetContinuation is the Task on which both
if and else branches will join after either one has been executed.
This value has no effect on the execution of the script
target
- the Continuation target of the action of this scriptpublic void setActionContinuation(Task target)
getActionType()
) of this FlowScript
is FlowActionType.IF
, the targetContinuation is the Task on which both
if and else branches will join after either one has been executed.
This value has no effect on the execution of the script
target
- the Continuation target of the action of this scriptpublic String getActionContinuation()
getActionType()
) of this FlowScript
is FlowActionType.IF
, the targetContinuation is the Task on which both
if and else branches will join after either one has been executed.
This value has no effect on the execution of the script
public String getId()
Script
getId
in class Script<FlowAction>
protected Reader getReader()
Script
getReader
in class Script<FlowAction>
protected ScriptResult<FlowAction> getResult(Object evalResult, Bindings bindings)
Script
getResult
in class Script<FlowAction>
protected void prepareSpecialBindings(Bindings bindings)
Script
prepareSpecialBindings
in class Script<FlowAction>