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
,Contextualizable
,LogEnabled
,Serviceable
public class QueryExtractionComponent extends AbstractGroupExtractionComponent implements TwoStepsExecutingExtractionComponent, Contextualizable
This class represents a query component of the extraction module
-
-
Field Summary
-
Fields inherited from class org.ametys.plugins.extraction.component.AbstractGroupExtractionComponent
_groupingFields
-
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 QueryExtractionComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumn(String fieldPath, String displayOptionalColumnName)
Add an optional column to the componentvoid
addColumns(String... fieldPaths)
Add columns to the components.void
addSort(String filedPath, Sort.Order order)
Add sort to the componentIterable<Content>
computeFirstLevelResults(ExtractionExecutionContext context)
Computes first level results for preparing multiple extraction executionsprotected void
computeReferencedQueryInfos(String refQueryContent)
Manages the stored query referenced by the componentvoid
configure(Configuration query)
void
contextualize(Context context)
void
executeFor(ContentHandler contentHandler, Iterable<Content> firstLevelResults, ExtractionExecutionContext context)
Execute the extraction of the component for the given first level resultsList<ExtractionColumn>
getColumns()
Retrieves the component columnsMap<String,Object>
getComponentDetailsForTree()
Retrieves the details of the component for treeprotected ContentSearcherFactory.SimpleContentSearcher
getContentSearcher()
Retrieves the content searcher to use for solr searchprotected String
getDefaultTagName()
Retrieves the default tag nameprotected String
getLogsPrefix()
Retrieves the prefix to use in exceptions thrown by this componentMap<String,Sort.Order>
getSorts()
Retrieves the component sortsboolean
overrideColumns()
the referenced query's columnsboolean
overrideSorts()
the referenced query's sortsvoid
prepareComponentExecution(ExtractionExecutionContext context)
Prepare the execution of the componentprotected void
processContents(Iterable<Content> contents, ContentHandler contentHandler, ExtractionExecutionContext context)
Process result contents to format the result documentprotected void
saxContents(ContentHandler contentHandler, ExtractionExecutionContext context, Collection<? extends ResultField> resultFields, List<Content> contents)
Sax a contentvoid
service(ServiceManager serviceManager)
void
setOverrideColumns(boolean overrideColumns)
Set the boolean to override the referenced query's columns or notvoid
setOverrideSorts(boolean overrideSorts)
Set the boolean to override the referenced query's sorts or not-
Methods inherited from class org.ametys.plugins.extraction.component.AbstractGroupExtractionComponent
addGroupingFields, getGroupingFields, organizeContentsInGroups, saxGroup
-
Methods inherited from class org.ametys.plugins.extraction.component.AbstractSolrExtractionComponent
_getAttributeTypeId, addClauses, addContentTypes, executeComponent, getClauses, getContents, getContentTypes, getQueryReferenceId, setQueryReferenceId
-
Methods inherited from class org.ametys.plugins.extraction.component.AbstractExtractionComponent
addSubComponent, execute, executeSubComponents, getSubComponents, getTagName, setTagName
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.extraction.component.ExtractionComponent
addSubComponent, getContentTypes, getSubComponents
-
Methods inherited from interface org.ametys.plugins.extraction.component.TwoStepsExecutingExtractionComponent
execute
-
-
-
-
Constructor Detail
-
QueryExtractionComponent
public QueryExtractionComponent()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractGroupExtractionComponent
- Throws:
ServiceException
-
configure
public void configure(Configuration query) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractGroupExtractionComponent
- 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 classAbstractGroupExtractionComponent
- Parameters:
context
- context of the extraction component- Throws:
Exception
- if an error occurs
-
computeReferencedQueryInfos
protected void computeReferencedQueryInfos(String refQueryContent) throws QuerySyntaxException
Description copied from class:AbstractSolrExtractionComponent
Manages the stored query referenced by the component- Overrides:
computeReferencedQueryInfos
in classAbstractSolrExtractionComponent
- Parameters:
refQueryContent
- referenced query content- Throws:
QuerySyntaxException
- if there is a syntax error in the referenced query
-
getContentSearcher
protected ContentSearcherFactory.SimpleContentSearcher getContentSearcher()
Description copied from class:AbstractSolrExtractionComponent
Retrieves the content searcher to use for solr search- Overrides:
getContentSearcher
in classAbstractSolrExtractionComponent
- Returns:
- the content searcher
-
processContents
protected void processContents(Iterable<Content> contents, ContentHandler contentHandler, ExtractionExecutionContext context) throws Exception
Description copied from class:AbstractSolrExtractionComponent
Process result contents to format the result document- Specified by:
processContents
in 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:TwoStepsExecutingExtractionComponent
Computes first level results for preparing multiple extraction executions- Specified by:
computeFirstLevelResults
in 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:TwoStepsExecutingExtractionComponent
Execute the extraction of the component for the given first level results- Specified by:
executeFor
in 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, Collection<? extends ResultField> resultFields, List<Content> contents) throws Exception
Description copied from class:AbstractGroupExtractionComponent
Sax a content- Specified by:
saxContents
in classAbstractGroupExtractionComponent
- 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 classAbstractGroupExtractionComponent
- Returns:
- a
Map
containing component details
-
getDefaultTagName
protected String getDefaultTagName()
Description copied from class:AbstractExtractionComponent
Retrieves the default tag name- Specified by:
getDefaultTagName
in classAbstractExtractionComponent
- Returns:
- the default tag name
-
getLogsPrefix
protected String getLogsPrefix()
Description copied from class:AbstractExtractionComponent
Retrieves the prefix to use in exceptions thrown by this component- Specified by:
getLogsPrefix
in classAbstractExtractionComponent
- Returns:
- the prefix for exceptions
-
overrideColumns
public boolean overrideColumns()
the referenced query's columns- Returns:
true
if the referenced query's columns are overridden on this component,false
otherwise
-
setOverrideColumns
public void setOverrideColumns(boolean overrideColumns)
Set the boolean to override the referenced query's columns or not- Parameters:
overrideColumns
-true
to override columns,false
otherwise
-
getColumns
public List<ExtractionColumn> getColumns()
Retrieves the component columns- Returns:
- The component columns
-
addColumns
public void addColumns(String... fieldPaths)
Add columns to the components. Do not manage optional columns' variables- Parameters:
fieldPaths
- Array of columns' field paths to add
-
addColumn
public void addColumn(String fieldPath, String displayOptionalColumnName)
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
public boolean overrideSorts()
the referenced query's sorts- Returns:
true
if the referenced query's sorts are overridden on this component,false
otherwise
-
setOverrideSorts
public void setOverrideSorts(boolean overrideSorts)
Set the boolean to override the referenced query's sorts or not- Parameters:
overrideSorts
-true
to override sorts,false
otherwise
-
getSorts
public Map<String,Sort.Order> getSorts()
Retrieves the component sorts- Returns:
- The component sorts
-
addSort
public void addSort(String filedPath, Sort.Order order)
Add sort to the component- Parameters:
filedPath
- Field on which apply sortorder
- sort order to apply for field
-
-