Class QueryExtractionComponent
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
org.ametys.plugins.extraction.component.QueryExtractionComponent
- All Implemented Interfaces:
ExtractionComponent,TwoStepsExecutingExtractionComponent,Configurable,LogEnabled,Serviceable
public class QueryExtractionComponent
extends AbstractGroupExtractionComponent
implements TwoStepsExecutingExtractionComponent
This class represents a query component of the extraction module
-
Field Summary
Fields inherited from class org.ametys.plugins.extraction.component.AbstractGroupExtractionComponent
_groupingFieldsFields 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 TypeMethodDescriptionvoidAdd an optional column to the componentvoidaddColumns(String... fieldPaths) Add columns to the components.voidAdd sort to the componentComputes first level results for preparing multiple extraction executionsprotected voidcomputeReferencedQueryInfos(String refQueryContent) Manages the stored query referenced by the componentvoidconfigure(Configuration query) voidexecuteFor(ContentHandler contentHandler, Iterable<Content> firstLevelResults, ExtractionExecutionContext context) Execute the extraction of the component for the given first level resultsRetrieves the component columnsRetrieves the details of the component for treeRetrieves the content searcher to use for solr searchprotected StringRetrieves the default tag nameprotected StringRetrieves the prefix to use in exceptions thrown by this componentgetSorts()Retrieves the component sortsbooleanthe referenced query's columnsbooleanthe referenced query's sortsvoidPrepare the execution of the componentprotected voidprocessContents(Iterable<Content> contents, ContentHandler contentHandler, ExtractionExecutionContext context) Process result contents to format the result documentprotected voidsaxContents(ContentHandler contentHandler, ExtractionExecutionContext context, ViewItemContainer resultItems, List<Content> contents) Sax a contentvoidservice(ServiceManager serviceManager) voidsetOverrideColumns(boolean overrideColumns) Set the boolean to override the referenced query's columns or notvoidsetOverrideSorts(boolean overrideSorts) Set the boolean to override the referenced query's sorts or notMethods inherited from class org.ametys.plugins.extraction.component.AbstractGroupExtractionComponent
addGroupingFields, getGroupingFields, organizeContentsInGroups, saxGroupMethods inherited from class org.ametys.plugins.extraction.component.AbstractSolrExtractionComponent
_getAttributeTypeId, addClauses, addContentTypes, executeComponent, getClauses, getContents, getContentTypes, getQueryReferenceId, setQueryReferenceIdMethods inherited from class org.ametys.plugins.extraction.component.AbstractExtractionComponent
addSubComponent, execute, executeSubComponents, getSubComponents, getTagName, setTagNameMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.plugins.extraction.component.ExtractionComponent
addSubComponent, getContentTypes, getSubComponentsMethods inherited from interface org.ametys.plugins.extraction.component.TwoStepsExecutingExtractionComponent
execute
-
Constructor Details
-
QueryExtractionComponent
public QueryExtractionComponent()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractGroupExtractionComponent- Throws:
ServiceException
-
configure
- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classAbstractGroupExtractionComponent- Throws:
ConfigurationException
-
prepareComponentExecution
Description copied from interface:ExtractionComponentPrepare the execution of the component- Specified by:
prepareComponentExecutionin interfaceExtractionComponent- Overrides:
prepareComponentExecutionin classAbstractGroupExtractionComponent- Parameters:
context- context of the extraction component- Throws:
Exception- if an error occurs
-
computeReferencedQueryInfos
Description copied from class:AbstractSolrExtractionComponentManages the stored query referenced by the component- Overrides:
computeReferencedQueryInfosin classAbstractSolrExtractionComponent- Parameters:
refQueryContent- referenced query content- Throws:
QuerySyntaxException- if there is a syntax error in the referenced query
-
getContentSearcher
Description copied from class:AbstractSolrExtractionComponentRetrieves the content searcher to use for solr search- Overrides:
getContentSearcherin classAbstractSolrExtractionComponent- Returns:
- the content searcher
-
processContents
protected void processContents(Iterable<Content> contents, ContentHandler contentHandler, ExtractionExecutionContext context) throws Exception Description copied from class:AbstractSolrExtractionComponentProcess result contents to format the result document- Specified by:
processContentsin classAbstractSolrExtractionComponent- Parameters:
contents- search resultscontentHandler- result documentcontext- component execution context- Throws:
Exception- if an error occurs
-
computeFirstLevelResults
public Iterable<Content> computeFirstLevelResults(ExtractionExecutionContext context) throws Exception Description copied from interface:TwoStepsExecutingExtractionComponentComputes first level results for preparing multiple extraction executions- Specified by:
computeFirstLevelResultsin interfaceTwoStepsExecutingExtractionComponent- Parameters:
context- context of the extraction component- Returns:
- The first level content results
- Throws:
Exception- if an error occurs
-
executeFor
public void executeFor(ContentHandler contentHandler, Iterable<Content> firstLevelResults, ExtractionExecutionContext context) throws Exception Description copied from interface:TwoStepsExecutingExtractionComponentExecute the extraction of the component for the given first level results- Specified by:
executeForin interfaceTwoStepsExecutingExtractionComponent- Parameters:
contentHandler- result documentfirstLevelResults- A subset of the first level content results previously returned byTwoStepsExecutingExtractionComponent.computeFirstLevelResults(ExtractionExecutionContext)context- context of the extraction component- Throws:
Exception- if an error occurs
-
saxContents
protected void saxContents(ContentHandler contentHandler, ExtractionExecutionContext context, ViewItemContainer resultItems, List<Content> contents) throws Exception Description copied from class:AbstractGroupExtractionComponentSax a content- Specified by:
saxContentsin classAbstractGroupExtractionComponent- 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 classAbstractGroupExtractionComponent- Returns:
- a
Mapcontaining component details
-
getDefaultTagName
Description copied from class:AbstractExtractionComponentRetrieves the default tag name- Specified by:
getDefaultTagNamein classAbstractExtractionComponent- Returns:
- the default tag name
-
getLogsPrefix
Description copied from class:AbstractExtractionComponentRetrieves the prefix to use in exceptions thrown by this component- Specified by:
getLogsPrefixin classAbstractExtractionComponent- Returns:
- the prefix for exceptions
-
overrideColumns
the referenced query's columns- Returns:
trueif the referenced query's columns are overridden on this component,falseotherwise
-
setOverrideColumns
Set the boolean to override the referenced query's columns or not- Parameters:
overrideColumns-trueto override columns,falseotherwise
-
getColumns
Retrieves the component columns- Returns:
- The component columns
-
addColumns
Add columns to the components. Do not manage optional columns' variables- Parameters:
fieldPaths- Array of columns' field paths to add
-
addColumn
Add an optional column to the component- Parameters:
fieldPath- The column's field pathdisplayOptionalColumnName- The name of the variable that manage the display of this optional column
-
overrideSorts
the referenced query's sorts- Returns:
trueif the referenced query's sorts are overridden on this component,falseotherwise
-
setOverrideSorts
Set the boolean to override the referenced query's sorts or not- Parameters:
overrideSorts-trueto override sorts,falseotherwise
-
getSorts
Retrieves the component sorts- Returns:
- The component sorts
-
addSort
Add sort to the component- Parameters:
filedPath- Field on which apply sortorder- sort order to apply for field
-