Class DefaultIndexerQueryContextFactory
- java.lang.Object
-
- de.hybris.platform.solrfacetsearch.indexer.impl.DefaultIndexerQueryContextFactory
-
- All Implemented Interfaces:
IndexerQueryContextFactory<DefaultIndexerQueryContext>
public class DefaultIndexerQueryContextFactory extends java.lang.Object implements IndexerQueryContextFactory<DefaultIndexerQueryContext>
Default implementation ofIndexerQueryContextFactory. It uses a thread local variable for storing the context.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringINDEXER_QUERY_LISTENERS_KEY
-
Constructor Summary
Constructors Constructor Description DefaultIndexerQueryContextFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultIndexerQueryContextcreateContext(FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> queryParameters)Creates a new indexer context and sets it as current.protected voidcreateLocalSessionContext()voiddestroyContext()Destroys the current context.voiddestroyContext(java.lang.Exception failureException)Destroys the current context because an exception occurred.protected voidexecuteAfterQueryErrorListeners(DefaultIndexerQueryContext context)protected voidexecuteAfterQueryListeners(DefaultIndexerQueryContext context)protected voidexecuteBeforeQueryListeners(DefaultIndexerQueryContext context)DefaultIndexerQueryContextgetContext()Returns the current context.protected java.util.List<IndexerQueryListener>getListeners(DefaultIndexerQueryContext context)ListenersFactorygetListenersFactory()SessionServicegetSessionService()voidinitializeContext()Initializes the current context and executes the before index listeners (seeIndexerListener.beforeIndex(IndexerContext)).protected voidremoveLocalSessionContext()voidsetListenersFactory(ListenersFactory listenersFactory)voidsetSessionService(SessionService sessionService)
-
-
-
Field Detail
-
INDEXER_QUERY_LISTENERS_KEY
public static final java.lang.String INDEXER_QUERY_LISTENERS_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSessionService
public SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getListenersFactory
public ListenersFactory getListenersFactory()
-
setListenersFactory
public void setListenersFactory(ListenersFactory listenersFactory)
-
createContext
public DefaultIndexerQueryContext createContext(FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> queryParameters) throws IndexerException
Description copied from interface:IndexerQueryContextFactoryCreates a new indexer context and sets it as current.- Specified by:
createContextin interfaceIndexerQueryContextFactory<DefaultIndexerQueryContext>- Parameters:
facetSearchConfig- - the facet search configurationindexedType- - the indexed typequery- - the queryqueryParameters- - the query parameters- Returns:
- the new context
- Throws:
IndexerException- if an error occurs during the listeners execution
-
initializeContext
public void initializeContext() throws IndexerExceptionDescription copied from interface:IndexerQueryContextFactoryInitializes the current context and executes the before index listeners (seeIndexerListener.beforeIndex(IndexerContext)).- Specified by:
initializeContextin interfaceIndexerQueryContextFactory<DefaultIndexerQueryContext>- Throws:
IndexerException- if an error occurs during the listeners execution
-
getContext
public DefaultIndexerQueryContext getContext()
Description copied from interface:IndexerQueryContextFactoryReturns the current context.- Specified by:
getContextin interfaceIndexerQueryContextFactory<DefaultIndexerQueryContext>- Returns:
- the current context
-
destroyContext
public void destroyContext() throws IndexerExceptionDescription copied from interface:IndexerQueryContextFactoryDestroys the current context. Before destroying an active context it executes the after query listeners (seeIndexerQueryListener.afterQuery(IndexerQueryContext)).- Specified by:
destroyContextin interfaceIndexerQueryContextFactory<DefaultIndexerQueryContext>- Throws:
IndexerException- if an error occurs during the listeners execution
-
destroyContext
public void destroyContext(java.lang.Exception failureException)
Description copied from interface:IndexerQueryContextFactoryDestroys the current context because an exception occurred. Before destroying an active context it executes the after query error listeners (seeIndexerQueryListener.afterQueryError(IndexerQueryContext)).- Specified by:
destroyContextin interfaceIndexerQueryContextFactory<DefaultIndexerQueryContext>
-
executeBeforeQueryListeners
protected void executeBeforeQueryListeners(DefaultIndexerQueryContext context) throws IndexerException
- Throws:
IndexerException
-
executeAfterQueryListeners
protected void executeAfterQueryListeners(DefaultIndexerQueryContext context) throws IndexerException
- Throws:
IndexerException
-
executeAfterQueryErrorListeners
protected void executeAfterQueryErrorListeners(DefaultIndexerQueryContext context)
-
getListeners
protected java.util.List<IndexerQueryListener> getListeners(DefaultIndexerQueryContext context)
-
createLocalSessionContext
protected void createLocalSessionContext()
-
removeLocalSessionContext
protected void removeLocalSessionContext()
-
-