Package org.ametys.plugins.blog.posts
Class PostsGenerator
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.xml.AbstractXMLProducer
-
- org.apache.cocoon.generation.AbstractGenerator
-
- org.apache.cocoon.generation.ServiceableGenerator
-
- org.ametys.plugins.blog.posts.PostsGenerator
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
public class PostsGenerator extends ServiceableGenerator
Generates posts from the cache.
-
-
Field Summary
Fields Modifier and Type Field Description protected AmetysObjectResolver
_ametysResolver
The ametys object resolver.protected BlogCacheManager
_blogCache
The blog cache manager.protected SiteManager
_siteManager
The site Manager.protected SourceResolver
_sourceResolver
The source resolver.-
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
-
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
-
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
-
-
Constructor Summary
Constructors Constructor Description PostsGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
generate()
protected Collection<String>
getPosts(String siteName, String language, String type, int year, int month, String tagName)
Get all the posts for the given criteria.protected Collection<String>
getPosts(String siteName, String language, String type, int year, int month, String tagName, int maxCount)
Get a limited number of posts for the given criteria.void
saxContent(Content content, String viewName)
SAX a content in its specific viewvoid
service(ServiceManager serviceManager)
-
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
-
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setup
-
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
-
-
-
Field Detail
-
_blogCache
protected BlogCacheManager _blogCache
The blog cache manager.
-
_ametysResolver
protected AmetysObjectResolver _ametysResolver
The ametys object resolver.
-
_siteManager
protected SiteManager _siteManager
The site Manager.
-
_sourceResolver
protected SourceResolver _sourceResolver
The source resolver.
-
-
Constructor Detail
-
PostsGenerator
public PostsGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
saxContent
public void saxContent(Content content, String viewName) throws SAXException, IOException
SAX a content in its specific view- Parameters:
content
- The content to SAXviewName
- The view to use- Throws:
SAXException
- If an error occurs while SAXingIOException
- If an error occurs while retrieving content.
-
getPosts
protected Collection<String> getPosts(String siteName, String language, String type, int year, int month, String tagName)
Get all the posts for the given criteria.- Parameters:
siteName
- the site name.language
- the language.type
- the search type ('all', 'year', 'month' or 'tag').year
- the year in case of a 'year' or 'month' search.month
- the month, in case of a 'month' search.tagName
- the tag name in case of a 'tag' search.- Returns:
- the post IDs.
-
getPosts
protected Collection<String> getPosts(String siteName, String language, String type, int year, int month, String tagName, int maxCount)
Get a limited number of posts for the given criteria.- Parameters:
siteName
- the site name.language
- the language.type
- the search type ('all', 'year', 'month' or 'tag').year
- the year in case of a 'year' or 'month' search.month
- the month, in case of a 'month' search.tagName
- the tag name in case of a 'tag' search.maxCount
- the maximum count of posts to retrieve.- Returns:
- the post IDs.
-
-