Interface OfferSummaryService<S extends OfferAuditSummary>
- All Known Implementing Classes:
DefaultOfferSummaryService
public interface OfferSummaryService<S extends OfferAuditSummary>
Service API for OfferAuditSummary
, supported by OfferAuditSummaryRepository
.
-
Method Summary
Modifier and TypeMethodDescriptioncreateOrUpdateAndIncrement
(String offerId, javax.money.MonetaryAmount totalSavings, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Create an instance ofOfferAuditSummary
, or atomically update an existing one.void
Perform a delete operation on the entity identified by the context id.readAll
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a list of narrowed instances in the form of the business instance.org.springframework.data.domain.Page<S>
readAll
(org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a page of narrowed instances in the form of the business instance.readAll
(org.springframework.data.domain.Sort sort, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a list of narrowed instances in the form of the business instance.readAllByContextId
(Iterable<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all business instances based on a list of context ids.readAllByOfferIds
(Set<String> offerIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve allOfferAuditSummary
records that relate to the provided offer IDs.readByContextId
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a single instance of an entity in the form of a business domain.readByOfferId
(String offerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOfferAuditSummary
record for the provided offer ID.
-
Method Details
-
readByContextId
S readByContextId(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a single instance of an entity in the form of a business domain.- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The narrowed entity instance in the form of a business instance
- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if no entity is found with the given id
-
readAllByContextId
Iterable<S> readAllByContextId(@NonNull Iterable<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all business instances based on a list of context ids.- Parameters:
ids
- A list of context ids for the entitys. This is the id by which the business recognizes the item.context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The narrowed iterable collection of data in the form of business instances
-
readAll
org.springframework.data.domain.Page<S> readAll(@NonNull org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a page of narrowed instances in the form of the business instance.- Parameters:
pageable
- The current page informationcontext
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The narrowed page of data in the form of business instances
-
readAll
Read a list of narrowed instances in the form of the business instance.- Parameters:
context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The narrowed list of data in the form of business instances
-
readAll
List<S> readAll(@NonNull org.springframework.data.domain.Sort sort, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a list of narrowed instances in the form of the business instance. Also apply the given sort.- Parameters:
sort
- The sort to be performed on the resultscontext
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The narrowed list of sorted data in the form of business instances
-
createOrUpdateAndIncrement
S createOrUpdateAndIncrement(@NonNull String offerId, @Nullable javax.money.MonetaryAmount totalSavings, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Create an instance ofOfferAuditSummary
, or atomically update an existing one. This flow also will not end up creating duplicate summaries for the same offer.- Parameters:
offerId
- The id of the related offertotalSavings
- The total savings applied to record for this offercontext
- Any tenant related information for the request context- Returns:
- The created or updated summary
-
delete
void delete(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Perform a delete operation on the entity identified by the context id. This could result in an archival, or a raw delete, depending on the result of processing throughDomainMapper.deleteMap(Object, ContextInfo)
.- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if no instance was found in the backing store corresponding to id
-
readByOfferId
@Nullable S readByOfferId(String offerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOfferAuditSummary
record for the provided offer ID.- Parameters:
offerId
- the offer ID to find summary record forcontextInfo
- the context to perform the operation in- Returns:
- the
OfferAuditSummary
record that relates to the provided offer ID
-
readAllByOfferIds
List<S> readAllByOfferIds(Set<String> offerIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve allOfferAuditSummary
records that relate to the provided offer IDs.- Parameters:
offerIds
- the list of offer IDs to find summary records forcontextInfo
- the context to perform the operation in- Returns:
- the
OfferAuditSummary
records that relate to the provided offer IDs
-