org.dspace.workflow
Class WorkflowManager

java.lang.Object
  extended by org.dspace.workflow.WorkflowManager

public class WorkflowManager
extends Object

Workflow state machine Notes: Determining item status from the database: When an item has not been submitted yet, it is in the user's personal workspace (there is a row in PersonalWorkspace pointing to it.) When an item is submitted and is somewhere in a workflow, it has a row in the WorkflowItem table pointing to it. The state of the workflow can be determined by looking at WorkflowItem.getState() When a submission is complete, the WorkflowItem pointing to the item is destroyed and the archive() method is called, which hooks the item up to the archive. Notification: When an item enters a state that requires notification, (WFSTATE_STEP1POOL, WFSTATE_STEP2POOL, WFSTATE_STEP3POOL,) the workflow needs to notify the appropriate groups that they have a pending task to claim. Revealing lists of approvers, editors, and reviewers. A method could be added to do this, but it isn't strictly necessary. (say public List getStateEPeople( WorkflowItem wi, int state ) could return people affected by the item's current state.


Field Summary
static int WFSTATE_ARCHIVE
           
static int WFSTATE_STEP1
           
static int WFSTATE_STEP1POOL
           
static int WFSTATE_STEP2
           
static int WFSTATE_STEP2POOL
           
static int WFSTATE_STEP3
           
static int WFSTATE_STEP3POOL
           
static int WFSTATE_SUBMIT
           
static String[] workflowText
          Symbolic names of workflow steps.
 
Constructor Summary
WorkflowManager()
           
 
Method Summary
static void abort(Context c, WorkflowItem wi, EPerson e)
          abort() aborts a workflow, completely deleting it (administrator do this) (it will basically do a reject from any state - the item ends up back in the user's PersonalWorkspace
static void advance(Context c, WorkflowItem wi, EPerson e)
          approveAction() sends an item forward in the workflow (reviewers, approvers, and editors all do an 'approve' to move the item forward) if the item arrives at the submit state, then remove the WorkflowItem and call the archive() method to put it in the archive, and email notify the submitter of a successful submission
static void claim(Context c, WorkflowItem wi, EPerson e)
          claim() claims a workflow task for an EPerson
static String getItemTitle(WorkflowItem wi)
          get the title of the item in this workflow
static List getOwnedTasks(Context c, EPerson e)
          getOwnedTasks() returns a List of WorkflowItems containing the tasks claimed and owned by an EPerson.
static List getPooledTasks(Context c, EPerson e)
          getPooledTasks() returns a List of WorkflowItems an EPerson could claim (as a reviewer, etc.) for display on a user's MyDSpace page.
static String getSubmitterName(WorkflowItem wi)
          get the name of the eperson who started this workflow
static int getWorkflowID(String state)
          Translate symbolic name of workflow state into number.
static WorkspaceItem reject(Context c, WorkflowItem wi, EPerson e, String rejection_message)
          rejects an item - rejection means undoing a submit - WorkspaceItem is created, and the WorkflowItem is removed, user is emailed rejection_message.
static WorkflowItem start(Context c, WorkspaceItem wsi)
          startWorkflow() begins a workflow - in a single transaction do away with the PersonalWorkspace entry and turn it into a WorkflowItem.
static WorkflowItem startWithoutNotify(Context c, WorkspaceItem wsi)
          startWithoutNotify() starts the workflow normally, but disables notifications (useful for large imports,) for the first workflow step - subsequent notifications happen normally
static void unclaim(Context c, WorkflowItem wi, EPerson e)
          unclaim() returns an owned task/item to the pool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WFSTATE_SUBMIT

public static final int WFSTATE_SUBMIT
See Also:
Constant Field Values

WFSTATE_STEP1POOL

public static final int WFSTATE_STEP1POOL
See Also:
Constant Field Values

WFSTATE_STEP1

public static final int WFSTATE_STEP1
See Also:
Constant Field Values

WFSTATE_STEP2POOL

public static final int WFSTATE_STEP2POOL
See Also:
Constant Field Values

WFSTATE_STEP2

public static final int WFSTATE_STEP2
See Also:
Constant Field Values

WFSTATE_STEP3POOL

public static final int WFSTATE_STEP3POOL
See Also:
Constant Field Values

WFSTATE_STEP3

public static final int WFSTATE_STEP3
See Also:
Constant Field Values

WFSTATE_ARCHIVE

public static final int WFSTATE_ARCHIVE
See Also:
Constant Field Values

workflowText

public static final String[] workflowText
Symbolic names of workflow steps.

Constructor Detail

WorkflowManager

public WorkflowManager()
Method Detail

getWorkflowID

public static int getWorkflowID(String state)
Translate symbolic name of workflow state into number. The name is case-insensitive. Returns -1 when name cannot be matched.

Parameters:
state - symbolic name of workflow state, must be one of the elements of workflowText array.
Returns:
numeric workflow state or -1 for error.

start

public static WorkflowItem start(Context c,
                                 WorkspaceItem wsi)
                          throws SQLException,
                                 AuthorizeException,
                                 IOException
startWorkflow() begins a workflow - in a single transaction do away with the PersonalWorkspace entry and turn it into a WorkflowItem.

Parameters:
c - Context
wsi - The WorkspaceItem to convert to a workflow item
Returns:
The resulting workflow item
Throws:
SQLException
AuthorizeException
IOException

startWithoutNotify

public static WorkflowItem startWithoutNotify(Context c,
                                              WorkspaceItem wsi)
                                       throws SQLException,
                                              AuthorizeException,
                                              IOException
startWithoutNotify() starts the workflow normally, but disables notifications (useful for large imports,) for the first workflow step - subsequent notifications happen normally

Throws:
SQLException
AuthorizeException
IOException

getOwnedTasks

public static List getOwnedTasks(Context c,
                                 EPerson e)
                          throws SQLException
getOwnedTasks() returns a List of WorkflowItems containing the tasks claimed and owned by an EPerson. The GUI displays this info on the MyDSpace page.

Parameters:
e - The EPerson we want to fetch owned tasks for.
Throws:
SQLException

getPooledTasks

public static List getPooledTasks(Context c,
                                  EPerson e)
                           throws SQLException
getPooledTasks() returns a List of WorkflowItems an EPerson could claim (as a reviewer, etc.) for display on a user's MyDSpace page.

Parameters:
e - The Eperson we want to fetch the pooled tasks for.
Throws:
SQLException

claim

public static void claim(Context c,
                         WorkflowItem wi,
                         EPerson e)
                  throws SQLException,
                         IOException,
                         AuthorizeException
claim() claims a workflow task for an EPerson

Parameters:
wi - WorkflowItem to do the claim on
e - The EPerson doing the claim
Throws:
SQLException
IOException
AuthorizeException

advance

public static void advance(Context c,
                           WorkflowItem wi,
                           EPerson e)
                    throws SQLException,
                           IOException,
                           AuthorizeException
approveAction() sends an item forward in the workflow (reviewers, approvers, and editors all do an 'approve' to move the item forward) if the item arrives at the submit state, then remove the WorkflowItem and call the archive() method to put it in the archive, and email notify the submitter of a successful submission

Parameters:
c - Context
wi - WorkflowItem do do the approval on
e - EPerson doing the approval
Throws:
SQLException
IOException
AuthorizeException

unclaim

public static void unclaim(Context c,
                           WorkflowItem wi,
                           EPerson e)
                    throws SQLException,
                           IOException,
                           AuthorizeException
unclaim() returns an owned task/item to the pool

Parameters:
c - Context
wi - WorkflowItem to operate on
e - EPerson doing the operation
Throws:
SQLException
IOException
AuthorizeException

abort

public static void abort(Context c,
                         WorkflowItem wi,
                         EPerson e)
                  throws SQLException,
                         AuthorizeException,
                         IOException
abort() aborts a workflow, completely deleting it (administrator do this) (it will basically do a reject from any state - the item ends up back in the user's PersonalWorkspace

Parameters:
c - Context
wi - WorkflowItem to operate on
e - EPerson doing the operation
Throws:
SQLException
AuthorizeException
IOException

reject

public static WorkspaceItem reject(Context c,
                                   WorkflowItem wi,
                                   EPerson e,
                                   String rejection_message)
                            throws SQLException,
                                   AuthorizeException,
                                   IOException
rejects an item - rejection means undoing a submit - WorkspaceItem is created, and the WorkflowItem is removed, user is emailed rejection_message.

Parameters:
c - Context
wi - WorkflowItem to operate on
e - EPerson doing the operation
rejection_message - message to email to user
Throws:
SQLException
AuthorizeException
IOException

getItemTitle

public static String getItemTitle(WorkflowItem wi)
                           throws SQLException
get the title of the item in this workflow

Parameters:
wi - the workflow item object
Throws:
SQLException

getSubmitterName

public static String getSubmitterName(WorkflowItem wi)
                               throws SQLException
get the name of the eperson who started this workflow

Parameters:
wi - the workflow item
Throws:
SQLException


Copyright © 2010 DuraSpace. All Rights Reserved.