Class WorkflowSplitService

java.lang.Object
com.axelor.workflow.split.WorkflowSplitService

public class WorkflowSplitService extends Object
Writes down where a split's branches got to once one of them has to wait. A split that finishes in one pass writes nothing; once a branch parks, every branch of the activation gets a row so the join can count them.
  • Constructor Details

    • WorkflowSplitService

      public WorkflowSplitService()
  • Method Details

    • materialize

      public MetaWorkflowSplit materialize(Long runId, String splitNode, String joinNode, Integer threshold, int selected, MetaWorkflowBranch parentToken, List<WorkflowSplitService.BranchOutcome> outcomes)
      Record one activation of a split and a branch row for each of its branches.
      Parameters:
      threshold - the arrivals its join waits for, or null for all
      selected - how many flows the split activated, stored because losers' rows no longer say
      parentToken - the branch this split sits inside, when nested; null at the top level
      Returns:
      the activation, with its branches saved
    • materialize

      public MetaWorkflowSplit materialize(Long runId, String splitNode, String joinNode, String nodePath, Integer threshold, int selected, MetaWorkflowBranch parentToken, List<WorkflowSplitService.BranchOutcome> outcomes, WorkflowSplitService.RegionPark regionPark)
      The same for a subflow's region: nodePath is the subflow node whose body the branches walk; null for a split.
    • closeRegionPark

      public void closeRegionPark(MetaWorkflowSplit split)
      Close a region's park on every way out, so no deadline stays due for a region already left.
    • repark

      public void repark(MetaWorkflowBranch branch, String currentNode, String parkKey, LocalDateTime wakeAt, boolean blocked, String vars, String bindings)
      A branch resumed and stopped again before its join: move its row to where the walk got to, still owed.
      Parameters:
      blocked - whether it stopped on a split of its own rather than a person or a timer
      vars - a region branch's own frame as JSON to carry across the park; null keeps the row's
      bindings - what the walk read as agent, task and error, as JSON
    • parkKeysOf

      public static List<String> parkKeysOf(List<WorkflowSplitService.BranchOutcome> outcomes)
      Every park key under these outcomes, however deeply nested.
    • openRegionOf

      public MetaWorkflowSplit openRegionOf(Long runId, String nodeId)
      The open activation of one subflow node in one run, or null.
    • finishBranches

      public void finishBranches(List<MetaWorkflowBranch> branches, WorkflowBranchStatus status)
      Move every branch that did not fail or get cancelled to status. When the activation fails or is cancelled, a branch that already finished keeps that, so it is not shown failing or losing work it did.
    • branchesOf

      public List<MetaWorkflowBranch> branchesOf(MetaWorkflowSplit split)
      The branches of this activation, whatever state they are in.