public abstract class AbstractTagCloudGenerator extends ServiceableGenerator implements Contextualizable
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractTagCloudGenerator.ItemOccurrenceComparator
Compares two terms by descending occurrence count.
|
protected static interface |
AbstractTagCloudGenerator.TagCloudItem
Abstract class for a tag cloud item
|
Modifier and Type | Field and Description |
---|---|
protected TagCloudCacheManager |
_cacheManager
The cache manager
|
protected Context |
_context
The context
|
protected AmetysObjectResolver |
_resolver
The Ametys object resolver
|
protected SolrClient |
_solrClient
The solr client.
|
protected SolrClientProvider |
_solrClientProvider
The solr client provider.
|
protected static Comparator<AbstractTagCloudGenerator.TagCloudItem> |
OCCURRENCE_COMPARATOR
Compares tag cloud items
|
manager
objectModel, parameters, resolver, source
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
Constructor and Description |
---|
AbstractTagCloudGenerator() |
Modifier and Type | Method and Description |
---|---|
protected 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 queries
|
protected int |
_getFontSize(int nb,
int min,
int max)
Get the font size
|
protected void |
_saxAdditionalAttributes(AbstractTagCloudGenerator.TagCloudItem item,
AttributesImpl attrs)
Sax additional attributes for item
|
protected void |
_saxContentTypeCriteria(String[] cTypes)
SAX the content types criteria
|
protected void |
_saxFormParameters(String[] cTypes,
String[] pages)
SAX teh form search criteria
|
protected void |
_saxSitemapCriteria(String[] pages)
SAX the pages criteria
|
protected SolrQuery |
build(Query query)
Build a
SolrQuery from a Query object. |
void |
contextualize(Context context) |
void |
generate() |
protected abstract List<AbstractTagCloudGenerator.TagCloudItem> |
getTagCloudItems(String siteName,
String lang,
CompositeMetadata serviceParameters)
Get the tag cloud items
|
protected void |
saxTagCloudItem(AbstractTagCloudGenerator.TagCloudItem item,
int min,
int max)
Sax a tag cloud item
|
void |
service(ServiceManager serviceManager) |
dispose
recycle, setup
setConsumer, setContentHandler, setLexicalHandler
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setConsumer
protected static final Comparator<AbstractTagCloudGenerator.TagCloudItem> OCCURRENCE_COMPARATOR
protected AmetysObjectResolver _resolver
protected TagCloudCacheManager _cacheManager
protected SolrClientProvider _solrClientProvider
protected SolrClient _solrClient
public AbstractTagCloudGenerator()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
service
in class ServiceableGenerator
ServiceException
public void generate() throws IOException, SAXException, ProcessingException
generate
in interface Generator
IOException
SAXException
ProcessingException
protected abstract List<AbstractTagCloudGenerator.TagCloudItem> getTagCloudItems(String siteName, String lang, CompositeMetadata serviceParameters) throws IOException, ProcessingException
siteName
- The site namelang
- The languageserviceParameters
- The service parametersIOException
- if an error occurs when manipulating filesProcessingException
- if an error occurs during the retrieving of the tag cloud itemsprotected void saxTagCloudItem(AbstractTagCloudGenerator.TagCloudItem item, int min, int max) throws SAXException
item
- The tag cloud item to saxmin
- The min number of occurrencemax
- The max number of occurrenceSAXException
- if an error occurs while saxingprotected SolrQuery build(Query query) throws QuerySyntaxException
SolrQuery
from a Query object.query
- the Query object.QuerySyntaxException
- if an error occurs.protected void _saxAdditionalAttributes(AbstractTagCloudGenerator.TagCloudItem item, AttributesImpl attrs) throws SAXException
item
- The tag cloud itemattrs
- The attributesSAXException
- if an error occurs while saxingprotected void _addContentTypeQuery(Collection<Query> queries, String[] cTypes)
queries
- The query collection.cTypes
- the content types. Can be empty or nullprotected void _addPagesQuery(Collection<Query> queries, String[] pageIds)
queries
- The query collection.pageIds
- The page IDs.protected void _saxFormParameters(String[] cTypes, String[] pages) throws SAXException
cTypes
- the content typespages
- the pagesSAXException
- if an error occurred while SAXingprotected int _getFontSize(int nb, int min, int max)
nb
- the number of occurrencemin
- the min number of occurrencemax
- the max number of occurrenceprotected void _saxContentTypeCriteria(String[] cTypes) throws SAXException
cTypes
- the content typesSAXException
- if an error occurred while SAXingprotected void _saxSitemapCriteria(String[] pages) throws SAXException
pages
- the pagesSAXException
- if an error occurred while SAXing