org.dspace.submit
Class AbstractProcessingStep

java.lang.Object
  extended by org.dspace.submit.AbstractProcessingStep
Direct Known Subclasses:
CompleteStep, DescribeStep, InitialQuestionsStep, LicenseStep, SampleStep, SelectCollectionStep, SkipInitialQuestionsStep, UploadStep, VerifyStep

public abstract class AbstractProcessingStep
extends Object

Abstract processing class for DSpace Submission Steps. This defines the base methods which are required for any Step processing class.

This abstract class defines the base methods which are used by both the Manakin XML UI and the JSP UI to perform submission step processing.

This includes the following methods:

If you are using the JSP UI (with the SubmissionController servlet) you should extend the org.dspace.submit.SubmissionStep class, which defines additional methods used to maintain the context of the submission within a JSP environment!

Version:
$Revision: 3738 $
Author:
Tim Donohue
See Also:
org.dspace.app.webui.submit.JSPStepManager, org.dspace.app.webui.servlet.SubmissionController, SubmissionConfig, SubmissionStepConfig

Field Summary
static String CANCEL_BUTTON
          Constant - Name of the "Cancel/Save" button
static int LAST_PAGE_REACHED
          Flag which specifies that the LAST PAGE of a step has been reached.
static String NEXT_BUTTON
          Constant - Name of the "Next->" button
static String PREVIOUS_BUTTON
          Constant - Name of the "<-Previous" button
static String PROGRESS_BAR_PREFIX
          Constant - Prefix of all buttons in the Progress Bar
static int STATUS_COMPLETE
          STATUS / ERROR FLAGS (returned by doProcessing() if an error occurs or additional user interaction may be required)
 
Constructor Summary
AbstractProcessingStep()
           
 
Method Summary
protected static 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())
protected  void addErrorMessage(int errorFlag, String errorMessage)
          Add an error message to the internal map for this step.
protected static void clearErrorFields(javax.servlet.http.HttpServletRequest request)
          Clears the list of all fields that errored out during the previous step's processing.
abstract  int doProcessing(Context context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, SubmissionInfo subInfo)
          Do any processing of the information input by the user, and/or perform step processing (if no user interaction required)
static int getCurrentPage(javax.servlet.http.HttpServletRequest request)
          Find out which page a user is currently viewing
static List getErrorFields(javax.servlet.http.HttpServletRequest request)
          Return a list of all UI fields which had errors that occurred during the step processing.
 String getErrorMessage(int errorFlag)
          Return the text of an error message based on the passed in error flag.
abstract  int getNumberOfPages(javax.servlet.http.HttpServletRequest request, SubmissionInfo subInfo)
          Retrieves the number of pages that this "step" extends over.
static void setCurrentPage(javax.servlet.http.HttpServletRequest request, int pageNumber)
          Set which page a user is currently viewing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREVIOUS_BUTTON

public static String PREVIOUS_BUTTON
Constant - Name of the "<-Previous" button


NEXT_BUTTON

public static String NEXT_BUTTON
Constant - Name of the "Next->" button


CANCEL_BUTTON

public static String CANCEL_BUTTON
Constant - Name of the "Cancel/Save" button


PROGRESS_BAR_PREFIX

public static String PROGRESS_BAR_PREFIX
Constant - Prefix of all buttons in the Progress Bar


LAST_PAGE_REACHED

public static int LAST_PAGE_REACHED
Flag which specifies that the LAST PAGE of a step has been reached. This flag is used when a Workflow Item is rejected (and returned to the workspace) to specify that the LAST PAGE of the LAST STEP has already been reached


STATUS_COMPLETE

public static int STATUS_COMPLETE
STATUS / ERROR FLAGS (returned by doProcessing() if an error occurs or additional user interaction may be required)

Constructor Detail

AbstractProcessingStep

public AbstractProcessingStep()
Method Detail

doProcessing

public abstract int doProcessing(Context context,
                                 javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 SubmissionInfo subInfo)
                          throws javax.servlet.ServletException,
                                 IOException,
                                 SQLException,
                                 AuthorizeException
Do any processing of the information input by the user, and/or perform step processing (if no user interaction required)

It is this method's job to save any data to the underlying database, as necessary, and return error messages (if any) which can then be processed by the doPostProcessing() method.

NOTE: If this step is a non-interactive step (i.e. requires no UI), then it should perform *all* of its processing in this method!

Parameters:
context - current DSpace context
request - current servlet request object
response - current servlet response object
subInfo - submission info object
Returns:
Status or error flag which will be processed by doPostProcessing() below! (if STATUS_COMPLETE or 0 is returned, no errors occurred!)
Throws:
javax.servlet.ServletException
IOException
SQLException
AuthorizeException

getErrorFields

public static final List getErrorFields(javax.servlet.http.HttpServletRequest request)
Return a list of all UI fields which had errors that occurred during the step processing. This list is for usage in generating the appropriate error message(s) in the UI.

The list of fields which had errors should be set by the AbstractProcessingStep's doProcessing() method, so that it can be accessed later by whatever UI is generated.

Parameters:
request - current servlet request object
Returns:
List of error fields (as Strings)

addErrorField

protected static final 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())

The list of fields which had errors should be set by the AbstractProcessingStep's doProcessing() method, so that it can be accessed later by whatever UI is generated.

Parameters:
fieldName - the name of the field which had an error

clearErrorFields

protected static final void clearErrorFields(javax.servlet.http.HttpServletRequest request)
Clears the list of all fields that errored out during the previous step's processing.

Parameters:
request - current servlet request object

getErrorMessage

public final String getErrorMessage(int errorFlag)
Return the text of an error message based on the passed in error flag. These error messages are used for non-interactive steps (so that they can log something more specific than just an error flag)

Since each step can define its own error messages and flags, this method depends on all the error messages being initialized by using the "addErrorMessage()" method within the constructor for the step class!

Parameters:
errorFlag - The error flag defined in this step which represents an error message.
Returns:
String which contains the text of the error message, or null if error message not found

addErrorMessage

protected final void addErrorMessage(int errorFlag,
                                     String errorMessage)
Add an error message to the internal map for this step.

This method associates a specific error message with an error flag defined in this step.

This is extremely useful to define the error message which will be logged for a non-interactive step.

Parameters:
fieldName - the name of the field which had an error

getNumberOfPages

public abstract int getNumberOfPages(javax.servlet.http.HttpServletRequest request,
                                     SubmissionInfo subInfo)
                              throws javax.servlet.ServletException
Retrieves the number of pages that this "step" extends over. This method is used by the SubmissionController to build the progress bar.

This method may just return 1 for most steps (since most steps consist of a single page). But, it should return a number greater than 1 for any "step" which spans across a number of HTML pages. For example, the configurable "Describe" step (configured using input-forms.xml) overrides this method to return the number of pages that are defined by its configuration file.

Steps which are non-interactive (i.e. they do not display an interface to the user) should return a value of 1, so that they are only processed once!

Parameters:
request - The HTTP Request
subInfo - The current submission information object
Returns:
the number of pages in this step
Throws:
javax.servlet.ServletException

getCurrentPage

public static final int getCurrentPage(javax.servlet.http.HttpServletRequest request)
Find out which page a user is currently viewing

Parameters:
request - HTTP request
Returns:
current page

setCurrentPage

public static final void setCurrentPage(javax.servlet.http.HttpServletRequest request,
                                        int pageNumber)
Set which page a user is currently viewing

Parameters:
request - HTTP request
pageNumber - new current page


Copyright © 2010 DuraSpace. All Rights Reserved.