From 97db4de531a1d49e32d319dea4b7d3d1057d47ab Mon Sep 17 00:00:00 2001 From: Mark Rogers Date: Tue, 22 Jul 2014 13:27:30 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud) 75639: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (5.0/Cloud) 75253: Merged DEV to V4.2-BUG-FIX (4.2.3) 75193 : MNT-11771 : Disabling thumbnail also disables Share preview - Provide force parameter to ignore system.thumbnail.generate git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@77515 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/jscript/ScriptNode.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/repo/jscript/ScriptNode.java b/source/java/org/alfresco/repo/jscript/ScriptNode.java index 4b23d8c9d9..c649e4280a 100644 --- a/source/java/org/alfresco/repo/jscript/ScriptNode.java +++ b/source/java/org/alfresco/repo/jscript/ScriptNode.java @@ -2876,13 +2876,35 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider * @return ScriptThumbnail the newly create thumbnail node or null if async creation occures */ public ScriptThumbnail createThumbnail(String thumbnailName, boolean async) + { + return createThumbnail(thumbnailName, async, false); + } + + /** + * Creates a thumbnail for the content property of the node. + * + * The thumbnail name corresponds to pre-set thumbnail details stored in the + * repository. + * + * If the thumbnail is created asynchronously then the result will be null and creation + * of the thumbnail will occure at some point in the background. + * + * If foce param specified system.thumbnail.generate is ignoring. Could be used for preview creation + * + * @param thumbnailName the name of the thumbnail + * @param async indicates whether the thumbnail is create asynchronously or not + * @param force ignore system.thumbnail.generate=false + * @return ScriptThumbnail the newly create thumbnail node or null if async creation occures + */ + public ScriptThumbnail createThumbnail(String thumbnailName, boolean async, boolean force) { final ThumbnailService thumbnailService = services.getThumbnailService(); ScriptThumbnail result = null; // If thumbnail generation has been configured off, then don't bother with any of this. - if ( thumbnailService.getThumbnailsEnabled()) + // We need to create preview for node even if system.thumbnail.generate=false + if (force || thumbnailService.getThumbnailsEnabled()) { // Use the thumbnail registy to get the details of the thumbail ThumbnailRegistry registry = thumbnailService.getThumbnailRegistry();