Merge from V3.4 to HEAD. Fix for ALF-6192.

r24622 Fix for ALF-6192 alfresco share could not delete file with preview.
      This issue was ultimately caused by the incorrect use of a BeforeDeleteNode policy.
      As a workaround to ALF-4119 a beforeDeleteNode policy was defined in RenditionAspect.java.
      This policy ensured that when path/template-based renditions were deleted, that the parent-child
      association to the source node, which is a non-primary association, was removed. In doing so, future
      calls to renditionService.getRenditions() would not return renditions from the archive store.

      However, this led to the permissions problem observed in this issue.

      It is possible that running the BeforeDeleteNode policy as system could have resolved the problem.
      However an alternative workaround for the deleted renditions problem has been implemented.
      The policy has been removed and instead, the RenditionService filters the results.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@24690 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2011-01-05 14:16:59 +00:00
parent d1b87163b6
commit 244fbe1460
4 changed files with 33 additions and 127 deletions

View File

@@ -43,6 +43,7 @@ import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.GUID;
@@ -292,9 +293,29 @@ public class RenditionServiceImpl implements RenditionService, RenditionDefiniti
{
// Get all the renditions that match the given rendition name
result = nodeService.getChildAssocs(node, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL);
result = removeArchivedRenditionsFrom(result);
}
return result;
}
private List<ChildAssociationRef> removeArchivedRenditionsFrom(List<ChildAssociationRef> renditionAssocs)
{
// This is a workaround for a bug in the NodeService (no JIRA number yet) whereby a call to
// nodeService.getChildAssocs can return all children, including children in the archive store.
List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>();
for (ChildAssociationRef chAssRef : renditionAssocs)
{
// If the rendition has *not* been deleted, then it should remain in the result list.
if (chAssRef.getChildRef().getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE) == false)
{
result.add(chAssRef);
}
}
return result;
}
/*
* (non-Javadoc)
@@ -330,6 +351,8 @@ public class RenditionServiceImpl implements RenditionService, RenditionDefiniti
}
}
filteredResults = removeArchivedRenditionsFrom(filteredResults);
return filteredResults;
}
@@ -347,6 +370,7 @@ public class RenditionServiceImpl implements RenditionService, RenditionDefiniti
// Get all the renditions that match the given rendition name -
// there should only be 1 (or 0)
renditions = this.nodeService.getChildAssocs(node, RenditionModel.ASSOC_RENDITION, renditionName);
renditions = this.removeArchivedRenditionsFrom(renditions);
}
if (renditions.isEmpty())
{