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
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.broadleafcommerce.search.api.domain.FieldRef
    buildFieldRef(@NonNull com.broadleafcommerce.search.api.domain.FieldDefinition field)
    Builds the FieldRef object based on the FieldDefinition
    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 object
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    void
    hydrateFieldDefinitions(@NonNull Iterable<R> relevancyRules, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Hydrates the full FieldDefinition 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 IDs
    readAllById(@NonNull List<String> relevancyRuleIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all non-archived relevancy rules by context ID
    org.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 name
    void
    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

      public static final String CACHE_RELEVANCY_RULE_BY_FIELD_DEFINITION_IDS
      See Also:
    • CACHE_RELEVANCY_RULE_BY_CONTEXT_IDS

      public static final String 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 interface RelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>
      Parameters:
      name - the name field being queried
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      page - the requested page of results from the database
      contextInfo - 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 full FieldDefinition on the provided relevancy-rules.
      Specified by:
      hydrateFieldDefinitions in interface RelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>
      Parameters:
      relevancyRules - An Iterable<com.broadleafcommerce.search.api.domain.RelevancyRule>. Uses iterable to support taking Collections or Pages.
      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 interface RelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>
      Parameters:
      relevancyRuleIds - the list of relevancy rule ids to filter on
      contextInfo - 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 interface RelevancyRuleService<R extends com.broadleafcommerce.search.api.domain.RelevancyRule>
      Parameters:
      fieldDefinitionIds - the field definition IDs to query on
      context - context information around sandbox and multitenant state
      Returns:
      a list of relevancy rules for the provided field definition IDs
    • getRepositoryDomain

      public String getRepositoryDomain()
      Description copied from interface: RelevancyRuleService
      Get the name of the Jpa Domain representation of the object
      Specified by:
      getRepositoryDomain in interface RelevancyRuleService<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 the FieldRef object based on the FieldDefinition
      Parameters:
      field - The FieldDefinition which is to be converted to a FieldRef
      Returns:
      The FieldRef object
    • getRepository

      protected RelevancyRuleRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
      Overrides:
      getRepository in class com.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()