/** * Returns all the Item Submission process configs with pagination * * @param limit max number of SubmissionConfig to return * @param offset number of SubmissionConfig to skip in the return * @return the list of SubmissionConfig */ public List<SubmissionConfig> getAllSubmissionConfigs(Integer limit, Integer offset) { int idx = 0; int count = 0; List<SubmissionConfig> subConfigs = new LinkedList<SubmissionConfig>(); for (String key : submitDefns.keySet()) { if (offset == null || idx >= offset) { count++; subConfigs.add(getSubmissionConfigByName(key)); } idx++; if (count >= limit) { break; } } return subConfigs; }
/** * Returns the Item Submission process config used for a particular * collection, or the default if none is defined for the collection * * @param collectionHandle collection's unique Handle * @return the SubmissionConfig representing the item submission config * @throws SubmissionConfigReaderException if no default submission process configuration defined */ public SubmissionConfig getSubmissionConfigByCollection(String collectionHandle) { // get the name of the submission process config for this collection String submitName = collectionToSubmissionConfig .get(collectionHandle); if (submitName == null) { submitName = collectionToSubmissionConfig .get(DEFAULT_COLLECTION); } if (submitName == null) { throw new IllegalStateException( "No item submission process configuration designated as 'default' in 'submission-map' section of " + "'item-submission.xml'."); } return getSubmissionConfigByName(submitName); }
public List<DCInputSet> getInputsBySubmissionName(String name) throws DCInputsReaderException { SubmissionConfig config; try { config = new SubmissionConfigReader().getSubmissionConfigByName(name); String formName = config.getSubmissionName(); if (formName == null) { throw new DCInputsReaderException("No form designated as default"); } List<DCInputSet> results = new ArrayList<DCInputSet>(); for (int idx = 0; idx < config.getNumberOfSteps(); idx++) { SubmissionStepConfig step = config.getStep(idx); if (SubmissionStepConfig.INPUT_FORM_STEP_NAME.equals(step.getType())) { results.add(getInputsByFormName(step.getId())); } } return results; } catch (SubmissionConfigReaderException e) { throw new DCInputsReaderException("No form designated as default", e); } }