You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by techie2k <de...@gmail.com> on 2014/01/13 14:14:46 UTC

JCR move content

I'm facing issue in Jackrabbit node contents moving from one path to another.

Trying to move list of documents(from temporary node in jcr) under a node to
new path(new node, which does not contain any documents).

Nodes are of mixin types.

Following is the partial snippet for creating document node:

*Node documentNode = session.getNode("/1/doc/1").addNode("Test_Sample",
"et:document");
documentNode.setProperty(PROPERTY_ID, 123);
documentNode.setProperty(Property.JCR_TITLE, "Test Sample");
documentNode.setProperty(Property.JCR_DESCRIPTION, "Sample Description");
documentNode.setProperty(ETNodeTypes.ET_TAGS.getName(), "web");

Node resourceNode = documentNode.addNode (Property.JCR_CONTENT,
"nt:resource");
resourceNode.setProperty (Property.JCR_MIMETYPE, "application/xstream");
resourceNode.setProperty (Property.JCR_ENCODING, "UTF-8");
Binary value = session.getValueFactory().createBinary(new
ByteArrayInputStream(document.getData()));
resourceNode.setProperty (Property.JCR_DATA, value);

Calendar lastModified = Calendar.getInstance ();
resourceNode.setProperty (Property.JCR_LAST_MODIFIED, lastModified);
session.save();

VersionManager versionManager = session.getWorkspace().getVersionManager();
documentNode.addMixin(JcrConstants.MIX_VERSIONABLE);
versionManager.checkin(documentNode.getPath());
doc.setVersionNumber(versionManager.getBaseVersion(documentNode.getPath()).getName());
return documentNode.getIdentifier();*


Node type description:

*/**
* Document node
*/
[et:document] > nt:file, mix:title, mix:versionable, mix:shareable
+ * (nt:file) VERSION
- et:tags multiple
- et:role multiple
- et:id (LONG)*
Wanted to move the contents using jcr api itself, instead of getting all
sub-nodes iterate and move to destination folder.

Using Jackrabbit core 2.6.0 with JCR 2.0.



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/JCR-move-content-tp4660146.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.