Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
3.3Site ServiceDraft PagesJavaScript APIActivities ServiceTagging ServiceThumbnail ServiceTransfer Service
This page describes the JavaScript Services API for Alfresco Enterprise 3.3.X and Alfresco Community 3.3.
See also 3.3 JavaScript API
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. |
Deprecated since version 3.2:
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 site 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)
Create new moderated invitation to this web site
ScriptInvitation inviteModerated(String inviteeComments, String inviteeUserName, String inviteeRole)
Create new nominated invitation to this web site for a user who may not already be an alfresco user.
public ScriptInvitation inviteNominated(String inviteeFirstName, String inviteeLastName, String inviteeEmail, String inviteeRole, String serverPath, String acceptUrl, String rejectUrl)
Create new nominated invitation to this web site
public ScriptInvitation inviteNominated(String inviteeUserName, String inviteeRole, String serverPath, String acceptUrl, String rejectUrl)
Get an invitation to this web site
public ScriptInvitation getInvitation(String invitationId)
list the outstanding invitations for this site
public ScriptInvitation[] listInvitations()
List the open invitations for this web site.
props specifies optional properties to be searched.
public ScriptInvitation[] listInvitations(Scriptable props)
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.
getThumbnailDefinitions()
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()
A rendition is an alternative representation of a content node. Renditions are derived from their source nodes and are usually updated automatically when their source node is updated. Thumbnails are a special case of renditions which are still available through the Thumbnail Service (see above). Other examples include content that has been transformed into other formats (MIME types), images that have been processed in some way or content which incorporates property values from the source node. This section describes the methods available for the Rendition Service.
The methods are grouped into the following object types:
The following methods describe the methods for the rendition service.
This method creates a new Rendition Definition with the specified rendition name and will use the specified rendering engine.
createRenditionDefinition(renditionName, renderingEngineName)
Parameters: | |
---|---|
renditionName | The rendition definition name. |
renderingEngineName | The rendering engine name. |
Return values: | |
---|---|
RenditionDefinition value | The newly created RenditionDefinition object. |
This method will use a rendition definition to produce a rendition from a given node.
render(sourceNode, renditionDefQName)
Parameters: | |
---|---|
sourceNode | The node for which a rendition should be created. |
renditionDefQName | The qname of the rendition definition to use. |
Return values: | |
---|---|
ScriptNode value | The new rendition object. |
These methods will retrieve existing renditions for a node.
getRenditions(node)
Parameters: | |
---|---|
node | The node whose renditions are requested. |
Return values: | |
---|---|
ScriptNode[] value | Any and all existing rendition objects for the specified node. |
getRenditions(node, mimeTypePrefix)
Parameters: | |
---|---|
node | The node whose renditions are requested. |
mimeTypePrefix | A filter to restrict the renditions returned to those whose MIME-type starts with the prefix. |
Return values: | |
---|---|
ScriptNode[] value | Any existing rendition objects for the specified node whose MIME-type starts with the given filter string. |
getRenditionsByName(node, renditionName)
Parameters: | |
---|---|
node | The node whose renditions are requested. |
renditionName | A filter to restrict the renditions returned to those with the given name. |
Return values: | |
---|---|
ScriptNode[] value | Any existing rendition objects for the specified node whose name matches renditionName. |
The ScriptRenditionDefinition extends from ScriptAction.
The following are extensions to the existing JavaScript_API for Script Actions:
This method returns the rendition definition name for the current rendition definition.
getRenditionName()
Return values: | |
---|---|
String value | The name of this rendition definition object. |
This method returns the rendering engine name used by the current rendition definition.
getRenderingEngineName()
Return values: | |
---|---|
String value | The name of the rendering engine used by the current rendition definition object. |
Script object representing the authority service. groups
Get the root groups, those without a parent group.
Parameters: |
---|
Return values: | |
---|---|
Array<ScriptGroup> | The root groups. (empty if there are no root groups) |
ScriptGroup[] getAllRootGroups()
Searches for root groups in the specified zone.
Parameters: | |
---|---|
zone | The zone to search in. |
Return values: | |
---|---|
Array<ScriptGroup> | The root groups. (empty if there are no root groups) |
ScriptGroup[] getAllRootGroupsInZone(String zone)
Get a group given its short name
Parameters: | |
---|---|
shortName | The short name of the group. |
Return values: | |
---|---|
ScriptGroup | The authority or null if it can't be found. |
ScriptGroup getGroup(String shortName)
Create a new root group
Parameters: | |
---|---|
shortName | The short name of the group. |
Return values: | |
---|---|
ScriptGroup | The authority or null if it can't be found. |
ScriptGroup createRootGroup(String shortName, String displayName)
Search for groups
Parameters: | |
---|---|
shortNameFilter | partial match on shortName (* and ?) work. If empty then matches everything. |
Return values: | |
---|---|
ScriptGroup[] | The groups matching the query |
ScriptGroup[] searchGroups(String shortNameFilter)
Parameters: | |
---|---|
shortNameFilter | partial match on shortName (* and ?) work. If empty then matches everything. |
zone | search in the specified zone? |
Return values: | |
---|---|
ScriptGroup[] | The groups matching the query |
ScriptGroup[] searchGroupsInZone(String shortNameFilter, string zone)
public class ScriptGroup implements Authority, Serializable
Delete this group
deleteGroup()
ScriptAuthorityType getAuthorityType()
String getShortName()
String getFullName()
Change the display name for this group. Need administrator permission to call this method to change a display name.
@param displayName
setDisplayName(String displayName)
public String getDisplayName()
Get the users contained within this group.
Return values: | |
---|---|
ScriptUser[] | The users contained within this group and its sub groups. |
ScriptUser[] getAllUsers()
Get all sub groups (all decendants)
Return values: | |
---|---|
ScriptGroup[] | The descenants of this group |
ScriptGroup[] getAllGroups()
Get child users of this group
ScriptUser[] getChildUsers()
Get child groups of this group
ScriptGroup[] getChildGroups()
Get the immediate parents of this group
Return values: | |
---|---|
ScriptGroup[] | The immediate parents of this group |
ScriptGroup[] getParentGroups()
Get all the parents of this group
Return values: | |
---|---|
ScriptGroup[] | All the parents of this group |
ScriptGroup[] getAllParentGroups()
Get all the children of this group, regardless of type
Return values: | |
---|---|
Authority[] | All the children of this group |
Authority[] getChildAuthorities()
Is this a root group?
boolean isRootGroup()
Is this an admin group?
Not yet implemented
boolean isAdminGroup()
Get the number of users contained within this group.
Return values: | |
---|---|
int | The number of users contained within this group. |
int getUserCount()
Get the number of child groups contained within this group.
Return values: | |
---|---|
int | The number of child groups contained within this group. |
int getGroupCount()
Create a new group as a child of this group.
Parameters: | |
---|---|
shortName | The short name of the group. |
displayName | The display name of the group. |
Return values: | |
---|---|
ScriptGroup | The new group. |
ScriptGroup createGroup(String shortName, String displayName)
Remove sub group from this group
Parameters: | |
---|---|
shortName | The short name of the group. |
removeGroup(String shortName)
Remove child user from this group
Parameters: | |
---|---|
shortName | The shortName of the user to remove from this group. |
removeUser(String shortName)
Add authority as a child of this group
Parameters: | |
---|---|
fullAuthorityName | the full name of the authority to add to this group. |
addAuthority(String fullAuthorityName)
Remove child Authority from this group
Parameters: | |
---|---|
fullAuthorityName | the full name of the authority to remove from this group. |
void removeAuthority(String fullAuthorityName)
The Script user is a USER authority exposed to the scripting API
ScriptAuthorityType getAuthorityType()
String getShortName()
String getFullName()
String getDisplayName()
The transfer service transfers nodes from one repository to another.
The following list shows the properties for a script transfer target:
;name:the unique name of the transfer target (read-only)
;description: the description (read-only)
;endpointHost: hostname (read-only)
;endpointProtocol: protocol http/https (read-only)
;endpointPort: port number (read-only)
Return values: | |
---|---|
ScriptTransferTarget | the targets |
ScriptTransferTarget[] getAllTransferTargets(groupName);
Parameters: | |
---|---|
groupName | The name of the transfer group. |
Return values: | |
---|---|
ScriptTransferTarget | the targets |
ScriptTransferTarget[] getTransferTargetsForGroup(groupName);
Transfers the set of nodes to the transfer target
Returns the transfer report node.
ScriptNode transfer(targetName, nodesToTransfer)
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.