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 -
Constructor Summary
ConstructorsConstructorDescriptionDefaultFacetService(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 TypeMethodDescriptionprotected com.broadleafcommerce.search.api.domain.FieldRefbuildFieldRef(com.broadleafcommerce.search.api.domain.FieldDefinition field) Builds theFieldRefobject based on aFieldDefinitionprotected com.broadleafcommerce.common.extension.cache.CacheStateManagerprotected 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.TypeFactorybooleanhasNonProductionRecordsByFieldIdsInTenant(@NonNull Collection<String> fieldDefinitionIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns true if there is non-productionJpaFacetthat match the givenfieldDefinitionIdsand the given context.voidhydrateFieldDefinitions(@NonNull Iterable<P> facets, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates the fullFieldDefinitionon 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 IDreadAllByFieldDefinitionIdInAndNotArchived(@NonNull Iterable<String> fieldDefinitionIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieves a list of facets for the provided field definition IDsreadAllById(@NonNull List<String> facetIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all non-archived facets by context IDorg.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 labelvoidsetTypeFactory(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_FACET_BY_FIELD_DEFINITION_IDS
- See Also:
-
CACHE_FACET_BY_CONTEXT_IDS
- See Also:
-
-
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:FacetServiceHydrates the fullFieldDefinitionon the provided facets.- Specified by:
hydrateFieldDefinitionsin interfaceFacetService<P extends com.broadleafcommerce.search.api.domain.Facet>- Parameters:
facets- AnIterable<com.broadleafcommerce.search.api.domain.Facet>. Uses iterable to support takingCollectionsorPages.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:FacetServiceRetrieves a page of facets by label- Specified by:
readAllByLabelin interfaceFacetService<P extends com.broadleafcommerce.search.api.domain.Facet>- Parameters:
label- the label field being queriedfilters- additional filters to apply in the query.page- describes the page of results to returncontext- 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:FacetServiceRetrieves a paged list of facets by field definition ID- Specified by:
readAllByFieldDefinitionIdin interfaceFacetService<P extends com.broadleafcommerce.search.api.domain.Facet>- Parameters:
fieldDefinitionId- the field definition ID to query onfilters- additional filters to apply in the query.page- the requested page of results from the databasecontext- 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:FacetServiceRetrieves a list of facets for the provided field definition IDs- Specified by:
readAllByFieldDefinitionIdInAndNotArchivedin interfaceFacetService<P extends com.broadleafcommerce.search.api.domain.Facet>- Parameters:
fieldDefinitionIds- the field definition IDs to query oncontext- 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:FacetServiceReads all non-archived facets by context ID- Specified by:
readAllByIdin interfaceFacetService<P extends com.broadleafcommerce.search.api.domain.Facet>- Parameters:
facetIds- the list of facetIds to filter oncontextInfo- 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:FacetServiceReturns true if there is non-productionJpaFacetthat match the givenfieldDefinitionIdsand the given context.- Specified by:
hasNonProductionRecordsByFieldIdsInTenantin interfaceFacetService<P extends com.broadleafcommerce.search.api.domain.Facet>- Parameters:
fieldDefinitionIds- IDs of parentFieldDefinitionto match againstcontextInfo- Request context information around sandbox and multitenant state- Returns:
- true if there is non-production records that match the given
fieldDefinitionIdsand the given context, and false otherwise
-
getRepositoryDomain
Description copied from interface:FacetServiceReturns the name of the repository domain corresponding to the projection domain.- Specified by:
getRepositoryDomainin interfaceFacetService<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 theFieldRefobject based on aFieldDefinition- Returns:
- The
FieldRefobject.
-
getRepository
- Overrides:
getRepositoryin classcom.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)
-