public class SubmissionController extends DSpaceServlet
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.
SubmissionInfo,
SubmissionConfig,
SubmissionStepConfig,
JSPStepManager,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
SubmissionController() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
deleteDirectory(File path) |
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.
|
protected void |
DoGetResumable(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected File |
doPostResumable(javax.servlet.http.HttpServletRequest request) |
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 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.
|
protected File |
makeFileFromChunks(String tmpDir,
File chunkDirPath,
javax.servlet.http.HttpServletRequest request) |
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 or in assembledFiles, and save them back as
Request attributes, for further processing by the appropriate user interface.
|
doGet, doPostdoDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, servicepublic static final int SELECT_COLLECTION
public static final int FIRST_STEP
public static final int WORKFLOW_FIRST_STEP
protected void doDSGet(Context context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException, SQLException, AuthorizeException
DSpaceServletdoDSGet in class DSpaceServletcontext - a DSpace Context objectrequest - the HTTP requestresponse - the HTTP responseSQLException - if a database error occursAuthorizeException - if some authorization error occursjavax.servlet.ServletExceptionIOExceptionprotected void doDSPost(Context context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException, SQLException, AuthorizeException
DSpaceServletdoDSPost in class DSpaceServletcontext - a DSpace Context objectrequest - the HTTP requestresponse - the HTTP responseSQLException - if a database error occursAuthorizeException - if some authorization error occursjavax.servlet.ServletExceptionIOExceptionpublic static SubmissionInfo getSubmissionInfo(Context context, javax.servlet.http.HttpServletRequest request) throws SQLException, javax.servlet.ServletException
null is returned.context - DSpace contextrequest - HTTP requestSQLExceptionjavax.servlet.ServletExceptionpublic static void saveSubmissionInfo(javax.servlet.http.HttpServletRequest request,
SubmissionInfo si)
request - HTTP requestsi - the current submission infopublic static SubmissionStepConfig getCurrentStepConfig(javax.servlet.http.HttpServletRequest request, SubmissionInfo si)
null is returned.request - HTTP requestsi - The current SubmissionInfo objectpublic static void saveCurrentStepConfig(javax.servlet.http.HttpServletRequest request,
SubmissionStepConfig step)
request - HTTP requeststep - The current SubmissionStepConfigpublic static boolean isFirstStep(javax.servlet.http.HttpServletRequest request,
SubmissionInfo si)
request - HTTP requestsi - The current Submission Infopublic static SubmissionStepConfig getPreviousVisibleStep(javax.servlet.http.HttpServletRequest request, SubmissionInfo si)
null otherwise.request - HTTP requestsi - The current Submission Infopublic static boolean isBeginningOfStep(javax.servlet.http.HttpServletRequest request)
false is returned.request - HTTP requestpublic static void setBeginningOfStep(javax.servlet.http.HttpServletRequest request,
boolean beginningOfStep)
false is returned.request - HTTP requestbeginningOfStep - true if step just beganpublic static boolean isCancellationInProgress(javax.servlet.http.HttpServletRequest request)
request - HTTP requestpublic static String getSubmissionParameters(Context context, javax.servlet.http.HttpServletRequest request) throws SQLException, javax.servlet.ServletException
context - DSpace contextrequest - HTTP requestSQLExceptionjavax.servlet.ServletExceptionpublic static int getStepReached(SubmissionInfo subInfo)
subInfo - submission info objectpublic void uploadFiles(Context context, javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
context - current DSpace contextrequest - current servlet request objectjavax.servlet.ServletExceptionprotected void DoGetResumable(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws IOException
IOExceptionprotected File doPostResumable(javax.servlet.http.HttpServletRequest request) throws org.apache.commons.fileupload.FileUploadBase.FileSizeLimitExceededException, IOException, javax.servlet.ServletException
org.apache.commons.fileupload.FileUploadBase.FileSizeLimitExceededExceptionIOExceptionjavax.servlet.ServletExceptionprotected File makeFileFromChunks(String tmpDir, File chunkDirPath, javax.servlet.http.HttpServletRequest request) throws IOException
IOExceptionpublic boolean deleteDirectory(File path)
Copyright © 2016 DuraSpace. All Rights Reserved.