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
FieldsModifier and TypeFieldDescriptionThe list of grouping fieldsFields inherited from class org.ametys.plugins.extraction.component.AbstractSolrExtractionComponent
_clauses, _contentTypes, _getQueryFromJSONHelper, _jsonUtils, _queryReferenceIdFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGroupingFields(String... groupingFields) Add grouping fields to the componentvoidconfigure(Configuration configuration) Retrieves the details of the component for treeRetrieves the component grouping fieldsprotected GroupSearchContentorganizeContentsInGroups(Iterable<Content> contents, Locale defaultLocale) Organizes contents in groupsvoidPrepare the execution of the componentprotected abstract voidsaxContents(ContentHandler contentHandler, ExtractionExecutionContext context, ViewItemContainer resultItems, List<Content> contents) Sax a contentprotected voidsaxGroup(ContentHandler contentHandler, GroupSearchContent group, int level, ExtractionExecutionContext context, ViewItemContainer resultItems) 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
_getAttributeTypeId, addClauses, addContentTypes, computeReferencedQueryInfos, executeComponent, getClauses, getContents, getContentSearcher, getContentTypes, getQueryReferenceId, processContents, setQueryReferenceIdMethods inherited from class org.ametys.plugins.extraction.component.AbstractExtractionComponent
addSubComponent, execute, executeSubComponents, getDefaultTagName, getLogsPrefix, getSubComponents, getTagName, setTagNameMethods 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:
servicein interfaceServiceable- Overrides:
servicein classAbstractSolrExtractionComponent- Throws:
ServiceException
-
configure
- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classAbstractSolrExtractionComponent- Throws:
ConfigurationException
-
prepareComponentExecution
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, ViewItemContainer resultItems) 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 contextresultItems- result items to sax- Throws:
Exception- if a error occurred
-
saxContents
protected abstract void saxContents(ContentHandler contentHandler, ExtractionExecutionContext context, ViewItemContainer resultItems, List<Content> contents) throws Exception Sax a content- Parameters:
contentHandler- result documentcontext- execution contextresultItems- result fields to saxcontents- contents to sax- Throws:
Exception- if an error occurs
-
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
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
-