Interface OfferCodeService<P extends OfferCode>
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- All Known Implementing Classes:
DefaultOfferCodeService
public interface OfferCodeService<P extends OfferCode>
extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
-
Method Summary
Modifier and TypeMethodDescriptionfindAllByGeneratorIdAndAssigned
(@NonNull String generatorId, boolean isAssigned, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) findAllDuplicatesForCodesInCampaign
(@NonNull String campaignId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all duplicatesOfferCodes
byCampaign.getId()
.findAllUnassignedByGeneratorId
(@NonNull String generatorId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all the unassignedOfferCodes
byOfferCode.getGeneratorId()
.org.springframework.data.domain.Page<P>
findByCampaignId
(String campaignId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<P>
findByOfferId
(String offerId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) findExistingByCodesIncludeExpiredForCampaignId
(Set<String> codes, String campaignId, Instant endAfterDate, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Search all non-expired offer codes or expired but belonging to the specified campaignId.findExistingByCodesIncludingInactive
(List<String> codes, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Search all non-expired offer codes or expired but belonging to the specified offerId.findOffersAndOfferCodesByCodes
(List<String> codes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) persistCodesAndReturn
(CodeGenerator info, Set<String> currentCodeSet, Class<P> payloadType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) int
persistCodesAndReturnNumber
(CodeGenerator info, Set<String> currentCodeSet, Class<P> payloadType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) 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.readAllByCode
(String code, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all of theOfferCodes
bycode
.readAllByCodes
(Set<String> codes, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all of theOfferCodes
bycodes
.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.default P
readByContextIdAndActive
(String contextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds an active offer code by ID.List<com.broadleafcommerce.data.tracking.core.Trackable>
saveAll
(List<P> businessInstances, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Call to launch an async process to warm the full code cache, if enabled.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
-
Method Details
-
readByContextIdAndActive
@Policy(operationTypes=READ) default P readByContextIdAndActive(String contextId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds an active offer code by ID.- Parameters:
contextId
- The ID to matchcontextInfo
- Request context information around sandbox and multitenant state- Returns:
- The offer code by ID
-
findOffersAndOfferCodesByCodes
-
findByCampaignId
-
findByOfferId
-
readAllByCode
@NonNull List<P> readAllByCode(@NonNull String code, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all of theOfferCodes
bycode
.- Parameters:
code
- Code to matchcontext
- Additional sandbox and multitenant state data- Returns:
- all of the
OfferCodes
bycode
-
readAllByCodes
@NonNull List<P> readAllByCodes(@NonNull Set<String> codes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all of theOfferCodes
bycodes
.- Parameters:
codes
- Codes to matchcontext
- Additional sandbox and multitenant state data- Returns:
- all of the
OfferCodes
bycode
-
saveAll
-
persistCodesAndReturnNumber
int persistCodesAndReturnNumber(CodeGenerator info, Set<String> currentCodeSet, Class<P> payloadType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
persistCodesAndReturn
-
readAllByCampaignId
Stream<P> 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
-
readAllByOfferId
Stream<P> 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
-
findExistingByCodesIncludeExpiredForCampaignId
List<P> findExistingByCodesIncludeExpiredForCampaignId(Set<String> codes, String campaignId, Instant endAfterDate, @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 due to the varying limitations on how many entries can be in an "in" statement please make sure that the property "broadleaf.dataimport.processor.batch-size" does not exceed this limitation.- Parameters:
codes
- The set of codes to matchcampaignId
- the campaign idendAfterDate
- Date after which code should be activecontext
- 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
-
findExistingByCodesIncludingInactive
List<P> findExistingByCodesIncludingInactive(List<String> codes, @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 due to the varying limitations on how many entries can be in an "in" statement please make sure that the property "broadleaf.dataimport.processor.batch-size" does not exceed this limitation.- Parameters:
codes
- The set of codes to matchcontext
- 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:
-
findAllDuplicatesForCodesInCampaign
List<P> findAllDuplicatesForCodesInCampaign(@NonNull @NonNull String campaignId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all duplicatesOfferCodes
byCampaign.getId()
. Typically, this will be used to check for duplicate campaign codes of campaign.- Parameters:
campaignId
- the campaign idcontext
- Request context information around sandbox and multitenant state- Returns:
- all duplicates
OfferCodes
byCampaign.getId()
-
findAllUnassignedByGeneratorId
default List<P> findAllUnassignedByGeneratorId(@NonNull @NonNull String generatorId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds all the unassignedOfferCodes
byOfferCode.getGeneratorId()
.- Parameters:
generatorId
- the id of the code generator that these codes were generated fromcontext
- Request context information around sandbox and multitenant state- Returns:
- all the unassigned
OfferCodes
byOfferCode.getGeneratorId()
-
findAllByGeneratorIdAndAssigned
List<P> findAllByGeneratorIdAndAssigned(@NonNull @NonNull String generatorId, boolean isAssigned, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Parameters:
generatorId
- the id of the code generator that these codes were generated fromisAssigned
- whether the offer codes are assignedcontext
- Request context information around sandbox and multitenant state- Returns:
- all the unassigned
OfferCodes
byOfferCode.getGeneratorId()
-
warmCache
FullCacheInitializationStatus warmCache()Call to launch an async process to warm the full code cache, if enabled. This method may be safely called repeatedly. If it is determined the cache has not been warmed yet, a new thread will spawn to fully populate the cache. Otherwise, the status of the cache warm process will simply be returned. For callers interested in the status, this method may be called repeatedly until the statusFullCacheInitializationStatus.READY
is returned, indicating the cache is fully warm.- Returns:
- The status of the cache warm process.
-