コード例 #1
0
  protected static DcsEntity fromSolr(SolrDocument doc) throws IOException {
    String type = get(doc, EntityField.TYPE);
    if (type == null) {
      throw new IOException("Missing field: " + EntityField.TYPE.solrName());
    }

    if (type.equals(EntityTypeValue.COLLECTION.solrValue())) {
      return getCollection(doc);
    } else if (type.equals(EntityTypeValue.DELIVERABLE_UNIT.solrValue())) {
      return getDeliverableUnit(doc);
    } else if (type.equals(EntityTypeValue.FILE.solrValue())) {
      return getFile(doc);
    } else if (type.equals(EntityTypeValue.MANIFESTATION.solrValue())) {
      return getManifestation(doc);
    } else if (type.equals(EntityTypeValue.EVENT.solrValue())) {
      return getEvent(doc);
    } else {
      throw new IOException("Unknown type: " + type);
    }
  }
コード例 #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;
  }