public DcsCollection createCollection(String parent) { DcsCollection col = new DcsCollection(); col.setId(nextid()); col.setTitle(randomText(rand.nextInt(10) + 1)); if (parent != null) { col.setParent(createCollectionRef(parent)); } col.setMetadata(createMetadataSet(rand.nextInt(2))); col.setSubjects(randomStringSet(4, 4)); col.setType(randomString(4, false)); col.setCreators(randomStringSet(4, 4)); return col; } }
private static DcsCollection getCollection(SolrDocument doc) { DcsCollection col = new DcsCollection(); col.setId(getFirst(doc, EntityField.ID)); if (has(doc, CollectionField.PARENT)) { col.setParent(getCollectionRef(doc, CollectionField.PARENT)); } if (has(doc, CoreMetadataField.TYPE)) { col.setType(getFirst(doc, CoreMetadataField.TYPE)); } if (has(doc, CoreMetadataField.TITLE)) { col.setTitle(getFirst(doc, CoreMetadataField.TITLE)); } col.setMetadata(getMetadataSet(doc)); col.setMetadataRef(col.getMetadataRef()); col.setSubjects(getStringSet(doc, CoreMetadataField.SUBJECT)); col.setCreators(getStringSet(doc, CoreMetadataField.CREATOR)); col.setAlternateIds(getResourceIdentifierSet(doc)); return col; }