MNT-20145 Don't delete the content url if the file has copies or it is a copy

This commit is contained in:
cagache
2019-02-07 17:54:46 +02:00
parent 00f66a34db
commit a5dc916a7e

View File

@@ -33,6 +33,7 @@ import java.util.Set;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.model.RenditionModel; import org.alfresco.model.RenditionModel;
import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel;
import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.policy.annotation.BehaviourBean; import org.alfresco.repo.policy.annotation.BehaviourBean;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -214,7 +215,12 @@ public class ContentDestructionComponent
// get content data // get content data
ContentData dataContent = (ContentData)entry.getValue(); ContentData dataContent = (ContentData)entry.getValue();
// if enabled cleanse content // destroy the nodes content properties only if it doesn't have copies or it is a copy
// destroy the nodes content properties only if the versionedNodeRef is deleted
if (getNodeService().getTargetAssocs(nodeRef, ContentModel.ASSOC_ORIGINAL).isEmpty() &&
getNodeService().getSourceAssocs(nodeRef, ContentModel.ASSOC_ORIGINAL).isEmpty() &&
getNodeService().getProperty(nodeRef, RecordableVersionModel.PROP_VERSIONED_NODEREF) == null)
{ // if enabled cleanse content
if (isCleansingEnabled()) if (isCleansingEnabled())
{ {
// register for cleanse then immediate destruction // register for cleanse then immediate destruction
@@ -225,6 +231,7 @@ public class ContentDestructionComponent
// register for immediate destruction // register for immediate destruction
getEagerContentStoreCleaner().registerOrphanedContentUrl(dataContent.getContentUrl(), true); getEagerContentStoreCleaner().registerOrphanedContentUrl(dataContent.getContentUrl(), true);
} }
}
// clear the property // clear the property
if (clearContentProperty) if (clearContentProperty)