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
FieldsModifier and TypeFieldDescriptionThe blog root page IDs, indexed by site and sitemap name.For each site, indicate if a blog root is present.protected AmetysObjectResolver
The ametys object resolver.protected SiteManager
The site manager.static final String
The avalon role. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SitemapElement
_getBlogRootPage
(String siteName, String sitemapName) Get the blog root page.void
Clear the blog root page cache.void
clearCache
(String siteName, String sitemapName) Clear the blog root page cache for a given site and language.getBlogPage
(String site, String language, String pagePath) Get a page under the blog root.getBlogRootPage
(String siteName, String sitemapName) Get the blog root page.getPostPage
(WebContent postContent) Get the Page holding the given post content.getPostPages
(WebContent postContent) Deprecated.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
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 Details
-
ROLE
The avalon role. -
_resolver
The ametys object resolver. -
_siteManager
The site manager. -
_blogRootPages
The blog root page IDs, indexed by site and sitemap name. -
_hasBlogRoot
For each site, indicate if a blog root is present.
-
-
Constructor Details
-
BlogPageHandler
public BlogPageHandler()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getBlogRootPage
public SitemapElement 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
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
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
Get the Page holding the given post content.- Parameters:
postContent
- the post content.- Returns:
- the Page holding the post content.
-
getTagPage
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.Get the pages corresponding to the post Content.- Parameters:
postContent
- the post Content.- Returns:
- the post pages.
-
clearCache
Clear the blog root page cache. -
clearCache
Clear the blog root page cache for a given site and language.- Parameters:
siteName
- the current site.sitemapName
- the current sitemap/language.
-
_getBlogRootPage
protected SitemapElement _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.
-