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
This class represents an extraction component with grouping fields
-
Field Summary
Modifier and TypeFieldDescriptionThe list of grouping fieldsFields 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addGroupingFields
(String... groupingFields) Add grouping fields to the componentvoid
configure
(Configuration configuration) Retrieves the details of the component for treeRetrieves the component grouping fieldsprotected GroupSearchContent
organizeContentsInGroups
(Iterable<Content> contents, Locale defaultLocale) Organizes contents in groupsvoid
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 Details
-
_groupingFields
The list of grouping fields
-
-
Constructor Details
-
AbstractGroupExtractionComponent
public AbstractGroupExtractionComponent()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSolrExtractionComponent
- Throws:
ServiceException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractSolrExtractionComponent
- Throws:
ConfigurationException
-
prepareComponentExecution
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
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
Retrieves the component grouping fields- Returns:
- The component grouping fields
-
addGroupingFields
Add grouping fields to the component- Parameters:
groupingFields
- Array of the grouping fields to add
-