JCROM addNodeWithUUID

36 views
Skip to first unread message

Mihai Dinca

unread,
Apr 22, 2013, 7:18:37 AM4/22/13
to jc...@googlegroups.com
Hello.

I want to be able to add a Node with a specific UUID. NodeImpl has a method addNodeWithUUID but Jcrom class does not have a correspondent. Would it be possible to add such a method to Jcrom?

Thanks,

Mike

Nicolas Dos Santos

unread,
Apr 22, 2013, 8:26:34 AM4/22/13
to jc...@googlegroups.com
We rely on the JCR 2.0 specification (http://www.day.com/specs/jcr/2.0/index.html) and javax.jcr.Node interface doesn't provide such method to implement (http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html)

The addNodeWithUuid(...) method exists in the implementation you're using, but that doesn't mean it exists in all implementations.
It needs to be checked  the implementation used to determine if the method exists. It's then outside the scope of JCROM.
Here is an example that you can use to do what you want:

Node newNode = session.getRootNode().addNode("myNewNode");
if(newNode instance of org.apache.jackrabbit.core.NodeImpl) {
  ((org.apache.jackrabbit.core.NodeImpl)newNode).addNodeWithUuid(...);

Mihai Dinca

unread,
Apr 23, 2013, 7:55:16 AM4/23/13
to jc...@googlegroups.com
Hi.

I understand that such method is not found in specification. Jcrom add method goes to a Mapper method:

 Node addNode( Node parentNode, Object entity, String[] mixinTypes, boolean createNode, boolean ignoreFileProperties )

which does much more than just add the node. I can get the entire code from this method to my code and test for NodeImpl instance, but this does not seem a good approach.

It would helped me if a call-back method existed somewhere and could be overwritten to just add the code you mentioned.

Thanks,

Mike

Mihai Dinca

unread,
Apr 23, 2013, 10:27:08 AM4/23/13
to jc...@googlegroups.com
Cannot copy the entire code because some classes (Mappers) are not exposed outside jcrom package. So the only solution will be to have a callback method.

Mike

Nicolas Dos Santos

unread,
Apr 23, 2013, 4:26:11 PM4/23/13
to jc...@googlegroups.com
OK. I understand what you want.

Could you create an issue (https://code.google.com/p/jcrom/issues/list)?
I'll see what I can do when I have some time. I have to think about how to treat this problem.

Mihai Dinca

unread,
Apr 24, 2013, 3:24:21 AM4/24/13
to jc...@googlegroups.com
I added an issue.
Thank you.
Reply all
Reply to author
Forward
0 new messages