org.dspace.app.xmlui.aspect.submission
Class FlowUtils

java.lang.Object
  extended by org.dspace.app.xmlui.aspect.submission.FlowUtils

public class FlowUtils
extends java.lang.Object

This is a utility class to aid in the submission flow scripts. Since data validation is cumbersome inside a flow script this is a collection of methods to perform processing at each step of the flow, the flow script will ties these operations together in a meaningful order but all actually processing is done through these various processes.

Author:
Scott Phillips, Tim Donohue (modified for Configurable Submission)

Constructor Summary
FlowUtils()
           
 
Method Summary
static InProgressSubmission findSubmission(Context context, java.lang.String inProgressSubmissionID)
          Return the InProgressSubmission, either workspaceItem or workflowItem, depending on the id provided.
static WorkflowItem findWorkflow(Context context, java.lang.String inProgressSubmissionID)
          Return the workflow identified by the given id, the id should be prepended with the character S to signify that it is a workflow instead of a workspace.
static WorkspaceItem findWorkspace(Context context, java.lang.String inProgressSubmissionID)
          Return the workspace identified by the given id, the id should be prepended with the character S to signify that it is a workspace instead of a workflow.
static java.lang.String getFieldName(DCInput input)
          Return the HTML / DRI field name for the given input.
static StepAndPage[] getListOfAllSteps(javax.servlet.http.HttpServletRequest request, SubmissionInfo subInfo)
          Retrieves a list of all steps and pages within the current submission process.
static int getMaximumPageReached(Context context, java.lang.String id)
          Find the maximum page (within the maximum step) that the user has reached in the submission processes.
static int getMaximumStepReached(Context context, java.lang.String id)
          Find the maximum step the user has reached in the submission processes.
static int getPage(double stepAndPage)
          Get number of the current page within the current step
static int getStep(double stepAndPage)
          Get current step number
static SubmissionInfo obtainSubmissionInfo(java.util.Map objectModel, java.lang.String workspaceID)
          Obtains the submission info for the current submission process.
static boolean processApproveTask(Context context, java.lang.String id)
          Update the provided workflowItem to advance to the next workflow step.
static void processClaimTask(Context context, java.lang.String id)
          Claim this task from the pool of unclaimed task so that this user may perform the task by either approving or rejecting it.
static java.lang.String processRejectTask(Context context, java.lang.String id, org.apache.cocoon.environment.Request request)
          Reject the given task for the given reason.
static void processSaveOrRemove(Context context, java.lang.String id, org.apache.cocoon.environment.Request request)
          Process the save or remove step.
static void processUnclaimTask(Context context, java.lang.String id)
          Return the given task back to the pool of unclaimed tasks for another user to select and perform.
static void setBackPageReached(Context context, java.lang.String id, int step, int page)
          Set a specific step and page as reached.
static void setPageReached(Context context, java.lang.String id, int step, int page)
          Indicate the user has advanced to the given page within a given step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowUtils

public FlowUtils()
Method Detail

findSubmission

public static InProgressSubmission findSubmission(Context context,
                                                  java.lang.String inProgressSubmissionID)
                                           throws java.sql.SQLException
Return the InProgressSubmission, either workspaceItem or workflowItem, depending on the id provided. If the id begins with an S then it is a considered a workspaceItem. If the id begins with a W then it is considered a workflowItem.

Parameters:
context -
inProgressSubmissionID -
Returns:
The InprogressSubmission or null if non found
Throws:
java.sql.SQLException

findWorkspace

public static WorkspaceItem findWorkspace(Context context,
                                          java.lang.String inProgressSubmissionID)
                                   throws java.sql.SQLException
Return the workspace identified by the given id, the id should be prepended with the character S to signify that it is a workspace instead of a workflow.

Parameters:
context -
inProgressSubmissionID -
Returns:
The found workspaceitem or null if none found.
Throws:
java.sql.SQLException

findWorkflow

public static WorkflowItem findWorkflow(Context context,
                                        java.lang.String inProgressSubmissionID)
                                 throws java.sql.SQLException
Return the workflow identified by the given id, the id should be prepended with the character S to signify that it is a workflow instead of a workspace.

Parameters:
context -
inProgressSubmissionID -
Returns:
The found workflowitem or null if none found.
Throws:
java.sql.SQLException

obtainSubmissionInfo

public static SubmissionInfo obtainSubmissionInfo(java.util.Map objectModel,
                                                  java.lang.String workspaceID)
                                           throws java.sql.SQLException
Obtains the submission info for the current submission process. If a submissionInfo object has already been created for this HTTP request, it is re-used, otherwise it is created.

Parameters:
objectModel - the cocoon Objectmodel
workspaceID - the workspaceID of the submission info to obtain
Returns:
a SubmissionInfo object
Throws:
java.sql.SQLException

setPageReached

public static void setPageReached(Context context,
                                  java.lang.String id,
                                  int step,
                                  int page)
                           throws java.sql.SQLException,
                                  AuthorizeException,
                                  java.io.IOException
Indicate the user has advanced to the given page within a given step. This will only actually do anything when it's a user initially entering a submission. It will increase the "stage reached" and "page reached" columns - it will not "set back" where a user has reached.

Parameters:
context - The current DSpace content
id - The unique ID of the current workflow/workspace
step - the step the user has just reached
page - the page (within the step) the user has just reached
Throws:
java.sql.SQLException
AuthorizeException
java.io.IOException

setBackPageReached

public static void setBackPageReached(Context context,
                                      java.lang.String id,
                                      int step,
                                      int page)
                               throws java.sql.SQLException,
                                      AuthorizeException,
                                      java.io.IOException
Set a specific step and page as reached. It will also "set back" where a user has reached.

Parameters:
context - The current DSpace content
id - The unique ID of the current workflow/workspace
step - the step to set as reached, can be also a previous reached step
page - the page (within the step) to set as reached, can be also a previous reached page
Throws:
java.sql.SQLException
AuthorizeException
java.io.IOException

getMaximumStepReached

public static int getMaximumStepReached(Context context,
                                        java.lang.String id)
                                 throws java.sql.SQLException
Find the maximum step the user has reached in the submission processes. If this submission is a workflow then return max-int.

Parameters:
context - The current DSpace content
id - The unique ID of the current workflow/workspace
Throws:
java.sql.SQLException

getMaximumPageReached

public static int getMaximumPageReached(Context context,
                                        java.lang.String id)
                                 throws java.sql.SQLException
Find the maximum page (within the maximum step) that the user has reached in the submission processes. If this submission is a workflow then return max-int.

Parameters:
context - The current DSpace content
id - The unique ID of the current workflow/workspace
Throws:
java.sql.SQLException

getStep

public static int getStep(double stepAndPage)
Get current step number

Parameters:
stepAndPage - a double representing the current step and page (e.g. 1.2 is page 2 of step 1)
Returns:
step number

getPage

public static int getPage(double stepAndPage)
Get number of the current page within the current step

Parameters:
stepAndPage - a double representing the current step and page (e.g. 1.2 is page 2 of step 1)
Returns:
page number (within current step)

processSaveOrRemove

public static void processSaveOrRemove(Context context,
                                       java.lang.String id,
                                       org.apache.cocoon.environment.Request request)
                                throws java.sql.SQLException,
                                       AuthorizeException,
                                       java.io.IOException
Process the save or remove step. If the user has selected to remove their submission then remove it.

Parameters:
context - The current DSpace content
id - The unique ID of the current workspace/workflow
request - The cocoon request object.
Throws:
java.sql.SQLException
AuthorizeException
java.io.IOException

processApproveTask

public static boolean processApproveTask(Context context,
                                         java.lang.String id)
                                  throws java.sql.SQLException,
                                         UIException,
                                         javax.servlet.ServletException,
                                         AuthorizeException,
                                         java.io.IOException
Update the provided workflowItem to advance to the next workflow step. If this was the last thing needed before the item is committed to the repository then return true, otherwise false.

Parameters:
context - The current DSpace content
id - The unique ID of the current workflow
Throws:
java.sql.SQLException
UIException
javax.servlet.ServletException
AuthorizeException
java.io.IOException

processUnclaimTask

public static void processUnclaimTask(Context context,
                                      java.lang.String id)
                               throws java.sql.SQLException,
                                      UIException,
                                      javax.servlet.ServletException,
                                      AuthorizeException,
                                      java.io.IOException
Return the given task back to the pool of unclaimed tasks for another user to select and perform.

Parameters:
context - The current DSpace content
id - The unique ID of the current workflow
Throws:
java.sql.SQLException
UIException
javax.servlet.ServletException
AuthorizeException
java.io.IOException

processClaimTask

public static void processClaimTask(Context context,
                                    java.lang.String id)
                             throws java.sql.SQLException,
                                    UIException,
                                    javax.servlet.ServletException,
                                    AuthorizeException,
                                    java.io.IOException
Claim this task from the pool of unclaimed task so that this user may perform the task by either approving or rejecting it.

Parameters:
context - The current DSpace content
id - The unique ID of the current workflow
Throws:
java.sql.SQLException
UIException
javax.servlet.ServletException
AuthorizeException
java.io.IOException

processRejectTask

public static java.lang.String processRejectTask(Context context,
                                                 java.lang.String id,
                                                 org.apache.cocoon.environment.Request request)
                                          throws java.sql.SQLException,
                                                 UIException,
                                                 javax.servlet.ServletException,
                                                 AuthorizeException,
                                                 java.io.IOException
Reject the given task for the given reason. If the user did not provide a reason then an error is generated placing that field in error.

Parameters:
context - The current DSpace content
id - The unique ID of the current workflow
request - The current request object
Throws:
java.sql.SQLException
UIException
javax.servlet.ServletException
AuthorizeException
java.io.IOException

getFieldName

public static java.lang.String getFieldName(DCInput input)
Return the HTML / DRI field name for the given input.

Parameters:
input -
Returns:
field name as a String (e.g. dc_contributor_editor)

getListOfAllSteps

public static StepAndPage[] getListOfAllSteps(javax.servlet.http.HttpServletRequest request,
                                              SubmissionInfo subInfo)
Retrieves a list of all steps and pages within the current submission process.

This list may differ from the list of steps in the progress bar if the current submission process includes non-interactive steps which do not appear in the progress bar!

This method is used by the Manakin submission flowscript (submission.js) to step forward/backward between steps.

Parameters:
request - The HTTP Servlet Request object
subInfo - the current SubmissionInfo object


Copyright © 2010 DuraSpace. All Rights Reserved.