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>_groupingFieldsThe list of grouping fieldsprivate GroupSearchContentHelper_groupSearchContentHelper-
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 voidaddGroupingFields(String... groupingFields)Add grouping fields to the componentvoidconfigure(Configuration configuration)Map<String,Object>getComponentDetailsForTree()Retrieves the details of the component for treeList<String>getGroupingFields()Retrieves the component grouping fieldsprotected GroupSearchContentorganizeContentsInGroups(Iterable<Content> contents, Locale defaultLocale)Organizes contents in groupsvoidprepareComponentExecution(ExtractionExecutionContext context)Prepare the execution of the componentprotected abstract voidsaxContents(ContentHandler contentHandler, ExtractionExecutionContext context, Collection<? extends ResultField> resultFields, List<Content> contents)Sax a contentprotected voidsaxGroup(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)voidservice(ServiceManager serviceManager)-
Methods inherited from class org.ametys.plugins.extraction.component.AbstractSolrExtractionComponent
_extractGroupExpressionsFromClause, _extractVariableFromClauseExpression, _getAttributeTypeId, _getClauseQueries, 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
-
_groupSearchContentHelper
private GroupSearchContentHelper _groupSearchContentHelper
-
-
Constructor Detail
-
AbstractGroupExtractionComponent
public AbstractGroupExtractionComponent()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractSolrExtractionComponent- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classAbstractSolrExtractionComponent- Throws:
ConfigurationException
-
prepareComponentExecution
public void prepareComponentExecution(ExtractionExecutionContext context) throws Exception
Description copied from interface:ExtractionComponentPrepare the execution of the component- Specified by:
prepareComponentExecutionin interfaceExtractionComponent- Overrides:
prepareComponentExecutionin 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:ExtractionComponentRetrieves the details of the component for tree- Specified by:
getComponentDetailsForTreein interfaceExtractionComponent- Overrides:
getComponentDetailsForTreein classAbstractSolrExtractionComponent- Returns:
- a
Mapcontaining 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
-
-