Interface OfferService<P extends Offer>
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- All Known Implementing Classes:
DefaultOfferService
public interface OfferService<P extends Offer>
extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- Author:
- Nathan Moore (nathanmoore).
-
Method Summary
Modifier and TypeMethodDescriptionboolean
existsById
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether the offer with the given id exists in the data storeboolean
existsByIdAndActive
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether the offer with the given id exists and is active in the data store.readActiveByIds
(Iterable<String> offerIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers filtering where contextId inofferIds
.readAllActiveByCodesIn
(Iterable<String> codes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers whereOffer.getOfferCodes()
intersects with the provided codes.readAllByContextIdInOrExternalIdIn
(Iterable<String> contextIds, Iterable<String> externalIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<P>
readAllByName
(String name, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) readAllCustomerOffersIn
(Iterable<UserTarget> userTargets, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers whereOffer.userTargets
intersects with the providedUserTarget
s, or the offer has noUserTarget
sreadAutomaticAndCodeAndCustomerOffersIn
(Iterable<String> offerIdsToFilterOn, Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) readAutomaticAndCodeAndCustomerOffersIn
(Iterable<String> offerIdsToFilterOn, Iterable<String> trackingIds, EnhancedOrder order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers whereOffer.isAutomaticallyConsidered()
is true or the offers match the passed in offerIds or contain the passed in campaign trackingIds.readByIds
(Iterable<String> offerIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all offers filtering where contextId inofferIds
.readByTrackingIds
(Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers filtering where trackingId intrackingIds
.readVoucherOffersIn
(Iterable<UserTarget> userTargets, Iterable<String> offerIdsForCodes, Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all voucher offers based on the provided user targets, codes, or tracking ids.Call to launch an async process to warm the full offer 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
-
readAllByName
-
readAutomaticAndCodeAndCustomerOffersIn
Stream<P> readAutomaticAndCodeAndCustomerOffersIn(Iterable<String> offerIdsToFilterOn, Iterable<String> trackingIds, @Nullable EnhancedOrder order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers whereOffer.isAutomaticallyConsidered()
is true or the offers match the passed in offerIds or contain the passed in campaign trackingIds.- Parameters:
offerIdsToFilterOn
- offerIds the returnedOffer
(s) are associated with.trackingIds
- tracking ids the returnedOffer
(s) are associated with.order
- the order for this requestcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- the offers matching the given criteria
-
readAutomaticAndCodeAndCustomerOffersIn
-
readActiveByIds
List<P> readActiveByIds(Iterable<String> offerIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers filtering where contextId inofferIds
.- Parameters:
offerIds
- The context ids to filter oncontextInfo
- Context information around sandbox and multitenant state.- Returns:
- All active offers filtering where contextId in
offerIds
.
-
readByIds
List<P> readByIds(Iterable<String> offerIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all offers filtering where contextId inofferIds
.- Parameters:
offerIds
- The context ids to filter oncontextInfo
- Context information around sandbox and multitenant state.- Returns:
- All active offers filtering where contextId in
offerIds
.
-
readByTrackingIds
List<P> readByTrackingIds(Iterable<String> trackingIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers filtering where trackingId intrackingIds
.- Parameters:
trackingIds
- The tracking ids to filter oncontextInfo
- Context information around sandbox and multitenant state.- Returns:
- All active offers filtering where trackingId in
trackingIds
.
-
readAllCustomerOffersIn
Stream<P> readAllCustomerOffersIn(Iterable<UserTarget> userTargets, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers whereOffer.userTargets
intersects with the providedUserTarget
s, or the offer has noUserTarget
s- Parameters:
userTargets
- users the returnedOffer
(s) should targetcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- the offers matching the given criteria
-
readAllActiveByCodesIn
List<P> readAllActiveByCodesIn(Iterable<String> codes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all active offers whereOffer.getOfferCodes()
intersects with the provided codes. -
readVoucherOffersIn
Stream<P> readVoucherOffersIn(Iterable<UserTarget> userTargets, Iterable<String> offerIdsForCodes, Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all voucher offers based on the provided user targets, codes, or tracking ids. Skips the active date narrowing to retrieve offers that may have been validly applied in the past.- Parameters:
userTargets
- users the returnedOffer
(s) should targetofferIdsForCodes
- offer ids the returnedOffer
(s) are associated with.trackingIds
- tracking ids the returnedOffer
(s) are associated with.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- all voucher offers based on the provided user targets, codes, or tracking ids
-
readAllByContextIdInOrExternalIdIn
-
existsById
boolean existsById(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether the offer with the given id exists in the data store- Parameters:
id
- the id of the offer to findcontextInfo
- context information surrounding sandboxing and multi tenant state- Returns:
- whether the offer with the given id exists in the data store
-
existsByIdAndActive
boolean existsByIdAndActive(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether the offer with the given id exists and is active in the data store.- Parameters:
id
- the id of the offer to findcontextInfo
- context information surrounding sandboxing and multi tenant state- Returns:
- whether the offer with the given id exists and is active in the data store
-
getRepositoryDomain
String getRepositoryDomain() -
warmCache
FullCacheInitializationStatus warmCache()Call to launch an async process to warm the full offer 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.
-