Class AbstractTagCloudGenerator
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.tagcloud.generators.AbstractTagCloudGenerator
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,Contextualizable
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
TagCloudOnTagsGenerator
,TagCloudOnWordsGenerator
public abstract class AbstractTagCloudGenerator
extends ServiceableGenerator
implements Contextualizable
Generator for tag clouds
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Compares two terms by descending occurrence count.protected static interface
Abstract class for a tag cloud item -
Field Summary
Modifier and TypeFieldDescriptionprotected TagCloudCacheManager
The cache managerprotected Context
The contextprotected AmetysObjectResolver
The Ametys object resolverprotected org.apache.solr.client.solrj.SolrClient
The solr client.protected SolrClientProvider
The solr client provider.protected static final Comparator<AbstractTagCloudGenerator.TagCloudItem>
Compares tag cloud itemsFields 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_addContentTypeQuery
(Collection<Query> queries, String[] cTypes) Add content types term query to the queries.protected void
_addPagesQuery
(Collection<Query> queries, String[] pageIds) Add pages term query to the queriesprotected int
_getFontSize
(int nb, int min, int max) Get the font sizeprotected void
Sax additional attributes for itemprotected void
_saxContentTypeCriteria
(String[] cTypes) SAX the content types criteriaprotected void
_saxFormParameters
(String[] cTypes, String[] pages) SAX teh form search criteriaprotected void
_saxSitemapCriteria
(String[] pages) SAX the pages criteriaprotected org.apache.solr.client.solrj.SolrQuery
Build aSolrQuery
from a Query object.void
contextualize
(Context context) void
generate()
protected abstract List<AbstractTagCloudGenerator.TagCloudItem>
getTagCloudItems
(String siteName, String lang, ModelAwareDataHolder serviceParameters) Get the tag cloud itemsprotected void
saxTagCloudItem
(AbstractTagCloudGenerator.TagCloudItem item, int min, int max) Sax a tag cloud itemvoid
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 Details
-
OCCURRENCE_COMPARATOR
Compares tag cloud items -
_resolver
The Ametys object resolver -
_cacheManager
The cache manager -
_solrClientProvider
The solr client provider. -
_solrClient
The solr client. -
_context
The context
-
-
Constructor Details
-
AbstractTagCloudGenerator
public AbstractTagCloudGenerator()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
- Specified by:
generate
in interfaceGenerator
- Throws:
IOException
SAXException
ProcessingException
-
getTagCloudItems
protected abstract List<AbstractTagCloudGenerator.TagCloudItem> getTagCloudItems(String siteName, String lang, ModelAwareDataHolder serviceParameters) throws IOException, ProcessingException Get the tag cloud items- Parameters:
siteName
- The site namelang
- The languageserviceParameters
- The service parameters- Returns:
- The list og tag cloud item
- Throws:
IOException
- if an error occurs when manipulating filesProcessingException
- if an error occurs during the retrieving of the tag cloud items
-
saxTagCloudItem
protected void saxTagCloudItem(AbstractTagCloudGenerator.TagCloudItem item, int min, int max) throws SAXException Sax a tag cloud item- Parameters:
item
- The tag cloud item to saxmin
- The min number of occurrencemax
- The max number of occurrence- Throws:
SAXException
- if an error occurs while saxing
-
build
Build aSolrQuery
from a Query object.- Parameters:
query
- the Query object.- Returns:
- The SolrQuery.
- Throws:
QuerySyntaxException
- if an error occurs.
-
_saxAdditionalAttributes
protected void _saxAdditionalAttributes(AbstractTagCloudGenerator.TagCloudItem item, AttributesImpl attrs) throws SAXException Sax additional attributes for item- Parameters:
item
- The tag cloud itemattrs
- The attributes- Throws:
SAXException
- if an error occurs while saxing
-
_addContentTypeQuery
Add content types term query to the queries.- Parameters:
queries
- The query collection.cTypes
- the content types. Can be empty or null
-
_addPagesQuery
Add pages term query to the queries- Parameters:
queries
- The query collection.pageIds
- The page IDs.
-
_saxFormParameters
SAX teh form search criteria- Parameters:
cTypes
- the content typespages
- the pages- Throws:
SAXException
- if an error occurred while SAXing
-
_getFontSize
Get the font size- Parameters:
nb
- the number of occurrencemin
- the min number of occurrencemax
- the max number of occurrence- Returns:
- the font size
-
_saxContentTypeCriteria
SAX the content types criteria- Parameters:
cTypes
- the content types- Throws:
SAXException
- if an error occurred while SAXing
-
_saxSitemapCriteria
SAX the pages criteria- Parameters:
pages
- the pages- Throws:
SAXException
- if an error occurred while SAXing
-