use of org.mycore.oai.pmh.SimpleMetadata in project mycore by MyCoRe-Org.
the class MCROAIObjectManager method getRecord.
public Record getRecord(Header header, MetadataFormat format) {
Element recordElement;
if (header.isDeleted()) {
return new Record(header);
}
try {
recordElement = getJDOMRecord(getMyCoReId(header.getId()), format);
} catch (Exception exc) {
LOGGER.error("unable to get record {} ({})", header.getId(), format.getPrefix(), exc);
return null;
}
Record record = new Record(header);
if (recordElement.getNamespace().equals(OAIConstants.NS_OAI)) {
Element metadataElement = recordElement.getChild("metadata", OAIConstants.NS_OAI);
if (metadataElement != null && !metadataElement.getChildren().isEmpty()) {
Element metadataChild = metadataElement.getChildren().get(0);
record.setMetadata(new SimpleMetadata(metadataChild.detach()));
}
Element aboutElement = recordElement.getChild("about", OAIConstants.NS_OAI);
if (aboutElement != null) {
for (Element aboutChild : aboutElement.getChildren()) {
record.getAboutList().add(aboutChild.detach());
}
}
} else {
// handle as metadata
record.setMetadata(new SimpleMetadata(recordElement));
}
return record;
}
Aggregations