mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RenditionService JS API.
Support for creating a RenditionDefinition from within JavaScript Support for executing such an ad hoc rendition definition. ScriptRendtionService now accepts long-form or short-form QNames where applicable. Replaced "rendering actions" with "rendition definitions" in some javadoc and some private or local variable names. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19269 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -19,27 +19,39 @@
|
||||
package org.alfresco.repo.rendition.script;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.jscript.ScriptAction;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.rendition.RenderingEngineDefinition;
|
||||
import org.alfresco.service.cmr.rendition.RenditionDefinition;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
|
||||
/**
|
||||
* RenditionDefinition JavaScript Object. This class is a JavaScript-friendly wrapper for
|
||||
* the {@link RenditionDefinition renditionDefinition} class.
|
||||
*
|
||||
* @author Neil McErlean
|
||||
* @see org.alfresco.service.cmr.rendition.RenditionDefinition
|
||||
*/
|
||||
public final class ScriptRenditionDefinition implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 8132935577891455490L;
|
||||
private final RenderingEngineDefinition engineDefinition;
|
||||
private final RenditionDefinition renditionDefinition;
|
||||
private final NamespaceService namespaceService;
|
||||
private final ServiceRegistry serviceRegistry;
|
||||
|
||||
private final ScriptAction scriptAction;
|
||||
|
||||
public ScriptRenditionDefinition(NamespaceService namespaceService, RenditionDefinition renditionDefinition)
|
||||
public ScriptRenditionDefinition(ServiceRegistry serviceRegistry, Scriptable scope,
|
||||
RenderingEngineDefinition engineDefinition, RenditionDefinition renditionDefinition)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.engineDefinition = engineDefinition;
|
||||
this.renditionDefinition = renditionDefinition;
|
||||
|
||||
this.scriptAction = new ScriptAction(serviceRegistry, renditionDefinition, engineDefinition);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +62,17 @@ public final class ScriptRenditionDefinition implements Serializable
|
||||
public String getRenditionName()
|
||||
{
|
||||
QName qname = this.renditionDefinition.getRenditionName();
|
||||
return qname.toPrefixString(namespaceService);
|
||||
return qname.toPrefixString(serviceRegistry.getNamespaceService());
|
||||
}
|
||||
|
||||
public String getRenderingEngineName()
|
||||
{
|
||||
return this.engineDefinition.getName();
|
||||
}
|
||||
|
||||
public Map<String, Serializable> getParameters()
|
||||
{
|
||||
return this.scriptAction.getParameters();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,4 +84,9 @@ public final class ScriptRenditionDefinition implements Serializable
|
||||
|
||||
return msg.toString();
|
||||
}
|
||||
|
||||
RenditionDefinition getRenditionDefinition()
|
||||
{
|
||||
return this.renditionDefinition;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user