From fa4928e6ea252705cfaaaf2ca34a01d89e446736 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Mon, 2 Dec 2013 10:40:24 +0000 Subject: [PATCH] CLOUD-2204: Merged HEAD-BUG-FIX (Cloud/4.3) to HEAD (Cloud/4.3) 57951: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 57947: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1) 57945: Merged V4.1.7 (4.1.7) to V4.1-BUG-FIX (4.1.8) 57943: MNT-9988: Merged V4.1.3 (4.1.3.18) to V4.1.7 (4.1.7) 57885: Merged DEV to V4.1.3-PATCHES (4.1.3.18) 57855 : MNT-9939, MNT-9969 : CLONE - alfresco webdav does not pass litmus webdav test suite - Adding OverWrite header support git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@58451 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/webdav/MoveMethod.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/source/java/org/alfresco/repo/webdav/MoveMethod.java b/source/java/org/alfresco/repo/webdav/MoveMethod.java index 06243375e2..71e9371714 100644 --- a/source/java/org/alfresco/repo/webdav/MoveMethod.java +++ b/source/java/org/alfresco/repo/webdav/MoveMethod.java @@ -221,6 +221,17 @@ public class MoveMethod extends HierarchicalMethod // If this is a copy then the source is just copied to destination. else if (!isMove) { + // MNT-9939 - check overwrite + if (hasOverWrite() && destFileInfo != null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Destination exists and overwrite is allowed"); + } + + fileFolderService.delete(destFileInfo.getNodeRef()); + } + fileFolderService.copy(sourceNodeRef, destParentNodeRef, name); } // If this is a move and the destination looks like the start of a shuffle operation, then the source is just @@ -239,6 +250,17 @@ public class MoveMethod extends HierarchicalMethod // It is a simple rename operation try { + // MNT-9939 - check overwrite + if (hasOverWrite() && destFileInfo != null && !sourceFileInfo.equals(destFileInfo)) + { + if (logger.isDebugEnabled()) + { + logger.debug("Destination exists and overwrite is allowed"); + } + + fileFolderService.delete(destFileInfo.getNodeRef()); + } + fileFolderService.rename(sourceNodeRef, name); // As per the WebDAV spec, we make sure the node is unlocked once moved getDAVHelper().getLockService().unlock(sourceNodeRef); @@ -260,6 +282,17 @@ public class MoveMethod extends HierarchicalMethod else { // It is a simple move operation + // MNT-9939 - check overwrite + if (hasOverWrite() && destFileInfo != null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Destination exists and overwrite is allowed"); + } + + fileFolderService.delete(destFileInfo.getNodeRef()); + } + fileFolderService.moveFrom(sourceNodeRef, sourceParentNodeRef, destParentNodeRef, name); // As per the WebDAV spec, we make sure the node is unlocked once moved