Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

68528: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud)
      68303: Merged V4.1-BUG-FIX (4.1.9) to V4.2-BUG-FIX (4.2.3)
         68256: MNT-11342: Merged V4.1.7 (4.1.7.7) to V4.1-BUG-FIX (4.1.9)
            65718: MNT-10966: 4.1.7 breaks onContentUpdate policies when using webdav
               Call onContentUpdate policies on ASPECT_NO_CONTENT removal as it means that new content was uploaded.
               For WebDAV ASPECT_NO_CONTENT is removed on UNLOCK of the new node.
            65741: MNT-10966: 4.1.7 breaks onContentUpdate policies when using webdav
               Add unit test for case
            - Test resources alraedy existed on V4.1-BUG-FIX


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@70410 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-05-16 16:30:37 +00:00
parent b78998bd06
commit 3e9a566944

View File

@@ -45,6 +45,7 @@ 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.avm.AVMService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
@@ -221,6 +222,10 @@ 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);
@@ -347,6 +352,25 @@ 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<QName> 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
*