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 Summary
Constructors Constructor Description Action()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidactivate(Context c, XmlWorkflowItem wf)Called when a workflow item becomes eligible for this Action.protected voidaddErrorField(javax.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())voidalertUsersOnActivation(Context c, XmlWorkflowItem wfi, RoleMembers members)Notify action role members that an item requires action.abstract ActionResultexecute(Context c, XmlWorkflowItem wfi, Step step, javax.servlet.http.HttpServletRequest request)Called when the action is to be performed.static ListgetErrorFields(javax.servlet.http.HttpServletRequest request)Return a list of all UI fields which had errors that occurred during the workflow processing.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 workflowWorkflowActionConfiggetParent()Get the configuration of this Action.StringgetProvenanceStartId()Build provenance information for the action.abstract booleanisAuthorized(Context context, javax.servlet.http.HttpServletRequest request, XmlWorkflowItem wfi)Is this client authorized to act on this item?protected booleanisOptionInParam(javax.servlet.http.HttpServletRequest request)Returns true if one of the options is a parameter of the requestvoidsetParent(WorkflowActionConfig parent)Configure this Action.
-
-
-
Method Detail
-
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, javax.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(javax.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, javax.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(javax.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(javax.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 objectfieldName- the name of the field which had an error
-
-