Hello,
I try to convert a node and its node-type after it was already created.
Does anyone have an idea how that can be achieved?
I tried cloning the parent-node into another workspace, the removed
the node to be changed, added a new node with the same name and a new
node-type.
Then I tried to merge the orginal parent-node and the cloned parent -
nothing changes on the original node.
I tried the whole thing with removing and copying a changed not to
the original location.
session.refresh(true);
session.getRootNode().getNode(nodePath).remove();
session.getWorkspace().copy("workingCopy",
"/"+nodePath, "/"+nodePath);
testNode= session.getRootNode().getNode(nodeName);
testNode.save();
session.save();
I do not like the whole way of doing this - so ist there a nicer and
souccessful way?
I cannot call save any more , even if I do something after the copy
command.
javax.jcr.InvalidItemStateException: /: the item cannot be saved
because it has been modified externally.
at org.apache.jackrabbit.core.ItemImpl.getTransientStates
(ItemImpl.java:343)
at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1054)
at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:805)
at ConvertType.main(ConvertType.java:123)
thanks
Eric