Interface IWorkflowManager


public interface IWorkflowManager
Handles the functionality related to workflow - both the workflow transitions (these have delegate methods on IWorkflowObject interface, so don't have to be called directly) and for work with the workflow configuration.
Author:
dobisekm
  • Method Details

    • getAvailableActions

      @NotNull IWorkflowAction[] getAvailableActions(@NotNull IWorkflowObject target)
      The workflow actions available for the target object. Which actions are available depends on the type of the object (@see IWorkflowObject#getType()), status of the object (@see IWorkflowObject.getStatus()) and the result of validating the conditions.
      Parameters:
      target - the object to get the actions for
      Returns:
      actions available for the target object
    • getUnavailableActions

      @NotNull Map<IWorkflowAction,String> getUnavailableActions(@NotNull IWorkflowObject target)
      The workflow actions unavailable for the target object.
      Parameters:
      target - the object to get the actions for
      Returns:
      map from unavailable actions to messages describing reason of unavailability
      Since:
      3.6.1
      See Also:
    • getAllActions

      @NotNull Map<IWorkflowAction,String> getAllActions(@NotNull IWorkflowObject item)
      The workflow actions both available and unavailable for the target object.
      Parameters:
      target - the object to get the actions for.
      Returns:
      map from all actions defined for the target object to messages describing the reason(s) for unavailability. In the case of available actions, the mapped message will be null.
      Since:
      3.20.2
    • getInitialAction

      @Nullable IWorkflowAction getInitialAction(@NotNull IWorkflowObject target)
      Returns the initial workflow action if it is defined for this workflow. The initial action is always called implicitly by the system and is made available through this method so that interested clients can check, for example, the list of required features.
      Returns:
      initial action or null
      Since:
      3.3.0
    • handleSave

      void handleSave(@NotNull IWorkflowObject target)
      Called internally. Clients should not call this method themselves.
      Since:
      3.3.0
    • performAction

      @NotNull IPObjectList performAction(@NotNull IWorkflowObject target, int actionId)
      Performs the given worflow action. The action might modify some other objects as well - in such a case the list with the modified objects is returned.

      This allows clients to handle that correctly - e.g. present this list to the user for approval, etc.

      Parameters:
      target - the object to perform the action on
      actionId - id of the action to perform
      Returns:
      a List object containing all modified IPObjects except the passed wi
      See Also:
    • resetWorkflow

      void resetWorkflow(@NotNull IWorkflowObject target)
      Resets the workflow so that the target enters the initial status. If there is initial workflow action defined, it will be registered and called on commit or before next workflow (whatever comes first).

      Open transaction is required to call this method.

      Called by the target whenever the type changes.

      Parameters:
      target - the object for which the workflow should be reset
    • getContributionsManager

      @NotNull IContributionsManager getContributionsManager()
      Returns:
      The contributions manager, which provides information about extensions contributed into workflow.
    • getWorkflowConfig

      @Nullable IWorkflowConfig getWorkflowConfig(@NotNull IWorkflowObject target)
      Returns workflow configuration that is used for the target object (it can be inherited from a different context or type). Returns null if no workflow configuration exists, or if it cannot be used because of some problem.
      Since:
      3.8.2
    • getWorkflowConfig

      @Nullable IWorkflowConfig getWorkflowConfig(@NotNull String prototype, @Nullable String typeId, @NotNull IContextId contextId)
      Returns workflow configuration that is used for the objects of given prototype and type in the given context (it can be inherited from a different context or type). Returns null if no workflow configuration exists, or if it cannot be used because of some problem.
      Since:
      3.8.3
    • readWorkflowConfig

      @Nullable IWorkflowConfig readWorkflowConfig(@NotNull String prototype, @Nullable String typeId, @NotNull IContextId contextId) throws VerificationException
      Returns the workflow which corresponds exactly to the given context, type and prototype, returns null if no workflow is defined for this combination of parameters.

      Note, that even is null is returned, there still might be a workflow configuration inherited from parent contexts or typeless one.

      Parameters:
      prototype - string with prototype where configuration will be read, not null
      typeId - string type ID, might be null
      contextId - never null
      Throws:
      VerificationException
      Since:
      3.8.1
    • updateWorkflowConfig

      void updateWorkflowConfig(@NotNull IWorkflowConfig config, @Nullable String typeId, @NotNull IContextId contextId) throws VerificationException
      Stores the given workflow configuration to the repository (for the prototype config.getPrototype()).
      Parameters:
      config -
      typeId - target object type ID, might be null
      contextId - never null
      Throws:
      VerificationException
    • parseWorkflowConfig

      @Nullable IWorkflowConfig parseWorkflowConfig(@NotNull InputStream in) throws VerificationException
      Convenience method for parsing workflows stored in some arbitrary location. The stream passed in will be closed before the method returns.
      Parameters:
      in - the stream to read the workflow config, not null.
      Returns:
      the configuration read from in
      Throws:
      VerificationException
    • readWorkflowConfig

      @Deprecated @Nullable IWorkflowConfig readWorkflowConfig(@Nullable String typeId, @NotNull IContextId contextId) throws VerificationException
      Returns the workflow which corresponds exactly to the given context, type and Work Item prototype, returns null if no workflow is defined for this combination of parameters.

      Note, that even is null is returned, there still might be a workflow configuration inherited from parent contexts or typeless one.

      Parameters:
      typeId - target object type ID, might be null
      contextId - never null
      Throws:
      VerificationException
    • calculateSignatureState

      @NotNull ISignatureStateOpt calculateSignatureState(@NotNull IWorkflowObject target, @NotNull String targetStatusId, @NotNull List<ISignature> signatures)
      Returns signature state of the transition from current status of the target object to the target status.
      Since:
      3.9.0
    • getSignatureStateMessage

      @Nullable String getSignatureStateMessage(@NotNull IWorkflowObject target, @NotNull String targetStatusId, @NotNull ISignatureStateOpt state)
      Returns message for the signature state of the transition from current status of the target object to the target status. The message is usually provided by the signature policy of the transition.
      Since:
      3.9.0