Package org.ametys.plugins.blog
Class BlogPageHandler
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.blog.BlogPageHandler
-
- All Implemented Interfaces:
Initializable
,Component
,LogEnabled
,Serviceable
public class BlogPageHandler extends AbstractLogEnabled implements Component, Initializable, Serviceable
Retrieves blog pages.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Map<String,String>>
_blogRootPages
The blog root page IDs, indexed by site and sitemap name.protected Map<String,Boolean>
_hasBlogRoot
For each site, indicate if a blog root is present.protected AmetysObjectResolver
_resolver
The ametys object resolver.protected SiteManager
_siteManager
The site manager.static String
ROLE
The avalon role.
-
Constructor Summary
Constructors Constructor Description BlogPageHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected PagesContainer
_getBlogRootPage(String siteName, String sitemapName)
Get the blog root page.void
clearCache()
Clear the blog root page cache.void
clearCache(String siteName, String sitemapName)
Clear the blog root page cache for a given site and language.Page
getBlogPage(String site, String language, String pagePath)
Get a page under the blog root.PagesContainer
getBlogRootPage(String siteName, String sitemapName)
Get the blog root page.Page
getPostPage(WebContent postContent)
Get the Page holding the given post content.Set<Page>
getPostPages(WebContent postContent)
Deprecated.Page
getTagPage(String siteName, String lang, String tagPath)
Get the page holding the given tagboolean
hasBlogRootPage(Site site)
Test if the given site has at least one sitemap with a blog root page.void
initialize()
boolean
isBlogRootPage(JCRAmetysObject ametysObject)
Test if the given page is the blog root page.void
service(ServiceManager serviceManager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver.
-
_siteManager
protected SiteManager _siteManager
The site manager.
-
_blogRootPages
protected Map<String,Map<String,String>> _blogRootPages
The blog root page IDs, indexed by site and sitemap name.
-
_hasBlogRoot
protected Map<String,Boolean> _hasBlogRoot
For each site, indicate if a blog root is present.
-
-
Constructor Detail
-
BlogPageHandler
public BlogPageHandler()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getBlogRootPage
public PagesContainer getBlogRootPage(String siteName, String sitemapName) throws AmetysRepositoryException
Get the blog root page.- Parameters:
siteName
- the current site.sitemapName
- the current sitemap/language.- Returns:
- the blog root page or null if not found.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
hasBlogRootPage
public boolean hasBlogRootPage(Site site)
Test if the given site has at least one sitemap with a blog root page.- Parameters:
site
- the site to test.- Returns:
- true if the site has at least one sitemap with a blog root page, false otherwise.
-
isBlogRootPage
public boolean isBlogRootPage(JCRAmetysObject ametysObject)
Test if the given page is the blog root page.- Parameters:
ametysObject
- the container ametysObject.- Returns:
- true/false.
-
getBlogPage
public Page getBlogPage(String site, String language, String pagePath) throws AmetysRepositoryException
Get a page under the blog root.- Parameters:
site
- the current site.language
- the current language/sitemap.pagePath
- the wanted page path.- Returns:
- the blog page or null if not found.
- Throws:
AmetysRepositoryException
- if an error occurs
-
getPostPage
public Page getPostPage(WebContent postContent)
Get the Page holding the given post content.- Parameters:
postContent
- the post content.- Returns:
- the Page holding the post content.
-
getTagPage
public Page getTagPage(String siteName, String lang, String tagPath)
Get the page holding the given tag- Parameters:
siteName
- The site's namelang
- The languagetagPath
- The tag's path- Returns:
- The page holding this tag or null if not exists
-
getPostPages
@Deprecated public Set<Page> getPostPages(WebContent postContent)
Deprecated.Get the pages corresponding to the post Content.- Parameters:
postContent
- the post Content.- Returns:
- the post pages.
-
clearCache
public void clearCache()
Clear the blog root page cache.
-
clearCache
public void clearCache(String siteName, String sitemapName)
Clear the blog root page cache for a given site and language.- Parameters:
siteName
- the current site.sitemapName
- the current sitemap/language.
-
_getBlogRootPage
protected PagesContainer _getBlogRootPage(String siteName, String sitemapName) throws AmetysRepositoryException
Get the blog root page.- Parameters:
siteName
- the current site.sitemapName
- the current sitemap/language.- Returns:
- the blog root page or null if not found.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
-