Package com.axelor.workflow.history
Class WorkflowRunService
java.lang.Object
com.axelor.workflow.history.WorkflowRunService
Persists workflow run history. Failed and parked runs are always recorded; successful and skipped
runs only when
workflow.trace asks for them (see WorkflowTraceLevel).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbegin(MetaWorkflow def, String model, Long recordId, TriggerKind trigger, Long episode, Long parentRunId, String subflowNode, String callerParkKey) Begins a run row whatever the trace level, for a run that must exist before its outcome is known: a parent for child runs, or a row to link node visits to.beginFrom(MetaWorkflowRun host, String subflowNode) Begins a non-cancelling boundary's escape branch, copying the host run's pinned identity (xmlId, revision, name, model, jsonModel) so it walks the host's revision.voidcancelParkedVisits(Collection<MetaWorkflowBranch> branches) Rewrites the visits these branches were parked at as cancelled, for branches taken down after their walk committed: a race loser, or seats still open when a quorum is met or a veto ends the run.voidcloseHeldVisit(MetaWorkflowSplit split, WorkflowNodeRunStatus status, String error, String viaBoundary) Closes the visit of a subflow or iterating call left waiting on its elements, once the activation they were written into is over: completed when they settled or a boundary led away, failed when one of them failed.voidfinish(MetaWorkflowRun run, WorkflowResult result) Finishes a run begun withbegin(com.axelor.meta.db.MetaWorkflow, java.lang.String, java.lang.Long, com.axelor.meta.schema.workflows.TriggerKind, java.lang.Long, java.lang.Long, java.lang.String, java.lang.String), whatever the trace level.recordFailure(MetaWorkflow def, String model, Long recordId, TriggerKind trigger, WorkflowResult result, LocalDateTime startedAt, Long episode) Record a failed run.voidrecordSkipped(MetaWorkflow def, String model, Long recordId, TriggerKind trigger, String reason, Long episode) Records a run rejected before executing, such as by the re-entrancy guard.voidstitchResume(String parkKey) Closes the open park identified byparkKey, stamping when it resumed and how long it waited.voidstitchResume(String parkKey, String viaBoundary)
-
Constructor Details
-
WorkflowRunService
public WorkflowRunService()
-
-
Method Details
-
begin
public MetaWorkflowRun begin(MetaWorkflow def, String model, Long recordId, TriggerKind trigger, Long episode, Long parentRunId, String subflowNode, String callerParkKey) Begins a run row whatever the trace level, for a run that must exist before its outcome is known: a parent for child runs, or a row to link node visits to. -
beginFrom
Begins a non-cancelling boundary's escape branch, copying the host run's pinned identity (xmlId, revision, name, model, jsonModel) so it walks the host's revision.- Parameters:
subflowNode- the boundary's own id, never the host's node id:WorkflowWaitService.resumeCaller(com.axelor.meta.db.MetaWorkflowRun)tells a call's child from an escape branch by this never matching the host's current node
-
finish
Finishes a run begun withbegin(com.axelor.meta.db.MetaWorkflow, java.lang.String, java.lang.Long, com.axelor.meta.schema.workflows.TriggerKind, java.lang.Long, java.lang.Long, java.lang.String, java.lang.String), whatever the trace level.A terminal result is held at "waiting" while an escape branch this run spawned is still live;
settleAsLastBranch(com.axelor.meta.db.MetaWorkflowRun)applies it when the last branch finishes. Such a run is told apart from a real park by having no park key and no open approval (isParked(com.axelor.meta.db.MetaWorkflowRun)). -
recordFailure
public MetaWorkflowRun recordFailure(MetaWorkflow def, String model, Long recordId, TriggerKind trigger, WorkflowResult result, LocalDateTime startedAt, Long episode) Record a failed run. Always persisted (not gated onworkflow.trace). -
recordSkipped
public void recordSkipped(MetaWorkflow def, String model, Long recordId, TriggerKind trigger, String reason, Long episode) Records a run rejected before executing, such as by the re-entrancy guard. Skipped unlessworkflow.traceis at leastruns, since a workflow saving its own record yields one per run. -
stitchResume
Closes the open park identified byparkKey, stamping when it resumed and how long it waited. Never throws: a woken run must not fail over a timestamp. -
stitchResume
- Parameters:
viaBoundary- the boundary that ended this park, or null when the node's own trigger did; two boundaries may lead to the same node, so the next row cannot tell
-
cancelParkedVisits
Rewrites the visits these branches were parked at as cancelled, for branches taken down after their walk committed: a race loser, or seats still open when a quorum is met or a veto ends the run. The committed counterpart ofNodeRunBuffer.cancelPark(java.lang.String). -
closeHeldVisit
public void closeHeldVisit(MetaWorkflowSplit split, WorkflowNodeRunStatus status, String error, String viaBoundary) Closes the visit of a subflow or iterating call left waiting on its elements, once the activation they were written into is over: completed when they settled or a boundary led away, failed when one of them failed. It has no park of its own to stitch, so it is found through the activation: its node, on the branch the activation hangs from.- Parameters:
error- the failure to record, or nullviaBoundary- the boundary that led away, or null
-