Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
Labs 3D3.0Design DiscussionsSite ServiceDraft PagesJavaScript APIActivities ServiceTagging ServiceThumbnail Service
This page describes the JavaScript Services API for Alfresco Enterprise 3.0.X and Alfresco Labs 3D. See also JavaScript API 3.0
A site is a collaborative area for a unit of work or a project.
This section describes the methods available for the Site Service. The methods are grouped into the following object types:
The following sections describe the available methods.
This method creates a new site.
createSite(sitePreset, shortName, title, description, visibility);
Parameters: | |
---|---|
sitePreset | The site preset. |
shortName | The site short name. The site short name will be used to identify the site, so it must be unique. |
title | A title for the site. |
description | A description for the site. |
visibility | The visibility of the site. (PUBLIC|PRIVATE|MODIFIED) |
Return values: | |
---|---|
Site | The created site. |
createSite(sitePreset, shortName, title, description, isPublic)
This method lists the sites that are available in the repository. The returned list can optionally be filtered by name and site.
listSites(nameFilter, sitePresetFilter)
Parameters: | |
---|---|
nameFilter | The name of the filter. |
sitePresetFilter | The site preset filter. |
Return values: | |
---|---|
List<Site> | A list of the site filtered, as appropriate. If no filters are specified then all the available sites are returned. |
This method gets a site for a provided short name.
getSite(shortName)
Parameters: | |
---|---|
shortName | The short name of the site. |
Return values: | |
---|---|
Site | The site. This is null if the sire does not exist. |
This method lists the roles for a site.
listSiteRoles()
The following list shows the properties for site:
This method saves any outstanding updates to the site details. If properties of the site are changed and the save method is not called, those changes will be lost.
save()
This method deletes the site.
deleteSite()
This method gets a map of members of the site with their role within the site. This list can be filtered by name and/or role.
listMembers(nameFilter, roleFilter)
Parameters: | |
---|---|
nameFilter | The user name filter. |
roleFilter | The user role filter. |
Return values: | |
---|---|
Map<String, String> | The list of members of a site with their roles. If no name or role filter is specified, all members of the site are listed. |
This method gets a user's role on this site.
getMembersRole(userName)
Parameters: | |
---|---|
userName | The user's name. |
Return values: | |
---|---|
String | The user's role. If the user is not a member of the site then null is returned. |
This method indicates whether a user is a member of the site.
isMember(userName)
Parameters: | |
---|---|
userName | The user's name. |
Return values: | |
---|---|
boolean value | This is a boolean value that is true if the user is a member of the site, or false if otherwise. |
This method sets the membership details for a user. If the user is not already a member of the site, then they are added with the role given. If the user is already a member of the site, then their role is updated to the new role. Only a site manager can modify memberships and there must be at least one site manager at all times.
setMembership(userName, role)
Parameters: | |
---|---|
userName | The user's name. |
role | The role for the user. |
Return values: | |
---|---|
role | The site role. |
This method removes a user's membership of the site. Only a site manager can remove a user's membership and the last site manager can not be removed.
removeMembership(userName)
Parameters: | |
---|---|
userName | The user's name. |
This method gets (or creates) the container folder for the specified component id. NOTE: The container is of type cm:folder.
ScriptNode getContainer(String componentId)
Parameters: | |
---|---|
componentId | The component identifier. |
Return values: | |
---|---|
node | The container folder. |
This method gets (or creates) the container folder for the specified component id. NOTE: The type of container is either the one specified by the caller (which must be cm:folder or a sub-type of), or cm:folder, if a type is not specified at all.
public ScriptNode getContainer(String componentId, String folderType)
Parameters: | |
---|---|
componentId | The component identifier. |
folderType | The type of folder to create. If this is null, it creates a standard folder. |
Return values: | |
---|---|
node | The name of the container folder. This is null if the container cannot be created. |
This method determines if the container folder for the specified component exists.
hasContainer(String componentId)
Parameters: | |
---|---|
componentId | The component identifier. |
Return values: | |
---|---|
boolean value | If this is true, the container folder exists. |
This method resets any permissions that have been set on the node. All permissions will be deleted and the node set to inherit permissions.
resetAllPermissions(node)
This method allows all members of the site collaboration rights on the node.
allowAllMembersCollaborate(node)
This method denies access to all members of the site to the node. Note: site managers will still have appropriate permissions on the node.
denyAllAccess(node)
Activities refer to the updates to content within a site, including the uploaded files, blogs, discussions, calendars, and the team wiki.
This section describes the methods available for the Activities Service. The methods are grouped into the following object types:
Note: siteId is currently required in order to get site members (and to apply feed controls).
Note: appToolId is optional, although recommended (to enable feed controls to applied to a specific type of appTool).
The following sections describe the overloaded methods for post activity.
This method posts a custom activity type.
postActivity(String activityType, String siteId, String appTool, String jsonActivityData)
Parameters: | |
---|---|
activityType | This is a required parameter. |
siteId | This is a required parameter. |
appToolId | This is an optional parameter. If it is set, then the feed controls can be applied. |
jsonActivityData | This is a required parameter. |
This method posts a predefined activity type. Activity data will be looked-up asynchronously, including:
postActivity(String activityType, String siteId, String appTool, NodeRef nodeRef)
Parameters: | |
---|---|
activityType | This is a required parameter. |
siteId | This is a required parameter. |
appToolId | This is an optional parameter. If it is set, then the feed controls can be applied. |
nodeRef | This is a required parameter. Do not use this parameter for deleted (or about to be deleted) nodeRef. |
This method posts a predefined activity type, for example, for checked-out nodeRef or renamed nodeRef.
postActivity(String activityType, String siteId, String appTool, NodeRef nodeRef, String beforeName)
Parameters: | |
---|---|
activityType | This is a required parameter. |
siteId | This is a required parameter. |
appToolId | This is an optional parameter. If it is set, then the feed controls can be applied. |
nodeRef | This is a required parameter. Do not use this parameter for a deleted (or about to be deleted) nodeRef. |
beforeName | This is an optional parameter. The name of the node prior to the name change. |
This method posts a predefined activity, for example, for the deleted nodeRef.
postActivity(String activityType, String siteId, String appTool, NodeRef nodeRef, String name, QName typeQName,
NodeRef parentNodeRef)
Parameters: | |
---|---|
activityType | This is a required parameter. |
siteId | This is a required parameter. |
appToolId | This is an optional parameter. If it is set, then the feed controls can be applied. |
nodeRef | This is a required parameter. Do not use this parameter for deleted (or about to be deleted) nodeRef. |
name | This is an optional parameter. The name of name. |
typeQName | This is an optional parameter. The type of node. |
parentNodeRef | This is a required parameter. This is used to lookup path/displayPath. |
The following sections describe the methods for feed controls.
This method sets the feed control (opt-out) for a site, an appTool, or a site/appTool combination for the current user.
setFeedControl(String siteId, String appToolId)
Parameters: | |
---|---|
siteId | This is a required parameter but is optional if the appToolId is supplied. |
appToolId | This is a required parameter but is optional if the siteId is supplied. |
This method gets the feed control for the current user.
FeedControl[] getFeedControls()
FeedControl returns an array of user feed controls.
This method unsets the feed control for the current user.
unsetFeedControl(String siteId, String appTool)
Parameters: | |
---|---|
siteId | This is a required parameter but is optional if the appToolId is supplied. |
appToolId | This is a required parameter but is optional if the siteId is supplied. |
A tag is a non-hierarchical keyword or term assigned to a piece of information.
This section describes the methods available for the Tagging Service. The methods are grouped into the following object types:
The following are extensions to the existing JavaScript_API.
The following section describes the getTags method for the tagging service.
function getTags();
The following properties are available for tag scope:
The following sections describe the methods for tag scope.
This method gets the top N tags ordered by count.
getTopTags(topN);
Parameters: | |
---|---|
topN | The number of top tags to return. |
Return values: | |
---|---|
TagDetails[] | The top N tag details ordered by count. |
This method gets the count of a tag.
getCount(tag);
Parameters: | |
---|---|
tag | The tag name. |
Return values: | |
---|---|
int | The tag count. This is zero if the tag is not present. |
This method refreshes the tag scope.
refresh();
The following properties are available for TagDetails:
The following properties are extensions to the existing Script Node:
The following sections describe the additional methods for Script Node.
This method clears the node's tags.
clearTags()
This method adds a tag to the node.
addTag(tag)
Parameters: | |
---|---|
tag | The tag name. |
This method adds all the tags to the node.
addTags(tags)
Parameters: | |
---|---|
tags | An array of tag names. |
This method removes a tag from the node.
removeTag(tag)
Parameters: | |
---|---|
tag | The tag name. |
This method removes all the tags from the node.
removeTags(tags)
Parameters | |
---|---|
tags | An array of tag names. |
This method gets all the (deep) children of this node that have the tag specified.
childrenByTag(tag)
Parameters: | |
---|---|
tag | The tag name. |
Return values: | |
---|---|
ScriptNode | The nodes that are the deep children of the node with the tag. |
The following sections describe the additional methods for the Search API.
This method searches the store for all nodes with the given tag applied.
tagSearch(store, tag)
Parameters: | |||
---|---|---|---|
store | The store reference string. The default is used if null is provided. | tag | The tag name. |
Return values: | |
---|---|
ScriptNode | The nodes with the tag applied. |
A thumbnail is a small image that provides a preview of the file without opening it. This section describes the methods available for the Thumbnail Service.
The methods are grouped into the following object types:
The following are extensions to the existing JavaScript_API:
The following methods describe the methods for the thumbnail service.
This method indicates whether a given thumbnail name has been registered.
isThumbnailNameRegistered(thumbnailName)
Parameters: | |
---|---|
thumbnailName | The thumbnail name. |
Return values: | |
---|---|
boolean value | This is true if the thumbnail name is registered, otherwise it is false. |
This method gets the resource path for the place holder thumbnail for the given named thumbnail.
getPlaceHolderResourcePath(thumbnailName)
Parameters: | |
---|---|
thumbnailName | The thumbnail name. |
Return values: | |
---|---|
String | The place holder thumbnail resource path. This is null if it is not set. |
The following sections describe the additional methods to the existing Script Node.
This method creates a thumbnail based on the definition registered for the thumbnail name provided.
createThumbnail(thumbnailName, async)
Parameters: | |
---|---|
thumbnailName | The thumbnail name. If the thumbnail name has not been registered, there will be an error. |
async | This is an optional parameter and is false by default. This parameter is true if the thumbnail was created asynchronously. Otherwise, it is false. When it is set to false, the method blocks until the thumbnail is created and the newly created thumbnail is returned. If it is set to true, the method queues the creation of the thumbnail asynchronously and immediately returns to the calling client with null. |
The return value for createThumbnail is the thumbnail script node if the async is false. Otherwise it is null.
This method gets the given thumbnail for the content property.
getThumbnail(thumbnailName)
Parameters: | |
---|---|
thumbnailName | The thumbnail name. |
Return values: | |
---|---|
ScriptThumbnail | The thumbnail. |
This method gets all the thumbnails for a given node's content property.
getThumbnails()
Return values: | |
---|---|
ScriptThumbnail | A list of thumbnails. This is empty if none are available. |
This method returns the names of the thumbnail definitions that can be applied to the content property of this node. Thumbnail definitions only appear in this list if they can produce a thumbnail for the content found in the content property. This will be determined by looking at the mimetype of the content and the destination mimetype of the thumbnail.
getThumbnailDefintions()
Return values: | |
---|---|
String | An array of thumbnail names that are valid for the current content type. |
The thumbnail object extends the standard ScriptNode and represents a thumbnail object.
updateThumbnail()
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.