Search in sources :

Example 71 with MCRObject

use of org.mycore.datamodel.metadata.MCRObject in project mycore by MyCoRe-Org.

the class MCRURNObjectXPathMetadataManager method insertIdentifier.

@Override
public void insertIdentifier(MCRDNBURN identifier, MCRBase obj, String additional) throws MCRPersistentIdentifierException {
    String xpath = getProperties().get("Xpath");
    Document xml = obj.createXML();
    MCRNodeBuilder nb = new MCRNodeBuilder();
    try {
        nb.buildElement(xpath, identifier.asString(), xml);
        MCRBase object = new MCRObject(xml);
        MCRMetadataManager.update(object);
    } catch (Exception e) {
        throw new MCRException("Error while inscribing URN to " + obj.getId(), e);
    }
}
Also used : MCRNodeBuilder(org.mycore.common.xml.MCRNodeBuilder) MCRException(org.mycore.common.MCRException) MCRObject(org.mycore.datamodel.metadata.MCRObject) MCRBase(org.mycore.datamodel.metadata.MCRBase) Document(org.jdom2.Document) MCRPersistentIdentifierException(org.mycore.pi.exceptions.MCRPersistentIdentifierException) MCRException(org.mycore.common.MCRException)

Aggregations

MCRObject (org.mycore.datamodel.metadata.MCRObject)71 MCRObjectID (org.mycore.datamodel.metadata.MCRObjectID)33 Document (org.jdom2.Document)18 Element (org.jdom2.Element)17 MCRException (org.mycore.common.MCRException)16 MCRDerivate (org.mycore.datamodel.metadata.MCRDerivate)14 MCRMetaLinkID (org.mycore.datamodel.metadata.MCRMetaLinkID)14 MCRCommand (org.mycore.frontend.cli.annotation.MCRCommand)12 IOException (java.io.IOException)11 MCRAccessException (org.mycore.access.MCRAccessException)11 MCRMODSWrapper (org.mycore.mods.MCRMODSWrapper)9 MCRPersistenceException (org.mycore.common.MCRPersistenceException)7 Date (java.util.Date)6 JDOMException (org.jdom2.JDOMException)6 MCRActiveLinkException (org.mycore.datamodel.common.MCRActiveLinkException)6 MCRPersistentIdentifierException (org.mycore.pi.exceptions.MCRPersistentIdentifierException)6 SAXException (org.xml.sax.SAXException)6 URI (java.net.URI)5 URISyntaxException (java.net.URISyntaxException)5 ArrayList (java.util.ArrayList)5