Class DefaultOfferSummaryService<P extends OfferAuditSummary>
java.lang.Object
com.broadleafcommerce.promotion.offer.service.DefaultOfferSummaryService<P>
- All Implemented Interfaces:
OfferSummaryService<P>
public class DefaultOfferSummaryService<P extends OfferAuditSummary>
extends Object
implements OfferSummaryService<P>
-
Constructor Summary
ConstructorDescriptionDefaultOfferSummaryService
(OfferAuditSummaryRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionprotected P
convertFromPersistentDomain
(com.broadleafcommerce.data.tracking.core.Trackable domain, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) createOrUpdateAndIncrement
(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.protected com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper
protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager
protected OfferAuditSummaryRepository<com.broadleafcommerce.data.tracking.core.Trackable>
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<P>
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.void
setMapper
(com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager mapper)
-
Constructor Details
-
DefaultOfferSummaryService
public DefaultOfferSummaryService(OfferAuditSummaryRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper)
-
-
Method Details
-
readByContextId
public P readByContextId(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:OfferSummaryService
Read a single instance of an entity in the form of a business domain.- Specified by:
readByContextId
in interfaceOfferSummaryService<P extends OfferAuditSummary>
- 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
-
readAllByContextId
public Iterable<P> readAllByContextId(@NonNull Iterable<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:OfferSummaryService
Retrieve all business instances based on a list of context ids.- Specified by:
readAllByContextId
in interfaceOfferSummaryService<P extends OfferAuditSummary>
- 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
public org.springframework.data.domain.Page<P> readAll(@NonNull org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:OfferSummaryService
Read a page of narrowed instances in the form of the business instance.- Specified by:
readAll
in interfaceOfferSummaryService<P extends OfferAuditSummary>
- 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
public List<P> readAll(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:OfferSummaryService
Read a list of narrowed instances in the form of the business instance.- Specified by:
readAll
in interfaceOfferSummaryService<P extends OfferAuditSummary>
- 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
public List<P> readAll(@NonNull org.springframework.data.domain.Sort sort, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:OfferSummaryService
Read a list of narrowed instances in the form of the business instance. Also apply the given sort.- Specified by:
readAll
in interfaceOfferSummaryService<P extends OfferAuditSummary>
- 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
public P createOrUpdateAndIncrement(String offerId, @Nullable javax.money.MonetaryAmount totalSavings, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:OfferSummaryService
Create an instance ofOfferAuditSummary
, or atomically update an existing one. This flow also will not end up creating duplicate summaries for the same offer.- Specified by:
createOrUpdateAndIncrement
in interfaceOfferSummaryService<P extends OfferAuditSummary>
- 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
public void delete(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:OfferSummaryService
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)
.- Specified by:
delete
in interfaceOfferSummaryService<P extends OfferAuditSummary>
- 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.
-
readByOfferId
@Nullable public P readByOfferId(String offerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OfferSummaryService
Retrieve theOfferAuditSummary
record for the provided offer ID.- Specified by:
readByOfferId
in interfaceOfferSummaryService<P extends OfferAuditSummary>
- 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
public List<P> readAllByOfferIds(@NonNull Set<String> offerIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OfferSummaryService
Retrieve allOfferAuditSummary
records that relate to the provided offer IDs.- Specified by:
readAllByOfferIds
in interfaceOfferSummaryService<P extends OfferAuditSummary>
- 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
-
convertFromPersistentDomain
protected P convertFromPersistentDomain(com.broadleafcommerce.data.tracking.core.Trackable domain, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getRepository
@NonNull protected OfferAuditSummaryRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository() -
getMapper
protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager getMapper() -
setMapper
@Autowired public void setMapper(@Nullable com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager mapper) -
getHelper
@NonNull protected com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper getHelper()
-