Class DefaultRelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<R>
com.broadleafcommerce.search.core.service.relevancyrule.DefaultRelevancyRuleService<R>
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<R>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<R>,RelevancyRuleService<R>
public class DefaultRelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<R>
implements RelevancyRuleService<R>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultRelevancyRuleService(RelevancyRuleRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitionService, com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> filterParser, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.search.api.domain.FieldRefbuildFieldRef(@NonNull com.broadleafcommerce.search.api.domain.FieldDefinition field) Builds theFieldRefobject based on theFieldDefinitionprotected com.broadleafcommerce.common.extension.cache.CacheStateManagerprotected FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition>protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node>protected RelevancyRuleRepository<com.broadleafcommerce.data.tracking.core.Trackable>Get the name of the Jpa Domain representation of the objectprotected com.broadleafcommerce.common.extension.TypeFactoryvoidhydrateFieldDefinitions(@NonNull Iterable<R> relevancyRules, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates the fullFieldDefinitionon the provided relevancy-rules.readAllByFieldDefinitionIdIn(@NonNull Iterable<String> fieldDefinitionIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieves a list of relevancy rules for the provided field definition IDsreadAllById(@NonNull List<String> relevancyRuleIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all non-archived relevancy rules by context IDorg.springframework.data.domain.Page<R>readAllByName(String name, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a paged list of relevancy-rules by namevoidsetTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAllMethods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Field Details
-
CACHE_RELEVANCY_RULE_BY_FIELD_DEFINITION_IDS
- See Also:
-
CACHE_RELEVANCY_RULE_BY_CONTEXT_IDS
- See Also:
-
-
Constructor Details
-
DefaultRelevancyRuleService
public DefaultRelevancyRuleService(RelevancyRuleRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitionService, com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> filterParser, @Nullable com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
-
-
Method Details
-
readAllByName
public org.springframework.data.domain.Page<R> readAllByName(@Nullable String name, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:RelevancyRuleServiceRetrieves a paged list of relevancy-rules by name- Specified by:
readAllByNamein interfaceRelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>- Parameters:
name- the name field being queriedfilters- additional filters to apply in the query. Should beEmptyNodeif no additional filters should be applied.page- the requested page of results from the databasecontextInfo- context information around sandbox and multitenant state- Returns:
- a paged list of relevancy-rules from the underlying repository
-
hydrateFieldDefinitions
public void hydrateFieldDefinitions(@NonNull @NonNull Iterable<R> relevancyRules, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:RelevancyRuleServiceHydrates the fullFieldDefinitionon the provided relevancy-rules.- Specified by:
hydrateFieldDefinitionsin interfaceRelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>- Parameters:
relevancyRules- AnIterable<com.broadleafcommerce.search.api.domain.RelevancyRule>. Uses iterable to support takingCollectionsorPages.contextInfo- Additional sandbox and multitenant info
-
readAllById
public List<R> readAllById(@NonNull @NonNull List<String> relevancyRuleIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:RelevancyRuleServiceReads all non-archived relevancy rules by context ID- Specified by:
readAllByIdin interfaceRelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>- Parameters:
relevancyRuleIds- the list of relevancy rule ids to filter oncontextInfo- context information around sandbox and multitenant state- Returns:
- all non-archived relevancy rules by context ID
-
readAllByFieldDefinitionIdIn
public List<R> readAllByFieldDefinitionIdIn(@NonNull @NonNull Iterable<String> fieldDefinitionIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:RelevancyRuleServiceRetrieves a list of relevancy rules for the provided field definition IDs- Specified by:
readAllByFieldDefinitionIdInin interfaceRelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>- Parameters:
fieldDefinitionIds- the field definition IDs to query oncontext- context information around sandbox and multitenant state- Returns:
- a list of relevancy rules for the provided field definition IDs
-
getRepositoryDomain
Description copied from interface:RelevancyRuleServiceGet the name of the Jpa Domain representation of the object- Specified by:
getRepositoryDomainin interfaceRelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>- Returns:
- the name of the Jpa Domain representation of the object
-
buildFieldRef
protected com.broadleafcommerce.search.api.domain.FieldRef buildFieldRef(@NonNull @NonNull com.broadleafcommerce.search.api.domain.FieldDefinition field) Builds theFieldRefobject based on theFieldDefinition- Parameters:
field- TheFieldDefinitionwhich is to be converted to aFieldRef- Returns:
- The
FieldRefobject
-
getRepository
protected RelevancyRuleRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()- Overrides:
getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>
-
getFieldDefinitionService
protected FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> getFieldDefinitionService() -
getCacheStateManager
@Nullable protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
getParser
protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> getParser()
-