mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-2220 fix. Rendition Definitions should only be persisted on startup if they have not already been persisted.
Also removed an unnecessary TODO. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19914 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -37,7 +37,7 @@ public class RenditionDefinitionImpl extends ActionImpl implements RenditionDefi
|
|||||||
* Serial version UID
|
* Serial version UID
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 4336392868488634875L;
|
private static final long serialVersionUID = 4336392868488634875L;
|
||||||
//TODO rename to renditionDefinitionName
|
|
||||||
protected static final String RENDITION_DEFINITION_NAME = "renderingActionName";
|
protected static final String RENDITION_DEFINITION_NAME = "renderingActionName";
|
||||||
|
|
||||||
public NodeRef renditionParent;
|
public NodeRef renditionParent;
|
||||||
|
@@ -29,6 +29,8 @@ import org.alfresco.service.cmr.rendition.RenditionDefinition;
|
|||||||
import org.alfresco.service.cmr.rendition.RenditionService;
|
import org.alfresco.service.cmr.rendition.RenditionService;
|
||||||
import org.alfresco.service.cmr.repository.ContentService;
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
import org.alfresco.service.cmr.thumbnail.ThumbnailException;
|
import org.alfresco.service.cmr.thumbnail.ThumbnailException;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
@@ -45,6 +47,9 @@ import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
|||||||
*/
|
*/
|
||||||
public class ThumbnailRegistry implements ApplicationContextAware, ApplicationListener<ApplicationContextEvent>
|
public class ThumbnailRegistry implements ApplicationContextAware, ApplicationListener<ApplicationContextEvent>
|
||||||
{
|
{
|
||||||
|
/** Logger */
|
||||||
|
private static Log logger = LogFactory.getLog(ThumbnailRegistry.class);
|
||||||
|
|
||||||
/** Content service */
|
/** Content service */
|
||||||
private ContentService contentService;
|
private ContentService contentService;
|
||||||
|
|
||||||
@@ -127,8 +132,25 @@ public class ThumbnailRegistry implements ApplicationContextAware, ApplicationLi
|
|||||||
// for the ThumbnailParentAssociationDetails object. Hence the null
|
// for the ThumbnailParentAssociationDetails object. Hence the null
|
||||||
RenditionDefinition renditionDef = thumbnailRenditionConvertor.convert(thumbnailDefinition, null);
|
RenditionDefinition renditionDef = thumbnailRenditionConvertor.convert(thumbnailDefinition, null);
|
||||||
|
|
||||||
|
// Thumbnail definitions are saved into the repository as actions
|
||||||
|
// but only if they have not already been saved.
|
||||||
|
boolean alreadyPersisted = renditionService.loadRenditionDefinition(renditionDef.getRenditionName()) != null;
|
||||||
|
if (!alreadyPersisted)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Init'ing and saving thumbnail definition " + thumbnailDefName);
|
||||||
|
}
|
||||||
renditionService.saveRenditionDefinition(renditionDef);
|
renditionService.saveRenditionDefinition(renditionDef);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Init'ing thumbnail definition " + thumbnailDefName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user