Class WorkflowExecutor

java.lang.Object
com.axelor.workflow.exec.WorkflowExecutor

public class WorkflowExecutor extends Object
Walks a workflow's graph for one record. It does not evaluate triggers, apply repeat policy or record the run; those belong to the dispatch and the runner.
  • Constructor Details

    • WorkflowExecutor

      public WorkflowExecutor()
  • Method Details

    • run

      public WorkflowResult run(WorkflowPlan plan, RecordRef record)
      Run with no triggering event.
    • run

      public WorkflowResult run(WorkflowPlan plan, RecordRef record, WorkflowEvent event)
      Parameters:
      record - the record to walk
      event - the triggering snapshot, read as event.self/event.old; null for a timer or programmatic run
    • resume

      public WorkflowResult resume(WorkflowPlan plan, RecordRef record, String fromNodeId, Map<String,Object> taskBinding, Long runId, MessageDelivery delivery)
      Resume a parked run from fromNodeId: the record is reloaded, the closed task is bound as task, and the run's variables are read back from its row.
    • resume

      public WorkflowResult resume(WorkflowPlan plan, RecordRef record, String fromNodeId, Map<String,Object> taskBinding, Long runId, MetaWorkflowBranch token, MessageDelivery delivery)
      Resume one branch of a split, which stops at the branch's join rather than running to an end.
      Parameters:
      token - the branch being continued, or null for a run's own resume
      delivery - the message that woke this walk, or null; it lives for this walk only
    • resumeFromJoin

      public WorkflowResult resumeFromJoin(WorkflowPlan plan, RecordRef record, String joinNode, Long runId, MetaWorkflowBranch token)
      Go on from a join its branches released. Nothing is restored as agent, task or error: no single branch's answer is the one to read after it.
    • resumeCaught

      public WorkflowResult resumeCaught(WorkflowPlan plan, RecordRef record, String fromNodeId, Long runId, MetaWorkflowBranch token, String message, String code)
      Continue at the boundary that caught a failure after a park, with the failure bound as error as it is when the boundary catches it on the spot.
    • walkBody

      public WorkflowExecutor.BodyWalk walkBody(WorkflowPlan body, String nodePath, RecordRef record, WorkflowRunContext caller)
      Walk an embedded body as one thread of a subflow's region, inside the run already walking. It has its own context (self is the element, parent the caller, its own variable frame) but the caller's run, so its parks and approvals belong to the run. Walked with the split depth raised, so a park belongs to the branch written for it.
    • mergeRunVars

      public static void mergeRunVars(Long runId, String nodeId, Map<String,Object> written)
      Merge written into the run's variables, as storeVars(java.lang.Long, com.axelor.workflow.exec.WorkflowResult, java.util.Map<java.lang.String, java.lang.Object>) does; also used by the join.
    • evaluateCondition

      public boolean evaluateCondition(WorkflowPlan plan, RecordRef record, String nodeId, String expr)
      Evaluate one node's condition against the record in a walk's scope, without walking; used to re-check a task's when before an approval is accepted.
    • rearmDeadlines

      public Map<String,LocalDateTime> rearmDeadlines(WorkflowPlan plan, String model, String jsonModel, Long recordId, String nodeId, List<WorkflowPlan.Boundary> boundaries, String parkKey, Map<String,LocalDateTime> armed)
      Re-read a park's until deadlines from the record, for an approval or a call, which a record change cannot re-enter. One context for all of the park's boundaries.
      Returns:
      the deadlines as they now stand, equal to armed when nothing moved or the record has gone
    • renderText

      public String renderText(WorkflowPlan plan, RecordRef record, String nodeId, String text)
      Render one node's prose against the record, as a task's <blocked> message. Returns the text unrendered when the record has gone; a bad placeholder throws.