From 00776fedf8b7178bd5a21ee87deaf2ca1dc70a68 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Fri, 3 Jun 2016 16:00:17 +0000 Subject: [PATCH] Merged 5.2.N (5.2.1) to HEAD (5.2) 124228 amorarasu: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 124145 amorarasu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2) 124106 rmunteanu: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4) 124105 amorarasu: Merged V4.1-BUG-FIX (4.1.11) to V4.2-BUG-FIX (4.2.7) 123915 rmunteanu: Merged V4.1.7 (4.1.7.18) to V4.1-BUG-FIX (4.1.11) MNT-15801 : onContentUpdate policies not working for updates via webdav - Reverted changes made for MNT-11185 and MNT-10966 , reverts that will fix MNT-15746 - Changed fix for MNT-5882 by adding the ASPECT_NO_CONTENT after the content is updated, this way preventing MNT-10966 from reproducing git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127744 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../filesys/repo/ContentDiskDriver2.java | 19 ++++++++------- .../repo/content/ContentServiceImpl.java | 23 ------------------- 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java b/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java index a78b7432b3..9bafbfb430 100644 --- a/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java +++ b/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java @@ -2988,6 +2988,15 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD lockKeeper.removeLock(target); + if(nodeService.hasAspect(target, ContentModel.ASPECT_NO_CONTENT)) + { + if(logger.isDebugEnabled()) + { + logger.debug("removed no content aspect"); + } + nodeService.removeAspect(target, ContentModel.ASPECT_NO_CONTENT); + } + if(tempFile.isChanged()) { tempFile.flushFile(); @@ -3085,16 +3094,6 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD writer.setMimetype(mimetype); writer.setEncoding(encoding); writer.putContent(tempFile.getFile()); - - // remove ASPECT_NO_CONTENT after content is present - if(nodeService.hasAspect(target, ContentModel.ASPECT_NO_CONTENT)) - { - if(logger.isDebugEnabled()) - { - logger.debug("removed no content aspect"); - } - nodeService.removeAspect(target, ContentModel.ASPECT_NO_CONTENT); - } } // if content changed } } diff --git a/source/java/org/alfresco/repo/content/ContentServiceImpl.java b/source/java/org/alfresco/repo/content/ContentServiceImpl.java index c999c03f06..66d25fd0f7 100644 --- a/source/java/org/alfresco/repo/content/ContentServiceImpl.java +++ b/source/java/org/alfresco/repo/content/ContentServiceImpl.java @@ -44,7 +44,6 @@ import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.ClassPolicyDelegate; import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DictionaryService; @@ -214,10 +213,6 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME, this, new JavaBehaviour(this, "onUpdateProperties")); - this.policyComponent.bindClassBehaviour( - NodeServicePolicies.OnRemoveAspectPolicy.QNAME, - ContentModel.ASPECT_NO_CONTENT, - new JavaBehaviour(this, "onRemoveAspect", NotificationFrequency.EVERY_EVENT)); // Register on content update policy this.onContentUpdateDelegate = this.policyComponent.registerClassPolicy(OnContentUpdatePolicy.class); @@ -344,25 +339,7 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa } } - /** - * MNT-10966: removing ASPECT_NO_CONTENT means that new content was uploaded - * - * @param nodeRef the node reference - * @param aspectTypeQName tha removed aspect - */ - public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName) - { - if (!nodeService.exists(nodeRef)) - { - return; - } - // Fire the content update policy - Set types = getTypes(nodeRef, null); - OnContentUpdatePolicy policy = onContentUpdateDelegate.get(nodeRef, types); - policy.onContentUpdate(nodeRef, true); - } - /** * Helper method to lazily populate the types associated with a node *