public abstract class AbstractProcessingStep extends Object
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!
org.dspace.app.webui.submit.JSPStepManager
,
org.dspace.app.webui.servlet.SubmissionController
,
SubmissionConfig
,
SubmissionStepConfig
Modifier and Type | Field and Description |
---|---|
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 String |
SELECT_CHANGE
Constant - Name of the "Select" list
|
static int |
STATUS_COMPLETE
STATUS / ERROR FLAGS (returned by doProcessing() if an error occurs or
additional user interaction may be required)
|
Constructor and Description |
---|
AbstractProcessingStep() |
Modifier and Type | Method and Description |
---|---|
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())
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.
|
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)
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.
|
static int |
getCurrentPage(javax.servlet.http.HttpServletRequest request)
Find out which page a user is currently viewing
|
static List<String> |
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
|
public static final String PREVIOUS_BUTTON
public static final String NEXT_BUTTON
public static final String SELECT_CHANGE
public static final String CANCEL_BUTTON
public static final String PROGRESS_BAR_PREFIX
public static final int LAST_PAGE_REACHED
public static final int STATUS_COMPLETE
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
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!
context
- current DSpace contextrequest
- current servlet request objectresponse
- current servlet response objectsubInfo
- submission info objectjavax.servlet.ServletException
IOException
SQLException
AuthorizeException
public static final List<String> getErrorFields(javax.servlet.http.HttpServletRequest request)
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.
request
- current servlet request objectprotected static final void addErrorField(javax.servlet.http.HttpServletRequest request, String fieldName)
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.
fieldName
- the name of the field which had an errorprotected static final void clearErrorFields(javax.servlet.http.HttpServletRequest request)
request
- current servlet request objectpublic final String getErrorMessage(int errorFlag)
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!
errorFlag
- The error flag defined in this step which represents an error
message.protected final void addErrorMessage(int errorFlag, String errorMessage)
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.
errorFlag
- the status value indicating the type of errorerrorMessage
- text of the message to be addedpublic abstract int getNumberOfPages(javax.servlet.http.HttpServletRequest request, SubmissionInfo subInfo) throws javax.servlet.ServletException
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!
request
- The HTTP RequestsubInfo
- The current submission information objectjavax.servlet.ServletException
public static final int getCurrentPage(javax.servlet.http.HttpServletRequest request)
request
- HTTP requestpublic static final void setCurrentPage(javax.servlet.http.HttpServletRequest request, int pageNumber)
request
- HTTP requestpageNumber
- new current pageCopyright © 2016 DuraSpace. All Rights Reserved.