Interface ProcessesService


public interface ProcessesService
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Registers the plugin that checks and writes the values a request carries and the form of a process.
    int
    archiveFinishedWorks(long userIdentityId)
    Archives every request the user created that is not archived yet and is finished: decided or cancelled, its task completed, whatever its column.
    archiveWork(long workId, boolean archived, long userIdentityId)
    Archives or restores a request in its requester's « My requests », when the user is its requester: only its record's flag changes, never its task.
    cancelWork(long workId, long userIdentityId)
    Cancels a pending request, when the user is its requester: its record says cancelled, then its task is completed through Task, its column left as it is, the flag written back when the completion fails (ProcessesStorage.saveRequestState(long, Boolean, Boolean, Boolean)); its managers are then notified.
    long
    countProjectRequests(long projectId, Boolean completed, long userIdentityId)
    Counts the requests of every process feeding a task project, open, completed or all, for a user who may read the request counts of at least one of them (see countRequests(long, Boolean, long)).
    long
    countRequests(long workFlowId)
    Counts the requests of a process whose task still exists.
    long
    countRequests(long workFlowId, Boolean completed, long userIdentityId)
    Counts the requests of a process, open, completed or all, whatever project their task is in, for a user who may see them: a processes administrator, a user who can edit the process, or a member of its managing space (its stored space, else its task project's) or a super manager of spaces, who see its pending requests.
    long
    countWorkDrafts(long workFlowId)
    Counts a process's drafts.
    int
    countWorkFlows(ProcessesFilter filter, long userIdentityId)
     
    int
    countWorks(long userIdentityId, WorkFilter workFilter)
    Counts the requests a user created that match a filter, as getWorks(long, WorkFilter, int, int) lists them.
    int
    countWorksByWorkflow(Long projectId, Boolean isCompleted)
    Deprecated, for removal: This API element is subject to removal in a future version.
    a task project may be fed by several processes and hold tasks created in Tasks: count the requests of one process with countRequests(long, Boolean, long), which checks the user's permission.
    default Work
    createWork(Work work, long userId)
    Creates a request, from a new work object or from an existing draft, in the stored task project of the process its workFlowId names, whatever project id it carries, and records it as a request of that process.
    createWork(Work work, long userId, String agentTitle)
    Creates a request, its task named by the fixed rule « Process name - yyyy/MM/dd - Requester name », followed by « - agent title » when one is given; the title of the given work is ignored.
    createWorkDraft(Work work, long userId)
    Creates a work draft
    createWorkFlow(WorkFlow workFlow, long userId)
    Creates a process.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    use deleteWorkById(Long, long) instead, which checks the user's permission.
    void
    deleteWorkById(Long workId, long userIdentityId)
    Delete a work by its given id, when the user is its creator or a manager of its process
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    use deleteWorkDraftById(Long, long) instead, which checks the user's permission.
    void
    deleteWorkDraftById(Long id, long userIdentityId)
    Deletes a work draft by its given id, when the user is its creator
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    use deleteWorkflowById(Long, long) instead, which checks the user's permission.
    void
    deleteWorkflowById(Long workflowId, long userIdentityId)
    Delete a workflow by its given Id, when the user is allowed to delete it
    Retrieves the list of available statuses in all workflows
    default List<Long>
    getCategoryIds(long userIdentityId)
    Reads the categories a user may filter the processes by: those the processes the user sees are filed under.
    default Map<Long, List<Long>>
    getCategoryIds(List<Long> workflowIds)
    Reads the categories each process is filed under, in one read.
    List<org.exoplatform.services.attachments.model.Attachment>
    getDocumentsToFill(long workFlowId, long userIdentityId)
    Lists the documents a process asks its requesters to fill in: its own documents, which each request's draft receives a copy of.
    Retrieves an illustration image by its given id
    getManagingSpaceId(long workFlowId)
    Reads the space that manages a process: its stored space when it still exists, else the first space that manages its task project.
    getProcessFormIds(long workFlowId, long userIdentityId)
    Reads the forms bound to a process itself, for a user who can edit it.
    getRequesterFormIds(long workFlowId)
    Reads the forms of a process's task project that its requesters fill when they create a request, as the process's editor chose them.
    getRequestProjectIds(long workFlowId)
    Reads the task projects that hold the requests of a process, in one query: the current projects of its request tasks, which may differ from the process's stored project when a request was moved.
    getRequestTaskIds(long workFlowId, Long afterTaskId, int limit)
    Reads one page of the tasks of a process's requests that still exist, by ascending id.
    getRequestWorkFlowId(long taskId)
    Reads the process a task was created for, from its request record.
    Reads the processes of the tasks that are requests, one query per page of 1000 task ids.
    getWorkById(long workId)
    Retrieves a request by its id, whoever asks: for the platform itself, for example the digest emails, never for a user request
    getWorkById(long userIdentityId, Long workId)
    Retrieves a Work by its given id
    getWorkDraft(long draftId, long userIdentityId)
    Reads one of the user's own request drafts.
    getWorkDraftIds(long workFlowId, Long afterDraftId, int limit)
    Reads one page of a process's draft ids, by ascending id.
    getWorkDraftOwnerId(long draftId)
    Reads the owner of a request draft.
    Reads what describes some request drafts, one query per page of 1000 ids.
    getWorkDrafts(long userIdentityId, WorkFilter workFilter, int offset, int limit)
    Retrieves a list of accessible WorkDraft, for a selected user
    getWorkDraftWorkFlowId(long draftId)
    Reads the process of a request draft.
    getWorkFlow(long id, Long userIdentityId)
    Retrieves a workflow by its id, with the user's permissions on it
    getWorkFlowByProjectId(long projectId)
    Deprecated, for removal: This API element is subject to removal in a future version.
    a task project may now be fed by several processes: read the process of a request from its request record instead.
    getWorkFlowIllustration(long workflowId, long userIdentityId)
    Retrieves the illustration image of a workflow, when the user can see the workflow: a member of its participators or of its request creators, or a processes manager
    getWorkFlows(ProcessesFilter filter, int offset, int limit, long userIdentityId)
    Retrieves a list of accessible WorkFlows, for a selected user, by applying the designated filter.
    getWorks(long userIdentityId, WorkFilter workFilter, int offset, int limit)
    Retrieves list of filtered works
    boolean
    isProcessesAdministrator(long userIdentityId)
    Checks whether a user administers every process: a member of /platform/processes or a platform administrator creates, edits and deletes any process, and manages any request
    listEligibleProjects(String spaceId, int offset, int limit, long userIdentityId)
    Lists the task projects a process of a space may feed: the projects attached to the space, whose managers hold the space's manager membership and whose managers and participants hold no group membership but the space's, users being allowed, whatever their columns.
    listProjectLabels(String spaceId, long projectId, long userIdentityId)
    Lists the labels of a task project a process of a space may feed, for the process editor, by id order.
    void
    Unregisters a plugin registered by addRequestValuesPlugin(RequestValuesPlugin).
    jakarta.persistence.criteria.Predicate
    requestOf(jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CommonAbstractCriteria query, jakarta.persistence.criteria.Expression<Long> taskId, Collection<Long> workFlowIds)
    Builds the restriction of a task query to the tasks that are requests of some processes: an EXISTS on their request records, correlated by the task id.
    void
    requestTaskCompleted(long taskId)
    Reacts to the completion of a task, in Tasks or in processes, otherwise than by its request's own cancel: a cancelled mark left on the request's record by a cancel interrupted before its task's completion is cleared, so the completion reads as the manager's decision, never as a cancel.
    void
    requestTaskReopened(long taskId)
    Reacts to the reopening of a task, in Tasks or in processes: a request whose task is not completed any more is pending again, so its record's cancelled and archived flags are cleared.
    updateWork(Work work, long userId)
     
    updateWorkCompleted(Long workId, boolean completed)
    Deprecated, for removal: This API element is subject to removal in a future version.
    use updateWorkCompleted(Long, boolean, long) instead, which checks the user's permission.
    updateWorkCompleted(Long workId, boolean completed, long userIdentityId)
    Completes or reopens the task of a request, when the user manages its process: a manager decides a request by completing it, the column it sits in wording the outcome.
    updateWorkDraft(Work work, long userId)
    Updates a work draft
    updateWorkFlow(WorkFlow workFlow, long userId)
    Updates a process, which keeps its task project.
  • Method Details

    • getWorkFlows

      List<WorkFlow> getWorkFlows(ProcessesFilter filter, int offset, int limit, long userIdentityId) throws IllegalAccessException
      Retrieves a list of accessible WorkFlows, for a selected user, by applying the designated filter. The returned results will be of type WorkFlow only. The ownerId of filter object will be used to select the list of accessible WorkFlows to retrieve.
      Parameters:
      filter - ProcessesFilter that contains filtering criteria
      offset - Offset of the result list
      limit - Limit of the result list
      userIdentityId - Identity technical identifier of the user acessing files
      Returns:
      List of WorkFlow
      Throws:
      IllegalAccessException - when the identity isn't an active user
    • countWorkFlows

      int countWorkFlows(ProcessesFilter filter, long userIdentityId) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • getCategoryIds

      default List<Long> getCategoryIds(long userIdentityId) throws IllegalAccessException
      Reads the categories a user may filter the processes by: those the processes the user sees are filed under. A user sees a process they participate in or may add a request to, and a disabled one only when they manage it.
      Parameters:
      userIdentityId - the user's identity technical identifier
      Returns:
      the category ids, without duplicates
      Throws:
      IllegalAccessException - when the identity isn't an active user
    • getCategoryIds

      default Map<Long, List<Long>> getCategoryIds(List<Long> workflowIds)
      Reads the categories each process is filed under, in one read. It checks no right: the caller reads processes the user already sees.
      Parameters:
      workflowIds - the process ids
      Returns:
      the category ids by process id; a process filed under none is absent
    • getWorkFlow

      WorkFlow getWorkFlow(long id, Long userIdentityId) throws IllegalAccessException
      Retrieves a workflow by its id, with the user's permissions on it
      Parameters:
      id - workflow technical identifier
      userIdentityId - the user's identity technical identifier, or null for a read made by the platform itself, whose permissions are all false
      Returns:
      the WorkFlow, or null when it doesn't exist
      Throws:
      IllegalAccessException - when the identity isn't an active user, or neither participates in the workflow nor may add a request to it
    • isProcessesAdministrator

      boolean isProcessesAdministrator(long userIdentityId) throws IllegalAccessException
      Checks whether a user administers every process: a member of /platform/processes or a platform administrator creates, edits and deletes any process, and manages any request
      Parameters:
      userIdentityId - Identity technical identifier of the user
      Returns:
      true when the user administers every process
      Throws:
      IllegalAccessException - when the identity isn't an active user
    • createWorkFlow

      WorkFlow createWorkFlow(WorkFlow workFlow, long userId) throws IllegalAccessException
      Creates a process. Its task project is a new one named after it (ProjectMode.NEW, or no mode stated), or the existing one its project id names (ProjectMode.EXISTING), which must be one listEligibleProjects(String, int, int, long) returns for its managing space; that project's columns are left as they are.
      Parameters:
      workFlow - the process to create
      userId - the creator's identity id
      Returns:
      the created process
      Throws:
      IllegalAccessException - when the user isn't a processes administrator
      IllegalArgumentException - with the message code processes.project.notEligible when the existing project cannot be used
    • listProjectLabels

      List<WorkFlowLabel> listProjectLabels(String spaceId, long projectId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Lists the labels of a task project a process of a space may feed, for the process editor, by id order.
      Parameters:
      spaceId - the managing space id
      projectId - the project id
      userIdentityId - the reading user's identity id
      Returns:
      the project's labels
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the space does not exist
      IllegalAccessException - when the user is neither a processes administrator nor a manager of the space
      IllegalArgumentException - processes.project.notEligible when a process of the space may not feed the project
    • listEligibleProjects

      EligibleProjects listEligibleProjects(String spaceId, int offset, int limit, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Lists the task projects a process of a space may feed: the projects attached to the space, whose managers hold the space's manager membership and whose managers and participants hold no group membership but the space's, users being allowed, whatever their columns. Each comes with the processes of that space that already feed it.
      Parameters:
      spaceId - the managing space id
      offset - the index of the first project of the page
      limit - the page size, 0 for every project
      userIdentityId - the reading user's identity id
      Returns:
      the page and the number of eligible projects
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the space does not exist
      IllegalAccessException - when the user is neither a processes administrator nor a manager of the space
      IllegalArgumentException - processes.projects.invalidPage for a negative offset or limit
    • updateWorkFlow

      WorkFlow updateWorkFlow(WorkFlow workFlow, long userId) throws IllegalArgumentException, org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Updates a process, which keeps its task project. Moving it to another space is refused while it keeps that project, since the project may be fed by other processes.
      Parameters:
      workFlow - the process as the client sent it
      userId - the editor's identity id
      Returns:
      the updated process
      Throws:
      IllegalArgumentException - processes.project.notEligible for a space change, processes.space.notFound for a space that does not exist, or when nothing changed
      org.exoplatform.commons.exception.ObjectNotFoundException - when the process does not exist
      IllegalAccessException - when the user may not edit it, or may not move it to the space sent
    • getWorks

      List<Work> getWorks(long userIdentityId, WorkFilter workFilter, int offset, int limit) throws Exception
      Retrieves list of filtered works
      Parameters:
      userIdentityId - user identity id
      workFilter - works filter
      offset - offset of the work lits result
      limit - limit of the queried result list
      Returns:
      List of Work
      Throws:
      Exception
    • countWorks

      int countWorks(long userIdentityId, WorkFilter workFilter) throws Exception
      Counts the requests a user created that match a filter, as getWorks(long, WorkFilter, int, int) lists them.
      Parameters:
      userIdentityId - the creator's identity id
      workFilter - the filter: status, text and completion
      Returns:
      the count
      Throws:
      Exception - when the Task add-on fails to count
    • archiveFinishedWorks

      int archiveFinishedWorks(long userIdentityId) throws Exception
      Archives every request the user created that is not archived yet and is finished: decided or cancelled, its task completed, whatever its column. Each request is archived through archiveWork(long, boolean, long) as that user; one refused, gone or no longer finished at its turn is skipped.
      Parameters:
      userIdentityId - the creator's identity id
      Returns:
      how many requests were archived
      Throws:
      Exception - when the requests cannot be listed
    • getWorkFlowByProjectId

      @Deprecated(since="7.3.0.50", forRemoval=true) WorkFlow getWorkFlowByProjectId(long projectId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      a task project may now be fed by several processes: read the process of a request from its request record instead. Since 7.3.0.50, for removal.
      Reads the first process feeding a task project.
      Parameters:
      projectId - the task project id
      Returns:
      the process of lowest id feeding it, or null when none does
    • createWork

      default Work createWork(Work work, long userId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Creates a request, from a new work object or from an existing draft, in the stored task project of the process its workFlowId names, whatever project id it carries, and records it as a request of that process. Its task is named by the fixed rule « Process name - yyyy/MM/dd - Requester name », whatever title the work carries.
      Parameters:
      work - the request
      userId - the requester's identity id
      Returns:
      the created request
      Throws:
      IllegalAccessException - when the user can't add a request to the process, or the draft is another user's
      org.exoplatform.commons.exception.ObjectNotFoundException - when the process or the draft does not exist
      IllegalArgumentException - processes.request.workflowRequired when no process is named, processes.request.draftMismatch when the draft is of another process
    • createWork

      Work createWork(Work work, long userId, String agentTitle) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Creates a request, its task named by the fixed rule « Process name - yyyy/MM/dd - Requester name », followed by « - agent title » when one is given; the title of the given work is ignored. Only the AI agent's tool gives an agent title: every other channel calls createWork(Work, long).
      Parameters:
      work - the request
      userId - the requester's identity id
      agentTitle - the title the AI agent sent, or null
      Returns:
      the created request
      Throws:
      IllegalAccessException - when the user can't add a request to the process, or the draft is another user's
      org.exoplatform.commons.exception.ObjectNotFoundException - when the process or the draft does not exist
      IllegalArgumentException - processes.request.workflowRequired when no process is named, processes.request.draftMismatch when the draft is of another process
    • updateWork

      Work updateWork(Work work, long userId) throws IllegalArgumentException, org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      IllegalArgumentException
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • deleteWorkflowById

      @Deprecated(forRemoval=true) void deleteWorkflowById(Long workflowId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use deleteWorkflowById(Long, long) instead, which checks the user's permission. Since 7.3.0, for removal.
      Delete a workflow by its given Id, without any permission check.
      Parameters:
      workflowId - : workflow id
    • deleteWorkflowById

      void deleteWorkflowById(Long workflowId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Delete a workflow by its given Id, when the user is allowed to delete it
      Parameters:
      workflowId - workflow id
      userIdentityId - user identity id
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the workflow doesn't exist
      IllegalAccessException - when the user isn't allowed to delete it
    • countWorksByWorkflow

      @Deprecated(since="7.3.0.50", forRemoval=true) int countWorksByWorkflow(Long projectId, Boolean isCompleted) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      a task project may be fed by several processes and hold tasks created in Tasks: count the requests of one process with countRequests(long, Boolean, long), which checks the user's permission. Since 7.3.0.50, for removal.
      Counts every task of a task project, without any permission check.
      Parameters:
      projectId - Tasks project id
      isCompleted - filter by completed and uncompleted tasks
      Returns:
      Filtered tasks count
      Throws:
      Exception - when the tasks can't be counted
    • deleteWorkById

      @Deprecated(forRemoval=true) void deleteWorkById(Long workId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use deleteWorkById(Long, long) instead, which checks the user's permission. Since 7.3.0, for removal.
      Delete a work by its given id, without any permission check.
      Parameters:
      workId - : Work id
    • deleteWorkById

      void deleteWorkById(Long workId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Delete a work by its given id, when the user is its creator or a manager of its process
      Parameters:
      workId - Work id
      userIdentityId - user identity id
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the work doesn't exist
      IllegalAccessException - when the task isn't a request of a process, or when the user isn't allowed to manage it
    • updateWorkCompleted

      @Deprecated(forRemoval=true) Work updateWorkCompleted(Long workId, boolean completed)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use updateWorkCompleted(Long, boolean, long) instead, which checks the user's permission. Since 7.3.0, for removal.
      update the completed property of the task of a work to completed or uncompleted, without any permission check.
      Parameters:
      workId - work id
      completed - work completed property, can be true or false
      Returns:
      Work
    • updateWorkCompleted

      Work updateWorkCompleted(Long workId, boolean completed, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Completes or reopens the task of a request, when the user manages its process: a manager decides a request by completing it, the column it sits in wording the outcome. A requester who doesn't manage the process is refused: they cancel with cancelWork(long, long) and archive with archiveWork(long, boolean, long).
      Parameters:
      workId - work id
      completed - work completed property, can be true or false
      userIdentityId - user identity id
      Returns:
      Work
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the work doesn't exist
      IllegalAccessException - when the task isn't a request of a process, or when the user isn't allowed to manage it
    • cancelWork

      Work cancelWork(long workId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Cancels a pending request, when the user is its requester: its record says cancelled, then its task is completed through Task, its column left as it is, the flag written back when the completion fails (ProcessesStorage.saveRequestState(long, Boolean, Boolean, Boolean)); its managers are then notified. An already cancelled request is returned as it is.
      Parameters:
      workId - the request's task id
      userIdentityId - the user's identity id
      Returns:
      the cancelled request
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the request doesn't exist
      IllegalAccessException - when the task isn't a request, the user isn't its requester, or the request is closed
    • archiveWork

      Work archiveWork(long workId, boolean archived, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Archives or restores a request in its requester's « My requests », when the user is its requester: only its record's flag changes, never its task. Only a finished request (decided or cancelled) is archived.
      Parameters:
      workId - the request's task id
      archived - true to archive, false to restore
      userIdentityId - the user's identity id
      Returns:
      the request
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the request doesn't exist
      IllegalAccessException - when the task isn't a request, the user isn't its requester, or the request to archive is pending
    • requestTaskReopened

      void requestTaskReopened(long taskId)
      Reacts to the reopening of a task, in Tasks or in processes: a request whose task is not completed any more is pending again, so its record's cancelled and archived flags are cleared. A task that is no request, or a request with neither flag, is left as it is. It is the platform's own call, for Task's update listener: it checks no user's right, so no user path may call it.
      Parameters:
      taskId - the reopened task's id
    • requestTaskCompleted

      void requestTaskCompleted(long taskId)
      Reacts to the completion of a task, in Tasks or in processes, otherwise than by its request's own cancel: a cancelled mark left on the request's record by a cancel interrupted before its task's completion is cleared, so the completion reads as the manager's decision, never as a cancel. A task that is no request, a request without the mark, or the completion a cancel runs on this thread is left as it is. A failure to clear it is logged, never thrown: the clear is a write of its own after Task's commit, so a stop or a failed write between the two leaves the request reading cancelled until its task is reopened. It is the platform's own call, for Task's update listener: it checks no user's right, so no user path may call it.
      Parameters:
      taskId - the completed task's id
    • createWorkDraft

      Work createWorkDraft(Work work, long userId) throws IllegalArgumentException, org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Creates a work draft
      Parameters:
      work - Work draft object
      userId - user identity
      Returns:
      Work
      Throws:
      IllegalArgumentException
      org.exoplatform.commons.exception.ObjectNotFoundException - when the draft's process doesn't exist
      IllegalAccessException - when the user can't add a request to the draft's process
    • updateWorkDraft

      Work updateWorkDraft(Work work, long userId) throws IllegalArgumentException, org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Updates a work draft
      Parameters:
      work - Work draft object
      userId - user identity
      Returns:
      Work
      Throws:
      IllegalArgumentException
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException - when the user isn't the draft's creator
    • getWorkDrafts

      List<Work> getWorkDrafts(long userIdentityId, WorkFilter workFilter, int offset, int limit)
      Retrieves a list of accessible WorkDraft, for a selected user
      Parameters:
      userIdentityId - user identity
      workFilter - work filter
      offset - Offset of the result list
      limit - Limit of the result list
      Returns:
      List of Work
    • deleteWorkDraftById

      @Deprecated(forRemoval=true) void deleteWorkDraftById(Long id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use deleteWorkDraftById(Long, long) instead, which checks the user's permission. Since 7.3.0, for removal.
      Deletes a work draft by its given id, without any permission check.
      Parameters:
      id - Work draft id
    • deleteWorkDraftById

      void deleteWorkDraftById(Long id, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Deletes a work draft by its given id, when the user is its creator
      Parameters:
      id - Work draft id
      userIdentityId - user identity id
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the draft doesn't exist
      IllegalAccessException - when the user isn't the draft's creator
    • getAvailableWorkStatuses

      List<WorkStatus> getAvailableWorkStatuses()
      Retrieves the list of available statuses in all workflows
      Returns:
      List of WorkStatus
    • getWorkById

      Work getWorkById(long userIdentityId, Long workId)
      Retrieves a Work by its given id
      Parameters:
      userIdentityId - user identity id
      workId - Work id
      Returns:
      Work
    • getWorkById

      Work getWorkById(long workId)
      Retrieves a request by its id, whoever asks: for the platform itself, for example the digest emails, never for a user request
      Parameters:
      workId - the request (work) id, the same as its task id
      Returns:
      the request, or null when it doesn't exist any more
    • getIllustrationImageById

      IllustrativeAttachment getIllustrationImageById(Long illustrationId) throws org.exoplatform.commons.file.services.FileStorageException, org.exoplatform.commons.exception.ObjectNotFoundException, IOException
      Retrieves an illustration image by its given id
      Parameters:
      illustrationId - illustration file id
      Returns:
      IllustrativeAttachment
      Throws:
      org.exoplatform.commons.file.services.FileStorageException
      org.exoplatform.commons.exception.ObjectNotFoundException
      IOException
    • getWorkFlowIllustration

      IllustrativeAttachment getWorkFlowIllustration(long workflowId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException, org.exoplatform.commons.file.services.FileStorageException, IOException
      Retrieves the illustration image of a workflow, when the user can see the workflow: a member of its participators or of its request creators, or a processes manager
      Parameters:
      workflowId - workflow id
      userIdentityId - user identity id
      Returns:
      IllustrativeAttachment
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the workflow doesn't exist or has no illustration
      IllegalAccessException - when the identity isn't an active user, or can't see the workflow
      org.exoplatform.commons.file.services.FileStorageException
      IOException
    • getRequestWorkFlowId

      Long getRequestWorkFlowId(long taskId)
      Reads the process a task was created for, from its request record. It is the platform's own read, with no user's permission: a caller that serves a user checks that user's rights on what it returns.
      Parameters:
      taskId - the task id
      Returns:
      the id of the process whose request the task is, or null when the task is no request
    • getRequestWorkFlowIds

      Map<Long,Long> getRequestWorkFlowIds(Collection<Long> taskIds)
      Reads the processes of the tasks that are requests, one query per page of 1000 task ids. It is the platform's own read, with no user's permission: a caller that serves a user checks first that user's right on the process with getWorkFlow(long, Long) given the user's identity id, and never returns its answer to a client as it is.
      Parameters:
      taskIds - the task ids
      Returns:
      task id → process id, for the tasks that are requests
    • getRequestTaskIds

      List<Long> getRequestTaskIds(long workFlowId, Long afterTaskId, int limit)
      Reads one page of the tasks of a process's requests that still exist, by ascending id. It is the platform's own read, with no user's permission: a caller that serves a user checks first that user's right on the process with getWorkFlow(long, Long) given the user's identity id, and never returns its answer to a client as it is.
      Parameters:
      workFlowId - the process id
      afterTaskId - the last task id of the previous page, or null for the first page
      limit - the page size, strictly positive
      Returns:
      the task ids of the page, ascending
    • getRequestProjectIds

      Set<Long> getRequestProjectIds(long workFlowId)
      Reads the task projects that hold the requests of a process, in one query: the current projects of its request tasks, which may differ from the process's stored project when a request was moved. It is the platform's own read, with no user's permission: a caller that serves a user checks first that user's right on the process with getWorkFlow(long, Long) given the user's identity id, and never returns its answer to a client as it is.
      Parameters:
      workFlowId - the process id
      Returns:
      the distinct project ids
    • countRequests

      long countRequests(long workFlowId)
      Counts the requests of a process whose task still exists. It is the platform's own read, with no user's permission: a caller that serves a user checks first that user's right on the process with getWorkFlow(long, Long) given the user's identity id, and never returns its answer to a client as it is.
      Parameters:
      workFlowId - the process id
      Returns:
      the number of request tasks of the process
    • countRequests

      long countRequests(long workFlowId, Boolean completed, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Counts the requests of a process, open, completed or all, whatever project their task is in, for a user who may see them: a processes administrator, a user who can edit the process, or a member of its managing space (its stored space, else its task project's) or a super manager of spaces, who see its pending requests.
      Parameters:
      workFlowId - the process id
      completed - true to count the completed requests, false the open ones, null to count them all
      userIdentityId - the identity id of the user asking
      Returns:
      the number of request tasks of the process in that state
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the process does not exist
      IllegalAccessException - when the user may not see the count
    • getDocumentsToFill

      List<org.exoplatform.services.attachments.model.Attachment> getDocumentsToFill(long workFlowId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Lists the documents a process asks its requesters to fill in: its own documents, which each request's draft receives a copy of. A user who may make a request on the process, or see it, gets them whatever their right on the process's own files, which a requester outside the managing space may not read: the request drawer tells the draft's copies by them.
      Parameters:
      workFlowId - the process id
      userIdentityId - the identity id of the user asking
      Returns:
      the process's documents
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the process does not exist, or the user may neither make a request on it nor see it
      IllegalAccessException - when the attachment service refuses the user the process's documents, which it declares and does not throw at this version
    • countProjectRequests

      long countProjectRequests(long projectId, Boolean completed, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Counts the requests of every process feeding a task project, open, completed or all, for a user who may read the request counts of at least one of them (see countRequests(long, Boolean, long)).
      Parameters:
      projectId - the task project id
      completed - true to count the completed requests, false the open ones, null to count them all
      userIdentityId - the identity id of the user asking
      Returns:
      the number of request tasks of those processes in that state
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when no process feeds the project
      IllegalAccessException - when the user may read the counts of none
    • getManagingSpaceId

      Long getManagingSpaceId(long workFlowId)
      Reads the space that manages a process: its stored space when it still exists, else the first space that manages its task project. It is the platform's own read, with no user's permission: a caller that serves a user checks first that user's right on the process with getWorkFlow(long, Long) given the user's identity id, and never returns its answer to a client as it is.
      Parameters:
      workFlowId - the process id
      Returns:
      the space id, or null when the process does not exist or no space manages it
    • getRequesterFormIds

      List<Long> getRequesterFormIds(long workFlowId)
      Reads the forms of a process's task project that its requesters fill when they create a request, as the process's editor chose them. It is the platform's own read, with no user's permission: a caller that serves a user checks first that user's right on the process with getWorkFlow(long, Long) given the user's identity id, and never returns its answer to a client as it is.
      Parameters:
      workFlowId - the process id
      Returns:
      the form ids, in id order; empty when the process does not exist or its requesters fill none of its project's forms
    • requestOf

      jakarta.persistence.criteria.Predicate requestOf(jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CommonAbstractCriteria query, jakarta.persistence.criteria.Expression<Long> taskId, Collection<Long> workFlowIds)
      Builds the restriction of a task query to the tasks that are requests of some processes: an EXISTS on their request records, correlated by the task id. It only narrows a query, and must stay out of any OR that would widen it. It is the platform's own read, with no user's permission: a caller that serves a user checks first that user's right on the process with getWorkFlow(long, Long) given the user's identity id, and never returns its answer to a client as it is.
      Parameters:
      cb - the criteria builder of the query
      query - the query, to create the subquery from
      taskId - the task id expression of the query
      workFlowIds - the process ids
      Returns:
      the restriction; one that no task meets when no process is given
    • addRequestValuesPlugin

      void addRequestValuesPlugin(RequestValuesPlugin plugin)
      Registers the plugin that checks and writes the values a request carries and the form of a process. At most one is registered: a second registration replaces the first.
      Parameters:
      plugin - the plugin to register
    • getWorkDraft

      Work getWorkDraft(long draftId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Reads one of the user's own request drafts.
      Parameters:
      draftId - the draft id
      userIdentityId - the user's identity id
      Returns:
      the draft
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when no such draft exists
      IllegalAccessException - when the draft is not the user's
    • getWorkDraftWorkFlowId

      Long getWorkDraftWorkFlowId(long draftId)
      Reads the process of a request draft. It is the platform's own read, with no user's permission: a caller that serves a user checks that the draft's owner is that user (getWorkDraft(long, long), or the owner id against the viewer), never only the user's right on the process, which would show one requester's drafts to every user who may add a request to it.
      Parameters:
      draftId - the draft id
      Returns:
      the process id, or null when no such draft exists
    • getWorkDraftOwnerId

      Long getWorkDraftOwnerId(long draftId)
      Reads the owner of a request draft. It is the platform's own read, with no user's permission: a caller that serves a user checks that the draft's owner is that user (getWorkDraft(long, long), or the owner id against the viewer), never only the user's right on the process, which would show one requester's drafts to every user who may add a request to it.
      Parameters:
      draftId - the draft id
      Returns:
      the owner's identity id, or null when no such draft exists
    • getWorkDraftRefs

      Map<Long, WorkDraftRef> getWorkDraftRefs(Collection<Long> draftIds)
      Reads what describes some request drafts, one query per page of 1000 ids. It is the platform's own read, with no user's permission: a caller that serves a user checks that the draft's owner is that user (getWorkDraft(long, long), or the owner id against the viewer), never only the user's right on the process, which would show one requester's drafts to every user who may add a request to it.
      Parameters:
      draftIds - the draft ids
      Returns:
      draft id → its owner, process, title and dates, for the ids that are drafts
    • getWorkDraftIds

      List<Long> getWorkDraftIds(long workFlowId, Long afterDraftId, int limit)
      Reads one page of a process's draft ids, by ascending id. It is the platform's own read, with no user's permission: a caller that serves a user checks that the draft's owner is that user (getWorkDraft(long, long), or the owner id against the viewer), never only the user's right on the process, which would show one requester's drafts to every user who may add a request to it.
      Parameters:
      workFlowId - the process id
      afterDraftId - the last id of the previous page, or null for the first page
      limit - the page size, strictly positive
      Returns:
      the draft ids of the page
    • countWorkDrafts

      long countWorkDrafts(long workFlowId)
      Counts a process's drafts. It is the platform's own read, with no user's permission: a caller that serves a user checks that the draft's owner is that user (getWorkDraft(long, long), or the owner id against the viewer), never only the user's right on the process, which would show one requester's drafts to every user who may add a request to it.
      Parameters:
      workFlowId - the process id
      Returns:
      the number of drafts
    • getProcessFormIds

      List<Long> getProcessFormIds(long workFlowId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Reads the forms bound to a process itself, for a user who can edit it.
      Parameters:
      workFlowId - the process id
      userIdentityId - the user's identity id
      Returns:
      the ids of the process's own forms, empty when it has none or when no add-on registered a request values plugin
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the process does not exist
      IllegalAccessException - when the user may not edit the process
    • removeRequestValuesPlugin

      void removeRequestValuesPlugin(RequestValuesPlugin plugin)
      Unregisters a plugin registered by addRequestValuesPlugin(RequestValuesPlugin). A plugin that is not the registered one leaves the registration as it is.
      Parameters:
      plugin - the plugin to unregister