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/BRANCHES/DEV/5.2.N/root@124228 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-03-18 12:50:49 +00:00
parent d8a66822f4
commit d20141eb13
2 changed files with 9 additions and 33 deletions

View File

@@ -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
}
}

View File

@@ -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,24 +339,6 @@ 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