Class WorkflowTaskQueries

java.lang.Object
com.axelor.workflow.task.WorkflowTaskQueries

public class WorkflowTaskQueries extends Object
What the approval inbox reads: which tasks a user may act on, the rows of a record's approvals dropdown, which buttons a task offers, and why one is out of reach.
  • Constructor Details

    • WorkflowTaskQueries

      public WorkflowTaskQueries()
  • Method Details

    • myTasksDomain

      public WorkflowTaskQueries.MyTasksQuery myTasksDomain(User user)
      Tasks a user may act on: pending and assigned to them, claimed by them, or unclaimed and offered to one of their roles or their group. Role membership cannot be written in a static domain, so the ids are returned for binding.
    • countMine

      public long countMine(User user)
      Pending tasks user may act on; 0 for no user.
    • pendingCount

      public long pendingCount(String model, Long recordId)
      Pending approvals on one business record.
    • rowsForRecord

      public List<Map<String,Object>> rowsForRecord(String model, Long recordId, User user)
      The pending tasks on one record as rows for its approvals dropdown, with the action flags worked out here so the client never decides who may act.
    • blockedReason

      public String blockedReason(MetaWorkflowTask task, boolean canAct, boolean owns)
      Why the current user cannot act on this task, or null when they can, from most to least specific: the assignee, the claimer, a hint to claim, then the pool.
    • visibility

      The buttons task offers user, from what the task service says they may do.
    • buttonVisibility

      public WorkflowTaskQueries.ButtonVisibility buttonVisibility(MetaWorkflowTask task, boolean canAct, boolean owns, boolean isAdmin)
      The buttons a task offers, from its state and three precomputed facts:
      • not pending: none
      • claim: a pooled, unclaimed task the user may act on
      • complete, reassign: the owner
      • reject: the owner, where the node allows it
      • cancel, force complete: an admin, where the node allows it

      The node's restrictions are snapshotted on the task, since a view has no plan.

    • canReadRecord

      public boolean canReadRecord(MetaWorkflowTask task)
      Whether the current user may read the task's record, checked per operation since a task points at its record polymorphically. Uses the persisted task's model and id, not the client's.
    • workflowModels

      public List<String> workflowModels()
      Models with at least one active workflow, so the client skips the approvals query elsewhere.