Class WorkflowTaskService

java.lang.Object
com.axelor.workflow.task.WorkflowTaskService
All Implemented Interfaces:
TaskBoundaryDelivery, RecordWake

public class WorkflowTaskService extends Object implements RecordWake, TaskBoundaryDelivery
Claims, completes and governs approvals, resuming the parked workflow when one closes.
  • Constructor Details

    • WorkflowTaskService

      public WorkflowTaskService()
  • Method Details

    • label

      public String label()
      Description copied from interface: RecordWake
      Names this source in the orchestrator's log when it fails.
      Specified by:
      label in interface RecordWake
    • wake

      public void wake(RecordRef record)
      Description copied from interface: RecordWake
      Re-check whatever this source watches for one record, resuming what has become due.
      Specified by:
      wake in interface RecordWake
    • canAct

      public boolean canAct(MetaWorkflowTask task, User user)
      Whether user may act: the assignee, a member of the assigned role or group, or an admin.
    • ownsTask

      public boolean ownsTask(MetaWorkflowTask task, User user)
      Whether user owns the task now: its assignee, the user who claimed it, or an admin. Acting requires ownership, so a candidate claims first.
    • claim

      public MetaWorkflowTask claim(Long taskId, User user)
      Claim a pooled task with a conditional update; a no-op when this user already holds it.
    • complete

      public WorkflowResult complete(Long taskId, String comment, User user)
      Complete a task and resume from its next. Refused with WorkflowTaskConditionNotMet while its when does not hold on the record now.
    • reject

      public WorkflowResult reject(Long taskId, String comment, User user)
      Reject a task and resume from its next; routing on the rejection is the graph's. Refused when the node disallows rejection.
    • reassign

      public MetaWorkflowTask reassign(Long taskId, User toUser, Role toRole, Group toGroup, User by)
      Reassign a pending task to a user, role or group, clearing any claim.
    • cancel

      public MetaWorkflowTask cancel(Long taskId, User by)
      Admin: abandon the run without resuming it. Refused when the node disallows cancelling; read from the task's snapshot so a task whose workflow no longer compiles can still be cleared.
    • forceComplete

      public WorkflowResult forceComplete(Long taskId, String comment, User by)
      Admin: force completion past assignment and when. Refused only when the node disallows it.
    • interruptTask

      public WorkflowResult interruptTask(Long taskId)
      Take the boundary whose deadline came due on a parked approval, for the scheduler. The approval is withdrawn, not answered, and the walk leaves by the boundary.
    • takeBoundary

      public WorkflowResult takeBoundary(Long taskId, String boundaryId, MessageDelivery message)
      Take a named boundary on a parked approval, for a message that matched its subscription.
      Specified by:
      takeBoundary in interface TaskBoundaryDelivery
    • resumeConditionTasksForRecord

      public void resumeConditionTasksForRecord(RecordRef record)
      Record-change wake for approvals: re-check each pending autoComplete task on the record, its condition boundaries first, and complete it on the spot when its when holds. A failing task is logged and skipped.
    • commentRequired

      public static boolean commentRequired(MetaWorkflowTask task, String action)
      Whether action ("complete" or "reject") needs a comment, per the task's commentMode, which defaults to "reject". Public for the views, which open the comment dialog only when one is needed.
    • isAdmin

      public static boolean isAdmin(User user)