Interface WorkflowContext


public interface WorkflowContext
A workflow context class is made available to a workflow implementation (see WorkflowImpl@getWorkflowContext) to obtain additional information during the execution of a workflow step.
  • Method Details

    • getWorkflow

      Workflow getWorkflow(String category) throws WorkflowException, RepositoryException
      Obtains a workflow instance for this workflow context its subject.

      Be aware that the returned workflow is checked against the getInternalWorkflowSession() privileges, so NOT against the initial workflow invocation getUserSession().

      For the returned workflow it is assumed there are no pending changes on its getInternalWorkflowSession(). So before using the returned workflow it might be required to first do a Session.save() or Session.refresh(false).

      Parameters:
      category - Name of the workflow category
      Returns:
      a workflow instance
      Throws:
      MappingException
      WorkflowException
      RepositoryException
    • getWorkflow

      Workflow getWorkflow(String category, Document document) throws WorkflowException, RepositoryException
      Obtains a workflow instance for a document subject

      Be aware that the returned workflow is checked against the getInternalWorkflowSession() privileges, so NOT against the initial workflow invocation getUserSession().

      For the returned workflow it is assumed there are no pending changes on its getInternalWorkflowSession(). So before using the returned workflow it might be required to first do a Session.save() or Session.refresh(false).

      Parameters:
      category - Name of the workflow category
      document - Document subject for which the new workflow instance will be returned
      Returns:
      a workflow instance
      Throws:
      MappingException
      WorkflowException
      RepositoryException
    • getUserIdentity

      String getUserIdentity()
      Returns:
      the invocation user identity
    • getUserSession

      Session getUserSession()
      Obtains the initial workflow invocation (user) session.
      Returns:
      the invocation user session
    • getSubject

      Node getSubject()
      Obtains the subject of this WorkflowContext
      Returns:
      the subject of this WorkflowContext
    • getSubjectSession

      Session getSubjectSession()
      Obtain the subject session used to check and load the current workflow.

      For an initial workflow invocation this will be, in most cases, but not all, see below, the getUserSession().
      For any subsequent (nested) workflow invocation this will be the getInternalWorkflowSession().

      If the initial workflow was invoked through WorkflowManager.getWorkflow(String, Node), the provided node parameter its own session will be used as subject session, so potentially different from the user session invoking the workflow!

      This separate session reference is useful to check JCR permissions within the workflow as was used to validate access the workflow itself.

      Returns:
      the session to check permissions on and within the current workflow itself
    • getInternalWorkflowSession

      Session getInternalWorkflowSession()
      Obain the internal workflow session which has 'root' privileges. This session is internally used by the workflow and used to persist workflow modifications. Also, the workflow subject (Node) itself will be loaded through this internal workflow session.

      Do NOT return JCR Items loaded through this internal workflow session back to the invoking user, as it will expose access to this session.

      Be very careful making changes through the internal workflow session: state consistency can easily broken that way.

      Returns:
      the internal workflow session with higer(st) privileges: be aware of possible dangerous side-effects when used for modifications
    • getWorkflowConfiguration

      RepositoryMap getWorkflowConfiguration()
    • getInteraction

      String getInteraction()
    • getInteractionId

      String getInteractionId()