JavaScript API提供了许多可从JavaScript代码中直接使用的根对象。
根对象具有各种类型,具体取决于它们公开的系统部分。例如,公共存储库概念(例如Company Home文件夹和登录用户)通过类型对象表示ScriptNode。这些对象支持全方位的属性和面向对象的APIScriptNode 类。
根据调用脚本的上下文,可以使用其他类型的根对象来表示系统的各个方面,例如服务器详细信息,用户信息,请求标头和传递给脚本的参数。此外,您可以从JavaScript代码访问各种服务,每个服务都有一个相应的根对象,可以在其上访问属性,并根据服务的API指定各种方法。
另请参阅Web脚本参考指南,其中更详细地介绍了根对象。
JavaScript代码可用的根对象取决于调用代码的上下文。不同的上下文可以访问不同的根对象集。有几种情况需要考虑:
- Web scripts
- Surf
- Rules/actions
- Workflow
- Share
本文介绍最常用的根对象。更专业的根对象在本文档的相关部分中有更详细的描述。
简单的根对象
下表列出了不公开API但由简单数据结构或类型组成的根对象:
Root Object | Type in Script Runtime | Description |
---|---|---|
guest | Boolean | True if the user is logged in as a guest |
server | Object | Server details |
model | Object | Used to pass a model from the control script to the view renderer (template). Web scripts only. |
暴露ScriptNode对象的根对象
下表列出了公开ScriptNode对象的根对象:
Root Object | Type in Script Runtime | Description |
---|---|---|
companyhome | org.alfresco.repo.jscript.ScriptNode | The company home ScriptNode. See ScriptNode API for properties and methods. |
document | org.alfresco.repo.jscript.ScriptNode | The current node ScriptNode (if any) |
person | org.alfresco.repo.jscript.ScriptNode | The ScriptNode representing the Person object of the currently authenticated user. See ScriptNode API for properties and methods. |
roothome | org.alfresco.repo.jscript.ScriptNode | The store root ScriptNode. The repository root folder. See ScriptNode API for properties and methods. |
script | org.alfresco.repo.jscript.ScriptNode | The ScriptNode representing the script object itself. This is only available if the script is loaded from the Java classpath. |
space | org.alfresco.repo.jscript.ScriptNode | The primary parent ScriptNode for the current node (ScriptNode). For a script executing from a rule, the space object is the space in which the rule resides. If the rule is inherited, this might not be the expected space. |
userhome | org.alfresco.repo.jscript.ScriptNode | The current user’s Home Space ScriptNode. See ScriptNode API for properties and methods. |
可在Web脚本中使用的根对象
下表列出了脚本作为Web脚本运行时可用的根对象。有关这些根对象的其他信息,请参阅Web脚本介绍。
Root Object | Type in Script Runtime | Description |
---|---|---|
args | List | List of arguments passed to the script |
argsM | List | List of arguments passed to the script |
cache | Object | Object containing cache information |
headers | List | List of headers passed to the script |
headersM | List | List of headers passed to the script |
session | Object | Object containing session information for the user connection |
url | Object | Object containing information about the URL used to invoke web script |
公开其他API的根对象
下表列出了公开其他API的根对象:
根对象 | 运行时类型 | 描述 |
---|---|---|
actions | org.alfresco.repo.jscript.Actions | Root object providing invocation of registered actions |
activities | org.alfresco.repo.activities.script.Activity | Root object providing access to the Alfresco Process Services API. |
appUtils | org.alfresco.repo.jscript.ApplicationScriptUtils | Root object providing access to methods specifically for external application use |
bulkFSImport | org.alfresco.repo.bulkimport.script.BulkImport | Bulk Import object |
classification | org.alfresco.repo.jscript.Classification | Access to the root elements of the Classification API |
cmis | org.alfresco.repo.cmis.client.CMISLocalConnectionManagerImpl | CMIS client |
cmisServer | org.alfresco.repo.cmis.rest.CMISScript | CMIS server REST access |
crossRepoCopy | org.alfresco.repo.jscript.CrossRepositoryCopy | Cross repository copy support. |
imap | org.alfresco.repo.jscript.Imap | Root object providing access to IMAP methods for mailbox support |
format | org.springframework.extensions.webscripts.FormatModel | Format model |
jsonUtils | org.springframework.extensions.webscripts.json.JSONUtils | JSON utilities. Web scripts only. |
logger | org.alfresco.repo.jscript.ScriptLogger | Root object providing access to console logging facilities for script debugging |
msg | org.springframework.extensions.webscripts.ScriptMessage | Web scripts only |
paging | org.alfresco.repo.web.util.paging.Paging | Paging API. web scripts only. |
people | org.alfresco.repo.jscript.People | Root object providing access to and manipulation of person objects and groups |
presence | org.alfresco.repo.jscript.Presence | Root object providing access to methods for detecting online presence of users |
search | org.alfresco.repo.jscript.Search | Root object providing access to the various Alfresco Content Services search interfaces such as FTS-Alfresco, Lucene, XPath, and Saved Search results |
session | org.alfresco.repo.jscript.Session | Session-related information such as the current authentication ticket |
slingshotDocLib | org.alfresco.repo.jscript.SlingshotDocLibCustomResponse | Slingshot |
stringUtils | org.springframework.extensions.webscripts.ScriptableUtils | String utilities |
test | org.alfresco.repo.jscript.ScriptTestUtils | Root object providing access to test utilities |
utils | org.alfresco.repo.jscript.ScriptUtils | Root object providing access to a library of helper functions that are not provided as part of generic JavaScript |
workflow | org.alfresco.repo.workflow.jscript.WorkflowManager | Root object providing access to the workflow service. |
公开服务的根对象
下表列出了公开服务的根对象:
根对象 | 运行时类型 | 描述 |
---|---|---|
actionTrackingService | org.alfresco.repo.action.script.ActionTrackingService | Root of the Action Tracking Service |
atom | org.springframework.extensions.webscripts.atom.atomService | Atom service |
commentService | org.alfresco.repo.web.scripts.comment.ScriptCommentService | Root of the Comment Service |
formService | org.alfresco.repo.forms.script.ScriptFormService | Root of the Form Service |
groups | org.alfresco.repo.security.authority.script.ScriptAuthorityService | Root of the Group authorities providing access to advanced authority APIs for manipulating groups and zones. |
invitations | org.alfresco.repo.invitation.script.ScriptInvitationService | Root of the Invitations API providing access to invitations for web sites. |
preferenceService | org.alfresco.repo.preference.script.ScriptPreferenceService | Root of the Preference Service |
ratingService | org.alfresco.repo.rating.script.ScriptRatingService | Root of the Rating Service |
renditionService | org.alfresco.repo.rendition.script.ScriptRenditionService | Root of the Rendition Service |
replicationService | org.alfresco.repo.replication.script.ScriptReplicationService | Root of the Replication Service |
siteService | org.alfresco.repo.site.script.ScriptSiteService | The root of sites service providing access to the sites service. |
taggingService | org.alfresco.repo.Tagging.script.ScriptTaggingService | Root of the Tagging Service |
thumbnailService | org.alfresco.repo.thumbnail.script.ScriptThumbnailService | Root of the Thumbnail Service |
transfer | org.alfresco.repo.transfer.script.ScriptTransferService | The root of transfer service providing access to the transfer service. |
文档更新时间: 2019-01-09 14:43 作者:凌云文档