Package org.ametys.web.repository.site
Class SiteManager
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.web.repository.site.SiteManager
- All Implemented Interfaces:
Initializable
,Component
,Contextualizable
,LogEnabled
,Serviceable
public class SiteManager
extends AbstractLogEnabled
implements Serviceable, Component, Contextualizable, Initializable
Helper component for managing sites.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Creates the cachesvoid
Clear the site cachevoid
contextualize
(Context context) Creates a site with the given name, from another site to copyCreates a site with the given name, from another site to copycreateSite
(String siteName) Creates a site with the given name.createSite
(String siteName, String parentId) Creates a site with the given name.Get the granted site names for the current usergetGrantedSites
(UserIdentity user) Get the granted site names for usergetRoot()
Returns the root for sites.Returns the sites names.Returns the root sites.Returns the namedSite
.Returns the namedSite
.Returns the sites names.getSites()
Returns the all sites.boolean
Returns true if the given site exists.void
boolean
isGrantedSite
(UserIdentity user, String siteName) Determines if the user has granted access to the sitevoid
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
Avalon Role -
REQUEST_CACHE
-
MEMORY_CACHE
-
ROOT_SITES
sites root's JCR node name- See Also:
-
ROOT_SITES_PATH
sites root's JCR path- See Also:
-
-
Constructor Details
-
SiteManager
public SiteManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
_createCaches
Creates the caches -
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
getRootSiteNames
Returns the sites names.- Returns:
- the sites names.
-
getSiteNames
Returns the sites names.- Returns:
- the sites names.
-
getGrantedSites
Get the granted site names for the current user- Returns:
- The name of sites the current user can access
-
getGrantedSites
Get the granted site names for user- Parameters:
user
- The user- Returns:
- The name of sites the user can access
-
isGrantedSite
Determines if the user has granted access to the site- Parameters:
user
- The usersiteName
- The site name- Returns:
true
if the user can access to the site
-
getRoot
Returns the root for sites.- Returns:
- the root for sites.
-
getRootSites
Returns the root sites.- Returns:
- the root sites.
-
getSites
Returns the all sites.- Returns:
- the all sites.
-
createSite
public Site createSite(String siteName, String parentId) throws RepositoryIntegrityViolationException Creates a site with the given name.- Parameters:
siteName
- the site name.parentId
- the id of the parent site. Can be null.- Returns:
- the newly created
Site
. - Throws:
RepositoryIntegrityViolationException
- if the named site already exists.
-
createSite
Creates a site with the given name.- Parameters:
siteName
- the site name.- Returns:
- the newly created
Site
. - Throws:
RepositoryIntegrityViolationException
- if the named site already exists.
-
copySite
Creates a site with the given name, from another site to copy- Parameters:
site
- the site to be copiedsiteName
- the site name- Returns:
- the newly created
Site
. - Throws:
RepositoryIntegrityViolationException
- if the named site already exists.
-
copySite
public Site copySite(Site site, String parentId, String siteName) throws RepositoryIntegrityViolationException Creates a site with the given name, from another site to copy- Parameters:
site
- the site to be copiedparentId
- the id of the parent site. Can be null.siteName
- the site name- Returns:
- the newly created
Site
. - Throws:
RepositoryIntegrityViolationException
- if the named site already exists.
-
hasSite
Returns true if the given site exists.- Parameters:
siteName
- the site name.- Returns:
- true if the given site exists.
-
getSite
Returns the namedSite
.- Parameters:
siteName
- the site name.- Returns:
- the named
Site
or null if the siteName is null - Throws:
UnknownAmetysObjectException
- if the named site does not exist
-
getSite
Returns the namedSite
.- Parameters:
siteName
- the site name.session
- the JCR Session to use to retrieve the site- Returns:
- the named
Site
or null if the siteName is null - Throws:
UnknownAmetysObjectException
- if the named site does not exist
-
clearCache
Clear the site cache
-