Search in sources :

Example 26 with MCRNodeBuilder

use of org.mycore.common.xml.MCRNodeBuilder in project mycore by MyCoRe-Org.

the class MCRTestNameMerger method buildNameEntry.

private MCRNameMerger buildNameEntry(String predicates) throws JaxenException {
    Element modsName = new MCRNodeBuilder().buildElement("mods:name[@type='personal']" + predicates, null, null);
    MCRNameMerger ne = new MCRNameMerger();
    ne.setElement(modsName);
    return ne;
}
Also used : MCRNodeBuilder(org.mycore.common.xml.MCRNodeBuilder) Element(org.jdom2.Element)

Example 27 with MCRNodeBuilder

use of org.mycore.common.xml.MCRNodeBuilder 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

MCRNodeBuilder (org.mycore.common.xml.MCRNodeBuilder)27 Document (org.jdom2.Document)24 Test (org.junit.Test)20 Element (org.jdom2.Element)19 MCRBinding (org.mycore.frontend.xeditor.MCRBinding)8 Attribute (org.jdom2.Attribute)6 MCRRepeatBinding (org.mycore.frontend.xeditor.MCRRepeatBinding)6 HashMap (java.util.HashMap)4 MCRAddedElement (org.mycore.frontend.xeditor.tracker.MCRAddedElement)2 Before (org.junit.Before)1 Ignore (org.junit.Ignore)1 MCRException (org.mycore.common.MCRException)1 MCRXPathEvaluator (org.mycore.common.xml.MCRXPathEvaluator)1 MCRBase (org.mycore.datamodel.metadata.MCRBase)1 MCRObject (org.mycore.datamodel.metadata.MCRObject)1 MCREditorSession (org.mycore.frontend.xeditor.MCREditorSession)1 MCRAddedAttribute (org.mycore.frontend.xeditor.tracker.MCRAddedAttribute)1 MCRRemoveAttribute (org.mycore.frontend.xeditor.tracker.MCRRemoveAttribute)1 MCRRemoveElement (org.mycore.frontend.xeditor.tracker.MCRRemoveElement)1 MCRPersistentIdentifierException (org.mycore.pi.exceptions.MCRPersistentIdentifierException)1