Class Action

java.lang.Object
org.dspace.xmlworkflow.state.actions.Action
Direct Known Subclasses:
ProcessingAction, UserSelectionAction

public abstract class Action extends Object
This abstract class represents a workflow action. Each step in the workflow consists of a number of actions. This abstract action contains some utility methods and the methods that each of these actions must implement including: activating, execution, ....
Author:
Bram De Schouwer (bram.deschouwer at dot com), Kevin Van de Velde (kevin at atmire dot com), Ben Bosman (ben at atmire dot com), Mark Diggory (markd at atmire dot com)
  • Constructor Details

    • Action

      public Action()
  • Method Details

    • activate

      public abstract void activate(Context c, XmlWorkflowItem wf) throws SQLException, IOException, AuthorizeException, WorkflowException
      Called when a workflow item becomes eligible for this Action.
      Parameters:
      c - current DSpace session.
      wf - the eligible item.
      Throws:
      SQLException - passed through.
      IOException - passed through.
      AuthorizeException - passed through.
      WorkflowException - passed through.
    • execute

      public abstract ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, jakarta.servlet.http.HttpServletRequest request) throws SQLException, AuthorizeException, IOException, WorkflowException
      Called when the action is to be performed.
      Parameters:
      c - current DSpace session.
      wfi - the item on which the action is to be performed.
      step - the workflow step in which the action is performed.
      request - the current client request.
      Returns:
      the result of performing the action.
      Throws:
      SQLException - passed through.
      AuthorizeException - passed through.
      IOException - passed through.
      WorkflowException - passed through.
    • getOptions

      public abstract List<String> getOptions()
      Returns a list of options that the user can select at this action which results in the next step in the workflow
      Returns:
      A list of options of this action, resulting in the next step of the workflow
    • isOptionInParam

      protected boolean isOptionInParam(jakarta.servlet.http.HttpServletRequest request)
      Returns true if one of the options is a parameter of the request
      Parameters:
      request - Action request
      Returns:
      true if one of the options is a parameter of the request; false if none was found
    • getParent

      public WorkflowActionConfig getParent()
      Get the configuration of this Action.
      Returns:
      details of this instance of an Action.
    • setParent

      public void setParent(WorkflowActionConfig parent)
      Configure this Action.
      Parameters:
      parent - details of this instance of an Action.
    • getProvenanceStartId

      public String getProvenanceStartId()
      Build provenance information for the action.
      Returns:
      a String identifying the step and action.
    • alertUsersOnActivation

      public void alertUsersOnActivation(Context c, XmlWorkflowItem wfi, RoleMembers members) throws SQLException, IOException
      Notify action role members that an item requires action.
      Parameters:
      c - current DSpace session.
      wfi - the needy item.
      members - users who may fulfill the role.
      Throws:
      SQLException - passed through.
      IOException - passed through.
    • isAuthorized

      public abstract boolean isAuthorized(Context context, jakarta.servlet.http.HttpServletRequest request, XmlWorkflowItem wfi) throws SQLException, AuthorizeException, IOException, WorkflowConfigurationException
      Is this client authorized to act on this item?
      Parameters:
      context - current DSpace session.
      request - current client request.
      wfi - the workflow item in question.
      Returns:
      true if authorized.
      Throws:
      SQLException - passed through.
      AuthorizeException - passed through.
      IOException - passed through.
      WorkflowConfigurationException - if the workflow is mis-configured.
    • getErrorFields

      public static List getErrorFields(jakarta.servlet.http.HttpServletRequest request)
      Return a list of all UI fields which had errors that occurred during the workflow processing. This list is for usage in generating the appropriate error message(s) in the UI.
      Parameters:
      request - current servlet request object
      Returns:
      List of error fields (as Strings)
    • addErrorField

      protected void addErrorField(jakarta.servlet.http.HttpServletRequest request, String fieldName)
      Add a single UI field to the list of all error fields (which can later be retrieved using getErrorFields())
      Parameters:
      request - current servlet request object
      fieldName - the name of the field which had an error
    • getAdvancedOptions

      protected List<String> getAdvancedOptions()
      Returns a list of advanced options that the user can select at this action
      Returns:
      A list of advanced options of this action, resulting in the next step of the workflow
    • isAdvanced

      protected boolean isAdvanced()
      Returns true if this Action has advanced options, false if it doesn't
      Returns:
      true if there are advanced options, false otherwise
    • getAdvancedInfo

      protected List<ActionAdvancedInfo> getAdvancedInfo()
      Returns a list of advanced info required by the advanced options
      Returns:
      A list of advanced info required by the advanced options
    • addApprovedProvenance

      public void addApprovedProvenance(Context c, XmlWorkflowItem wfi) throws SQLException, AuthorizeException
      Adds info in the metadata field dc.description.provenance about item being approved containing in which step it was approved, which user approved it and the time
      Parameters:
      c - DSpace contact
      wfi - Workflow item we're adding workflow accept provenance on
      Throws:
      SQLException
      AuthorizeException