Search in sources :

Example 26 with MCRObjectID

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

the class MCRMapObjectIDDOIGeneratorTest method missingMappingTest.

@Test(expected = MCRPersistentIdentifierException.class)
public void missingMappingTest() throws Exception {
    MCRObjectID brandNewTest00000001 = MCRObjectID.getInstance("brandNew_test_00000001");
    doiGenerator.generate(brandNewTest00000001, null);
}
Also used : MCRObjectID(org.mycore.datamodel.metadata.MCRObjectID) Test(org.junit.Test)

Example 27 with MCRObjectID

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

the class MCRMapObjectIDDOIGeneratorTest method generate.

@Test
public void generate() throws Exception {
    MCRObjectID junitTest00004711 = MCRObjectID.getInstance("junit_test_00004711");
    MCRObjectID myTest00000815 = MCRObjectID.getInstance("my_test_00000815");
    assertEquals(TEST_DOI_PREFIX + "/4711", doiGenerator.generate(junitTest00004711, null).asString());
    assertEquals(TEST_DOI_PREFIX + "/my.815", doiGenerator.generate(myTest00000815, null).asString());
}
Also used : MCRObjectID(org.mycore.datamodel.metadata.MCRObjectID) Test(org.junit.Test)

Example 28 with MCRObjectID

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

the class MCRIDPURLGeneratorTest method generate.

@Test
public void generate() throws MCRPersistentIdentifierException {
    MCRObjectID testID = MCRObjectID.getInstance("my_test_00000001");
    MCRIDPURLGenerator generator1 = new MCRIDPURLGenerator(GENERATOR_1);
    Assert.assertEquals("", generator1.generate(testID, "").asString(), "http://purl.myurl.de/my_test_00000001");
    MCRIDPURLGenerator generator2 = new MCRIDPURLGenerator(GENERATOR_2);
    Assert.assertEquals("", generator2.generate(testID, "").asString(), "http://purl.myurl.de/my_test_00000001/my_test_00000001/my_test_00000001");
}
Also used : MCRObjectID(org.mycore.datamodel.metadata.MCRObjectID) Test(org.junit.Test)

Example 29 with MCRObjectID

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

the class MCRDNBURNGeneratorTest method generate.

@Test
public void generate() throws Exception {
    MCRObjectID getID = MCRObjectID.getNextFreeId("test", "mock");
    MCRDNBURN generated = new MCRFLURNGenerator(GENERATOR_ID).generate(getID, "");
    String urn = generated.asString();
    LOGGER.info("THE URN IS: {}", urn);
    Assert.assertFalse(urn.startsWith("urn:nbn:de:urn:nbn:de"));
}
Also used : MCRObjectID(org.mycore.datamodel.metadata.MCRObjectID) Test(org.junit.Test)

Example 30 with MCRObjectID

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

the class MCRSolrTransformerInputDocumentFactory method getMergedDocument.

private Document getMergedDocument(Map<MCRObjectID, MCRContent> contentMap) throws IOException, SAXException, JDOMException {
    Element rootElement = new Element("add");
    Document doc = new Document(rootElement);
    for (Map.Entry<MCRObjectID, MCRContent> entry : contentMap.entrySet()) {
        rootElement.addContent(entry.getValue().asXML().detachRootElement());
    }
    return doc;
}
Also used : Element(org.jdom2.Element) MCRObjectID(org.mycore.datamodel.metadata.MCRObjectID) Document(org.jdom2.Document) SolrInputDocument(org.apache.solr.common.SolrInputDocument) Map(java.util.Map) MCRContent(org.mycore.common.content.MCRContent)

Aggregations

MCRObjectID (org.mycore.datamodel.metadata.MCRObjectID)144 IOException (java.io.IOException)37 MCRObject (org.mycore.datamodel.metadata.MCRObject)32 MCRException (org.mycore.common.MCRException)30 MCRCommand (org.mycore.frontend.cli.annotation.MCRCommand)30 MCRDerivate (org.mycore.datamodel.metadata.MCRDerivate)29 MCRPath (org.mycore.datamodel.niofs.MCRPath)25 MCRAccessException (org.mycore.access.MCRAccessException)22 Document (org.jdom2.Document)20 MCRPersistenceException (org.mycore.common.MCRPersistenceException)18 MCRMetaLinkID (org.mycore.datamodel.metadata.MCRMetaLinkID)16 JDOMException (org.jdom2.JDOMException)15 MCRBase (org.mycore.datamodel.metadata.MCRBase)15 SAXException (org.xml.sax.SAXException)15 Date (java.util.Date)14 MCRActiveLinkException (org.mycore.datamodel.common.MCRActiveLinkException)13 MCRSession (org.mycore.common.MCRSession)11 MCRContent (org.mycore.common.content.MCRContent)11 MCRPersistentIdentifierException (org.mycore.pi.exceptions.MCRPersistentIdentifierException)11 URISyntaxException (java.net.URISyntaxException)10