/** * Returns the set of DC inputs used for a particular input form * * @param formName input form unique name * @return DC input set * @throws DCInputsReaderException if not found */ public DCInputSet getInputsByFormName(String formName) throws DCInputsReaderException { // check mini-cache, and return if match if (lastInputSet != null && lastInputSet.getFormName().equals(formName)) { return lastInputSet; } // cache miss - construct new DCInputSet List<List<Map<String, String>>> pages = formDefns.get(formName); if (pages == null) { throw new DCInputsReaderException("Missing the " + formName + " form"); } lastInputSet = new DCInputSet(formName, pages, valuePairs); return lastInputSet; }
protected List<String> getReqList(String handle) throws DCInputsReaderException { List<String> reqList = reqMap.get(handle); if (reqList == null) { reqList = reqMap.get("default"); } if (reqList == null) { reqList = new ArrayList<String>(); List<DCInputSet> inputSet = reader.getInputsByCollectionHandle(handle); for (DCInputSet inputs : inputSet) { for (DCInput[] row : inputs.getFields()) { for (DCInput input : row) { if (input.isRequired()) { StringBuilder sb = new StringBuilder(); sb.append(input.getSchema()).append("."); sb.append(input.getElement()).append("."); String qual = input.getQualifier(); if (qual == null) { qual = ""; } sb.append(qual); reqList.add(sb.toString()); } } } reqMap.put(inputs.getFormName(), reqList); } } return reqList; } }
public String getInputFormNameByCollectionAndField(Collection collection, String field) throws DCInputsReaderException { List<DCInputSet> inputSets = getInputsByCollectionHandle(collection.getHandle()); for (DCInputSet inputSet : inputSets) { String[] tokenized = Utils.tokenize(field); String schema = tokenized[0]; String element = tokenized[1]; String qualifier = tokenized[2]; if (StringUtils.isBlank(qualifier)) { qualifier = null; } String standardized = Utils.standardize(schema, element, qualifier, "."); if (inputSet.isFieldPresent(standardized)) { return inputSet.getFormName(); } } throw new DCInputsReaderException("No field configuration found!"); }
continue; ifa.getDelegates().put(dcinputSet.getFormName(), ma); controller.put(fieldKey, ifa);