Class DefaultFacetService<P extends com.broadleafcommerce.search.api.domain.Facet>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.search.core.service.facet.DefaultFacetService<P>
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>, FacetService<P>

public class DefaultFacetService<P extends com.broadleafcommerce.search.api.domain.Facet> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P> implements FacetService<P>
Service API for Facet
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultFacetService(FacetRepository<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.common.extension.cache.CacheStateManager cacheStateManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.broadleafcommerce.search.api.domain.FieldRef
    buildFieldRef(com.broadleafcommerce.search.api.domain.FieldDefinition field)
    Builds the FieldRef object based on a FieldDefinition
    protected com.broadleafcommerce.common.extension.cache.CacheStateManager
     
    protected FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition>
     
    protected FacetRepository<com.broadleafcommerce.data.tracking.core.Trackable>
     
    Returns the name of the repository domain corresponding to the projection domain.
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    boolean
    hasNonProductionRecordsByFieldIdsInTenant(@NonNull Collection<String> fieldDefinitionIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns true if there is non-production JpaFacet that match the given fieldDefinitionIds and the given context.
    void
    hydrateFieldDefinitions(@NonNull Iterable<P> facets, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Hydrates the full FieldDefinition on the provided facets.
    org.springframework.data.domain.Page<P>
    readAllByFieldDefinitionId(String fieldDefinitionId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Retrieves a paged list of facets by field definition ID
    readAllByFieldDefinitionIdInAndNotArchived(@NonNull Iterable<String> fieldDefinitionIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Retrieves a list of facets for the provided field definition IDs
    readAllById(@NonNull List<String> facetIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all non-archived facets by context ID
    org.springframework.data.domain.Page<P>
    readAllByLabel(String label, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Retrieves a page of facets by label
    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

  • Constructor Details

    • DefaultFacetService

      public DefaultFacetService(FacetRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitionService, @Nullable com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
  • Method Details

    • hydrateFieldDefinitions

      public void hydrateFieldDefinitions(@NonNull @NonNull Iterable<P> facets, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: FacetService
      Hydrates the full FieldDefinition on the provided facets.
      Specified by:
      hydrateFieldDefinitions in interface FacetService<P extends com.broadleafcommerce.search.api.domain.Facet>
      Parameters:
      facets - An Iterable<com.broadleafcommerce.search.api.domain.Facet>. Uses iterable to support taking Collections or Pages.
      contextInfo - Additional sandbox and multitenant info
    • readAllByLabel

      public org.springframework.data.domain.Page<P> readAllByLabel(@Nullable String label, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: FacetService
      Retrieves a page of facets by label
      Specified by:
      readAllByLabel in interface FacetService<P extends com.broadleafcommerce.search.api.domain.Facet>
      Parameters:
      label - the label field being queried
      filters - additional filters to apply in the query.
      page - describes the page of results to return
      context - context information around sandbox and multitenant state
      Returns:
      a paged list of facets matching the label string
    • readAllByFieldDefinitionId

      public org.springframework.data.domain.Page<P> readAllByFieldDefinitionId(String fieldDefinitionId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: FacetService
      Retrieves a paged list of facets by field definition ID
      Specified by:
      readAllByFieldDefinitionId in interface FacetService<P extends com.broadleafcommerce.search.api.domain.Facet>
      Parameters:
      fieldDefinitionId - the field definition ID to query on
      filters - additional filters to apply in the query.
      page - the requested page of results from the database
      context - context information around sandbox and multitenant state
      Returns:
      a paged list of facets for the given field definition ID
    • readAllByFieldDefinitionIdInAndNotArchived

      public List<P> readAllByFieldDefinitionIdInAndNotArchived(@NonNull @NonNull Iterable<String> fieldDefinitionIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: FacetService
      Retrieves a list of facets for the provided field definition IDs
      Specified by:
      readAllByFieldDefinitionIdInAndNotArchived in interface FacetService<P extends com.broadleafcommerce.search.api.domain.Facet>
      Parameters:
      fieldDefinitionIds - the field definition IDs to query on
      context - context information around sandbox and multitenant state
      Returns:
      a list of facets for the provided field definition IDs
    • readAllById

      public List<P> readAllById(@NonNull @NonNull List<String> facetIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: FacetService
      Reads all non-archived facets by context ID
      Specified by:
      readAllById in interface FacetService<P extends com.broadleafcommerce.search.api.domain.Facet>
      Parameters:
      facetIds - the list of facetIds to filter on
      contextInfo - context information around sandbox and multitenant state
      Returns:
      all non-archived facets by context ID
    • hasNonProductionRecordsByFieldIdsInTenant

      public boolean hasNonProductionRecordsByFieldIdsInTenant(@NonNull @NonNull Collection<String> fieldDefinitionIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: FacetService
      Returns true if there is non-production JpaFacet that match the given fieldDefinitionIds and the given context.
      Specified by:
      hasNonProductionRecordsByFieldIdsInTenant in interface FacetService<P extends com.broadleafcommerce.search.api.domain.Facet>
      Parameters:
      fieldDefinitionIds - IDs of parent FieldDefinition to match against
      contextInfo - Request context information around sandbox and multitenant state
      Returns:
      true if there is non-production records that match the given fieldDefinitionIds and the given context, and false otherwise
    • getRepositoryDomain

      public String getRepositoryDomain()
      Description copied from interface: FacetService
      Returns the name of the repository domain corresponding to the projection domain.
      Specified by:
      getRepositoryDomain in interface FacetService<P extends com.broadleafcommerce.search.api.domain.Facet>
      Returns:
      The name of the repository domain corresponding to the projection domain.
    • buildFieldRef

      protected com.broadleafcommerce.search.api.domain.FieldRef buildFieldRef(com.broadleafcommerce.search.api.domain.FieldDefinition field)
      Builds the FieldRef object based on a FieldDefinition
      Returns:
      The FieldRef object.
    • getRepository

      protected FacetRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends com.broadleafcommerce.search.api.domain.Facet>
    • 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)