private static DcsCollection getCollection(SolrDocument doc) { DcsCollection col = new DcsCollection(); col.setId(get(doc, EntityField.ID)); if (has(doc, CollectionField.PARENT)) { col.setParent(getCollectionRef(doc, CollectionField.PARENT)); } if (has(doc, CoreMetadataField.TYPE)) { col.setType(get(doc, CoreMetadataField.TYPE)); } if (has(doc, CoreMetadataField.TITLE)) { col.setTitle(get(doc, CoreMetadataField.TITLE)); } col.setMetadata(getMetadataSet(doc)); col.setMetadataRef(col.getMetadataRef()); col.setSubjects(getStringSet(doc, CoreMetadataField.SUBJECT)); col.setAlternateIds(getResourceIdentifierSet(doc)); return col; }
private static SolrInputDocument toSolr(DcsCollection col, ArchiveStore store) throws IOException { SolrInputDocument doc = new SolrInputDocument(); add(doc, EntityField.ID, col.getId()); add(doc, EntityField.TYPE, EntityTypeValue.COLLECTION.solrValue()); if (col.getParent() != null) { add(doc, CollectionField.PARENT, col.getParent().getRef()); } add(doc, CoreMetadataField.TITLE, col.getTitle()); addMetadataSet(doc, col.getMetadata()); addMetadataRefSet(doc, col.getMetadataRef(), EntityField.METADATA_REF, store); addResourceIdentifierSet(doc, col.getAlternateIds()); add(doc, CoreMetadataField.TYPE, col.getType()); addStrings(doc, col.getSubjects(), CoreMetadataField.SUBJECT); // addStrings(doc, col.getCreators(), CoreMetadataField.CREATOR); // addCreatorSet(doc,col.getCreators()); return doc; }