Class DefaultFlexibleSearchService
java.lang.Object
de.hybris.platform.servicelayer.internal.service.AbstractService
de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService
- All Implemented Interfaces:
FlexibleSearchService,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
QueryBasedTasksProviderTest.TestFlexibleSearchService
public class DefaultFlexibleSearchService
extends AbstractBusinessService
implements FlexibleSearchService
Default implementation of the flexible search service.
- Since:
- 4.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO -
Field Summary
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManagerFields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> SearchResultImpl<T>createEmptyResult(SearchResult<T> jaloResult) protected FlexibleSearch<T> TgetModelByExample(T example) Search for an existing object (in the database) by a given (not saved) example.protected ModelConvertergetModelConverterByModel(Object model) <T> List<T>getModelsByExample(T example) Search for an existing objects (in the database) by a given (not saved) example.protected StringgetSourceTypeFromModel(Object model) Checks for the presence ofReadOnlyConditionsHelper.CTX_ENABLE_FS_ON_READ_REPLICAin SessionContext associated with the calling thread, which is the property responsible for enabling read-only datasource.Checks for the presence ofReadOnlyConditionsHelper.CTX_ENABLE_FS_ON_READ_REPLICAin the passed SessionContext, which is the property responsible for enabling read-only datasource.Must be overwritten! Use <lookup-method> in spring.Must be overwritten! Use <lookup-method> in spring.<T> voidprocessSearchRows(FlexibleSearchQuery query, Consumer<T> rowConsumer) Search.<T> SearchResult<T>search(FlexibleSearchQuery query) Search.<T> SearchResult<T>Simplest search available.<T> SearchResult<T>Convenience method which internally delegates toFlexibleSearchService.search(FlexibleSearchQuery).<T> SearchResult<T>searchRelation(ItemModel model, String attribute, int start, int count) This method is not implemented.<T> SearchResult<T>searchRelation(RelationQuery query) This method is not implemented.<T> TsearchUnique(FlexibleSearchQuery searchQuery) Searches for exactly one model fitting givenFlexibleSearchQuery.voidsetModelResolver(ItemObjectResolver modelResolver) voidsetMultiModelResolver(ItemObjectResolver multiModelResolver) <T> TtoPersistenceLayer(Object modelValue) translate(FlexibleSearchQuery query) TranslatesFlexibleSearchQueryintoTranslationResultobject which contains translatedFlexibleSearchQueryto real SQL query and all parameters which will be used in SQL query.Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerMethods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplaceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.servicelayer.search.FlexibleSearchService
processSearchRows
-
Constructor Details
-
DefaultFlexibleSearchService
public DefaultFlexibleSearchService()
-
-
Method Details
-
getConverterRegistry
-
getModelByExample
public <T> T getModelByExample(T example) Description copied from interface:FlexibleSearchServiceSearch for an existing object (in the database) by a given (not saved) example. Every modified attribute in this example is used as search parameter.- Specified by:
getModelByExamplein interfaceFlexibleSearchService- Type Parameters:
T- the type of the example and the return type- Parameters:
example- the example- Returns:
- the result if this was found by the example.
-
getModelsByExample
Description copied from interface:FlexibleSearchServiceSearch for an existing objects (in the database) by a given (not saved) example. Every modified attribute in this example is used as search parameter. Returns all matching results.- Specified by:
getModelsByExamplein interfaceFlexibleSearchService- Type Parameters:
T- the type of the example and the return type- Parameters:
example- the example- Returns:
- the list of models found by the example.
-
getModelSearchStrategy
-
getQueryPreprocessorRegistry
-
lookupConverterRegistry
Must be overwritten! Use <lookup-method> in spring. -
lookupModelSearchStrategy
Must be overwritten! Use <lookup-method> in spring. -
lookupQueryPreprocessorRegistry
-
search
Search.- Specified by:
searchin interfaceFlexibleSearchService- Parameters:
query- the search query- Returns:
- the search result< t>
-
processSearchRows
Description copied from interface:FlexibleSearchServiceSearch.- Specified by:
processSearchRowsin interfaceFlexibleSearchService- Parameters:
query- the search queryrowConsumer- consumer for rows fetched from DB
-
createEmptyResult
-
search
Simplest search available.- Specified by:
searchin interfaceFlexibleSearchService- Parameters:
query- the query- Returns:
- the search result< t>
-
search
Convenience method which internally delegates toFlexibleSearchService.search(FlexibleSearchQuery).- Specified by:
searchin interfaceFlexibleSearchService- Parameters:
query- query string in flexible search syntaxqueryParams- additional query parameters; null permitted- Returns:
- the search result< t>
-
searchRelation
This method is not implemented.- Specified by:
searchRelationin interfaceFlexibleSearchService
-
searchRelation
This method is not implemented.- Specified by:
searchRelationin interfaceFlexibleSearchService
-
searchUnique
Searches for exactly one model fitting givenFlexibleSearchQuery. Throws an exception when more or none results found.- Specified by:
searchUniquein interfaceFlexibleSearchService- Parameters:
searchQuery- the search query- Returns:
- the search result< t>
-
setModelResolver
-
setMultiModelResolver
-
translate
Translates
FlexibleSearchQueryintoTranslationResultobject which contains translatedFlexibleSearchQueryto real SQL query and all parameters which will be used in SQL query.Translation also respects
SearchRestrictionModelbased restrictions for types and users.- Specified by:
translatein interfaceFlexibleSearchService- Parameters:
query-FlexibleSearchQueryto be translated.- Returns:
TranslationResultobject containing SQL query with parameters.
-
getModelConverterByModel
-
getSourceTypeFromModel
-
getFlexibleSearchInstance
-
toPersistenceLayer
-
isReadOnlyDataSourceEnabled
Description copied from interface:FlexibleSearchServiceChecks for the presence ofReadOnlyConditionsHelper.CTX_ENABLE_FS_ON_READ_REPLICAin SessionContext associated with the calling thread, which is the property responsible for enabling read-only datasource.- Specified by:
isReadOnlyDataSourceEnabledin interfaceFlexibleSearchService- Returns:
Optional.of(true)if the session has the attribute set totrue(or string equivalent);Optional.of(false)if the session has the attribute set tofalse(or string equivalent);Optional.empty()if there is no attribute defined in the session or it cannot be parsed to boolean
-
isReadOnlyDataSourceEnabled
Description copied from interface:FlexibleSearchServiceChecks for the presence ofReadOnlyConditionsHelper.CTX_ENABLE_FS_ON_READ_REPLICAin the passed SessionContext, which is the property responsible for enabling read-only datasource.- Specified by:
isReadOnlyDataSourceEnabledin interfaceFlexibleSearchService- Parameters:
ctx- the session context- Returns:
Optional.of(true)if the session has the attribute set totrue(or string equivalent);Optional.of(false)if the session has the attribute set tofalse(or string equivalent);Optional.empty()if there is no attribute defined in the session or it cannot be parsed to boolean
-