Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
r2.06.06 (m13 - rc7)
-
None
-
None
-
ubuntu
Description
I'm trying to delete a document from a client app, I wrote some code for that using the FullReviewedActionsWorkflow. I first look for a published document, and if that exists, I unpublish it first. After that, I look up the unpublished version of the document and invoke delete(). The result is that the document is deleted, but I get an exception:
javax.jcr.version.VersionException: node /content/attic/2009/7/16/DocumentA/DocumentA/links/link: : cannot set property of a checked-in node
at org.apache.jackrabbit.core.NodeImpl.checkSetProperty(NodeImpl.java:1287)
at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2297)
at org.hippoecm.repository.decorating.NodeDecorator.setProperty(NodeDecorator.java:157)
at org.hippoecm.repository.impl.WorkspaceDecorator$2.leaving(WorkspaceDecorator.java:210)
at javax.jcr.util.TraversingItemVisitor.visit(TraversingItemVisitor.java:183)
at org.hippoecm.repository.decorating.ItemVisitorDecorator.visit(ItemVisitorDecorator.java:48)
at org.apache.jackrabbit.core.NodeImpl.accept(NodeImpl.java:2062)
at org.hippoecm.repository.decorating.ItemDecorator.accept(ItemDecorator.java:138)
at javax.jcr.util.TraversingItemVisitor.visit(TraversingItemVisitor.java:179)
at org.hippoecm.repository.decorating.ItemVisitorDecorator.visit(ItemVisitorDecorator.java:48)
at org.apache.jackrabbit.core.NodeImpl.accept(NodeImpl.java:2062)
at org.hippoecm.repository.decorating.ItemDecorator.accept(ItemDecorator.java:138)
at javax.jcr.util.TraversingItemVisitor.visit(TraversingItemVisitor.java:179)
at org.hippoecm.repository.decorating.ItemVisitorDecorator.visit(ItemVisitorDecorator.java:48)
at org.apache.jackrabbit.core.NodeImpl.accept(NodeImpl.java:2062)
at org.hippoecm.repository.decorating.ItemDecorator.accept(ItemDecorator.java:138)
at javax.jcr.util.TraversingItemVisitor.visit(TraversingItemVisitor.java:179)
at org.hippoecm.repository.decorating.ItemVisitorDecorator.visit(ItemVisitorDecorator.java:48)
at org.apache.jackrabbit.core.NodeImpl.accept(NodeImpl.java:2062)
at org.hippoecm.repository.decorating.ItemDecorator.accept(ItemDecorator.java:138)
at org.hippoecm.repository.impl.WorkspaceDecorator.touch(WorkspaceDecorator.java:201)
at org.hippoecm.repository.impl.WorkspaceDecorator.move(WorkspaceDecorator.java:239)
at org.hippoecm.repository.standardworkflow.FolderWorkflowImpl.doArchive(FolderWorkflowImpl.java:251)
at org.hippoecm.repository.standardworkflow.FolderWorkflowImpl.archive(FolderWorkflowImpl.java:317)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hippoecm.repository.impl.WorkflowManagerImpl$WorkflowInvocationHandler.invoke(WorkflowManagerImpl.java:508)
at $Proxy2.archive(Unknown Source)
at org.hippoecm.repository.standardworkflow.DefaultWorkflowImpl.archive(DefaultWorkflowImpl.java:119)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hippoecm.repository.impl.WorkflowManagerImpl$WorkflowInvocationImpl.invoke(WorkflowManagerImpl.java:819)
at org.hippoecm.repository.impl.WorkflowManagerImpl$WorkflowInvocationHandler.invoke(WorkflowManagerImpl.java:524)
my code is as follows:
protected Node getUnpublishedVariant(Node handle) throws RepositoryException
{ return getVariant(handle, "unpublished"); }protected Node getPublishedVariant(Node handle) throws RepositoryException
{ return getVariant(handle, "published"); } private Node getVariant(Node handle, String variant) throws RepositoryException{
NodeIterator nodeIter = handle.getNodes();
while (nodeIter.hasNext()){
Node child = nodeIter.nextNode();
String state = null;
try
catch (PathNotFoundException pnfe){
}
if (variant.equals(state))
}
return null;
}
protected void deleteNode(HippoWorkspace workspace, Node handleNodeToBeDeleted)
throws RepositoryException, WorkflowException, RemoteException {
Session session = handleNodeToBeDeleted.getSession();
// first unpublish if published
Node publishedNode = getPublishedVariant(handleNodeToBeDeleted);
if (publishedNode != null){
FullReviewedActionsWorkflow workflow = getWorkflowForConcreteNode(handleNodeToBeDeleted.getSession(),publishedNode);
if (workflow == null)
workflow.depublish();
}
// next, delete unpublished version
Node unpublishedNode = getUnpublishedVariant(handleNodeToBeDeleted);
if (unpublishedNode == null)
FullReviewedActionsWorkflow workflow = getWorkflowForConcreteNode(handleNodeToBeDeleted.getSession(),unpublishedNode);
if (workflow == null)
workflow.delete();
}
protected FullReviewedActionsWorkflow getWorkflowForConcreteNode(Session session, Node concreteNode) throws RepositoryException {
WorkflowManager workflowManager = ((HippoWorkspace)session.getWorkspace()).getWorkflowManager();
Workflow reviewedActionsWorkflow = workflowManager.getWorkflow("default", concreteNode);
if (reviewedActionsWorkflow instanceof FullReviewedActionsWorkflow)
else
{ return null; }}
Attachments
Issue Links
- is awaited by
-
HSTTWO-728 refactor the remove method in PersistableObjectBeanManagerWorkflowImpl regarding node checkout when CMS7-2844 is done
- Closed