mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RenditionService. Providing extra extension point in thumbnail-rendition conversion
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19105 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -46,19 +46,24 @@
|
|||||||
<property name="thumbnailRegistry" ref="thumbnailRegistry" />
|
<property name="thumbnailRegistry" ref="thumbnailRegistry" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!-- This bean is responsible for the conversion of thumbnail definitions to
|
||||||
|
rendition definitions and vice versa -->
|
||||||
|
<bean id ="thumbnailRenditionConvertor" class="org.alfresco.repo.thumbnail.ThumbnailRenditionConvertor" />
|
||||||
|
|
||||||
<!-- Thumbnail Register -->
|
<!-- Thumbnail Register -->
|
||||||
<bean id="thumbnailRegistry" class="org.alfresco.repo.thumbnail.ThumbnailRegistry">
|
<bean id="thumbnailRegistry" class="org.alfresco.repo.thumbnail.ThumbnailRegistry">
|
||||||
<property name="contentService" ref="ContentService"/>
|
<property name="contentService" ref="ContentService"/>
|
||||||
<property name="renditionService" ref="renditionService" />
|
<property name="renditionService" ref="renditionService" />
|
||||||
<property name="thumbnails">
|
<property name="thumbnails">
|
||||||
<list>
|
<list>
|
||||||
<value>medium</value>
|
<value>medium</value>
|
||||||
<value>doclib</value>
|
<value>doclib</value>
|
||||||
<value>webpreview</value>
|
<value>webpreview</value>
|
||||||
<value>imgpreview</value>
|
<value>imgpreview</value>
|
||||||
<value>avatar</value>
|
<value>avatar</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="thumbnailRenditionConvertor" ref="thumbnailRenditionConvertor" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Create Thumbnail Action -->
|
<!-- Create Thumbnail Action -->
|
||||||
|
@@ -55,6 +55,19 @@ public class ThumbnailRegistry
|
|||||||
|
|
||||||
/** Cache to store mimetype to thumbnailDefinition mapping */
|
/** Cache to store mimetype to thumbnailDefinition mapping */
|
||||||
private Map<String, List<ThumbnailDefinition>> mimetypeMap = new HashMap<String, List<ThumbnailDefinition>>(17);
|
private Map<String, List<ThumbnailDefinition>> mimetypeMap = new HashMap<String, List<ThumbnailDefinition>>(17);
|
||||||
|
|
||||||
|
private ThumbnailRenditionConvertor thumbnailRenditionConvertor;
|
||||||
|
|
||||||
|
public void setThumbnailRenditionConvertor(
|
||||||
|
ThumbnailRenditionConvertor thumbnailRenditionConvertor)
|
||||||
|
{
|
||||||
|
this.thumbnailRenditionConvertor = thumbnailRenditionConvertor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThumbnailRenditionConvertor getThumbnailRenditionConvertor()
|
||||||
|
{
|
||||||
|
return thumbnailRenditionConvertor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content service
|
* Content service
|
||||||
@@ -79,7 +92,7 @@ public class ThumbnailRegistry
|
|||||||
public void setThumbnails(final List<String> thumbnails)
|
public void setThumbnails(final List<String> thumbnails)
|
||||||
{
|
{
|
||||||
this.thumbnails = thumbnails;
|
this.thumbnails = thumbnails;
|
||||||
|
|
||||||
// We'll not populate the data fields in the ThumbnailRegistry here, instead preferring
|
// We'll not populate the data fields in the ThumbnailRegistry here, instead preferring
|
||||||
// to do it lazily later.
|
// to do it lazily later.
|
||||||
}
|
}
|
||||||
@@ -101,8 +114,6 @@ public class ThumbnailRegistry
|
|||||||
|
|
||||||
private void initThumbnailDefinitions()
|
private void initThumbnailDefinitions()
|
||||||
{
|
{
|
||||||
ThumbnailRenditionConvertor thumbnailRenditionConvertor = new ThumbnailRenditionConvertor();
|
|
||||||
|
|
||||||
for (String thumbnailDefinitionName : this.thumbnails)
|
for (String thumbnailDefinitionName : this.thumbnails)
|
||||||
{
|
{
|
||||||
QName qName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, thumbnailDefinitionName);
|
QName qName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, thumbnailDefinitionName);
|
||||||
|
@@ -215,7 +215,7 @@ public class ThumbnailServiceImpl implements ThumbnailService
|
|||||||
|
|
||||||
renderingAction = renditionService.createRenditionDefinition(thumbnailQName, renderingEngineName);
|
renderingAction = renditionService.createRenditionDefinition(thumbnailQName, renderingEngineName);
|
||||||
}
|
}
|
||||||
Map<String, Serializable> params = new ThumbnailRenditionConvertor().convert(transformationOptions, assocDetails);
|
Map<String, Serializable> params = thumbnailRegistry.getThumbnailRenditionConvertor().convert(transformationOptions, assocDetails);
|
||||||
for (String key : params.keySet())
|
for (String key : params.keySet())
|
||||||
{
|
{
|
||||||
renderingAction.setParameterValue(key, params.get(key));
|
renderingAction.setParameterValue(key, params.get(key));
|
||||||
@@ -314,7 +314,7 @@ public class ThumbnailServiceImpl implements ThumbnailService
|
|||||||
|
|
||||||
rendDefn = renditionService.createRenditionDefinition(parentAssoc.getQName(), renderingEngineName);
|
rendDefn = renditionService.createRenditionDefinition(parentAssoc.getQName(), renderingEngineName);
|
||||||
}
|
}
|
||||||
Map<String, Serializable> params = new ThumbnailRenditionConvertor().convert(transformationOptions, null);
|
Map<String, Serializable> params = thumbnailRegistry.getThumbnailRenditionConvertor().convert(transformationOptions, null);
|
||||||
for (String key : params.keySet())
|
for (String key : params.keySet())
|
||||||
{
|
{
|
||||||
rendDefn.setParameterValue(key, params.get(key));
|
rendDefn.setParameterValue(key, params.get(key));
|
||||||
|
@@ -114,6 +114,13 @@ public class ThumbnailServiceImplParameterTest
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
thumbs.setRenditionService(renditionService);
|
thumbs.setRenditionService(renditionService);
|
||||||
|
thumbs.setThumbnailRegistry(new ThumbnailRegistry() {
|
||||||
|
@Override
|
||||||
|
public ThumbnailRenditionConvertor getThumbnailRenditionConvertor()
|
||||||
|
{
|
||||||
|
return new ThumbnailRenditionConvertor();
|
||||||
|
}
|
||||||
|
});
|
||||||
thumbnailService = thumbs;
|
thumbnailService = thumbs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user