Package com.axelor.workflow.exec
Class WorkflowRunContext
java.lang.Object
com.axelor.workflow.exec.WorkflowRunContext
- All Implemented Interfaces:
ActivityContext,AutoCloseable
-
Method Summary
Modifier and TypeMethodDescriptionbindings()What this walk reads asagent,taskanderrornow.intHow deep in that cascade this walk is; zero when nothing started it by message.The cascade this walk belongs to, or null.voidclose()The run this walk belongs to, or null before one has been written.intWhich pass over the executing node this is, from 1: durable across resumes for nodes that park, counted within this segment for the rest.Evaluate a split's flow conditions in one call and return the matching indices in order; aonesplit stops at the first match.The branch this walk was resumed from, if any.voidenclosingToken(MetaWorkflowBranch token) voidTrack entering and leaving a split, so a nested park can be recognised.booleanevalCondition(String stepId, String expr) Evaluate a condition: anything but booleantrueis false.Evaluate a JS expression against the read-only scope, as a durable host value.event()voidTell the context which node is about to run, for the bindings that describe it.intbooleaninFork()Whether this walk belongs to a split's branch, walking or resumed; its park then belongs to the branch.The custom model, whenActivityContext.model()is a custom record; else null.voidmodel()The entity class the run is about.nodePath()The subflow node whose body this walk is in, or null for the definition's own graph; stamped on every visit it records.voidnodes()Per-node history for this walk.voidparkedWith(String key) Record that this node parked underkey, for the visit about to be written.recordId()The record the run is about, or null for a run with no record.The record's display name: a custom record's name or the model's name column, or null.static StringrecordNameOf(String model, Long recordId) recordName()for an arbitrary record; seerecordOf(java.lang.String, java.lang.Long).renderTemplate(String stepId, String text) Render a template, evaluating its${expr}spans against this run's scope.voidreParked()Record that this node's existing park was asked again rather than a new one opened.resolveCollection(String stepId, String expr) The recordseachselects; a scalar is refused, sincerecordsays one record.resolveQueryIds(String stepId, String model, String filter, int cap) The ids afilterselects, and the records behind them.resolveRecord(String stepId, String expr) The one persisted recordrecordselects; anything else fails.This run's own record, for a selector-less call; empty only for a run with no record.resolveUser(String stepId, String expr) Evaluateexprand coerce the result to aUser, or null.voidRun a<script>body: it may changeself, build records withcreate(name)and persist them withsave(obj), orsave()forself.voidsetAgentBinding(Map<String, Object> binding) Publish an activity's answer for the nodes after it to read by name.voidsetErrorBinding(String message, String code) Bind the failure a boundary caught aserror: its message, and its code or null.voidsetTaskBinding(Map<String, Object> binding) voidRecord the flows the executing split took, by id; its visit keeps them.vars()The process variables visible at this point, flattened.The definition's name, as authored.The definition's xmlId, or null.
-
Method Details
-
model
Description copied from interface:ActivityContextThe entity class the run is about.- Specified by:
modelin interfaceActivityContext
-
jsonModel
Description copied from interface:ActivityContextThe custom model, whenActivityContext.model()is a custom record; else null.- Specified by:
jsonModelin interfaceActivityContext
-
recordId
Description copied from interface:ActivityContextThe record the run is about, or null for a run with no record.- Specified by:
recordIdin interfaceActivityContext
-
event
-
currentRunId
Description copied from interface:ActivityContextThe run this walk belongs to, or null before one has been written.- Specified by:
currentRunIdin interfaceActivityContext
-
workflowName
Description copied from interface:ActivityContextThe definition's name, as authored.- Specified by:
workflowNamein interfaceActivityContext
-
workflowXmlId
The definition's xmlId, or null.- Specified by:
workflowXmlIdin interfaceActivityContext
-
recordName
The record's display name: a custom record's name or the model's name column, or null.- Specified by:
recordNamein interfaceActivityContext
-
recordNameOf
recordName()for an arbitrary record; seerecordOf(java.lang.String, java.lang.Long). -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
nodes
Per-node history for this walk. -
executing
Tell the context which node is about to run, for the bindings that describe it. -
currentVisit
public int currentVisit()Which pass over the executing node this is, from 1: durable across resumes for nodes that park, counted within this segment for the rest. -
inFork
public boolean inFork()Whether this walk belongs to a split's branch, walking or resumed; its park then belongs to the branch. -
nodePath
The subflow node whose body this walk is in, or null for the definition's own graph; stamped on every visit it records. -
nodePath
-
enclosingToken
The branch this walk was resumed from, if any. -
enclosingToken
-
enterFork
public void enterFork()Track entering and leaving a split, so a nested park can be recognised. -
leaveFork
public void leaveFork() -
forkDepth
public int forkDepth() -
parkedWith
Record that this node parked underkey, for the visit about to be written. -
reParked
public void reParked()Record that this node's existing park was asked again rather than a new one opened. -
splitTook
Record the flows the executing split took, by id; its visit keeps them. -
vars
Description copied from interface:ActivityContextThe process variables visible at this point, flattened.- Specified by:
varsin interfaceActivityContext
-
setAgentBinding
Description copied from interface:ActivityContextPublish an activity's answer for the nodes after it to read by name.- Specified by:
setAgentBindingin interfaceActivityContext
-
bindings
What this walk reads asagent,taskanderrornow. -
setTaskBinding
-
setErrorBinding
Bind the failure a boundary caught aserror: its message, and its code or null. -
cascadeId
The cascade this walk belongs to, or null. A call's child inherits its caller's cascade, so a loop through a call stays bounded, but not itsmessage.- Specified by:
cascadeIdin interfaceActivityContext
-
cascadeDepth
public int cascadeDepth()How deep in that cascade this walk is; zero when nothing started it by message.- Specified by:
cascadeDepthin interfaceActivityContext
-
runScript
Run a<script>body: it may changeself, build records withcreate(name)and persist them withsave(obj), orsave()forself. -
evalExpr
Evaluate a JS expression against the read-only scope, as a durable host value. -
evalCondition
Evaluate a condition: anything but booleantrueis false. -
decide
Evaluate a split's flow conditions in one call and return the matching indices in order; aonesplit stops at the first match. -
renderTemplate
Render a template, evaluating its${expr}spans against this run's scope.- Specified by:
renderTemplatein interfaceActivityContext
-
resolveUser
Evaluateexprand coerce the result to aUser, or null. -
resolveSelf
This run's own record, for a selector-less call; empty only for a run with no record. -
resolveRecord
The one persisted recordrecordselects; anything else fails. -
resolveCollection
The recordseachselects; a scalar is refused, sincerecordsays one record. -
resolveQueryIds
The ids afilterselects, and the records behind them. -
loadByIds
-