org.dspace.submit.step
Class DescribeStep

java.lang.Object
  extended by org.dspace.submit.AbstractProcessingStep
      extended by org.dspace.submit.step.DescribeStep

public class DescribeStep
extends AbstractProcessingStep

Describe step for DSpace submission process. Handles the gathering of descriptive information (i.e. metadata) for an item being submitted into DSpace.

This class performs all the behind-the-scenes processing that this particular step requires. This class's methods are utilized by both the JSP-UI and the Manakin XML-UI

Version:
$Revision: 4895 $
Author:
Tim Donohue
See Also:
SubmissionConfig, SubmissionStepConfig, AbstractProcessingStep

Field Summary
static String LANGUAGE_QUALIFIER
           
static int STATUS_MISSING_REQUIRED_FIELDS
           
static int STATUS_MORE_INPUT_REQUESTED
          STATUS / ERROR FLAGS (returned by doProcessing() if an error occurs or additional user interaction may be required) (Do NOT use status of 0, since it corresponds to STATUS_COMPLETE flag defined in the JSPStepManager class)
 
Fields inherited from class org.dspace.submit.AbstractProcessingStep
CANCEL_BUTTON, LAST_PAGE_REACHED, NEXT_BUTTON, PREVIOUS_BUTTON, PROGRESS_BAR_PREFIX, STATUS_COMPLETE
 
Constructor Summary
DescribeStep()
          Constructor
 
Method Summary
 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 String getDefaultLanguageQualifier()
           
static String getFieldName(DCInput input)
          Return the HTML / DRI field name for the given input.
static DCInputsReader getInputsReader()
           
static DCInputsReader getInputsReader(String filename)
           
 int getNumberOfPages(javax.servlet.http.HttpServletRequest request, SubmissionInfo subInfo)
          Retrieves the number of pages that this "step" extends over.
protected  List getRepeatedParameter(javax.servlet.http.HttpServletRequest request, String metadataField, String param)
          Get repeated values from a form.
protected  void readDate(javax.servlet.http.HttpServletRequest request, Item item, String schema, String element, String qualifier)
          Fill out a metadata date field with the value from a form.
protected  void readNames(javax.servlet.http.HttpServletRequest request, Item item, String schema, String element, String qualifier, boolean repeated)
          Set relevant metadata fields in an item from name values in the form.
protected  void readSeriesNumbers(javax.servlet.http.HttpServletRequest request, Item item, String schema, String element, String qualifier, boolean repeated)
          Set relevant metadata fields in an item from series/number values in the form.
protected  void readText(javax.servlet.http.HttpServletRequest request, Item item, String schema, String element, String qualifier, boolean repeated, String lang)
          Fill out an item's metadata values from a plain standard text field.
 
Methods inherited from class org.dspace.submit.AbstractProcessingStep
addErrorField, addErrorMessage, clearErrorFields, getCurrentPage, getErrorFields, getErrorMessage, setCurrentPage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_MORE_INPUT_REQUESTED

public static final int STATUS_MORE_INPUT_REQUESTED
STATUS / ERROR FLAGS (returned by doProcessing() if an error occurs or additional user interaction may be required) (Do NOT use status of 0, since it corresponds to STATUS_COMPLETE flag defined in the JSPStepManager class)

See Also:
Constant Field Values

STATUS_MISSING_REQUIRED_FIELDS

public static final int STATUS_MISSING_REQUIRED_FIELDS
See Also:
Constant Field Values

LANGUAGE_QUALIFIER

public static final String LANGUAGE_QUALIFIER
Constructor Detail

DescribeStep

public DescribeStep()
             throws javax.servlet.ServletException
Constructor

Throws:
javax.servlet.ServletException
Method Detail

doProcessing

public 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 appropriate user interface (JSP-UI or XML-UI)

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!

Specified by:
doProcessing in class AbstractProcessingStep
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

getNumberOfPages

public 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 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!

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

getInputsReader

public static DCInputsReader getInputsReader()
                                      throws javax.servlet.ServletException
Returns:
the current DCInputsReader
Throws:
javax.servlet.ServletException

getInputsReader

public static DCInputsReader getInputsReader(String filename)
                                      throws javax.servlet.ServletException
Parameters:
filename - file to get the input reader for
Returns:
the current DCInputsReader
Throws:
javax.servlet.ServletException

getDefaultLanguageQualifier

public static String getDefaultLanguageQualifier()
Returns:
the default language qualifier for metadata

readNames

protected void readNames(javax.servlet.http.HttpServletRequest request,
                         Item item,
                         String schema,
                         String element,
                         String qualifier,
                         boolean repeated)
Set relevant metadata fields in an item from name values in the form. Some fields are repeatable in the form. If this is the case, and the field is "dc.contributor.author", the names in the request will be from the fields as follows: dc_contributor_author_last -> last name of first author dc_contributor_author_first -> first name(s) of first author dc_contributor_author_last_1 -> last name of second author dc_contributor_author_first_1 -> first name(s) of second author and so on. If the field is unqualified: dc_contributor_last -> last name of first contributor dc_contributor_first -> first name(s) of first contributor If the parameter "submit_dc_contributor_author_remove_n" is set, that value is removed. Otherwise the parameters are of the form: dc_contributor_author_last dc_contributor_author_first The values will be put in separate DCValues, in the form "last name, first name(s)", ordered as they appear in the list. These will replace any existing values.

Parameters:
request - the request object
item - the item to update
schema - the metadata schema
element - the metadata element
qualifier - the metadata qualifier, or null if unqualified
repeated - set to true if the field is repeatable on the form

readText

protected void readText(javax.servlet.http.HttpServletRequest request,
                        Item item,
                        String schema,
                        String element,
                        String qualifier,
                        boolean repeated,
                        String lang)
Fill out an item's metadata values from a plain standard text field. If the field isn't repeatable, the input field name is called: element_qualifier or for an unqualified element: element Repeated elements are appended with an underscore then an integer. e.g.: dc_title_alternative dc_title_alternative_1 The values will be put in separate DCValues, ordered as they appear in the list. These will replace any existing values.

Parameters:
request - the request object
item - the item to update
schema - the short schema name
element - the metadata element
qualifier - the metadata qualifier, or null if unqualified
repeated - set to true if the field is repeatable on the form
lang - language to set (ISO code)

readDate

protected void readDate(javax.servlet.http.HttpServletRequest request,
                        Item item,
                        String schema,
                        String element,
                        String qualifier)
                 throws SQLException
Fill out a metadata date field with the value from a form. The date is taken from the three parameters: element_qualifier_year element_qualifier_month element_qualifier_day The granularity is determined by the values that are actually set. If the year isn't set (or is invalid)

Parameters:
request - the request object
item - the item to update
schema - the metadata schema
element - the metadata element
qualifier - the metadata qualifier, or null if unqualified
Throws:
SQLException

readSeriesNumbers

protected void readSeriesNumbers(javax.servlet.http.HttpServletRequest request,
                                 Item item,
                                 String schema,
                                 String element,
                                 String qualifier,
                                 boolean repeated)
Set relevant metadata fields in an item from series/number values in the form. Some fields are repeatable in the form. If this is the case, and the field is "relation.ispartof", the names in the request will be from the fields as follows: dc_relation_ispartof_series dc_relation_ispartof_number dc_relation_ispartof_series_1 dc_relation_ispartof_number_1 and so on. If the field is unqualified: dc_relation_series dc_relation_number Otherwise the parameters are of the form: dc_relation_ispartof_series dc_relation_ispartof_number The values will be put in separate DCValues, in the form "last name, first name(s)", ordered as they appear in the list. These will replace any existing values.

Parameters:
request - the request object
item - the item to update
schema - the metadata schema
element - the metadata element
qualifier - the metadata qualifier, or null if unqualified
repeated - set to true if the field is repeatable on the form

getRepeatedParameter

protected List getRepeatedParameter(javax.servlet.http.HttpServletRequest request,
                                    String metadataField,
                                    String param)
Get repeated values from a form. If "foo" is passed in as the parameter, values in the form of parameters "foo", "foo_1", "foo_2", etc. are returned.

This method can also handle "composite fields" (metadata fields which may require multiple params, etc. a first name and last name).

Parameters:
request - the HTTP request containing the form information
metadataField - the metadata field which can store repeated values
param - the repeated parameter on the page (used to fill out the metadataField)
Returns:
a List of Strings

getFieldName

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

Parameters:
input -
Returns:


Copyright © 2010 DuraSpace. All Rights Reserved.