Class AbstractGroupExtractionComponent
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.extraction.component.AbstractExtractionComponent
-
- org.ametys.plugins.extraction.component.AbstractSolrExtractionComponent
-
- org.ametys.plugins.extraction.component.AbstractGroupExtractionComponent
-
- All Implemented Interfaces:
ExtractionComponent
,Configurable
,LogEnabled
,Serviceable
- Direct Known Subclasses:
CountExtractionComponent
,QueryExtractionComponent
public abstract class AbstractGroupExtractionComponent extends AbstractSolrExtractionComponent
This class represents an extraction component with grouping fields
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
_groupingFields
The list of grouping fields-
Fields inherited from class org.ametys.plugins.extraction.component.AbstractSolrExtractionComponent
_clauses, _contentTypes, _getQueryFromJSONHelper, _jsonUtils, _queryReferenceId
-
Fields inherited from class org.ametys.plugins.extraction.component.AbstractExtractionComponent
_contentTypeExtensionPoint, _contentTypesHelper, _subComponents, _tagName, _thesaurusDAO, EXTRACTION_ITEM_PATH_SEPARATOR, JOIN_HIERARCHY_ELEMENT, JOIN_HIERARCHY_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description AbstractGroupExtractionComponent()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addGroupingFields(String... groupingFields)
Add grouping fields to the componentvoid
configure(Configuration configuration)
Map<String,Object>
getComponentDetailsForTree()
Retrieves the details of the component for treeList<String>
getGroupingFields()
Retrieves the component grouping fieldsprotected GroupSearchContent
organizeContentsInGroups(Iterable<Content> contents, Locale defaultLocale)
Organizes contents in groupsvoid
prepareComponentExecution(ExtractionExecutionContext context)
Prepare the execution of the componentprotected abstract void
saxContents(ContentHandler contentHandler, ExtractionExecutionContext context, Collection<? extends ResultField> resultFields, List<Content> contents)
Sax a contentprotected void
saxGroup(ContentHandler contentHandler, GroupSearchContent group, int level, ExtractionExecutionContext context, Collection<? extends ResultField> resultFields)
Recursive method that saxes group of contents First level (level=0) will not create a xml group (usually, 1st group is just here to handle a list)void
service(ServiceManager serviceManager)
-
Methods inherited from class org.ametys.plugins.extraction.component.AbstractSolrExtractionComponent
_getAttributeTypeId, addClauses, addContentTypes, computeReferencedQueryInfos, executeComponent, getClauses, getContents, getContentSearcher, getContentTypes, getQueryReferenceId, processContents, setQueryReferenceId
-
Methods inherited from class org.ametys.plugins.extraction.component.AbstractExtractionComponent
addSubComponent, execute, executeSubComponents, getDefaultTagName, getLogsPrefix, getSubComponents, getTagName, setTagName
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_groupingFields
protected List<String> _groupingFields
The list of grouping fields
-
-
Constructor Detail
-
AbstractGroupExtractionComponent
public AbstractGroupExtractionComponent()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSolrExtractionComponent
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractSolrExtractionComponent
- Throws:
ConfigurationException
-
prepareComponentExecution
public void prepareComponentExecution(ExtractionExecutionContext context) throws Exception
Description copied from interface:ExtractionComponent
Prepare the execution of the component- Specified by:
prepareComponentExecution
in interfaceExtractionComponent
- Overrides:
prepareComponentExecution
in classAbstractSolrExtractionComponent
- Parameters:
context
- context of the extraction component- Throws:
Exception
- if an error occurs
-
organizeContentsInGroups
protected GroupSearchContent organizeContentsInGroups(Iterable<Content> contents, Locale defaultLocale)
Organizes contents in groups- Parameters:
contents
- The contents to organizedefaultLocale
- The default locale for localized values. Only useful if grouping by multilingual contents or multilingual string- Returns:
- groups of content
-
saxGroup
protected void saxGroup(ContentHandler contentHandler, GroupSearchContent group, int level, ExtractionExecutionContext context, Collection<? extends ResultField> resultFields) throws Exception
Recursive method that saxes group of contents First level (level=0) will not create a xml group (usually, 1st group is just here to handle a list)- Parameters:
contentHandler
- result documentgroup
- group to saxlevel
- current level (start with zero)context
- execution contextresultFields
- result fields to sax- Throws:
Exception
- if a error occurred
-
saxContents
protected abstract void saxContents(ContentHandler contentHandler, ExtractionExecutionContext context, Collection<? extends ResultField> resultFields, List<Content> contents) throws Exception
Sax a content- Parameters:
contentHandler
- result documentcontext
- execution contextresultFields
- result fields to saxcontents
- contents to sax- Throws:
Exception
- if an error occurs
-
getComponentDetailsForTree
public Map<String,Object> getComponentDetailsForTree()
Description copied from interface:ExtractionComponent
Retrieves the details of the component for tree- Specified by:
getComponentDetailsForTree
in interfaceExtractionComponent
- Overrides:
getComponentDetailsForTree
in classAbstractSolrExtractionComponent
- Returns:
- a
Map
containing component details
-
getGroupingFields
public List<String> getGroupingFields()
Retrieves the component grouping fields- Returns:
- The component grouping fields
-
addGroupingFields
public void addGroupingFields(String... groupingFields)
Add grouping fields to the component- Parameters:
groupingFields
- Array of the grouping fields to add
-
-