Interface RequestValuesPlugin


public interface RequestValuesPlugin
The values a request carries beyond its title and description, and the form a process asks its requesters to fill. The Process add-on knows nothing of the add-on that implements it: it hands over the values a requester sent, and the form an editor chose, at the steps of a request's creation and of a process's save where they must be checked or written. At most one plugin is registered, through ProcessesService.addRequestValuesPlugin(RequestValuesPlugin).

Every method throws IllegalArgumentException, whose message is the code of the refusal, for a refused value, and IllegalAccessException for a refused right. A plugin translates its own add-on's exceptions into those two before they leave it.

The values are given as form id → field key → values: an absent form or field is not sent, an empty list clears the field.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checkProcessForm(Long workFlowId, String spaceId, Long formId, org.exoplatform.services.security.Identity editor)
    Checks the form an editor chose for a process, before any write of the process's save: the refusals that need no process row.
    default void
    checkRequesterForms(Long workFlowId, long projectId, List<Long> formIds, org.exoplatform.services.security.Identity editor)
    Checks the forms of an existing task project an editor newly chose for a process's requesters to fill, before any write of the process's save: each one must be a form the project gives its tasks, which the editor may see.
    void
    checkRequestValues(long workFlowId, Long draftId, Map<Long, Map<String, List<Object>>> values, org.exoplatform.services.security.Identity requester)
    Checks the values a requester sends with a new request of a process, before its task exists: the forms the process asks for, the required fields, the shape of every value.
    getProcessFormIds(long workFlowId)
    Reads the forms bound to a process itself, the ones its editor shows.
    void
    setProcessForm(long workFlowId, Long formId, org.exoplatform.services.security.Identity editor)
    Makes a form the process's only own form, or removes every own form of the process, inside the process's save, once its row is written.
    void
    writeDraftValues(long workFlowId, long draftId, Map<Long, Map<String, List<Object>>> values, org.exoplatform.services.security.Identity owner)
    Writes the values its owner sent with a request draft's save, with the value rules of the forms the draft's process asks for and no required-field check: required fields block a request's submit only.
    void
    writeRequestValues(long workFlowId, Long draftId, long taskId, Map<Long, Map<String, List<Object>>> values, org.exoplatform.services.security.Identity requester)
    Writes the values of a new request on its task, once the task and its request record exist: the defaults of every field not sent, then the sent values.
  • Method Details

    • checkRequestValues

      void checkRequestValues(long workFlowId, Long draftId, Map<Long, Map<String, List<Object>>> values, org.exoplatform.services.security.Identity requester) throws IllegalAccessException
      Checks the values a requester sends with a new request of a process, before its task exists: the forms the process asks for, the required fields, the shape of every value. When the request is made from a draft, the draft's stored values are checked with the sent ones, which override them field by field; the draft must be of the request's process.
      Parameters:
      workFlowId - the id of the process the request is made for
      draftId - the id of the requester's draft the request is made from, or null
      values - the sent values, form id → field key → values, empty when none was sent
      requester - the requester's identity
      Throws:
      IllegalAccessException - when the requester may not write the values
    • writeRequestValues

      void writeRequestValues(long workFlowId, Long draftId, long taskId, Map<Long, Map<String, List<Object>>> values, org.exoplatform.services.security.Identity requester) throws IllegalAccessException
      Writes the values of a new request on its task, once the task and its request record exist: the defaults of every field not sent, then the sent values. It checks them again, so a refusal here, after a change of the process's form, makes the caller remove the request. When the request is made from a draft, the draft's stored values are written with the sent ones, which override them field by field.
      Parameters:
      workFlowId - the id of the process the request was made for
      draftId - the id of the requester's draft the request is made from, or null
      taskId - the id of the request's task
      values - the sent values, form id → field key → values, empty when none was sent
      requester - the requester's identity, the task's creator
      Throws:
      IllegalAccessException - when the requester may not write the values
    • writeDraftValues

      void writeDraftValues(long workFlowId, long draftId, Map<Long, Map<String, List<Object>>> values, org.exoplatform.services.security.Identity owner) throws IllegalAccessException
      Writes the values its owner sent with a request draft's save, with the value rules of the forms the draft's process asks for and no required-field check: required fields block a request's submit only.
      Parameters:
      workFlowId - the id of the stored draft's process, never the one the client sent
      draftId - the draft id
      values - the sent values, form id → field key → values
      owner - the draft owner's identity
      Throws:
      IllegalAccessException - when the owner may not write the values
    • getProcessFormIds

      List<Long> getProcessFormIds(long workFlowId)
      Reads the forms bound to a process itself, the ones its editor shows. It is the platform's own read: the caller checks the user's right on the process first.
      Parameters:
      workFlowId - the process id
      Returns:
      the ids of the forms bound to the process, empty when it has none
    • checkProcessForm

      void checkProcessForm(Long workFlowId, String spaceId, Long formId, org.exoplatform.services.security.Identity editor) throws IllegalAccessException
      Checks the form an editor chose for a process, before any write of the process's save: the refusals that need no process row.
      Parameters:
      workFlowId - the process id, or null for a new process
      spaceId - the id of the space that manages the process, or null when it is not known
      formId - the chosen form id, or null for no form
      editor - the editor's identity
      Throws:
      IllegalAccessException - when the editor may not choose the form of the process
    • setProcessForm

      void setProcessForm(long workFlowId, Long formId, org.exoplatform.services.security.Identity editor) throws IllegalAccessException
      Makes a form the process's only own form, or removes every own form of the process, inside the process's save, once its row is written. It checks the choice again.
      Parameters:
      workFlowId - the process id
      formId - the chosen form id, or null for no form
      editor - the editor's identity
      Throws:
      IllegalAccessException - when the editor may not choose the form of the process
    • checkRequesterForms

      default void checkRequesterForms(Long workFlowId, long projectId, List<Long> formIds, org.exoplatform.services.security.Identity editor) throws IllegalAccessException
      Checks the forms of an existing task project an editor newly chose for a process's requesters to fill, before any write of the process's save: each one must be a form the project gives its tasks, which the editor may see. The forms the process already stores are not sent again. A plugin that does not know the choice refuses any form, so that no choice is stored unchecked.
      Parameters:
      workFlowId - the process id, or null for a new process
      projectId - the id of the task project the process stores its requests on
      formIds - the newly chosen form ids, distinct, never empty
      editor - the editor's identity
      Throws:
      IllegalAccessException - when the editor may not choose the forms of that project
      IllegalArgumentException - when a form is not one the project gives