use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRFileTest method contentXML.
@Test
public void contentXML() throws Exception {
MCRFile file = col.createFile("foo.xml");
Document xml = new Document(new Element("root"));
file.setContent(new MCRJDOMContent(xml));
assertFalse(MCRFile.MD5_OF_EMPTY_FILE.equals(file.getMD5()));
Document xml2 = file.getContent().asXML();
assertEquals("root", xml2.getRootElement().getName());
}
use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRMetadataStoreTest method delete.
@Test
public void delete() throws Exception {
Document xml1 = new Document(new Element("root"));
int id = getMetaDataStore().create(new MCRJDOMContent(xml1)).getID();
assertTrue(getMetaDataStore().exists(id));
getMetaDataStore().delete(id);
assertFalse(getMetaDataStore().exists(id));
assertNull(getMetaDataStore().retrieve(id));
}
use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRMailEventHandler method handleCategoryEvent.
private void handleCategoryEvent(MCREvent evt, MCRCategory obj) {
MCRContent xml = new MCRJDOMContent(MCRCategoryTransformer.getMetaDataDocument(obj, false));
handleEvent(evt, xml, obj.toString());
}
use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRClassificationBrowser2 method renderToHTML.
/**
* Sends output to client browser
* @throws SAXException
* @throws TransformerException
*/
private void renderToHTML(MCRServletJob job, HttpServletRequest req, Element xml) throws IOException, TransformerException, SAXException {
// XSL.Style, optional
String style = req.getParameter("style");
if ((style != null) && (style.length() > 0)) {
req.setAttribute("XSL.Style", style);
}
MCRServlet.getLayoutService().doLayout(req, job.getResponse(), new MCRJDOMContent(xml));
}
use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRMetadataStoreTest method update.
@Test
public void update() throws Exception {
Document xml1 = new Document(new Element("root"));
MCRStoredMetadata sm = getMetaDataStore().create(new MCRJDOMContent(xml1));
Document xml2 = new Document(new Element("update"));
sm.update(new MCRJDOMContent(xml2));
MCRContent xml3 = getMetaDataStore().retrieve(sm.getID()).getMetadata();
assertEquals(new MCRJDOMContent(xml2).asString(), xml3.asString());
}
Aggregations