Hi, I am trying to create custom content using JCR. I created a new custom tag for content and modifies some xmls. but unable to create content using JCR. Please if anyone can help me…
this is my code………..in the code - "dml is my custom tag"
Node rootNode = session.getRootNode();
Node companyHome = rootNode.getNode("app:company_home");
// create the content node
String name = "JCR sample (" + System.currentTimeMillis() + ")";
Node content = companyHome.addNode("dml:" + name, "dml:newscontent");
// Node content = companyHome.addNode("cm:" + name, "cm:content");
content.setProperty("cm:name", name);
// add titled aspect (for Web Client display)
//content.addMixin("cm:titled");
// content.setProperty("cm:title", name);
//content.setProperty("cm:description", name);
content.setProperty("dml:Headline", name);
//
// write some content to new node
//
//content.setProperty("cm:content", "The quick brown fox jumps over the lazy dog");
//
// To set the content mime type, we need to use an Alfresco native service
// as there isn't an equivalent call in JCR
//
setMimeType(context, content, MimetypeMap.MIMETYPE_TEXT_PLAIN);