Package org.ametys.web.repository.page
Class SitemapDAO
- java.lang.Object
 - 
- org.apache.avalon.framework.logger.AbstractLogEnabled
 - 
- org.ametys.web.repository.page.SitemapDAO
 
 
 
- 
- All Implemented Interfaces:
 Component,LogEnabled,Serviceable
public class SitemapDAO extends AbstractLogEnabled implements Serviceable, Component
DAO for manipulating pages 
- 
- 
Field Summary
Fields Modifier and Type Field Description private CurrentUserProvider_currentUserProviderprivate AmetysObjectResolver_resolverprivate RightManager_rightManagerprivate SiteManager_siteManagerprivate SitemapDecoratorsHandler_sitemapHandlerstatic StringROLEThe component's role 
- 
Constructor Summary
Constructors Constructor Description SitemapDAO() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_getMatchingPages(Page page, String value, List<String> matchingPaths)StringconvertPathToId(String siteName, String lang, String path)Get the id of a page from its site name, language and sitemap's pathList<String>filterPagesByRegExp(String id, String value)Get the path of pages which match filter regexpList<Map<String,Object>>getDecorators(String siteName)Get the sitemap's decoratorsMap<String,Object>getPageProperties(String pageId)Get the properties of a page in order to display it into a sitemap treeMap<String,Object>getPageProperties(Page page)Get the properties of a page in order to display it into a sitemap treeMap<String,Object>getPageProperties(Page page, List<String> rightsToCheck)Get the properties of a page in order to display it into a sitemap treeMap<String,Object>getProperties(String siteName, String lang)Get properties of a site, sitemap or on sites root nodeMap<String,Object>getSitemap(String sitemapId)Get sitemap propertiesMap<String,Object>getSitemapProperties(String siteName, String lang, List<String> rights)Get the sitemap properties as JSON objectMap<String,Object>getSitemapProperties(Sitemap sitemap, List<String> rightsToCheck)Get the sitemap properties into a JSON objectprotected Set<String>getUserRights(Sitemap sitemap)Get the user rights on a sitemapbooleanisCurrentUserAllowed(PagesContainer pageContainer, List<String> rights)Determines if the current user has the requested right on this pages containervoidservice(ServiceManager smanager)- 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger 
 - 
 
 - 
 
- 
- 
Field Detail
- 
_resolver
private AmetysObjectResolver _resolver
 
- 
_rightManager
private RightManager _rightManager
 
- 
_currentUserProvider
private CurrentUserProvider _currentUserProvider
 
- 
_siteManager
private SiteManager _siteManager
 
- 
_sitemapHandler
private SitemapDecoratorsHandler _sitemapHandler
 
 - 
 
- 
Constructor Detail
- 
SitemapDAO
public SitemapDAO()
 
 - 
 
- 
Method Detail
- 
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
 servicein interfaceServiceable- Throws:
 ServiceException
 
- 
getSitemap
public Map<String,Object> getSitemap(String sitemapId)
Get sitemap properties- Parameters:
 sitemapId- the sitemap ID- Returns:
 - the sitemap's properties or null if not found
 
 
- 
getProperties
public Map<String,Object> getProperties(String siteName, String lang)
Get properties of a site, sitemap or on sites root node- Parameters:
 siteName- the site name. Set to null to get properties of sites root nodelang- the sitemap language. Set to null to get properties of site node- Returns:
 - the properties
 
 
- 
getSitemapProperties
public Map<String,Object> getSitemapProperties(String siteName, String lang, List<String> rights)
Get the sitemap properties as JSON object- Parameters:
 siteName- the site name. Set to null to get properties of sites root nodelang- the sitemap language. Set to null to get properties of site noderights- If not null, the sitemap properties will contain a 'isAllowed' property based on user rights. Can be null.- Returns:
 - the sitemap properties
 
 
- 
getSitemapProperties
public Map<String,Object> getSitemapProperties(Sitemap sitemap, List<String> rightsToCheck)
Get the sitemap properties into a JSON object- Parameters:
 sitemap- The sitemaprightsToCheck- If not null, the sitemap properties will contain a 'isAllowed' property based on user rights. Can be null.- Returns:
 - the sitemap properties
 
 
- 
getPageProperties
public Map<String,Object> getPageProperties(String pageId)
Get the properties of a page in order to display it into a sitemap tree- Parameters:
 pageId- The page's id- Returns:
 - The page's properties
 
 
- 
getPageProperties
public Map<String,Object> getPageProperties(Page page)
Get the properties of a page in order to display it into a sitemap tree- Parameters:
 page- The page- Returns:
 - The page's properties
 
 
- 
getPageProperties
public Map<String,Object> getPageProperties(Page page, List<String> rightsToCheck)
Get the properties of a page in order to display it into a sitemap tree- Parameters:
 page- The pagerightsToCheck- If not null, the page properties will contain a 'isAllowed' property based on user rights- Returns:
 - The page's properties
 
 
- 
isCurrentUserAllowed
public boolean isCurrentUserAllowed(PagesContainer pageContainer, List<String> rights)
Determines if the current user has the requested right on this pages container- Parameters:
 pageContainer- The pages containerrights- The rights to check- Returns:
 - true if the current user is allowed
 
 
- 
filterPagesByRegExp
public List<String> filterPagesByRegExp(String id, String value)
Get the path of pages which match filter regexp- Parameters:
 id- The id of page or sitemap to start searchvalue- the value to match- Returns:
 - the matching paths
 
 
- 
_getMatchingPages
private void _getMatchingPages(Page page, String value, List<String> matchingPaths)
 
- 
getDecorators
public List<Map<String,Object>> getDecorators(String siteName)
Get the sitemap's decorators- Parameters:
 siteName- the site name- Returns:
 - the list of decorators
 
 
- 
convertPathToId
public String convertPathToId(String siteName, String lang, String path)
Get the id of a page from its site name, language and sitemap's path- Parameters:
 siteName- The site namelang- The languagepath- the page's path. Can be null to get sitemap's id- Returns:
 - the page id or null if not found
 
 
- 
getUserRights
protected Set<String> getUserRights(Sitemap sitemap)
Get the user rights on a sitemap- Parameters:
 sitemap- the sitemap- Returns:
 - The user's rights
 
 
 - 
 
 -