use of org.alfresco.service.cmr.rendition.RenderingEngineDefinition in project alfresco-repository by Alfresco.
the class RenditionServiceImplTest method testGetRenderingEngineDefinitions.
public void testGetRenderingEngineDefinitions() throws Exception {
LinkedList<ActionDefinition> actionDefs = new LinkedList<ActionDefinition>();
when(actionService.getActionDefinitions()).thenReturn(actionDefs);
// Check case where no action definitions returned.
List<RenderingEngineDefinition> engineDefs = renditionService.getRenderingEngineDefinitions();
assertTrue("The list of rendering action definitions should be empty!", engineDefs.isEmpty());
// Check that when the action service returns a rendering engine
// definition then the rendering service includes this in the list of
// returned values.
ActionDefinition renderingDefinition = new RenderingEngineDefinitionImpl(ENGINE_NAME);
actionDefs.add(renderingDefinition);
engineDefs = renditionService.getRenderingEngineDefinitions();
assertEquals(1, engineDefs.size());
assertSame(renderingDefinition, engineDefs.get(0));
assertNotNull(renditionService.loadRenditionDefinitions(ENGINE_NAME));
// Check that when the action service returns a non-rendering action
// definition then the rendering service does not include it.
ActionDefinition actionDefinition = new ActionDefinitionImpl(ENGINE_NAME);
actionDefs.add(actionDefinition);
engineDefs = renditionService.getRenderingEngineDefinitions();
assertEquals(1, engineDefs.size());
assertSame(renderingDefinition, engineDefs.get(0));
}
use of org.alfresco.service.cmr.rendition.RenderingEngineDefinition in project alfresco-repository by Alfresco.
the class ScriptRenditionService method createRenditionDefinition.
/**
* Creates a new {@link ScriptRenditionDefinition} and sets the rendition name and
* the rendering engine name to the specified values.
*
* @param renditionName A unique identifier used to specify the created
* {@link ScriptRenditionDefinition}.
* @param renderingEngineName The name of the rendering engine associated
* with this {@link ScriptRenditionDefinition}.
* @return the created {@link ScriptRenditionDefinition}.
* @see org.alfresco.service.cmr.rendition.RenditionService#createRenditionDefinition(QName, String)
*/
public ScriptRenditionDefinition createRenditionDefinition(String renditionName, String renderingEngineName) {
QName renditionQName = createQName(renditionName);
if (logger.isDebugEnabled()) {
StringBuilder msg = new StringBuilder();
msg.append("Creating ScriptRenditionDefinition [").append(renditionName).append(", ").append(renderingEngineName).append("]");
logger.debug(msg.toString());
}
RenderingEngineDefinition engineDefinition = renditionService.getRenderingEngineDefinition(renderingEngineName);
RenditionDefinition rendDef = renditionService.createRenditionDefinition(renditionQName, renderingEngineName);
return new ScriptRenditionDefinition(serviceRegistry, this.getScope(), engineDefinition, rendDef);
}
use of org.alfresco.service.cmr.rendition.RenderingEngineDefinition in project alfresco-repository by Alfresco.
the class RenditionServiceImpl method getRenderingEngineDefinitions.
/*
* (non-Javadoc)
* @see org.alfresco.service.cmr.rendition.RenditionService#getRenderingEngineDefinitions()
*/
public List<RenderingEngineDefinition> getRenderingEngineDefinitions() {
List<RenderingEngineDefinition> results = new ArrayList<RenderingEngineDefinition>();
List<ActionDefinition> actionDefs = actionService.getActionDefinitions();
for (ActionDefinition actionDef : actionDefs) {
if (actionDef instanceof RenderingEngineDefinition) {
RenderingEngineDefinition renderingDef = (RenderingEngineDefinition) actionDef;
results.add(renderingDef);
}
}
return results;
}
use of org.alfresco.service.cmr.rendition.RenderingEngineDefinition in project alfresco-repository by Alfresco.
the class RenditionServiceIntegrationTest method validateRenderingActionDefinition.
private void validateRenderingActionDefinition(final String renderingEngineName) {
// Make sure we can get the action definition.
RenderingEngineDefinition renderingActionDefn = renditionService.getRenderingEngineDefinition(renderingEngineName);
assertNotNull("renderingActionDefn was null", renderingActionDefn);
assertEquals("Incorrect renderingActionDefn name", renderingEngineName, renderingActionDefn.getName());
}
Aggregations