Class ProcessUtil

java.lang.Object
com.ssgllc.fish.service.util.published.ProcessUtil

@Component public class ProcessUtil extends Object
Reads and manipulates running BPM process instances from a Groovy script.

Called as the processUtil bean. For task-level work see TaskUtil; for the broader workflow API see bpmUtil.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addNote(String processInstanceId, String note)
    Adds a note to the given process instance's note thread and returns the created note's id.
    void
    grantRoleAccess(String processInstanceId, String roleName, String identityLinkType)
    Adds a role identity link of the specified type to the given process instance.
    Processes that contain no user tasks never have identity links created automatically, which makes them invisible to org users.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProcessUtil

      public ProcessUtil()
  • Method Details

    • grantRoleAccess

      public void grantRoleAccess(String processInstanceId, String roleName, String identityLinkType)
      Adds a role identity link of the specified type to the given process instance.
      Processes that contain no user tasks never have identity links created automatically, which makes them invisible to org users. Call this in a script task early in such a process to open visibility to the appropriate role.
      Parameters:
      processInstanceId - The ID of the process instance to grant access to.
      roleName - The name of the role (e.g. 'ORDER_MANAGER').
      identityLinkType - The type of identity link to create. 'candidate' is the most common choice unless you have a specific reason otherwise. Other allowed values — 'assignee', 'owner', 'starter', 'participant' — are valid but carry distinct Flowable semantics; only use them when you are certain of the intended behaviour.

      Groovy example:
      processUtil.grantRoleAccess(execution.processInstanceId, 'ORDER_MANAGER', 'candidate')

      Effect:
      The process instance becomes visible to users with the given role via the specified identity link type, equivalent to the link Flowable would have created automatically had a user task been assigned to that role.
    • addNote

      public String addNote(String processInstanceId, String note)
      Adds a note to the given process instance's note thread and returns the created note's id. Works for running and completed process instances. This is the supported way to attach a ProcessNote from a script — the ProcessNote.processInstance association is read-only at the entity layer, so entityUtil.createEntity cannot establish the link. For a note tied to a specific task, use taskUtil.addNote instead.
      The note is created with security bypassed: the executing user does not need access to the process instance, so scripts fired without an authenticated user (timers, message events) work too.
      Groovy example:
      def noteId = processUtil.addNote(execution.processInstanceId, 'Escalated to supervisor')
      Returns: the id of the created ProcessNote
      Parameters:
      processInstanceId - the process instance to attach the note to (running or completed)
      note - the note text
      Returns:
      the created ProcessNote's id