Merged 5.1.N (5.1.1) to HEAD (5.2)

122488 amorarasu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.1) (PARTIAL MERGE)
      122474 rneamtu: Merged DEV to 5.0.N (5.0.4)
         122425 rneamtu: MNT-14687 : Creating a document as checkedout and then cancelling the checkout should delete the document
            - fixed cancel editing and delete failures


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123669 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-03-11 22:27:02 +00:00
parent 63501315b7
commit 03c9eaeb9f
2 changed files with 30 additions and 4 deletions

View File

@@ -34,6 +34,7 @@ import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
@@ -123,6 +124,12 @@ public class WorkingCopyAspect implements CopyServicePolicies.OnCopyNodePolicy,
NodeServicePolicies.OnRemoveAspectPolicy.QNAME,
ContentModel.ASPECT_WORKING_COPY,
new JavaBehaviour(this, "onRemoveAspect"));
this.policyComponent.bindAssociationBehaviour(
NodeServicePolicies.OnDeleteAssociationPolicy.QNAME,
ContentModel.ASPECT_CMIS_CREATED_CHECKEDOUT,
ContentModel.ASSOC_WORKING_COPY_LINK,
new JavaBehaviour(this, "onDeleteCmisCreatedCheckoutWorkingCopyAssociation"));
}
/**
@@ -141,10 +148,6 @@ public class WorkingCopyAspect implements CopyServicePolicies.OnCopyNodePolicy,
lockService.unlock(checkedOutNodeRef, false, true);
nodeService.removeAspect(checkedOutNodeRef, ContentModel.ASPECT_CHECKED_OUT);
if (nodeService.hasAspect(checkedOutNodeRef, ContentModel.ASPECT_CMIS_CREATED_CHECKEDOUT))
{
nodeService.deleteNode(checkedOutNodeRef);
}
}
finally
{
@@ -152,6 +155,27 @@ public class WorkingCopyAspect implements CopyServicePolicies.OnCopyNodePolicy,
}
}
}
/**
* onDeleteAssociation policy behaviour If the node has the aspect ASPECT_CMIS_CREATED_CHECKEDOUT and ASSOC_WORKING_COPY_LINK association is deleted, delete the node. Fix for MNT-14850.
*
* @param nodeAssocRef ASSOC_WORKING_COPY_LINK association where the source is the checkedOut node and the target is the workingCopy
*/
public void onDeleteCmisCreatedCheckoutWorkingCopyAssociation(AssociationRef nodeAssocRef)
{
NodeRef checkedOutNodeRef = nodeAssocRef.getSourceRef();
policyBehaviourFilter.disableBehaviour(checkedOutNodeRef, ContentModel.ASPECT_AUDITABLE);
try
{
nodeService.deleteNode(checkedOutNodeRef);
}
finally
{
policyBehaviourFilter.enableBehaviour(checkedOutNodeRef, ContentModel.ASPECT_AUDITABLE);
}
}
@Override
public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName)