コード例 #1
0
  private void mapPublisherName(Document opus, OriginInfoDefinition oid) {
    final String publisherName = opus.getPublisherName();

    XmlString modsPublisher = (XmlString) select("mods:publisher", oid);

    if (modsPublisher == null) {
      modsPublisher = oid.addNewPublisher();
      signalChanges(MODS_CHANGES);
    }

    if (!modsPublisher.getStringValue().equals(publisherName)) {
      modsPublisher.setStringValue(publisherName);
      signalChanges(MODS_CHANGES);
    }
  }
コード例 #2
0
  private void mapPublisherPlace(Document opus, OriginInfoDefinition oid) {
    final String publisherPlace = singleline(opus.getPublisherPlace());

    PlaceDefinition pd = (PlaceDefinition) select("mods:place", oid);

    if (pd == null) {
      pd = oid.addNewPlace();
      signalChanges(MODS_CHANGES);
    }

    PlaceTermDefinition ptd =
        (PlaceTermDefinition)
            select("mods:placeTerm[@type='text' and text()='" + publisherPlace + "']", pd);

    if (ptd == null) {
      ptd = pd.addNewPlaceTerm();
      ptd.setType(TEXT);
      ptd.setStringValue(publisherPlace);
      signalChanges(MODS_CHANGES);
    }
  }
コード例 #3
0
  private void mapServerDatePublished(Document opus, OriginInfoDefinition oid) {
    final String mappedDateEncoding = dateEncoding(opus.getServerDatePublished());

    DateDefinition dateIssued =
        (DateDefinition)
            select(
                String.format(
                    "mods:dateIssued[@encoding='%s' and @keyDate='%s']", "iso8601", "yes"),
                oid);

    if (dateIssued == null) {
      dateIssued = oid.addNewDateIssued();
      dateIssued.setEncoding(ISO_8601);
      dateIssued.setKeyDate(XmlString.Factory.newValue("yes"));
      signalChanges(MODS_CHANGES);
    }

    if (!dateIssued.getStringValue().equals(mappedDateEncoding)) {
      dateIssued.setStringValue(mappedDateEncoding);
      signalChanges(MODS_CHANGES);
    }
  }