org.alfresco.repo.site.script
Class ScriptSiteService

java.lang.Object
  extended by org.alfresco.repo.processor.BaseProcessorExtension
      extended by org.alfresco.repo.jscript.BaseScopableProcessorExtension
          extended by org.alfresco.repo.site.script.ScriptSiteService
All Implemented Interfaces:
org.alfresco.processor.ProcessorExtension, Scopeable

public class ScriptSiteService
extends BaseScopableProcessorExtension

Script object representing the site service.


Field Summary
static java.lang.String MODERATED_SITE
           
static java.lang.String PRIVATE_SITE
           
static java.lang.String PUBLIC_SITE
          Visibility helper constants
 
Constructor Summary
ScriptSiteService()
           
 
Method Summary
 void cleanSitePermissions(org.alfresco.service.cmr.repository.NodeRef targetNode)
          It removes permissions which pertain to sites other than the node's current site.
 void cleanSitePermissions(ScriptNode targetNode)
          This method cleans up the permissions on the specified node and all its primary children.
 Site createSite(java.lang.String sitePreset, java.lang.String shortName, java.lang.String title, java.lang.String description, boolean isPublic)
          Deprecated. as of version 3.2, replaced by ScriptSiteService.createSite(String, String, String, String, String)
 Site createSite(java.lang.String sitePreset, java.lang.String shortName, java.lang.String title, java.lang.String description, java.lang.String visibility)
          Create a new site.
 Site createSite(java.lang.String sitePreset, java.lang.String shortName, java.lang.String title, java.lang.String description, java.lang.String visibility, java.lang.String siteType)
          Create a new site.
 Site[] findSites(java.lang.String filter, java.lang.String sitePresetFilter, int size)
          Find (search) the sites available in the repository.
 Site getSite(java.lang.String shortName)
          Get a site for a provided site short name.
 Site[] getSites(java.lang.String filter, java.lang.String sitePresetFilter, int size)
          Retrieves the sites available in the repository.
 boolean hasCreateSitePermissions()
          This method checks if the currently authenticated user has permission to create sites.
 boolean isSiteManager(java.lang.String siteId)
          Determines if the current user is a manager of the given site.
 java.lang.String[] listSiteRoles()
          Returns an array of all the roles that can be assigned to a member of a site.
 java.lang.String[] listSiteRoles(java.lang.String shortName)
          Returns an array of all the roles that can be assigned to a member of a specific site.
 Site[] listSites(java.lang.String filter, java.lang.String sitePresetFilter)
          List the sites available in the repository.
 Site[] listSites(java.lang.String filter, java.lang.String sitePresetFilter, int size)
          List the sites available in the repository.
 Site[] listUserSites(java.lang.String userName)
          List all the sites that the specified user has an explicit membership to.
 Site[] listUserSites(java.lang.String userName, int size)
          List all the sites that the specified user has an explicit membership to.
protected  Site[] makeSitesArray(java.util.List siteInfos)
          Converts the given List of SiteInfo objects to a JavaScript friendly array of Site objects.
 void setServiceRegistry(ServiceRegistry serviceRegistry)
          Sets the Service Registry
 void setSiteService(SiteService siteService)
          Set the site service
 
Methods inherited from class org.alfresco.repo.jscript.BaseScopableProcessorExtension
getScope, setScope
 
Methods inherited from class org.alfresco.repo.processor.BaseProcessorExtension
getExtensionName, register, setExtensionName, setProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUBLIC_SITE

public static final java.lang.String PUBLIC_SITE
Visibility helper constants

See Also:
Constant Field Values

MODERATED_SITE

public static final java.lang.String MODERATED_SITE
See Also:
Constant Field Values

PRIVATE_SITE

public static final java.lang.String PRIVATE_SITE
See Also:
Constant Field Values
Constructor Detail

ScriptSiteService

public ScriptSiteService()
Method Detail

setServiceRegistry

public void setServiceRegistry(ServiceRegistry serviceRegistry)
Sets the Service Registry

Parameters:
serviceRegistry -

setSiteService

public void setSiteService(SiteService siteService)
Set the site service

Parameters:
siteService - the site service

createSite

public Site createSite(java.lang.String sitePreset,
                       java.lang.String shortName,
                       java.lang.String title,
                       java.lang.String description,
                       boolean isPublic)
Deprecated. as of version 3.2, replaced by ScriptSiteService.createSite(String, String, String, String, String)

Parameters:
sitePreset - site preset
shortName - site short name
title - site title
description - site description
isPublic - whether the site is public or not
Returns:
Site the created site
See Also:
#createSite(String, String, String, String, String)}

createSite

public Site createSite(java.lang.String sitePreset,
                       java.lang.String shortName,
                       java.lang.String title,
                       java.lang.String description,
                       java.lang.String visibility)
Create a new site.

The site short name will be used to uniquely identify the site so it must be unique.

Parameters:
sitePreset - site preset
shortName - site short name
title - site title
description - site description
visibility - visibility of the site (public|moderated|private)
Returns:
Site the created site

createSite

public Site createSite(java.lang.String sitePreset,
                       java.lang.String shortName,
                       java.lang.String title,
                       java.lang.String description,
                       java.lang.String visibility,
                       java.lang.String siteType)
Create a new site.

The site short name will be used to uniquely identify the site so it must be unique.

Parameters:
sitePreset - site preset
shortName - site short name
title - site title
description - site description
visibility - visibility of the site (public|moderated|private)
siteType - qname of site type to create
Returns:
Site the created site

hasCreateSitePermissions

public boolean hasCreateSitePermissions()
This method checks if the currently authenticated user has permission to create sites.

Returns:
true if the current user is a Contributor to "Sites" node, else false.
Since:
3.4

isSiteManager

public boolean isSiteManager(java.lang.String siteId)
Determines if the current user is a manager of the given site.

Parameters:
siteId - The short name of the site to check
Returns:
true if the current user is a manager of the given site

getSites

public Site[] getSites(java.lang.String filter,
                       java.lang.String sitePresetFilter,
                       int size)
Retrieves the sites available in the repository. The returned list can optionally be filtered by name and site preset. If no filters are specified then all the available sites are returned. NOTE: If the filter starts with a * a Lucene based search will be performed, this may discover a wider range of results i.e. those sites that contain the search term as opposed to those that start with the search term, but newly created sites may not be found until the underlying search indexes are updated.

Parameters:
filter - inclusion filter for returned sites. Only sites whose cm:name OR cm:title OR cm:description start with the filter string will be returned.
sitePresetFilter - site preset filter
size - max results size crop if >0
Returns:
Site[] a list of the site filtered as appropriate

listSites

public Site[] listSites(java.lang.String filter,
                        java.lang.String sitePresetFilter)
List the sites available in the repository. The returned list can optionally be filtered by name and site preset.

If no filters are specified then all the available sites are returned.

Parameters:
filter - inclusion filter for returned sites. Only sites whose cm:name OR cm:title OR cm:description start with the filter string will be returned.
sitePresetFilter - site preset filter
Returns:
Site[] a list of the site filtered as appropriate
See Also:
for a description of the limitations of this method.

listSites

public Site[] listSites(java.lang.String filter,
                        java.lang.String sitePresetFilter,
                        int size)
List the sites available in the repository. The returned list can optionally be filtered by name and site preset.

If no filters are specified then all the available sites are returned.

Parameters:
filter - inclusion filter for returned sites. Only sites whose cm:name OR cm:title OR cm:description start with the filter string will be returned.
sitePresetFilter - site preset filter
size - max results size crop if >0
Returns:
Site[] a list of the site filtered as appropriate
See Also:
for a description of the limitations of this method.

findSites

public Site[] findSites(java.lang.String filter,
                        java.lang.String sitePresetFilter,
                        int size)
Find (search) the sites available in the repository. The returned list can optionally be filtered by name and site preset.

If no filters are specified then all the available sites are returned.

Parameters:
filter - inclusion filter for returned sites. Only sites whose cm:name OR cm:title OR cm:description CONTAIN the filter string will be returned.
sitePresetFilter - site preset filter
size - max results size crop if >0
Returns:
Site[] a list of the site filtered as appropriate
Since:
4.0
See Also:
for a description of the limitations of this method.

makeSitesArray

protected Site[] makeSitesArray(java.util.List siteInfos)
Converts the given List of SiteInfo objects to a JavaScript friendly array of Site objects.

Parameters:
siteInfos -
Returns:
Array of Site objects

listUserSites

public Site[] listUserSites(java.lang.String userName,
                            int size)
List all the sites that the specified user has an explicit membership to.

Parameters:
userName - user name
size - maximum list size
Returns:
Site[] a list of sites the user has an explicit membership to

listUserSites

public Site[] listUserSites(java.lang.String userName)
List all the sites that the specified user has an explicit membership to.

Parameters:
userName - user name
Returns:
Site[] a list of sites the user has an explicit membership to

getSite

public Site getSite(java.lang.String shortName)
Get a site for a provided site short name.

Returns null if the site does not exist.

Parameters:
shortName - short name of the site
Returns:
Site the site, null if does not exist

listSiteRoles

public java.lang.String[] listSiteRoles()
Returns an array of all the roles that can be assigned to a member of a site.

Returns:
String[] roles available to assign to a member of a site

cleanSitePermissions

public void cleanSitePermissions(org.alfresco.service.cmr.repository.NodeRef targetNode)
It removes permissions which pertain to sites other than the node's current site.

Parameters:
targetNode - the root node which is to have its permissions cleaned.
See Also:
SiteService.cleanSitePermissions(NodeRef, SiteInfo)

cleanSitePermissions

public void cleanSitePermissions(ScriptNode targetNode)
This method cleans up the permissions on the specified node and all its primary children. It removes permissions which pertain to sites other than the node's current site.

Since:
3.4.2
See Also:
SiteService.cleanSitePermissions(NodeRef, SiteInfo)

listSiteRoles

public java.lang.String[] listSiteRoles(java.lang.String shortName)
Returns an array of all the roles that can be assigned to a member of a specific site.

Returns:
String[] roles available to assign to a member of a site


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.