diff --git a/source/java/org/alfresco/repo/content/ContentServiceImpl.java b/source/java/org/alfresco/repo/content/ContentServiceImpl.java index 5fb63ec3c4..5f5793b30f 100644 --- a/source/java/org/alfresco/repo/content/ContentServiceImpl.java +++ b/source/java/org/alfresco/repo/content/ContentServiceImpl.java @@ -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 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 *