/** * Gets parent DC. * * @param parent parent to query * @return the description metadata or {@code null} * @throws DigitalObjectException failure */ private static OaiDcType getParentDcMetadata(DigitalObjectHandler parent) throws DigitalObjectException { if (parent != null) { MetadataHandler<Object> metadataHandler = parent.metadata(); if (metadataHandler != null) { Object metadata = metadataHandler.getMetadata().getData(); if (metadata instanceof OaiDcType) { return (OaiDcType) metadata; } } } return null; }
@Override public void setDissemination(DisseminationInput input, String message) throws DigitalObjectException { defaultHandler.setDissemination(input, message); MetadataHandler<OaiDcType> metadata = handler.metadata(); DescriptionMetadata<OaiDcType> dm = metadata.getMetadata(); OaiDcType data = dm.getData(); List<ElementType> titles = data.getTitles(); titles.clear(); String filename = input.getFilename(); titles.add(new ElementType(filename, null)); List<ElementType> formats = data.getFormats(); formats.clear(); formats.add(new ElementType(input.getMime().toString(), null)); metadata.setMetadata(dm, message); }
/** Parses the given XML string into a list of key/value pairs. */ public static Hashtable<String, String> parseXML(String xml) throws IOException { MetadataHandler handler = new MetadataHandler(); parseXML(xml, handler); return handler.getMetadata(); }