Merge branch 'feature-2.4/RM-2937_RecordDestructionKeepingMetadata' into 'release/V2.4'

Feature 2.4/rm 2937 record destruction keeping metadata

RM-2937 - The destruction of records can not be completed if the metadata is set to be maintained after destruction.

The issue reproduces only if image magic is correctly installed. If the node to be destroyed has associated renditions cleaning the rendition's content is failing because there is no capability to allow the operation. This in a regression from 2.3 where method security was disabled for the class that was deleting the thumbnails.

The code has been refactored in 2.4 and the content cleaning is performed in a new class. ExtendedContentDestructionComoponent uses the NodeService interface which enforces method security. ExtendedContentDestructionComoponent  extends ContentDestructionComoponent from community which uses the nodeService implementation. I fixed it by using the implementation directly.

After fixing the issue I noticed the renditions nodes are not deleted which is a regression from 2.3 and there is no comment to specify this was intended so I deleted the rendition node.

I noticed that the method ContentDestructionComponent.destroyContent has the parameter includeRenditions which is not being used in the code. We are deleting the rendition even if this boolean is set to false. Should I fix it with this issue or should we raise another issue for this problem. Please advise.

See merge request !39
This commit is contained in:
Ana Bozianu
2016-02-23 09:54:52 +00:00

View File

@@ -168,8 +168,9 @@ public class ContentDestructionComponent
// We want to remove the rn:renditioned aspect, but due to the possibility
// that there is Alfresco 3.2-era data with the cm:thumbnailed aspect
// applied, we must consider removing it too.
if (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED) ||
getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED))
if (includeRenditions
&& (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED)
|| getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED)))
{
// get the rendition assoc types
Set<QName> childAssocTypes = dictionaryService.getAspect(RenditionModel.ASPECT_RENDITIONED).getChildAssociations().keySet();
@@ -179,6 +180,9 @@ public class ContentDestructionComponent
{
// destroy renditions content
destroyContent(child.getChildRef(), false);
//delete the rendition node
getNodeService().deleteNode(child.getChildRef());
}
}
}