public class ScriptServiceImpl extends Object implements ScriptService
| Constructor and Description |
|---|
ScriptServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildCoreModel(Map<String,Object> inputMap)
Add core data-model to provided Map
|
Map<String,Object> |
buildDefaultModel(NodeRef person,
NodeRef companyHome,
NodeRef userHome,
NodeRef script,
NodeRef document,
NodeRef space)
Create the default data-model available to scripts as global scope level objects:
|
protected Object |
execute(ScriptProcessor processor,
NodeRef scriptRef,
QName contentProp,
Map<String,Object> model)
Execute script
|
protected Object |
execute(ScriptProcessor processor,
ScriptLocation location,
Map<String,Object> model)
Execute script
|
protected Object |
execute(ScriptProcessor processor,
String location,
Map<String,Object> model)
Execute script
|
Object |
executeScript(NodeRef scriptRef,
QName contentProp,
Map<String,Object> model)
Process a script against the supplied data model.
|
Object |
executeScript(ScriptLocation location,
Map<String,Object> model)
Process a script against the supplied data model
Uses the most approparite script engine or the default if none found.
|
Object |
executeScript(String scriptClasspath,
Map<String,Object> model)
Process a script against the supplied data model.
|
Object |
executeScript(String engine,
NodeRef scriptRef,
QName contentProp,
Map<String,Object> model)
Process a script against the supplied data model.
|
Object |
executeScript(String engine,
ScriptLocation location,
Map<String,Object> model)
Process a script against the supplied data model.
|
Object |
executeScript(String engine,
String scriptClasspath,
Map<String,Object> model)
Process a script against the supplied data model.
|
Object |
executeScriptString(String script,
Map<String,Object> model)
Process a script against the supplied data model.
|
Object |
executeScriptString(String engine,
String script,
Map<String,Object> model)
Process a script against the supplied data model.
|
protected Object |
executeString(ScriptProcessor processor,
String script,
Map<String,Object> model)
Execute script string
|
protected ScriptProcessor |
getScriptProcessor(NodeRef scriptNode)
Gets a scipt processor based on the node reference of a script
|
protected ScriptProcessor |
getScriptProcessor(String scriptLocation)
Gets a script processor based on the script location string
|
protected ScriptProcessor |
getScriptProcessorImpl(String scriptFileName)
Gets a script processor based on the scripts file name
|
protected ScriptProcessor |
lookupScriptProcessor(String name)
Helper method to lookup the script processor based on a name
|
void |
registerScriptProcessor(ScriptProcessor scriptProcessor)
Register a script processor
|
void |
resetScriptProcessors()
Reset all registered script processors
|
void |
setDefaultScriptProcessor(String defaultScriptProcessor)
Sets the name of the default script processor
|
void |
setNodeService(NodeService nodeService)
Set the node service
|
void |
setSysAdminParams(SysAdminParams sysAdminParams)
Set the sysAdminParams
|
protected ScriptException |
translateProcessingException(String scriptInfo,
Throwable err) |
public void setDefaultScriptProcessor(String defaultScriptProcessor)
defaultScriptProcessor - the name of the default script processorpublic void setNodeService(NodeService nodeService)
nodeService - the node servicepublic void setSysAdminParams(SysAdminParams sysAdminParams)
sysAdminParams - the sysAdminParamspublic void registerScriptProcessor(ScriptProcessor scriptProcessor)
registerScriptProcessor in interface ScriptServicescriptProcessor - the script processor to register with the script servicepublic void resetScriptProcessors()
resetScriptProcessors in interface ScriptServicepublic Object executeScript(String scriptClasspath, Map<String,Object> model) throws ScriptException
ScriptServiceexecuteScript in interface ScriptServicescriptClasspath - Script location as qualified classpath namemodel - Object model to process script againstScriptExceptionScriptService.executeScript(java.lang.String, java.util.Map)public Object executeScript(String engine, String scriptClasspath, Map<String,Object> model) throws ScriptException
ScriptServiceexecuteScript in interface ScriptServiceengine - the script engine to usescriptClasspath - Script location as qualified classpath namemodel - Object model to process script againstScriptExceptionScriptService.executeScript(java.lang.String, java.lang.String, java.util.Map)public Object executeScript(NodeRef scriptRef, QName contentProp, Map<String,Object> model) throws ScriptException
ScriptServiceexecuteScript in interface ScriptServicescriptRef - Script NodeRef locationcontentProp - QName of the property on the node that contains the content, null can
be passed to indicate the default property of 'cm:content'model - Object model to process script againstScriptExceptionScriptService.executeScript(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Map)public Object executeScript(String engine, NodeRef scriptRef, QName contentProp, Map<String,Object> model) throws ScriptException
ScriptServiceexecuteScript in interface ScriptServiceengine - the script engine to usescriptRef - Script NodeRef locationcontentProp - QName of the property on the node that contains the content, null can
be passed to indicate the default property of 'cm:content'model - Object model to process script againstScriptExceptionScriptService.executeScript(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Map)public Object executeScript(ScriptLocation location, Map<String,Object> model) throws ScriptException
ScriptServiceexecuteScript in interface ScriptServicelocation - object representing the script locationmodel - Object model to process script againstScriptExceptionScriptService.executeScript(org.alfresco.service.cmr.repository.ScriptLocation, java.util.Map)public Object executeScript(String engine, ScriptLocation location, Map<String,Object> model) throws ScriptException
ScriptServiceexecuteScript in interface ScriptServiceengine - the script engine to uselocation - object representing the script locationmodel - Object model to process script againstScriptExceptionScriptService.executeScript(java.lang.String, org.alfresco.service.cmr.repository.ScriptLocation, java.util.Map)public Object executeScriptString(String script, Map<String,Object> model) throws ScriptException
ScriptServiceexecuteScriptString in interface ScriptServicescript - Script content as a String.model - Object model to process script againstScriptExceptionScriptService.executeScriptString(java.lang.String, java.util.Map)public Object executeScriptString(String engine, String script, Map<String,Object> model) throws ScriptException
ScriptServiceexecuteScriptString in interface ScriptServiceengine - the script engine to usescript - Script content as a String.model - Object model to process script againstScriptExceptionScriptService.executeScriptString(java.lang.String, java.util.Map)protected Object execute(ScriptProcessor processor, ScriptLocation location, Map<String,Object> model)
location - the location of the scriptmodel - context modelprotected Object execute(ScriptProcessor processor, NodeRef scriptRef, QName contentProp, Map<String,Object> model)
scriptRef - the script node referencecontentProp - the content property of the scriptmodel - the context modelprotected Object execute(ScriptProcessor processor, String location, Map<String,Object> model)
location - the classpath string locating the scriptmodel - the context modelprotected Object executeString(ScriptProcessor processor, String script, Map<String,Object> model)
script - the script stringmodel - the context modelprotected ScriptException translateProcessingException(String scriptInfo, Throwable err)
protected ScriptProcessor lookupScriptProcessor(String name)
name - the name of the script processorprotected ScriptProcessor getScriptProcessor(NodeRef scriptNode)
scriptNode - the node reference of the scriptprotected ScriptProcessor getScriptProcessor(String scriptLocation)
scriptLocation - the script locationprotected ScriptProcessor getScriptProcessorImpl(String scriptFileName)
scriptFileName - the scripts file namepublic void buildCoreModel(Map<String,Object> inputMap)
ScriptServicebuildCoreModel in interface ScriptServiceinputMap - initial Map of global scope scriptable Node objectsScriptService.buildCoreModel(java.util.Map)public Map<String,Object> buildDefaultModel(NodeRef person, NodeRef companyHome, NodeRef userHome, NodeRef script, NodeRef document, NodeRef space)
ScriptService
'companyhome' - the Company Home node
'userhome' - the current user home space node
'person' - the node representing the current user Person
'script' - the node representing the script itself (may not be available)
'document' - document context node (may not be available)
'space' - space context node (may not be available)
buildDefaultModel in interface ScriptServiceperson - The current user Person NodecompanyHome - The CompanyHome refuserHome - The User home space refscript - Optional ref to the script itselfdocument - Optional ref to a document Nodespace - Optional ref to a space NodeScriptService.buildDefaultModel(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)Copyright © 2005–2020 Alfresco Software. All rights reserved.