Interface ProcessesService
public interface ProcessesService
-
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters the plugin that checks and writes the values a request carries and the form of a process.intarchiveFinishedWorks(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.longcountProjectRequests(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 (seecountRequests(long, Boolean, long)).longcountRequests(long workFlowId) Counts the requests of a process whose task still exists.longcountRequests(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.longcountWorkDrafts(long workFlowId) Counts a process's drafts.intcountWorkFlows(ProcessesFilter filter, long userIdentityId) intcountWorks(long userIdentityId, WorkFilter workFilter) Counts the requests a user created that match a filter, asgetWorks(long, WorkFilter, int, int)lists them.intcountWorksByWorkflow(Long projectId, Boolean isCompleted) Deprecated, for removal: This API element is subject to removal in a future version.default WorkcreateWork(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 itsworkFlowIdnames, 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 draftcreateWorkFlow(WorkFlow workFlow, long userId) Creates a process.voiddeleteWorkById(Long workId) Deprecated, for removal: This API element is subject to removal in a future version.usedeleteWorkById(Long, long)instead, which checks the user's permission.voiddeleteWorkById(Long workId, long userIdentityId) Delete a work by its given id, when the user is its creator or a manager of its processvoidDeprecated, for removal: This API element is subject to removal in a future version.usedeleteWorkDraftById(Long, long)instead, which checks the user's permission.voiddeleteWorkDraftById(Long id, long userIdentityId) Deletes a work draft by its given id, when the user is its creatorvoiddeleteWorkflowById(Long workflowId) Deprecated, for removal: This API element is subject to removal in a future version.usedeleteWorkflowById(Long, long)instead, which checks the user's permission.voiddeleteWorkflowById(Long workflowId, long userIdentityId) Delete a workflow by its given Id, when the user is allowed to delete itRetrieves the list of available statuses in all workflowsgetCategoryIds(long userIdentityId) Reads the categories a user may filter the processes by: those the processes the user sees are filed under.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.getIllustrationImageById(Long illustrationId) Retrieves an illustration image by its given idgetManagingSpaceId(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.getRequestWorkFlowIds(Collection<Long> taskIds) Reads the processes of the tasks that are requests, one query per page of1000task 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 requestgetWorkById(long userIdentityId, Long workId) Retrieves a Work by its given idgetWorkDraft(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.getWorkDraftRefs(Collection<Long> draftIds) Reads what describes some request drafts, one query per page of1000ids.getWorkDrafts(long userIdentityId, WorkFilter workFilter, int offset, int limit) Retrieves a list of accessible WorkDraft, for a selected usergetWorkDraftWorkFlowId(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 itgetWorkFlowByProjectId(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 managergetWorkFlows(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 worksbooleanisProcessesAdministrator(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 requestlistEligibleProjects(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.voidUnregisters a plugin registered byaddRequestValuesPlugin(RequestValuesPlugin).jakarta.persistence.criteria.PredicaterequestOf(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.voidrequestTaskCompleted(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.voidrequestTaskReopened(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.useupdateWorkCompleted(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 draftupdateWorkFlow(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 typeWorkFlowonly. The ownerId of filter object will be used to select the list of accessible WorkFlows to retrieve.- Parameters:
filter-ProcessesFilterthat contains filtering criteriaoffset- Offset of the result listlimit- Limit of the result listuserIdentityId-Identitytechnical identifier of the user acessing files- Returns:
ListofWorkFlow- Throws:
IllegalAccessException- when the identity isn't an active user
-
countWorkFlows
- Throws:
IllegalAccessException
-
getCategoryIds
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
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
Retrieves a workflow by its id, with the user's permissions on it- Parameters:
id- workflow technical identifieruserIdentityId- 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
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-Identitytechnical identifier of the user- Returns:
- true when the user administers every process
- Throws:
IllegalAccessException- when the identity isn't an active user
-
createWorkFlow
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 onelistEligibleProjects(String, int, int, long)returns for its managing space; that project's columns are left as they are.- Parameters:
workFlow- the process to createuserId- the creator's identity id- Returns:
- the created process
- Throws:
IllegalAccessException- when the user isn't a processes administratorIllegalArgumentException- 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 idprojectId- the project iduserIdentityId- the reading user's identity id- Returns:
- the project's labels
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the space does not existIllegalAccessException- when the user is neither a processes administrator nor a manager of the spaceIllegalArgumentException- 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 idoffset- the index of the first project of the pagelimit- the page size, 0 for every projectuserIdentityId- 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 existIllegalAccessException- when the user is neither a processes administrator nor a manager of the spaceIllegalArgumentException- 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 ituserId- 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 changedorg.exoplatform.commons.exception.ObjectNotFoundException- when the process does not existIllegalAccessException- 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 -
countWorks
Counts the requests a user created that match a filter, asgetWorks(long, WorkFilter, int, int)lists them.- Parameters:
userIdentityId- the creator's identity idworkFilter- the filter: status, text and completion- Returns:
- the count
- Throws:
Exception- when the Task add-on fails to count
-
archiveFinishedWorks
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 througharchiveWork(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, 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 itsworkFlowIdnames, 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 requestuserId- 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'sorg.exoplatform.commons.exception.ObjectNotFoundException- when the process or the draft does not existIllegalArgumentException- 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 callscreateWork(Work, long).- Parameters:
work- the requestuserId- the requester's identity idagentTitle- 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'sorg.exoplatform.commons.exception.ObjectNotFoundException- when the process or the draft does not existIllegalArgumentException- 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:
IllegalArgumentExceptionorg.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
deleteWorkflowById
Deprecated, for removal: This API element is subject to removal in a future version.usedeleteWorkflowById(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 iduserIdentityId- user identity id- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the workflow doesn't existIllegalAccessException- 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 withcountRequests(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 idisCompleted- filter by completed and uncompleted tasks- Returns:
- Filtered tasks count
- Throws:
Exception- when the tasks can't be counted
-
deleteWorkById
Deprecated, for removal: This API element is subject to removal in a future version.usedeleteWorkById(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 iduserIdentityId- user identity id- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the work doesn't existIllegalAccessException- when the task isn't a request of a process, or when the user isn't allowed to manage it
-
updateWorkCompleted
Deprecated, for removal: This API element is subject to removal in a future version.useupdateWorkCompleted(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 idcompleted- 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 withcancelWork(long, long)and archive witharchiveWork(long, boolean, long).- Parameters:
workId- work idcompleted- work completed property, can be true or falseuserIdentityId- user identity id- Returns:
Work- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the work doesn't existIllegalAccessException- 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 iduserIdentityId- the user's identity id- Returns:
- the cancelled request
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the request doesn't existIllegalAccessException- 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 idarchived- true to archive, false to restoreuserIdentityId- the user's identity id- Returns:
- the request
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the request doesn't existIllegalAccessException- 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 objectuserId- user identity- Returns:
Work- Throws:
IllegalArgumentExceptionorg.exoplatform.commons.exception.ObjectNotFoundException- when the draft's process doesn't existIllegalAccessException- 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 objectuserId- user identity- Returns:
Work- Throws:
IllegalArgumentExceptionorg.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException- when the user isn't the draft's creator
-
getWorkDrafts
Retrieves a list of accessible WorkDraft, for a selected user -
deleteWorkDraftById
Deprecated, for removal: This API element is subject to removal in a future version.usedeleteWorkDraftById(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 iduserIdentityId- user identity id- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the draft doesn't existIllegalAccessException- when the user isn't the draft's creator
-
getAvailableWorkStatuses
List<WorkStatus> getAvailableWorkStatuses()Retrieves the list of available statuses in all workflows- Returns:
ListofWorkStatus
-
getWorkById
-
getWorkById
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.FileStorageExceptionorg.exoplatform.commons.exception.ObjectNotFoundExceptionIOException
-
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 iduserIdentityId- user identity id- Returns:
IllustrativeAttachment- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the workflow doesn't exist or has no illustrationIllegalAccessException- when the identity isn't an active user, or can't see the workfloworg.exoplatform.commons.file.services.FileStorageExceptionIOException
-
getRequestWorkFlowId
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
Reads the processes of the tasks that are requests, one query per page of1000task 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 withgetWorkFlow(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
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 withgetWorkFlow(long, Long)given the user's identity id, and never returns its answer to a client as it is.- Parameters:
workFlowId- the process idafterTaskId- the last task id of the previous page, or null for the first pagelimit- the page size, strictly positive- Returns:
- the task ids of the page, ascending
-
getRequestProjectIds
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 withgetWorkFlow(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 withgetWorkFlow(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 idcompleted- true to count the completed requests, false the open ones, null to count them alluserIdentityId- 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 existIllegalAccessException- 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 iduserIdentityId- 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 itIllegalAccessException- 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 (seecountRequests(long, Boolean, long)).- Parameters:
projectId- the task project idcompleted- true to count the completed requests, false the open ones, null to count them alluserIdentityId- 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 projectIllegalAccessException- when the user may read the counts of none
-
getManagingSpaceId
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 withgetWorkFlow(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
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 withgetWorkFlow(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 withgetWorkFlow(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 queryquery- the query, to create the subquery fromtaskId- the task id expression of the queryworkFlowIds- the process ids- Returns:
- the restriction; one that no task meets when no process is given
-
addRequestValuesPlugin
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 iduserIdentityId- the user's identity id- Returns:
- the draft
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when no such draft existsIllegalAccessException- when the draft is not the user's
-
getWorkDraftWorkFlowId
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
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
Reads what describes some request drafts, one query per page of1000ids. 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
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 idafterDraftId- the last id of the previous page, or null for the first pagelimit- 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 iduserIdentityId- 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 existIllegalAccessException- when the user may not edit the process
-
removeRequestValuesPlugin
Unregisters a plugin registered byaddRequestValuesPlugin(RequestValuesPlugin). A plugin that is not the registered one leaves the registration as it is.- Parameters:
plugin- the plugin to unregister
-
countRequests(long, Boolean, long), which checks the user's permission.