Package org.dspace.app.util
Class DCInputsReader
- java.lang.Object
-
- org.dspace.app.util.DCInputsReader
-
public class DCInputsReader extends Object
Submission form generator for DSpace. Reads and parses the installation form definitions file, submission-forms.xml, from the configuration directory. A forms definition details the page and field layout of the metadata collection pages used by the submission process. Each forms definition starts with a unique name that gets associated with that form set. The file also specifies which collections use which form sets. At a minimum, the definitions file must define a default mapping from the placeholder collection #0 to the distinguished form 'default'. Any collections that use a custom form set are listed paired with the name of the form set they use. The definitions file also may contain sets of value pairs. Each value pair will contain one string that the user reads, and a paired string that will supply the value stored in the database if its sibling display value gets selected from a choice list.- Version:
- $Revision$
- Author:
- Brian S. Hughes
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_COLLECTIONThe ID of the default collection.
-
Constructor Summary
Constructors Constructor Description DCInputsReader()Parse an XML encoded submission forms template file, and create a hashmap containing all the form information.DCInputsReader(String fileName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountInputs()List<DCInputSet>getAllInputs(Integer limit, Integer offset)Returns all the Input forms with paginationStringgetInputFormNameByCollectionAndField(Collection collection, String field)List<DCInputSet>getInputsByCollectionHandle(String collectionHandle)Returns the set of DC inputs used for a particular collection, or the default set if no inputs defined for the collectionDCInputSetgetInputsByFormName(String formName)Returns the set of DC inputs used for a particular input formList<DCInputSet>getInputsBySubmissionName(String name)List<String>getPairs(String name)Iterator<String>getPairsNameIterator()
-
-
-
Field Detail
-
DEFAULT_COLLECTION
public static final String DEFAULT_COLLECTION
The ID of the default collection. Will never be the ID of a named collection- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DCInputsReader
public DCInputsReader() throws DCInputsReaderExceptionParse an XML encoded submission forms template file, and create a hashmap containing all the form information. This hashmap will contain three top level structures: a map between collections and forms, the definition for each page of each form, and lists of pairs of values that populate selection boxes.- Throws:
DCInputsReaderException- if input reader error
-
DCInputsReader
public DCInputsReader(String fileName) throws DCInputsReaderException
- Throws:
DCInputsReaderException
-
-
Method Detail
-
getInputsByCollectionHandle
public List<DCInputSet> getInputsByCollectionHandle(String collectionHandle) throws DCInputsReaderException
Returns the set of DC inputs used for a particular collection, or the default set if no inputs defined for the collection- Parameters:
collectionHandle- collection's unique Handle- Returns:
- DC input set
- Throws:
DCInputsReaderException- if no default set definedjavax.servlet.ServletException
-
getInputsBySubmissionName
public List<DCInputSet> getInputsBySubmissionName(String name) throws DCInputsReaderException
- Throws:
DCInputsReaderException
-
getInputsByFormName
public DCInputSet getInputsByFormName(String formName) throws DCInputsReaderException
Returns the set of DC inputs used for a particular input form- Parameters:
formName- input form unique name- Returns:
- DC input set
- Throws:
DCInputsReaderException- if not found
-
countInputs
public int countInputs()
- Returns:
- the number of defined input forms
-
getAllInputs
public List<DCInputSet> getAllInputs(Integer limit, Integer offset) throws DCInputsReaderException
Returns all the Input forms with pagination- Parameters:
limit- max number of Input Forms to returnoffset- number of Input form to skip in the return- Returns:
- the list of input forms
- Throws:
DCInputsReaderException
-
getInputFormNameByCollectionAndField
public String getInputFormNameByCollectionAndField(Collection collection, String field) throws DCInputsReaderException
- Throws:
DCInputsReaderException
-
-