From 2fe6c6fa7224766a966b764d038bd4a7b258a630 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Wed, 20 Jul 2011 18:45:17 +0000 Subject: [PATCH] ALF-9569: copiedFromAspect patch does not take documents with more than one working copy into account - Added handling of detection of multiple check-outs of a node: - ALF-9029 RINF 49: Lucene Removal: CheckOutCheckInService API - ALF-9032: RINF 49: fixes to cm:workingcopy aspect git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29236 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../patch/impl/CopiedFromAspectPatch.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/source/java/org/alfresco/repo/admin/patch/impl/CopiedFromAspectPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/CopiedFromAspectPatch.java index a83e9e2964..09500940ec 100644 --- a/source/java/org/alfresco/repo/admin/patch/impl/CopiedFromAspectPatch.java +++ b/source/java/org/alfresco/repo/admin/patch/impl/CopiedFromAspectPatch.java @@ -363,6 +363,7 @@ public class CopiedFromAspectPatch extends AbstractPatch // Does the source exist? if (sourceNodeRef == null || !nodeService.exists(sourceNodeRef)) { + boolean isNewModel = true; if ( nodeService.hasAspect(nodeRef, ContentModel.ASPECT_COPIEDFROM) && nodeService.getSourceAssocs(nodeRef, ContentModel.ASSOC_ORIGINAL).size() == 0) @@ -374,6 +375,7 @@ public class CopiedFromAspectPatch extends AbstractPatch } writeLine(file, "Removing cm:copiedfrom from node: " + nodePair); nodeService.removeAspect(nodeRef, ContentModel.ASPECT_COPIEDFROM); + isNewModel = false; } if ( nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY) && @@ -386,8 +388,17 @@ public class CopiedFromAspectPatch extends AbstractPatch } writeLine(file, "Removing cm:workingcopy from node: " + nodePair); nodeService.removeAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY); + isNewModel = false; } // If nothing was done, then it's a node with the new data model and we can leave it + if (isNewModel) + { + if (logger.isDebugEnabled()) + { + logger.debug("\tP: Ignoring data with new model: " + nodePair); + } + writeLine(file, "Ignoring data with new model: " + nodePair); + } } else { @@ -416,6 +427,20 @@ public class CopiedFromAspectPatch extends AbstractPatch { // The association is already present, so just remove the property (we'll do that later) } + else if (nodeService.hasAspect(sourceNodeRef, ContentModel.ASPECT_CHECKED_OUT)) + { + // ALF-9569: copiedFromAspect patch does not take documents with + // more than one working copy into account + // So there are multiple working copies + if (logger.isDebugEnabled()) + { + logger.debug("\tP: Found node with multiple working copies: " + sourceNodeRef); + logger.debug("\tP: Removing cm:workingcopy: " + nodePair); + } + writeLine(file, "Found node with multiple working copies: " + nodePair); + writeLine(file, "Removing cm:workingcopy from node: " + nodePair); + nodeService.removeAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY); + } else { if (logger.isDebugEnabled())