/** * Does this set of inputs include an alternate title field? * * @return true if the current set has an alternate title field */ public boolean isDefinedMultTitles() { return isFieldPresent("dc.title.alternative"); }
/** * 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; }
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!"); }
inputs = inputSet.getPageRows(getPage()-1, submission.hasMultipleTitles(), submission.isPublishedBefore()); if ( ! inputSet.isFieldPresent(unfilteredFieldName) )
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; } }
int fieldsNums = inputSet.getNumberFields(); DCInput[][] inputs = inputSet.getFields();
public static List<String> differenceInSubmissionFields(Collection fromCollection, Collection toCollection) throws DCInputsReaderException { DCInputsReader reader = new DCInputsReader(); List<DCInputSet> from = reader.getInputsByCollectionHandle(fromCollection.getHandle()); List<DCInputSet> to = reader.getInputsByCollectionHandle(toCollection.getHandle()); Set<String> fromFieldName = new HashSet<>(); Set<String> toFieldName = new HashSet<>(); for (DCInputSet ff : from) { for (DCInput[] fdcrow : ff.getFields()) { for (DCInput fdc : fdcrow) { fromFieldName.add(fdc.getFieldName()); } } } for (DCInputSet tt : to) { for (DCInput[] tdcrow : tt.getFields()) { for (DCInput tdc : tdcrow) { toFieldName.add(tdc.getFieldName()); } } } return ListUtils.removeAll(fromFieldName, toFieldName); } }
DCInput[] inputs = inputSet.getPageRows(getPage()-1, submission.hasMultipleTitles(), submission.isPublishedBefore());
DCInputsReader dcInputsReader = new DCInputsReader(); for (DCInputSet dcinputSet : dcInputsReader.getAllInputs(Integer.MAX_VALUE, 0)) { DCInput[][] dcinputs = dcinputSet.getFields(); for (DCInput[] dcrows : dcinputs) { for (DCInput dcinput : dcrows) { continue; ifa.getDelegates().put(dcinputSet.getFormName(), ma); controller.put(fieldKey, ifa);
protected DCInput getDCInput(String formName, String schema, String element, String qualifier) throws DCInputsReaderException { List<DCInputSet> dcinputsets = new DCInputsReader().getInputsBySubmissionName(formName); for (DCInputSet dcinputset : dcinputsets) { for (DCInput[] dcrow : dcinputset.getFields()) { for (DCInput dcinput : dcrow) { if (dcinput.getSchema().equals(schema) && dcinput.getElement().equals(element) && ((dcinput.getQualifier() != null && dcinput .getQualifier().equals(qualifier)) || (dcinput.getQualifier() == null && qualifier == null))) { return dcinput; } } } } return null; }
/** * Does this set of inputs include the previously published fields? * * @return true if the current set has all the prev. published fields */ public boolean isDefinedPubBefore() { return (isFieldPresent("dc.date.issued") && isFieldPresent("dc.identifier.citation") && isFieldPresent("dc.publisher")); }
private void autoRegisterAuthorityFromInputReader() { try { DCInputsReader dcInputsReader = new DCInputsReader(); for (DCInputSet dcinputSet : dcInputsReader.getAllInputs(Integer.MAX_VALUE, 0)) { DCInput[][] dcinputs = dcinputSet.getFields(); for (DCInput[] dcrows : dcinputs) { for (DCInput dcinput : dcrows) { if (StringUtils.isNotBlank(dcinput.getPairsType()) || StringUtils.isNotBlank(dcinput.getVocabulary())) { String authorityName = dcinput.getPairsType(); if (StringUtils.isBlank(authorityName)) { authorityName = dcinput.getVocabulary(); } if (!StringUtils.equals(dcinput.getInputType(), "qualdrop_value")) { String fieldKey = makeFieldKey(dcinput.getSchema(), dcinput.getElement(), dcinput.getQualifier()); boolean req = ConfigurationManager .getBooleanProperty("authority.required." + fieldKey, false); controlled.put(fieldKey, true); isAuthorityRequired.put(fieldKey, req); } } } } } } catch (DCInputsReaderException e) { throw new IllegalStateException(e.getMessage(), e); } } }