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.FieldRef
buildFieldRef
(com.broadleafcommerce.search.api.domain.FieldDefinition field) Builds theFieldRef
object based on aFieldDefinition
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-productionJpaFacet
that match the givenfieldDefinitionIds
and the given context.void
hydrateFieldDefinitions
(@NonNull Iterable<P> facets, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates the fullFieldDefinition
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 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 labelvoid
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_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:FacetService
Hydrates the fullFieldDefinition
on the provided facets.- Specified by:
hydrateFieldDefinitions
in interfaceFacetService<P extends com.broadleafcommerce.search.api.domain.Facet>
- Parameters:
facets
- AnIterable<com.broadleafcommerce.search.api.domain.Facet>
. Uses iterable to support takingCollections
orPages
.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 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:FacetService
Retrieves a paged list of facets by field definition ID- Specified by:
readAllByFieldDefinitionId
in 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:FacetService
Retrieves a list of facets for the provided field definition IDs- Specified by:
readAllByFieldDefinitionIdInAndNotArchived
in 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:FacetService
Reads all non-archived facets by context ID- Specified by:
readAllById
in 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:FacetService
Returns true if there is non-productionJpaFacet
that match the givenfieldDefinitionIds
and the given context.- Specified by:
hasNonProductionRecordsByFieldIdsInTenant
in interfaceFacetService<P extends com.broadleafcommerce.search.api.domain.Facet>
- Parameters:
fieldDefinitionIds
- IDs of parentFieldDefinition
to match againstcontextInfo
- 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
Description copied from interface:FacetService
Returns the name of the repository domain corresponding to the projection domain.- Specified by:
getRepositoryDomain
in 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 theFieldRef
object based on aFieldDefinition
- Returns:
- The
FieldRef
object.
-
getRepository
- Overrides:
getRepository
in 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)
-