mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ALF-2047. The fix was to ensure that rendition definitions that produce thumbnails always have PARAM_RENDITION_NODETYPE=cm:thumbnail. To do this, I removed the parameter from the create thumbnail code and added it to the ThumbnailRenditionConvertor, from where it will be picked up by all the code that needs it.
Formerly, the parameter was only set for create thumbnail calls, but not for update thumbnail calls. Therefore when the content nodes were changed as described in the issue, the updated thumbnails were of the default type in the rendition service, which is cm:content which leads to problems in various views. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19955 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,6 +22,7 @@ import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.transform.magick.ImageResizeOptions;
|
||||
import org.alfresco.repo.content.transform.magick.ImageTransformationOptions;
|
||||
import org.alfresco.repo.content.transform.swf.SWFTransformationOptions;
|
||||
@@ -130,7 +131,12 @@ public class ThumbnailRenditionConvertor
|
||||
{
|
||||
Map<String, Serializable> parameters = new HashMap<String, Serializable>();
|
||||
|
||||
// All TransformationOptions-based renditions are considered to be "thumbnails".
|
||||
// Therefore they should be created with a node type of cm:thumbnail
|
||||
parameters.put(RenditionService.PARAM_RENDITION_NODETYPE, ContentModel.TYPE_THUMBNAIL);
|
||||
|
||||
// parameters common to all transformations
|
||||
|
||||
putParameterIfNotNull(AbstractRenderingEngine.PARAM_SOURCE_CONTENT_PROPERTY, transformationOptions.getSourceContentProperty(), parameters);
|
||||
putParameterIfNotNull(AbstractRenderingEngine.PARAM_TARGET_CONTENT_PROPERTY, transformationOptions.getTargetContentProperty(), parameters);
|
||||
putParameterIfNotNull(RenditionService.PARAM_DESTINATION_NODE, transformationOptions.getTargetNodeRef(), parameters);
|
||||
|
@@ -430,7 +430,6 @@ public class ThumbnailServiceImpl implements ThumbnailService
|
||||
// Add the other parameters given in this method signature.
|
||||
params.put(AbstractRenderingEngine.PARAM_SOURCE_CONTENT_PROPERTY, contentProperty);
|
||||
params.put(AbstractRenderingEngine.PARAM_MIME_TYPE, mimetype);
|
||||
params.put(RenditionService.PARAM_RENDITION_NODETYPE, ContentModel.TYPE_THUMBNAIL);
|
||||
|
||||
// Set the parameters on the rendition definition.
|
||||
definition.addParameterValues(params);
|
||||
|
@@ -261,8 +261,14 @@ public class ThumbnailServiceImplTest extends BaseAlfrescoSpringTest
|
||||
NodeRef thumbnail1 = this.thumbnailService.createThumbnail(jpgOrig, ContentModel.PROP_CONTENT,
|
||||
MimetypeMap.MIMETYPE_IMAGE_JPEG, imageTransformationOptions, "small");
|
||||
|
||||
// Thumbnails should always be of type cm:thumbnail.
|
||||
assertEquals(ContentModel.TYPE_THUMBNAIL, nodeService.getType(thumbnail1));
|
||||
|
||||
// Update the thumbnail
|
||||
this.thumbnailService.updateThumbnail(thumbnail1, imageTransformationOptions);
|
||||
|
||||
// ALF-2047. Thumbnails were changing to type cm:content after update.
|
||||
assertEquals(ContentModel.TYPE_THUMBNAIL, nodeService.getType(thumbnail1));
|
||||
}
|
||||
|
||||
public void testGetThumbnailByName() throws Exception
|
||||
|
Reference in New Issue
Block a user