org.alfresco.repo.site
Class SiteServiceImpl

java.lang.Object
  extended by org.alfresco.repo.site.SiteServiceImpl
All Implemented Interfaces:
SiteModel, SiteService

public class SiteServiceImpl
extends java.lang.Object
implements SiteService, SiteModel

Site Service Implementation. Also bootstraps the site AVM and DM stores.


Field Summary
static StoreRef SITE_STORE
          The DM store where site's are kept
 
Fields inherited from interface org.alfresco.repo.site.SiteModel
ASPECT_SITE_CONTAINER, PROP_COMPONENT_ID, PROP_SITE_PRESET, PROP_SITE_VISIBILITY, SITE_COLLABORATOR, SITE_CONSUMER, SITE_CONTRIBUTOR, SITE_CUSTOM_PROPERTY_PREFIX, SITE_CUSTOM_PROPERTY_URL, SITE_MANAGER, SITE_MODEL_PREFIX, SITE_MODEL_URL, TYPE_SITE, TYPE_SITES
 
Constructor Summary
SiteServiceImpl()
           
 
Method Summary
 NodeRef createContainer(java.lang.String shortName, java.lang.String componentId, QName containerType, java.util.Map containerProperties)
          Creates a container for a component is a site of the given container type (must be a sub-type of st:siteContainer)
 SiteInfo createSite(java.lang.String sitePreset, java.lang.String passedShortName, java.lang.String title, java.lang.String description, boolean isPublic)
          Create a new site.
 SiteInfo createSite(java.lang.String sitePreset, java.lang.String passedShortName, java.lang.String title, java.lang.String description, SiteVisibility visibility)
          Create a new site.
 void deleteSite(java.lang.String shortName)
          Delete the site.
 NodeRef getContainer(java.lang.String shortName, java.lang.String componentId)
          Gets the "container" folder for the specified component.
 java.lang.String getMembersRole(java.lang.String shortName, java.lang.String authorityName)
          Gets the role of the specified user.
 java.util.List getMembersRoles(java.lang.String shortName, java.lang.String authorityName)
           
 java.util.Comparator getRoleComparator()
           
 SiteInfo getSite(NodeRef nodeRef)
           
 SiteInfo getSite(java.lang.String shortName)
          Gets site information based on the short name of a site.
 java.lang.String getSiteGroup(java.lang.String shortName)
          Gets the sites group.
 java.lang.String getSiteGroup(java.lang.String shortName, boolean withGroupPrefix)
          Helper method to get the name of the site group
 java.lang.String getSiteRoleGroup(java.lang.String shortName, java.lang.String role)
          Gets the sites role group.
 java.lang.String getSiteRoleGroup(java.lang.String shortName, java.lang.String permission, boolean withGroupPrefix)
          Helper method to get the name of the site permission group
 java.util.List getSiteRoles()
          Gets a list of all the currently available roles that a user can perform on a site
 boolean hasContainer(java.lang.String shortName, java.lang.String componentId)
          Determines if a "container" folder for the specified component exists.
 void init()
          Checks that all necessary properties and services have been provided.
 boolean isMember(java.lang.String shortName, java.lang.String authorityName)
          Indicates whether an authority is a member of a site or not
 java.util.Map listMembers(java.lang.String shortName, java.lang.String nameFilter, java.lang.String roleFilter, int size)
          List the members of the site.
 java.util.Map listMembers(java.lang.String shortName, java.lang.String nameFilter, java.lang.String roleFilter, int size, boolean collapseGroups)
          List the members of the site.
 java.util.List listSites(java.lang.String userName)
          List all the sites that the specified user has a explicit membership to.
 java.util.List listSites(java.lang.String nameFilter, java.lang.String sitePresetFilter)
          List the available sites.
 java.util.List listSites(java.lang.String nameFilter, java.lang.String sitePresetFilter, int size)
          List the available sites.
 void removeMembership(java.lang.String shortName, java.lang.String authorityName)
          Clears an authorities role within a site
 void setActivityService(ActivityService activityService)
          Set activity service
 void setAuthenticationContext(AuthenticationContext authenticationContext)
          Set authentication component
 void setAuthorityService(AuthorityService authorityService)
          Set the authority service
 void setDictionaryService(DictionaryService dictionaryService)
          Set the dictionary service
 void setFileFolderService(FileFolderService fileFolderService)
          Set file folder service
 void setMembership(java.lang.String shortName, java.lang.String authorityName, java.lang.String role)
          Sets the role of an authority within a site
 void setNamespaceService(NamespaceService namespaceService)
          Set Namespace service
 void setNodeService(NodeService nodeService)
          Set node service
 void setPermissionService(PermissionService permissionService)
          Set permission service
 void setPersonService(PersonService personService)
          Set person service
 void setRoleComparator(java.util.Comparator roleComparator)
           
 void setSearchService(SearchService searchService)
          Set search service
 void setSitesXPath(java.lang.String sitesXPath)
          Set the path to the location of the sites root folder.
 void setTaggingService(TaggingService taggingService)
          Set the tagging service
 void setTenantAdminService(TenantAdminService tenantAdminService)
          Sets the tenant admin service
 void setTenantService(TenantService tenantService)
          Set the tenant service
 void setTransactionHelper(RetryingTransactionHelper retryingTransactionHelper)
          Sets helper that provides transaction callbacks
 void updateSite(SiteInfo siteInfo)
          Update the site information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SITE_STORE

public static final StoreRef SITE_STORE
The DM store where site's are kept

Constructor Detail

SiteServiceImpl

public SiteServiceImpl()
Method Detail

setSitesXPath

public void setSitesXPath(java.lang.String sitesXPath)
Set the path to the location of the sites root folder. For example:
 ./app:company_home/st:sites
 

Parameters:
sitesXPath - a valid XPath

setNodeService

public void setNodeService(NodeService nodeService)
Set node service


setFileFolderService

public void setFileFolderService(FileFolderService fileFolderService)
Set file folder service


setSearchService

public void setSearchService(SearchService searchService)
Set search service


setNamespaceService

public void setNamespaceService(NamespaceService namespaceService)
Set Namespace service


setPermissionService

public void setPermissionService(PermissionService permissionService)
Set permission service


setActivityService

public void setActivityService(ActivityService activityService)
Set activity service


setPersonService

public void setPersonService(PersonService personService)
Set person service


setAuthenticationContext

public void setAuthenticationContext(AuthenticationContext authenticationContext)
Set authentication component


setTaggingService

public void setTaggingService(TaggingService taggingService)
Set the tagging service


setAuthorityService

public void setAuthorityService(AuthorityService authorityService)
Set the authority service


setDictionaryService

public void setDictionaryService(DictionaryService dictionaryService)
Set the dictionary service

Parameters:
dictionaryService - dictionary service

setTenantService

public void setTenantService(TenantService tenantService)
Set the tenant service

Parameters:
tenantService - tenant service

setTenantAdminService

public void setTenantAdminService(TenantAdminService tenantAdminService)
Sets the tenant admin service


setTransactionHelper

public void setTransactionHelper(RetryingTransactionHelper retryingTransactionHelper)
Sets helper that provides transaction callbacks


setRoleComparator

public void setRoleComparator(java.util.Comparator roleComparator)

getRoleComparator

public java.util.Comparator getRoleComparator()

init

public void init()
Checks that all necessary properties and services have been provided.


createSite

public SiteInfo createSite(java.lang.String sitePreset,
                           java.lang.String passedShortName,
                           java.lang.String title,
                           java.lang.String description,
                           boolean isPublic)
Description copied from interface: SiteService
Create a new site.

Specified by:
createSite in interface SiteService
Parameters:
sitePreset - site preset name
passedShortName - site short name, must be unique
title - site title
description - site description
isPublic - whether the site is public or not (true = public, false = private)
Returns:
SiteInfo information about the created site
See Also:
SiteService.createSite(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)

createSite

public SiteInfo createSite(java.lang.String sitePreset,
                           java.lang.String passedShortName,
                           java.lang.String title,
                           java.lang.String description,
                           SiteVisibility visibility)
Description copied from interface: SiteService
Create a new site.

Specified by:
createSite in interface SiteService
Parameters:
sitePreset - site preset name
passedShortName - site short name, must be unique
title - site title
description - site description
visibility - site visibility (public|moderated|private)
Returns:
SiteInfo information about the created site
See Also:
SiteService.createSite(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)

getSiteGroup

public java.lang.String getSiteGroup(java.lang.String shortName)
Description copied from interface: SiteService
Gets the sites group. All members of the site are contained within this group.

Specified by:
getSiteGroup in interface SiteService
Parameters:
shortName - site short name
Returns:
String group name
See Also:
SiteService.getSiteGroup(java.lang.String)

getSiteRoleGroup

public java.lang.String getSiteRoleGroup(java.lang.String shortName,
                                         java.lang.String role)
Description copied from interface: SiteService
Gets the sites role group. All members assigned the given role will be memebers of the returned group.

Specified by:
getSiteRoleGroup in interface SiteService
Parameters:
shortName - site short name
role - membership role
Returns:
String group name
See Also:
SiteService.getSiteRoleGroup(java.lang.String, java.lang.String)

getSiteGroup

public java.lang.String getSiteGroup(java.lang.String shortName,
                                     boolean withGroupPrefix)
Helper method to get the name of the site group

Parameters:
shortName - site short name
Returns:
String site group name

getSiteRoleGroup

public java.lang.String getSiteRoleGroup(java.lang.String shortName,
                                         java.lang.String permission,
                                         boolean withGroupPrefix)
Helper method to get the name of the site permission group

Parameters:
shortName - site short name
permission - permission name
withGroupPrefix - - should the name have the GROUP_ prefix?
Returns:
String site permission group name

listSites

public java.util.List listSites(java.lang.String nameFilter,
                                java.lang.String sitePresetFilter)
Description copied from interface: SiteService
List the available sites. This list can optionally be filtered by site name and/or site preset.

Specified by:
listSites in interface SiteService
Parameters:
nameFilter - name filter
sitePresetFilter - site preset filter
Returns:
List list of site information
See Also:
SiteService.listSites(java.lang.String, java.lang.String)

listSites

public java.util.List listSites(java.lang.String nameFilter,
                                java.lang.String sitePresetFilter,
                                int size)
Description copied from interface: SiteService
List the available sites. This list can optionally be filtered by site name and/or site preset.

Specified by:
listSites in interface SiteService
Parameters:
nameFilter - name filter
sitePresetFilter - site preset filter
size - list maximum size or zero for all
Returns:
List list of site information
See Also:
SiteService.listSites(java.lang.String, java.lang.String, int)

listSites

public java.util.List listSites(java.lang.String userName)
Description copied from interface: SiteService
List all the sites that the specified user has a explicit membership to.

Specified by:
listSites in interface SiteService
Parameters:
userName - user name
Returns:
List list of site information
See Also:
SiteService.listSites(java.lang.String)

getSite

public SiteInfo getSite(java.lang.String shortName)
Description copied from interface: SiteService
Gets site information based on the short name of a site.

Returns null if the site can not be found.

Specified by:
getSite in interface SiteService
Parameters:
shortName - the site short name
Returns:
SiteInfo the site information
See Also:
SiteService.getSite(java.lang.String)

getSite

public SiteInfo getSite(NodeRef nodeRef)
Specified by:
getSite in interface SiteService
Returns:
See Also:
SiteService.getSite(org.alfresco.service.cmr.repository.NodeRef)

updateSite

public void updateSite(SiteInfo siteInfo)
Description copied from interface: SiteService
Update the site information.

Note that the short name and site preset of a site can not be updated once the site has been created.

Specified by:
updateSite in interface SiteService
Parameters:
siteInfo - site information
See Also:
SiteService.updateSite(org.alfresco.service.cmr.site.SiteInfo)

deleteSite

public void deleteSite(java.lang.String shortName)
Description copied from interface: SiteService
Delete the site.

Specified by:
deleteSite in interface SiteService
Parameters:
shortName - site short name
See Also:
SiteService.deleteSite(java.lang.String)

listMembers

public java.util.Map listMembers(java.lang.String shortName,
                                 java.lang.String nameFilter,
                                 java.lang.String roleFilter,
                                 int size)
Description copied from interface: SiteService
List the members of the site. This includes both users and groups.

Name and role filters are optional and if not specified all the members of the site are returned.

Specified by:
listMembers in interface SiteService
Parameters:
shortName - site short name
nameFilter - name filter
roleFilter - role filter
size - max results size crop if >0
Returns:
Map the authority name and their role
See Also:
SiteService.listMembers(java.lang.String, java.lang.String, java.lang.String, int)

listMembers

public java.util.Map listMembers(java.lang.String shortName,
                                 java.lang.String nameFilter,
                                 java.lang.String roleFilter,
                                 int size,
                                 boolean collapseGroups)
Description copied from interface: SiteService
List the members of the site. This includes both users and groups if collapseGroups is set to false, otherwise all groups that are members are collapsed into their component users and listed.

Specified by:
listMembers in interface SiteService
Parameters:
shortName - site short name
nameFilter - name filter
roleFilter - role filter
size - max results size crop if >0
collapseGroups - true if collapse member groups into user list, false otherwise
Returns:
Map the authority name and their role
See Also:
SiteService.listMembers(String, String, String, int, boolean)

getMembersRole

public java.lang.String getMembersRole(java.lang.String shortName,
                                       java.lang.String authorityName)
Description copied from interface: SiteService
Gets the role of the specified user.

Specified by:
getMembersRole in interface SiteService
Parameters:
shortName - site short name
authorityName - full authority name (so if it's a group then its prefixed with 'GROUP_')
Returns:
String site role, null if none
See Also:
SiteService.getMembersRole(java.lang.String, java.lang.String)

getMembersRoles

public java.util.List getMembersRoles(java.lang.String shortName,
                                      java.lang.String authorityName)

getSiteRoles

public java.util.List getSiteRoles()
Description copied from interface: SiteService
Gets a list of all the currently available roles that a user can perform on a site

Specified by:
getSiteRoles in interface SiteService
Returns:
List list of available roles
See Also:
SiteService.getSiteRoles()

isMember

public boolean isMember(java.lang.String shortName,
                        java.lang.String authorityName)
Description copied from interface: SiteService
Indicates whether an authority is a member of a site or not

Specified by:
isMember in interface SiteService
Parameters:
shortName - site short name
authorityName - authority name (so if it's a group then its prefixed with 'GROUP_')
Returns:
boolean true if the authority is a member of the site, false otherwise
See Also:
SiteService.isMember(java.lang.String, java.lang.String)

removeMembership

public void removeMembership(java.lang.String shortName,
                             java.lang.String authorityName)
Description copied from interface: SiteService
Clears an authorities role within a site

Specified by:
removeMembership in interface SiteService
Parameters:
shortName - site short name
authorityName - authority name (so if it's a group then its prefixed with 'GROUP_')
See Also:
SiteService.removeMembership(java.lang.String, java.lang.String)

setMembership

public void setMembership(java.lang.String shortName,
                          java.lang.String authorityName,
                          java.lang.String role)
Description copied from interface: SiteService
Sets the role of an authority within a site

Specified by:
setMembership in interface SiteService
Parameters:
shortName - site short name
authorityName - authority name (so if it's a group then its prefixed with 'GROUP_')
role - site role
See Also:
SiteService.setMembership(java.lang.String, java.lang.String, java.lang.String)

createContainer

public NodeRef createContainer(java.lang.String shortName,
                               java.lang.String componentId,
                               QName containerType,
                               java.util.Map containerProperties)
Description copied from interface: SiteService
Creates a container for a component is a site of the given container type (must be a sub-type of st:siteContainer)

If no container type is specified then a node of type st:siteContainer is created.

The map of container properties are set on the created container node. Null can be provided when no properties need to be set.

Specified by:
createContainer in interface SiteService
Parameters:
shortName - site short name
componentId - component id
containerType - container type to create (can be null)
containerProperties - container property values (can be null)
Returns:
noderef of container or null if a container can't be created.
See Also:
SiteService.createContainer(java.lang.String, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map)

getContainer

public NodeRef getContainer(java.lang.String shortName,
                            java.lang.String componentId)
Description copied from interface: SiteService
Gets the "container" folder for the specified component.

Specified by:
getContainer in interface SiteService
Parameters:
shortName - short name of site
componentId - component id
Returns:
noderef of container
See Also:
org.alfresco.service.cmr.site.SiteService#getContainer(java.lang.String)

hasContainer

public boolean hasContainer(java.lang.String shortName,
                            java.lang.String componentId)
Description copied from interface: SiteService
Determines if a "container" folder for the specified component exists.

Specified by:
hasContainer in interface SiteService
Parameters:
shortName - short name of site
componentId - component id
Returns:
true => "container" folder exists for component
See Also:
org.alfresco.service.cmr.site.SiteService#hasContainer(java.lang.String)


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