org.dspace.app.webui.servlet
Class SubmissionController

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.dspace.app.webui.servlet.DSpaceServlet
              extended by org.dspace.app.webui.servlet.SubmissionController
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class SubmissionController
extends DSpaceServlet

Submission Manager servlet for DSpace. Handles the initial submission of items, as well as the editing of items further down the line.

Whenever the submit servlet receives a GET request, this is taken to indicate the start of a fresh new submission, where no collection has been selected, and the submission process is started from scratch.

All other interactions happen via POSTs. Part of the post will normally be a (hidden) "step" parameter, which will correspond to the form that the user has just filled out. If this is absent, step 0 (select collection) is assumed, meaning that it's simple to place "Submit to this collection" buttons on collection home pages.

According to the step number of the incoming form, the values posted from the form are processed (using the process* methods), and the item updated as appropriate. The servlet then forwards control of the request to the appropriate JSP (from jsp/submit) to render the next stage of the process or an error if appropriate. Each of these JSPs may require that attributes be passed in. Check the comments at the top of a JSP to see which attributes are needed. All submit-related forms require a properly initialised SubmissionInfo object to be present in the the "submission.info" attribute. This holds the core information relevant to the submission, e.g. the item, personal workspace or workflow item, the submitting "e-person", and the target collection.

When control of the request reaches a JSP, it is assumed that all checks, interactions with the database and so on have been performed and that all necessary information to render the form is in memory. e.g. The SubmitFormInfo object passed in must be correctly filled out. Thus the JSPs do no error or integrity checking; it is the servlet's responsibility to ensure that everything is prepared. The servlet is fairly diligent about ensuring integrity at each step.

Each step has an integer constant defined below. The main sequence of the submission procedure always runs from 0 upwards, until SUBMISSION_COMPLETE. Other, not-in-sequence steps (such as the cancellation screen and the "previous version ID verification" screen) have numbers much higher than SUBMISSION_COMPLETE. These conventions allow the progress bar component of the submission forms to render the user's progress through the process.

Version:
$Revision: 5845 $
Author:
Tim Donohue
See Also:
SubmissionInfo, SubmissionConfig, SubmissionStepConfig, JSPStepManager, Serialized Form

Field Summary
static int FIRST_STEP
          First step after "select collection"
static int SELECT_COLLECTION
          Selection collection step
static int WORKFLOW_FIRST_STEP
          For workflows, first step is step #0 (since Select Collection is already filtered out)
 
Constructor Summary
SubmissionController()
           
 
Method Summary
protected  void doDSGet(Context context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process an incoming HTTP GET.
protected  void doDSPost(Context context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process an incoming HTTP POST.
static SubmissionStepConfig getCurrentStepConfig(javax.servlet.http.HttpServletRequest request, SubmissionInfo si)
          Get the configuration of the current step from parameters in the request, along with the current SubmissionInfo object.
static SubmissionStepConfig getPreviousVisibleStep(javax.servlet.http.HttpServletRequest request, SubmissionInfo si)
          Return the previous "visibile" step in the item submission process if any, null otherwise.
static int getStepReached(SubmissionInfo subInfo)
          Find out which step a user has reached in the submission process.
static SubmissionInfo getSubmissionInfo(Context context, javax.servlet.http.HttpServletRequest request)
          Reloads a filled-out submission info object from the parameters in the current request.
static java.lang.String getSubmissionParameters(Context context, javax.servlet.http.HttpServletRequest request)
          Return the submission info as hidden parameters for an HTML form on a JSP page.
static boolean isBeginningOfStep(javax.servlet.http.HttpServletRequest request)
          Get whether or not the current step has just begun.
static boolean isCancellationInProgress(javax.servlet.http.HttpServletRequest request)
          Get whether or not a cancellation is in progress (i.e.
static boolean isFirstStep(javax.servlet.http.HttpServletRequest request, SubmissionInfo si)
          Checks if the current step is also the first "visibile" step in the item submission process.
static void saveCurrentStepConfig(javax.servlet.http.HttpServletRequest request, SubmissionStepConfig step)
          Saves the current step configuration into the request.
static void saveSubmissionInfo(javax.servlet.http.HttpServletRequest request, SubmissionInfo si)
          Saves the submission info object to the current request.
static void setBeginningOfStep(javax.servlet.http.HttpServletRequest request, boolean beginningOfStep)
          Get whether or not the current step has just begun.
 void uploadFiles(Context context, javax.servlet.http.HttpServletRequest request)
          Upload any files found on the Request, and save them back as Request attributes, for further processing by the appropriate user interface.
 
Methods inherited from class org.dspace.app.webui.servlet.DSpaceServlet
doGet, doPost
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECT_COLLECTION

public static final int SELECT_COLLECTION
Selection collection step

See Also:
Constant Field Values

FIRST_STEP

public static final int FIRST_STEP
First step after "select collection"

See Also:
Constant Field Values

WORKFLOW_FIRST_STEP

public static final int WORKFLOW_FIRST_STEP
For workflows, first step is step #0 (since Select Collection is already filtered out)

See Also:
Constant Field Values
Constructor Detail

SubmissionController

public SubmissionController()
Method Detail

doDSGet

protected void doDSGet(Context context,
                       javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException,
                       java.io.IOException,
                       java.sql.SQLException,
                       AuthorizeException
Description copied from class: DSpaceServlet
Process an incoming HTTP GET. If an exception is thrown, or for some other reason the passed in context is not completed, it will be aborted and any changes made by this method discarded when this method returns.

Overrides:
doDSGet in class DSpaceServlet
Parameters:
context - a DSpace Context object
request - the HTTP request
response - the HTTP response
Throws:
java.sql.SQLException - if a database error occurs
AuthorizeException - if some authorization error occurs
javax.servlet.ServletException
java.io.IOException

doDSPost

protected void doDSPost(Context context,
                        javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
                 throws javax.servlet.ServletException,
                        java.io.IOException,
                        java.sql.SQLException,
                        AuthorizeException
Description copied from class: DSpaceServlet
Process an incoming HTTP POST. If an exception is thrown, or for some other reason the passed in context is not completed, it will be aborted and any changes made by this method discarded when this method returns.

Overrides:
doDSPost in class DSpaceServlet
Parameters:
context - a DSpace Context object
request - the HTTP request
response - the HTTP response
Throws:
java.sql.SQLException - if a database error occurs
AuthorizeException - if some authorization error occurs
javax.servlet.ServletException
java.io.IOException

getSubmissionInfo

public static SubmissionInfo getSubmissionInfo(Context context,
                                               javax.servlet.http.HttpServletRequest request)
                                        throws java.sql.SQLException,
                                               javax.servlet.ServletException
Reloads a filled-out submission info object from the parameters in the current request. If there is a problem, null is returned.

Parameters:
context - DSpace context
request - HTTP request
Returns:
filled-out submission info, or null
Throws:
java.sql.SQLException
javax.servlet.ServletException

saveSubmissionInfo

public static void saveSubmissionInfo(javax.servlet.http.HttpServletRequest request,
                                      SubmissionInfo si)
Saves the submission info object to the current request.

Parameters:
request - HTTP request
si - the current submission info

getCurrentStepConfig

public static SubmissionStepConfig getCurrentStepConfig(javax.servlet.http.HttpServletRequest request,
                                                        SubmissionInfo si)
Get the configuration of the current step from parameters in the request, along with the current SubmissionInfo object. If there is a problem, null is returned.

Parameters:
request - HTTP request
si - The current SubmissionInfo object
Returns:
the current SubmissionStepConfig

saveCurrentStepConfig

public static void saveCurrentStepConfig(javax.servlet.http.HttpServletRequest request,
                                         SubmissionStepConfig step)
Saves the current step configuration into the request.

Parameters:
request - HTTP request
step - The current SubmissionStepConfig

isFirstStep

public static boolean isFirstStep(javax.servlet.http.HttpServletRequest request,
                                  SubmissionInfo si)
Checks if the current step is also the first "visibile" step in the item submission process.

Parameters:
request - HTTP request
si - The current Submission Info
Returns:
whether or not the current step is the first step

getPreviousVisibleStep

public static SubmissionStepConfig getPreviousVisibleStep(javax.servlet.http.HttpServletRequest request,
                                                          SubmissionInfo si)
Return the previous "visibile" step in the item submission process if any, null otherwise.

Parameters:
request - HTTP request
si - The current Submission Info
Returns:
the previous step in the item submission process if any

isBeginningOfStep

public static boolean isBeginningOfStep(javax.servlet.http.HttpServletRequest request)
Get whether or not the current step has just begun. This helps determine if we've done any pre-processing yet. If the step is just started, we need to do pre-processing, otherwise we should be doing post-processing. If there is a problem, false is returned.

Parameters:
request - HTTP request
Returns:
true if the step has just started (and JSP has not been loaded for this step), false otherwise.

setBeginningOfStep

public static void setBeginningOfStep(javax.servlet.http.HttpServletRequest request,
                                      boolean beginningOfStep)
Get whether or not the current step has just begun. This helps determine if we've done any pre-processing yet. If the step is just started, we need to do pre-processing, otherwise we should be doing post-processing. If there is a problem, false is returned.

Parameters:
request - HTTP request
beginningOfStep - true if step just began

isCancellationInProgress

public static boolean isCancellationInProgress(javax.servlet.http.HttpServletRequest request)
Get whether or not a cancellation is in progress (i.e. the user clicked on the "Cancel/Save" button from any submission page).

Parameters:
request - HTTP request
Returns:
true if a cancellation is in progress

getSubmissionParameters

public static java.lang.String getSubmissionParameters(Context context,
                                                       javax.servlet.http.HttpServletRequest request)
                                                throws java.sql.SQLException,
                                                       javax.servlet.ServletException
Return the submission info as hidden parameters for an HTML form on a JSP page.

Parameters:
context - DSpace context
request - HTTP request
Returns:
HTML hidden parameters
Throws:
java.sql.SQLException
javax.servlet.ServletException

getStepReached

public static int getStepReached(SubmissionInfo subInfo)
Find out which step a user has reached in the submission process. If the submission is in the workflow process, this returns -1.

Parameters:
subInfo - submission info object
Returns:
step reached

uploadFiles

public void uploadFiles(Context context,
                        javax.servlet.http.HttpServletRequest request)
                 throws javax.servlet.ServletException
Upload any files found on the Request, and save them back as Request attributes, for further processing by the appropriate user interface.

Parameters:
context - current DSpace context
request - current servlet request object
Throws:
javax.servlet.ServletException


Copyright © 2010 DuraSpace. All Rights Reserved.