Exemplo n.º 1
0
    private void write(OaiDcType dc, long timestamp, String message) throws DigitalObjectException {
      EditorResult result = editor.createResult();

      // DO NOT include schemaLocation. Fedora validator does not accept it.
      DcUtils.marshal(result, dc, false);
      editor.write(result, timestamp, message);

      // Label: spec requires identifier + title
      StringBuilder label = new StringBuilder();
      if (!dc.getIdentifiers().isEmpty()) {
        label.append(dc.getIdentifiers().get(0).getValue());
      }
      if (!dc.getTitles().isEmpty()) {
        if (label.length() > 0) {
          label.append(' ');
        }
        label.append(dc.getTitles().get(0).getValue());
      }
      String objLabel = label.toString().trim();
      object.setLabel(objLabel.isEmpty() ? "?" : objLabel);

      // DC
      DcStreamEditor dcEditor = handler.objectMetadata();
      DublinCoreRecord dcr = dcEditor.read();
      dcr.setDc(dc);
      dcEditor.write(handler, dcr, message);
    }
Exemplo n.º 2
0
 @Override
 public DescriptionMetadata<String> getMetadataAsXml() throws DigitalObjectException {
   DescriptionMetadata<OaiDcType> dm = getMetadata();
   OaiDcType dc = dm.getData();
   DescriptionMetadata<String> result = new DescriptionMetadata<String>();
   result.setPid(dm.getPid());
   result.setBatchId(dm.getBatchId());
   String xml = DcUtils.toXml(dc, true);
   result.setData(xml);
   return result;
 }
Exemplo n.º 3
0
 @Override
 public DescriptionMetadata<OaiDcType> getMetadata() throws DigitalObjectException {
   Source src = getDataAsSource();
   DescriptionMetadata<OaiDcType> dm = new DescriptionMetadata<OaiDcType>();
   dm.setPid(object.getPid());
   dm.setTimestamp(editor.getLastModified());
   //            dm.setEditor(editorId);
   OaiDcType dc = DcUtils.unmarshal(src, OaiDcType.class);
   dm.setData(dc);
   return dm;
 }
Exemplo n.º 4
0
 @Override
 public void setMetadataAsXml(DescriptionMetadata<String> xml, String message)
     throws DigitalObjectException {
   OaiDcType dc = null;
   if (xml.getData() != null) {
     dc = DcUtils.unmarshal(xml.getData(), OaiDcType.class);
   }
   if (dc == null) {
     dc = createDefautDc();
   }
   write(dc, xml.getTimestamp(), message);
 }