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(org.alfresco.service.cmr.repository.NodeRef person,
org.alfresco.service.cmr.repository.NodeRef companyHome,
org.alfresco.service.cmr.repository.NodeRef userHome,
org.alfresco.service.cmr.repository.NodeRef script,
org.alfresco.service.cmr.repository.NodeRef document,
org.alfresco.service.cmr.repository.NodeRef space)
Create the default data-model available to scripts as global scope level objects:
|
protected Object |
execute(ScriptProcessor processor,
org.alfresco.service.cmr.repository.NodeRef scriptRef,
org.alfresco.service.namespace.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(org.alfresco.service.cmr.repository.NodeRef scriptRef,
org.alfresco.service.namespace.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,
org.alfresco.service.cmr.repository.NodeRef scriptRef,
org.alfresco.service.namespace.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(org.alfresco.service.cmr.repository.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(org.alfresco.service.cmr.repository.NodeService nodeService)
Set the node service
|
void |
setSysAdminParams(SysAdminParams sysAdminParams)
Set the sysAdminParams
|
protected org.alfresco.scripts.ScriptException |
translateProcessingException(String scriptInfo,
Throwable err) |
public void setDefaultScriptProcessor(String defaultScriptProcessor)
defaultScriptProcessor
- the name of the default script processorpublic void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
nodeService
- the node servicepublic void setSysAdminParams(SysAdminParams sysAdminParams)
sysAdminParams
- the sysAdminParamspublic void registerScriptProcessor(ScriptProcessor scriptProcessor)
registerScriptProcessor
in interface ScriptService
scriptProcessor
- the script processor to register with the script servicepublic void resetScriptProcessors()
resetScriptProcessors
in interface ScriptService
public Object executeScript(String scriptClasspath, Map<String,Object> model) throws org.alfresco.scripts.ScriptException
ScriptService
executeScript
in interface ScriptService
scriptClasspath
- Script location as qualified classpath namemodel
- Object model to process script againstorg.alfresco.scripts.ScriptException
ScriptService.executeScript(java.lang.String, java.util.Map)
public Object executeScript(String engine, String scriptClasspath, Map<String,Object> model) throws org.alfresco.scripts.ScriptException
ScriptService
executeScript
in interface ScriptService
engine
- the script engine to usescriptClasspath
- Script location as qualified classpath namemodel
- Object model to process script againstorg.alfresco.scripts.ScriptException
ScriptService.executeScript(java.lang.String, java.lang.String, java.util.Map)
public Object executeScript(org.alfresco.service.cmr.repository.NodeRef scriptRef, org.alfresco.service.namespace.QName contentProp, Map<String,Object> model) throws org.alfresco.scripts.ScriptException
ScriptService
executeScript
in interface ScriptService
scriptRef
- 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 againstorg.alfresco.scripts.ScriptException
ScriptService.executeScript(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Map)
public Object executeScript(String engine, org.alfresco.service.cmr.repository.NodeRef scriptRef, org.alfresco.service.namespace.QName contentProp, Map<String,Object> model) throws org.alfresco.scripts.ScriptException
ScriptService
executeScript
in interface ScriptService
engine
- 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 againstorg.alfresco.scripts.ScriptException
ScriptService.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 org.alfresco.scripts.ScriptException
ScriptService
executeScript
in interface ScriptService
location
- object representing the script locationmodel
- Object model to process script againstorg.alfresco.scripts.ScriptException
ScriptService.executeScript(org.alfresco.service.cmr.repository.ScriptLocation, java.util.Map)
public Object executeScript(String engine, ScriptLocation location, Map<String,Object> model) throws org.alfresco.scripts.ScriptException
ScriptService
executeScript
in interface ScriptService
engine
- the script engine to uselocation
- object representing the script locationmodel
- Object model to process script againstorg.alfresco.scripts.ScriptException
ScriptService.executeScript(java.lang.String, org.alfresco.service.cmr.repository.ScriptLocation, java.util.Map)
public Object executeScriptString(String script, Map<String,Object> model) throws org.alfresco.scripts.ScriptException
ScriptService
executeScriptString
in interface ScriptService
script
- Script content as a String.model
- Object model to process script againstorg.alfresco.scripts.ScriptException
ScriptService.executeScriptString(java.lang.String, java.util.Map)
public Object executeScriptString(String engine, String script, Map<String,Object> model) throws org.alfresco.scripts.ScriptException
ScriptService
executeScriptString
in interface ScriptService
engine
- the script engine to usescript
- Script content as a String.model
- Object model to process script againstorg.alfresco.scripts.ScriptException
ScriptService.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, org.alfresco.service.cmr.repository.NodeRef scriptRef, org.alfresco.service.namespace.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 org.alfresco.scripts.ScriptException translateProcessingException(String scriptInfo, Throwable err)
protected ScriptProcessor lookupScriptProcessor(String name)
name
- the name of the script processorprotected ScriptProcessor getScriptProcessor(org.alfresco.service.cmr.repository.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)
ScriptService
buildCoreModel
in interface ScriptService
inputMap
- initial Map of global scope scriptable Node objectsScriptService.buildCoreModel(java.util.Map)
public Map<String,Object> buildDefaultModel(org.alfresco.service.cmr.repository.NodeRef person, org.alfresco.service.cmr.repository.NodeRef companyHome, org.alfresco.service.cmr.repository.NodeRef userHome, org.alfresco.service.cmr.repository.NodeRef script, org.alfresco.service.cmr.repository.NodeRef document, org.alfresco.service.cmr.repository.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 ScriptService
person
- 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–2017 Alfresco Software. All rights reserved.