Class NodeRunBuffer

java.lang.Object
com.axelor.workflow.history.NodeRunBuffer

public final class NodeRunBuffer extends Object
Collects one row per node visited in the run in progress and writes them once, when the run finalizes.

Below trace level nodes only nodes that can park are kept, so a run waiting on a person or a timer is findable at any level. Rows are written only under a run row; a flush without one is dropped with a warning.

  • Constructor Details

  • Method Details

    • enter

      public NodeRunBuffer.Entry enter(String nodeId, String nodePath, String nodeType, String nodeTitle)
      Starts recording a visit. Every visit is buffered, since whether one is kept is known only once it ends; flush() keeps, below nodes, the ones a run's path branches at -- a park, a failure, a split's decision -- the stretches between them having one way through.
    • exit

      public void exit(NodeRunBuffer.Entry entry, WorkflowNodeRunStatus status, String errorMessage)
      Closes a visit with its outcome. The pass number is settled here because a re-fire absorbed by an open approval is not a pass.
    • exit

      public void exit(NodeRunBuffer.Entry entry, WorkflowNodeRunStatus status, String errorMessage, String parkKey)
      Closes a visit that parked, recording its park key. Only the open parked row carries the key; flush() uses it to link the row to its MetaWorkflowPark.
    • took

      public void took(NodeRunBuffer.Entry entry, List<String> flowIds)
      Records the flows a split's visit took.
    • caughtBy

      public void caughtBy(NodeRunBuffer.Entry entry, String boundaryId)
      Records the boundary that caught this visit's failure and took the run on from there.
    • discard

      public void discard(NodeRunBuffer.Entry entry)
      Forgets a visit that only re-asked a wait's condition; the park's own row is the visit.
    • cancelPark

      public void cancelPark(String parkKey)
      Rewrites the buffered visit that opened this park as cancelled, for a park the same walk decided against: a branch that lost its race, or an approval still open when a terminate end ended the run.
    • assignToken

      public void assignToken(String parkKey, Long tokenId)
      Attach a branch to the buffered visit that opened this park, before the rows are written.
    • passesSoFar

      public int passesSoFar(String nodeId, String nodePath)
      How many passes over this node the run has completed, counted across resumes.
    • isEmpty

      public boolean isEmpty()
      Whether anything is waiting to be written.
    • flushTo

      public void flushTo(Long runId)
      Writes the buffered visits against a run whose row was written only once its walk had ended, as a failed run's is on the lazy path.
    • flush

      public void flush()
      Writes the buffered visits against their run and clears them. Never throws: losing history must not fail a workflow that has already done its work.