Class EventsGenerator
- 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.calendar.events.AbstractEventGenerator
-
- org.ametys.plugins.calendar.events.EventsGenerator
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
public class EventsGenerator extends AbstractEventGenerator
Query and generate news according to many parameters.
-
-
Field Summary
Fields Modifier and Type Field Description protected AmetysObjectResolver
_ametysResolver
The ametys object resolver.protected EventsFilterHelper
_eventsFilterHelper
The events helper-
Fields inherited from class org.ametys.plugins.calendar.events.AbstractEventGenerator
_filterHelper, _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 EventsGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_sax(LocalDate today, int monthsBefore, int monthsAfter, int year, int month, int day, Set<String> filteredCategoryTags, Page page, ZoneItem zoneItem, ZonedDateTime dateTime, String title, String rangeType, boolean maskOrphan, boolean pdfDownload, boolean icalDownload, String link, String linkTitle, boolean doRetrieveView, Set<String> tags, Set<Tag> categories, String pagePath, EventsFilter eventsFilter, EventsFilterHelper.DateRange dateRange, AmetysObjectIterable<Content> eventContents)
protected void
_saxCategories(Collection<Tag> categories)
Generate the list of selected tags that act as categories and their descendant tags.protected void
_saxDays(ZonedDateTime date, String type)
Generate days to build a "calendar" view.protected void
_saxDaysNew(EventsFilterHelper.DateRange dateRange, String rangeType)
Generate days to build a "calendar" view.protected void
_saxMonths(EventsFilterHelper.DateRange dateRange)
SAX information on the months spanning the date range.private void
_saxRssUrl(ZoneItem zoneItem)
protected void
_saxTags(Collection<String> tags)
Generate the list of selected tags.protected void
addNavAttributes(AttributesImpl attrs, ZonedDateTime current, ZonedDateTime previousDay, ZonedDateTime nextDay)
Add nav attributes.void
generate()
void
saxMatchingContents(ContentHandler handler, WebContentFilter filter, AmetysObjectIterable<Content> contents, Page currentPage, boolean saxContentItSelf)
SAX all contents matching the given filtervoid
service(ServiceManager serviceManager)
-
Methods inherited from class org.ametys.plugins.calendar.events.AbstractEventGenerator
_getFormatedDateAttribute, saxContent, saxXMLContent
-
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
-
_ametysResolver
protected AmetysObjectResolver _ametysResolver
The ametys object resolver.
-
_eventsFilterHelper
protected EventsFilterHelper _eventsFilterHelper
The events helper
-
-
Constructor Detail
-
EventsGenerator
public EventsGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractEventGenerator
- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
_sax
private void _sax(LocalDate today, int monthsBefore, int monthsAfter, int year, int month, int day, Set<String> filteredCategoryTags, Page page, ZoneItem zoneItem, ZonedDateTime dateTime, String title, String rangeType, boolean maskOrphan, boolean pdfDownload, boolean icalDownload, String link, String linkTitle, boolean doRetrieveView, Set<String> tags, Set<Tag> categories, String pagePath, EventsFilter eventsFilter, EventsFilterHelper.DateRange dateRange, AmetysObjectIterable<Content> eventContents) throws SAXException, IOException
- Throws:
SAXException
IOException
-
_saxRssUrl
private void _saxRssUrl(ZoneItem zoneItem) throws SAXException
- Throws:
SAXException
-
saxMatchingContents
public void saxMatchingContents(ContentHandler handler, WebContentFilter filter, AmetysObjectIterable<Content> contents, Page currentPage, boolean saxContentItSelf) throws SAXException, IOException
SAX all contents matching the given filter- Parameters:
handler
- The content handler to SAX intofilter
- The filtercontents
- iterator on the contents.currentPage
- The current page.saxContentItSelf
- true to sax the content, false will only sax some meta- Throws:
SAXException
- If an error occurs while SAXingIOException
- If an error occurs while retrieving content.
-
_saxMonths
protected void _saxMonths(EventsFilterHelper.DateRange dateRange) throws SAXException
SAX information on the months spanning the date range.- Parameters:
dateRange
- the date range.- Throws:
SAXException
- if a error occurs while saxing
-
_saxDaysNew
protected void _saxDaysNew(EventsFilterHelper.DateRange dateRange, String rangeType) throws SAXException
Generate days to build a "calendar" view.- Parameters:
dateRange
- a date belonging to the time span to generate.rangeType
- the range type, "month" or "week".- Throws:
SAXException
- if an error occurs while saxing
-
_saxDays
protected void _saxDays(ZonedDateTime date, String type) throws SAXException
Generate days to build a "calendar" view.- Parameters:
date
- a date belonging to the time span to generate.type
- the range type, "month" or "week".- Throws:
SAXException
- if an error occurs while saxing
-
addNavAttributes
protected void addNavAttributes(AttributesImpl attrs, ZonedDateTime current, ZonedDateTime previousDay, ZonedDateTime nextDay)
Add nav attributes.- Parameters:
attrs
- the attributes object to fill in.current
- the current date.previousDay
- the previous date.nextDay
- the next date.
-
_saxTags
protected void _saxTags(Collection<String> tags) throws SAXException
Generate the list of selected tags.- Parameters:
tags
- the list of tags.- Throws:
SAXException
- if an error occurs while saxing
-
_saxCategories
protected void _saxCategories(Collection<Tag> categories) throws SAXException
Generate the list of selected tags that act as categories and their descendant tags.- Parameters:
categories
- the list of categories to generate.- Throws:
SAXException
- if an error occurs while saxing
-
-