use of org.mycore.pi.purl.MCRPersistentUniformResourceLocator in project mycore by MyCoRe-Org.
the class MCRMODSPURLPersistentIdentifierMetadataManager method getIdentifier.
@Override
public Optional<MCRPersistentIdentifier> getIdentifier(MCRBase obj, String additional) throws MCRPersistentIdentifierException {
MCRObject object = checkObject(obj);
MCRMODSWrapper wrapper = new MCRMODSWrapper(object);
Element element = wrapper.getElement(MODS_IDENTIFIER_TYPE_PURL);
if (element == null) {
return Optional.empty();
}
String purlString = element.getTextNormalize();
try {
return Optional.of(new MCRPersistentUniformResourceLocator(new URL(purlString)));
} catch (MalformedURLException e) {
return Optional.empty();
}
}
Aggregations