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.FieldRef
buildFieldRef
(@NonNull com.broadleafcommerce.search.api.domain.FieldDefinition field) Builds theFieldRef
object based on theFieldDefinition
protected com.broadleafcommerce.common.extension.cache.CacheStateManager
protected 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.TypeFactory
void
hydrateFieldDefinitions
(@NonNull Iterable<R> relevancyRules, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates the fullFieldDefinition
on 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 namevoid
setTypeFactory
(com.broadleafcommerce.common.extension.TypeFactory typeFactory) Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAll
Methods 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, updateSort
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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, updateSort
Methods 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:RelevancyRuleService
Retrieves a paged list of relevancy-rules by name- Specified by:
readAllByName
in interfaceRelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>
- Parameters:
name
- the name field being queriedfilters
- additional filters to apply in the query. Should beEmptyNode
if 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:RelevancyRuleService
Hydrates the fullFieldDefinition
on the provided relevancy-rules.- Specified by:
hydrateFieldDefinitions
in interfaceRelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>
- Parameters:
relevancyRules
- AnIterable<com.broadleafcommerce.search.api.domain.RelevancyRule>
. Uses iterable to support takingCollections
orPages
.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:RelevancyRuleService
Reads all non-archived relevancy rules by context ID- Specified by:
readAllById
in 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:RelevancyRuleService
Retrieves a list of relevancy rules for the provided field definition IDs- Specified by:
readAllByFieldDefinitionIdIn
in 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:RelevancyRuleService
Get the name of the Jpa Domain representation of the object- Specified by:
getRepositoryDomain
in 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 theFieldRef
object based on theFieldDefinition
- Parameters:
field
- TheFieldDefinition
which is to be converted to aFieldRef
- Returns:
- The
FieldRef
object
-
getRepository
protected RelevancyRuleRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()- Overrides:
getRepository
in 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()
-