Class WorkflowStateService

java.lang.Object
com.axelor.workflow.trigger.WorkflowStateService

public class WorkflowStateService extends Object
Manages the MetaWorkflowState rows of once and timer workflows, unique on (workflow, recordId). Tenants live in separate databases, so there is no tenant column.
  • Constructor Details

    • WorkflowStateService

      public WorkflowStateService()
  • Method Details

    • claimOnce

      public MetaWorkflowState claimOnce(WorkflowEvent event, MetaWorkflow def)
      Claim the once budget for a record: the claimed row, now running, or null when the budget is spent or a run is in flight. Taken under a row lock, so a concurrent caller waits and then skips.
    • markOnceDone

      public void markOnceDone(WorkflowEvent event, MetaWorkflow def)
      Spend the once budget directly, for an ungated programmatic run.
    • markDone

      public void markDone(MetaWorkflowState state)
      Finalize a successful once run: the budget is consumed.
    • release

      public void release(MetaWorkflowState state)
      Release a claim after a failed run so the once budget is preserved.
    • activate

      public void activate(WorkflowEvent event, MetaWorkflow def, WorkflowPlan.StartPlan start)
      Arm a timer workflow: record when and until when, opening a new episode.
    • deactivate

      public void deactivate(WorkflowEvent event, MetaWorkflow def)
      Disarm a time workflow when its condition goes false; the episode resets.