Interface CategoryProductRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
- All Superinterfaces:
CustomizedCategoryProductRepository<D>
,com.broadleafcommerce.common.extension.DomainTypeAware
,com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
,org.springframework.data.repository.Repository<D,
,String> com.broadleafcommerce.data.tracking.core.TrackableRepository<D>
,com.broadleafcommerce.data.tracking.core.TrackableRsqlFilterExecutor<D>
- All Known Subinterfaces:
JpaCategoryProductRepository<D>
@NoRepositoryBean
public interface CategoryProductRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
extends com.broadleafcommerce.data.tracking.core.TrackableRepository<D>, CustomizedCategoryProductRepository<D>, com.broadleafcommerce.data.tracking.core.TrackableRsqlFilterExecutor<D>
Repository
for persistent counter-parts of
CategoryProduct
- Author:
- Samarth Dhruva (samarthd)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
existsByProductContextIdAndCategoryContextId
(String productContextId, String categoryContextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether there is a category-product relationship for the given product and category in the data store.findAllByCategoryContextIdIn
(Collection<String> categoryContextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds the list ofCategoryProducts
bycategoryId
.org.springframework.data.domain.Page<D>
findByCategoryContextId
(String categoryContextId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds all of the CategoryProduct relationships in the database associated with the given category context ID.org.springframework.data.domain.Page<D>
findByCategoryContextIdIn
(Collection<String> categoryContextIds, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds theCategoryProducts
bycategoryId
.findByContextIdAndCategoryContextId
(String contextId, String categoryContextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<D>
findByProductContextId
(String productContextId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds all of the CategoryProduct relationships in the database associated with the given product context ID.findByProductContextIdAndCategoryContextId
(String productContextId, String categoryContextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the CategoryProduct associated with the given product context ID and category context ID.findByProductContextIdInAndPrimaryTrue
(Collection<String> productContextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads allCategoryProducts
whose product ID is in one of the given values and whoseCategoryProduct.primary
is true.Methods inherited from interface com.broadleafcommerce.catalog.repository.CustomizedCategoryProductRepository
countNonProductionRecordsByProductIdsInTenant, findAllByCategoryIdAndIsSorted, findAllByCategoryIdAndProductIds, findAllByCategoryIdAndProductIdsAndIsSorted, findAllByProductContextIdIn
Methods inherited from interface com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
findNotificationReadyMembers, setFailedNotificationAttempt, setNotificationAcknowledged
Methods inherited from interface com.broadleafcommerce.data.tracking.core.TrackableRepository
archive, existsByContextId, findAll, findAll, findAll, findAll, findAll, findAll, findAllByContextId, findByContextId, findByContextIdAndCatalog, findByNativeId, findDeployable, findMaxSortMember, findMinSortMember, findOriginal, findPromotable, findPromoteOrientedItems, findRebasable, findRejectable, findRevertable, findTarget, getDomainType, getEntityInformation, getTrackableBehaviorUtil, getTypesToRegisterInMappingContext, pruneChangeDetails, pruneRestingNotificationStates, purgeObsoleteSandboxData, save, saveAll, setTrackableBehaviorUtil
Methods inherited from interface com.broadleafcommerce.data.tracking.core.TrackableRsqlFilterExecutor
exists, findAll, findAll, findAll, findAll
-
Method Details
-
findByCategoryContextId
@Policy(operationTypes=READ) @NonNull org.springframework.data.domain.Page<D> findByCategoryContextId(@NonNull String categoryContextId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds all of the CategoryProduct relationships in the database associated with the given category context ID.- Parameters:
categoryContextId
- the category context ID to find the relationships forfilters
- 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 surrounding sandboxing and multitenant state- Returns:
- the CategoryProduct relationships in the database that match the given category context ID
-
findByProductContextId
@Policy(operationTypes=READ) @NonNull org.springframework.data.domain.Page<D> findByProductContextId(@NonNull String productContextId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds all of the CategoryProduct relationships in the database associated with the given product context ID.- Parameters:
productContextId
- the product context ID to find the relationships forfilters
- 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 surrounding sandboxing and multitenant state- Returns:
- the CategoryProduct relationships in the database that match the given category context ID
-
findByProductContextIdAndCategoryContextId
@Policy(operationTypes=READ) Optional<D> findByProductContextIdAndCategoryContextId(@NonNull String productContextId, @NonNull String categoryContextId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the CategoryProduct associated with the given product context ID and category context ID.- Parameters:
productContextId
- the product context IDcategoryContextId
- the category context IDcontextInfo
- context surrounding sandboxing and multitenant state- Returns:
- an
Optional
containing the CategoryProduct that was found, or empty if no item was found
-
existsByProductContextIdAndCategoryContextId
@Policy(operationTypes=READ) boolean existsByProductContextIdAndCategoryContextId(@NonNull String productContextId, @NonNull String categoryContextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether there is a category-product relationship for the given product and category in the data store.- Parameters:
productContextId
- the product context IDcategoryContextId
- the category context IDcontextInfo
- context surrounding sandboxing and multitenant state- Returns:
- true if a relationship was found between the product and category, false otherwise
-
findByContextIdAndCategoryContextId
-
findByCategoryContextIdIn
@NonNull @Policy(operationTypes=READ) org.springframework.data.domain.Page<D> findByCategoryContextIdIn(@NonNull Collection<String> categoryContextIds, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds theCategoryProducts
bycategoryId
.- Parameters:
categoryContextIds
- Category IDs to match againstpage
- Pagination infocontextInfo
- Request context information around sandbox and multitenant state- Returns:
- Finds the
CategoryProducts
bycategoryId
and within the active date range.
-
findAllByCategoryContextIdIn
@NonNull @Policy(operationTypes=READ) List<D> findAllByCategoryContextIdIn(@NonNull Collection<String> categoryContextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds the list ofCategoryProducts
bycategoryId
.- Parameters:
categoryContextIds
- Category IDs to match againstcontextInfo
- Request context information around sandbox and multitenant state- Returns:
- Finds the list of
CategoryProducts
bycategoryId
.
-
findByProductContextIdInAndPrimaryTrue
@Policy(operationTypes=READ) @NonNull List<D> findByProductContextIdInAndPrimaryTrue(@NonNull Collection<String> productContextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads allCategoryProducts
whose product ID is in one of the given values and whoseCategoryProduct.primary
is true.This essentially finds the relationships between the given products and their primary categories.
- Parameters:
productContextIds
- the context ids of the products for which to find primary category-product relationshipscontextInfo
- context surrounding sandboxing and multitenant state- Returns:
- a list of all primary category products found for the given product ids
-