public class ScriptServiceImpl extends java.lang.Object implements ScriptService
| Constructor and Description |
|---|
ScriptServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildCoreModel(java.util.Map inputMap)
Add core data-model to provided Map
|
java.util.Map |
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 java.lang.Object |
execute(ScriptProcessor processor,
org.alfresco.service.cmr.repository.NodeRef scriptRef,
org.alfresco.service.namespace.QName contentProp,
java.util.Map model)
Execute script
|
protected java.lang.Object |
execute(ScriptProcessor processor,
ScriptLocation location,
java.util.Map model)
Execute script
|
protected java.lang.Object |
execute(ScriptProcessor processor,
java.lang.String location,
java.util.Map model)
Execute script
|
java.lang.Object |
executeScript(org.alfresco.service.cmr.repository.NodeRef scriptRef,
org.alfresco.service.namespace.QName contentProp,
java.util.Map model)
Process a script against the supplied data model.
|
java.lang.Object |
executeScript(ScriptLocation location,
java.util.Map model)
Process a script against the supplied data model
Uses the most approparite script engine or the default if none found.
|
java.lang.Object |
executeScript(java.lang.String scriptClasspath,
java.util.Map model)
Process a script against the supplied data model.
|
java.lang.Object |
executeScript(java.lang.String engine,
org.alfresco.service.cmr.repository.NodeRef scriptRef,
org.alfresco.service.namespace.QName contentProp,
java.util.Map model)
Process a script against the supplied data model.
|
java.lang.Object |
executeScript(java.lang.String engine,
ScriptLocation location,
java.util.Map model)
Process a script against the supplied data model.
|
java.lang.Object |
executeScript(java.lang.String engine,
java.lang.String scriptClasspath,
java.util.Map model)
Process a script against the supplied data model.
|
java.lang.Object |
executeScriptString(java.lang.String script,
java.util.Map model)
Process a script against the supplied data model.
|
java.lang.Object |
executeScriptString(java.lang.String engine,
java.lang.String script,
java.util.Map model)
Process a script against the supplied data model.
|
protected java.lang.Object |
executeString(ScriptProcessor processor,
java.lang.String script,
java.util.Map 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(java.lang.String scriptLocation)
Gets a script processor based on the script location string
|
protected ScriptProcessor |
getScriptProcessorImpl(java.lang.String scriptFileName)
Gets a script processor based on the scripts file name
|
protected ScriptProcessor |
lookupScriptProcessor(java.lang.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(java.lang.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(java.lang.String scriptInfo,
java.lang.Throwable err) |
public void setDefaultScriptProcessor(java.lang.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 ScriptServicescriptProcessor - the script processor to register with the script servicepublic void resetScriptProcessors()
resetScriptProcessors in interface ScriptServicepublic java.lang.Object executeScript(java.lang.String scriptClasspath,
java.util.Map model)
throws org.alfresco.scripts.ScriptException
ScriptServiceexecuteScript in interface ScriptServicescriptClasspath - Script location as qualified classpath namemodel - Object model to process script againstorg.alfresco.scripts.ScriptExceptionScriptService.executeScript(java.lang.String, java.util.Map)public java.lang.Object executeScript(java.lang.String engine,
java.lang.String scriptClasspath,
java.util.Map model)
throws org.alfresco.scripts.ScriptException
ScriptServiceexecuteScript in interface ScriptServiceengine - the script engine to usescriptClasspath - Script location as qualified classpath namemodel - Object model to process script againstorg.alfresco.scripts.ScriptExceptionScriptService.executeScript(java.lang.String, java.lang.String, java.util.Map)public java.lang.Object executeScript(org.alfresco.service.cmr.repository.NodeRef scriptRef,
org.alfresco.service.namespace.QName contentProp,
java.util.Map model)
throws org.alfresco.scripts.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 againstorg.alfresco.scripts.ScriptExceptionScriptService.executeScript(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Map)public java.lang.Object executeScript(java.lang.String engine,
org.alfresco.service.cmr.repository.NodeRef scriptRef,
org.alfresco.service.namespace.QName contentProp,
java.util.Map model)
throws org.alfresco.scripts.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 againstorg.alfresco.scripts.ScriptExceptionScriptService.executeScript(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Map)public java.lang.Object executeScript(ScriptLocation location, java.util.Map model) throws org.alfresco.scripts.ScriptException
ScriptServiceexecuteScript in interface ScriptServicelocation - object representing the script locationmodel - Object model to process script againstorg.alfresco.scripts.ScriptExceptionScriptService.executeScript(org.alfresco.service.cmr.repository.ScriptLocation, java.util.Map)public java.lang.Object executeScript(java.lang.String engine,
ScriptLocation location,
java.util.Map model)
throws org.alfresco.scripts.ScriptException
ScriptServiceexecuteScript in interface ScriptServiceengine - the script engine to uselocation - object representing the script locationmodel - Object model to process script againstorg.alfresco.scripts.ScriptExceptionScriptService.executeScript(java.lang.String, org.alfresco.service.cmr.repository.ScriptLocation, java.util.Map)public java.lang.Object executeScriptString(java.lang.String script,
java.util.Map model)
throws org.alfresco.scripts.ScriptException
ScriptServiceexecuteScriptString in interface ScriptServicescript - Script content as a String.model - Object model to process script againstorg.alfresco.scripts.ScriptExceptionScriptService.executeScriptString(java.lang.String, java.util.Map)public java.lang.Object executeScriptString(java.lang.String engine,
java.lang.String script,
java.util.Map model)
throws org.alfresco.scripts.ScriptException
ScriptServiceexecuteScriptString in interface ScriptServiceengine - the script engine to usescript - Script content as a String.model - Object model to process script againstorg.alfresco.scripts.ScriptExceptionScriptService.executeScriptString(java.lang.String, java.util.Map)protected java.lang.Object execute(ScriptProcessor processor, ScriptLocation location, java.util.Map model)
location - the location of the scriptmodel - context modelprotected java.lang.Object execute(ScriptProcessor processor, org.alfresco.service.cmr.repository.NodeRef scriptRef, org.alfresco.service.namespace.QName contentProp, java.util.Map model)
scriptRef - the script node referencecontentProp - the content property of the scriptmodel - the context modelprotected java.lang.Object execute(ScriptProcessor processor, java.lang.String location, java.util.Map model)
location - the classpath string locating the scriptmodel - the context modelprotected java.lang.Object executeString(ScriptProcessor processor, java.lang.String script, java.util.Map model)
script - the script stringmodel - the context modelprotected org.alfresco.scripts.ScriptException translateProcessingException(java.lang.String scriptInfo,
java.lang.Throwable err)
protected ScriptProcessor lookupScriptProcessor(java.lang.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(java.lang.String scriptLocation)
scriptLocation - the script locationprotected ScriptProcessor getScriptProcessorImpl(java.lang.String scriptFileName)
scriptFileName - the scripts file namepublic void buildCoreModel(java.util.Map inputMap)
ScriptServicebuildCoreModel in interface ScriptServiceinputMap - initial Map of global scope scriptable Node objectsScriptService.buildCoreModel(java.util.Map)public java.util.Map 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 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 - 2010 Alfresco Software, Inc. All Rights Reserved.