Ejemplo n.º 1
0
  private static DcsManifestation getManifestation(SolrDocument doc) {
    DcsManifestation man = new DcsManifestation();

    man.setId(get(doc, EntityField.ID));

    if (has(doc, ManifestationField.DELIVERABLE_UNIT)) {
      man.setDeliverableUnit(get(doc, ManifestationField.DELIVERABLE_UNIT));
    }

    man.setMetadata(getMetadataSet(doc));
    man.setMetadataRef(getMetadataRefSet(doc, EntityField.METADATA_REF));
    man.setManifestationFiles(getManifestationFileSet(doc));

    if (has(doc, CoreMetadataField.TYPE)) {
      man.setType(get(doc, CoreMetadataField.TYPE));
    }

    man.setTechnicalEnvironment(getStringSet(doc, ManifestationField.TECH));

    if (has(doc, ManifestationField.DATE_CREATED)) {
      man.setDateCreated(
          DateUtility.toIso8601(
              ((Date) doc.getFirstValue(ManifestationField.DATE_CREATED.solrName())).getTime()));
    }

    man.setAlternateIds(getResourceIdentifierSet(doc));
    return man;
  }
Ejemplo n.º 2
0
  private static SolrInputDocument toSolr(DcsManifestation man, ArchiveStore store)
      throws IOException {
    SolrInputDocument doc = new SolrInputDocument();

    add(doc, EntityField.ID, man.getId());
    add(doc, EntityField.TYPE, EntityTypeValue.MANIFESTATION.solrValue());
    add(doc, ManifestationField.DELIVERABLE_UNIT, man.getDeliverableUnit());
    add(doc, CoreMetadataField.TYPE, man.getType());
    add(doc, ManifestationField.DATE_CREATED, man.getDateCreated());

    addMetadataSet(doc, man.getMetadata());
    addManifestationFileSet(doc, man.getManifestationFiles(), store);
    addMetadataRefSet(doc, man.getMetadataRef(), EntityField.METADATA_REF, store);

    addStrings(doc, man.getTechnicalEnvironment(), ManifestationField.TECH);

    addResourceIdentifierSet(doc, man.getAlternateIds());

    return doc;
  }