Search in sources :

Example 1 with RenderingEngineDefinition

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));
}
Also used : RenderingEngineDefinition(org.alfresco.service.cmr.rendition.RenderingEngineDefinition) ActionDefinitionImpl(org.alfresco.repo.action.ActionDefinitionImpl) ActionDefinition(org.alfresco.service.cmr.action.ActionDefinition) LinkedList(java.util.LinkedList)

Example 2 with RenderingEngineDefinition

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);
}
Also used : RenderingEngineDefinition(org.alfresco.service.cmr.rendition.RenderingEngineDefinition) QName(org.alfresco.service.namespace.QName) RenditionDefinition(org.alfresco.service.cmr.rendition.RenditionDefinition)

Example 3 with RenderingEngineDefinition

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;
}
Also used : RenderingEngineDefinition(org.alfresco.service.cmr.rendition.RenderingEngineDefinition) ArrayList(java.util.ArrayList) ActionDefinition(org.alfresco.service.cmr.action.ActionDefinition)

Example 4 with RenderingEngineDefinition

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());
}
Also used : RenderingEngineDefinition(org.alfresco.service.cmr.rendition.RenderingEngineDefinition)

Aggregations

RenderingEngineDefinition (org.alfresco.service.cmr.rendition.RenderingEngineDefinition)4 ActionDefinition (org.alfresco.service.cmr.action.ActionDefinition)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 ActionDefinitionImpl (org.alfresco.repo.action.ActionDefinitionImpl)1 RenditionDefinition (org.alfresco.service.cmr.rendition.RenditionDefinition)1 QName (org.alfresco.service.namespace.QName)1