/** * Returns all the Input forms with pagination * * @param limit max number of Input Forms to return * @param offset number of Input form to skip in the return * @return the list of input forms * @throws DCInputsReaderException */ public List<DCInputSet> getAllInputs(Integer limit, Integer offset) throws DCInputsReaderException { int idx = 0; int count = 0; List<DCInputSet> subConfigs = new LinkedList<DCInputSet>(); for (String key : formDefns.keySet()) { if (offset == null || idx >= offset) { count++; subConfigs.add(getInputsByFormName(key)); } idx++; if (count >= limit) { break; } } return subConfigs; }
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); } }
/** * Returns the set of DC inputs used for a particular collection, or the * default set if no inputs defined for the collection * * @param collectionHandle collection's unique Handle * @return DC input set * @throws DCInputsReaderException if no default set defined * @throws ServletException */ public List<DCInputSet> getInputsByCollectionHandle(String collectionHandle) throws DCInputsReaderException { SubmissionConfig config; try { config = new SubmissionConfigReader().getSubmissionConfigByCollection(collectionHandle); 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); } }