Interface CustomizedOfferCodeRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
- Type Parameters:
D
- The type of the persistent version ofOfferCode
for a specific data store implementation
- All Known Subinterfaces:
JpaOfferCodeRepository<D>
,OfferCodeRepository<D>
- All Known Implementing Classes:
JpaCustomizedOfferCodeRepository
public interface CustomizedOfferCodeRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
Provides advanced functionality for
OfferCodes
that require manually
implemented queries rather than through Spring Data.- Author:
- Karan Jariwala (karan-j-blc)
-
Method Summary
Modifier and TypeMethodDescriptionfindAllByCode
(String code, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds allOfferCodes
byOfferCode.getCode()
.findAllByCodes
(Set<String> codes, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds allOfferCodes
byOfferCode.getCode()
.findAllByCodesIncludingInactive
(List<String> codes, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) findAllCodesForFullCache
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all the codes in the system based on full cache configuration.findAllDuplicatesForCodesInCampaign
(@NonNull String campaignId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all duplicatesOfferCodes
byOfferCode.getId()
.Read a list of distinct tenants for all offer codesfindExistingByCodesIncludeExpiredForCampaignId
(Set<String> codes, String campaignId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Search all non-expired offer codes or expired but belonging to the specified campaignId.findExistingByCodesIncludeExpiredForOfferId
(Set<String> codes, String offerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Search all non-expired offer codes or expired but belonging to the specified offerId.readAllByCampaignId
(String campaignId, int pageSize, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the offer codes for the specified campaign id matching the given page size and filters.readAllByCampaignId
(String campaignId, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads the offer codes for the specified campaign id matching the given filters.readAllByOfferId
(String offerId, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads the offer codes for the specified offer id matching the given filters.int
updateMaxUsageStatus
(String offerCodeId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update the status (seeMaxUsageStatusType
) for an offercode, and respond if the status was actually changed.
-
Method Details
-
findAllByCode
@Policy(operationTypes=READ) default List<D> findAllByCode(String code, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds allOfferCodes
byOfferCode.getCode()
.- Parameters:
code
- Code to matchcontext
- Request context information around sandbox and multitenant state- Returns:
- all
OfferCodes
byOfferCode.getCode()
.
-
findAllByCodes
@Policy(operationTypes=READ) List<D> findAllByCodes(Set<String> codes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds allOfferCodes
byOfferCode.getCode()
.- Parameters:
codes
- The set of codes to matchcontext
- Request context information around sandbox and multitenant state- Returns:
- all
OfferCodes
byOfferCode.getCode()
.
-
findAllCodesForFullCache
@Policy(operationTypes=READ) List<String> findAllCodesForFullCache(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all the codes in the system based on full cache configuration. SeeOfferCacheProperties.getFullCodeCacheType()
for more information on how the configuration will influence the results of this method.- Parameters:
context
- Request context information around sandbox and multitenant state- Returns:
- All the codes in the system limited by the cache type configuration.
-
findAllByCodesIncludingInactive
-
findAllDuplicatesForCodesInCampaign
@Policy(operationTypes=READ) List<D> findAllDuplicatesForCodesInCampaign(@NonNull @NonNull String campaignId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all duplicatesOfferCodes
byOfferCode.getId()
. Typically, this will be used to check for duplicate offer codes of campaign.- Parameters:
campaignId
- the campaign idcontext
- Request context information around sandbox and multitenant state- Returns:
- all duplicates
OfferCodes
byOfferCode.getId()
-
findExistingByCodesIncludeExpiredForCampaignId
@Policy(operationTypes=READ) List<D> findExistingByCodesIncludeExpiredForCampaignId(Set<String> codes, String campaignId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Search all non-expired offer codes or expired but belonging to the specified campaignId. This is useful to validate that the offer codes can be added or updated. NOTE: This method is used during import ofOfferCode
and because different DBs has a different limitation on how many entries can be in "in" statement please make sure that the property "broadleaf.dataimport.processor.batch-size" not exited this limitation.- Parameters:
codes
- The set of codes to matchcampaignId
- the campaign idcontext
- Request context information around sandbox and multitenant state- Returns:
- all
OfferCodes
byOfferCode.getCode()
that are also active or belonging to the specified campaignId - See Also:
-
com.broadleafcommerce.promotion.offer.dataimport.CampaignCodeImportBatchHandler
-
findExistingByCodesIncludeExpiredForOfferId
@Policy(operationTypes=READ) List<D> findExistingByCodesIncludeExpiredForOfferId(Set<String> codes, String offerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Search all non-expired offer codes or expired but belonging to the specified offerId. This is useful to validate that the offer codes can be added or updated. NOTE: This method is used during import ofOfferCode
and because different DBs has a different limitation on how many entries can be in "in" statement please make sure that the property "broadleaf.dataimport.processor.batch-size" not exited this limitation.- Parameters:
codes
- The set of codes to matchofferId
- the offer idcontext
- Request context information around sandbox and multitenant state- Returns:
- all
OfferCodes
byOfferCode.getCode()
that are also active or belonging to the specified offerId - See Also:
-
com.broadleafcommerce.promotion.offer.dataimport.CampaignCodeImportBatchHandler
-
readAllByCampaignId
@Policy(operationTypes=READ) Stream<D> readAllByCampaignId(String campaignId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads the offer codes for the specified campaign id matching the given filters.- Parameters:
campaignId
- the campaign idfilters
- additional filters to apply in the querycontext
- Request context information around sandbox and multitenant state- Returns:
- the offer codes for the specified campaign id matching the given filters
-
readAllByCampaignId
@Policy(operationTypes=READ) Stream<D> readAllByCampaignId(String campaignId, int pageSize, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the offer codes for the specified campaign id matching the given page size and filters.- Parameters:
campaignId
- the campaign idpageSize
- the page size to use when querying for records within the streamfilters
- additional filters to apply in the querycontext
- Request context information around sandbox and multitenant state- Returns:
- the offer codes for the specified campaign id matching the given filters and page size
-
readAllByOfferId
@Policy(operationTypes=READ) Stream<D> readAllByOfferId(String offerId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads the offer codes for the specified offer id matching the given filters.- Parameters:
offerId
- the offer idfilters
- additional filters to apply in the querycontext
- Request context information around sandbox and multitenant state- Returns:
- the offer codes for the specified offer id matching the given filters
-
updateMaxUsageStatus
@Policy(operationTypes=UPDATE) @Transactional("offerTransactionManager") int updateMaxUsageStatus(String offerCodeId, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update the status (seeMaxUsageStatusType
) for an offercode, and respond if the status was actually changed.- Parameters:
offerContextId
- The contextId of the offercode to updatestatus
- The status to set (seeMaxUsageStatusType
)contextInfo
- Context containing tenant related information (specifically tenantId and applicationId) to use to further discriminate the change- Returns:
- The number of records updated, if any. It is expected this method is called under load, so the response is a useful measure to detect when the value is actually updated. This is in contrast to other possible duplicate and ineffectual attempts.
-
findAllTenants
Read a list of distinct tenants for all offer codes- Returns:
- List of distinct tenants
-