Class DefaultSharedCodeSummaryService<P extends SharedCodeAuditSummary>
java.lang.Object
com.broadleafcommerce.promotion.offer.service.DefaultSharedCodeSummaryService<P>
- All Implemented Interfaces:
SharedCodeSummaryService<P>
public class DefaultSharedCodeSummaryService<P extends SharedCodeAuditSummary>
extends Object
implements SharedCodeSummaryService<P>
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSharedCodeSummaryService(SharedCodeAuditSummaryRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper rsqlHelper) -
Method Summary
Modifier and TypeMethodDescriptionprotected PconvertFromPersistentDomain(com.broadleafcommerce.data.tracking.core.Trackable domain, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) createOrUpdateAndIncrement(String offerCodeId, String offerCode, javax.money.MonetaryAmount totalSavings, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Create an instance ofSharedCodeAuditSummary, or atomically update an existing one.voidPerform a delete operation on the entity identified by the context id.protected com.broadleafcommerce.data.tracking.core.service.CrudEntityHelperprotected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManagerprotected SharedCodeAuditSummaryRepository<com.broadleafcommerce.data.tracking.core.Trackable>protected com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelperreadAll(com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a list of narrowed instances in the form of the business instance.readAll(cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all domain instances using a structured query string to drive the query criteria.org.springframework.data.domain.Page<P>readAll(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all domain instances using a structured query string to drive the query criteria.readAll(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Sort sort, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all domain instances using a structured query string to drive the query criteria.org.springframework.data.domain.Page<P>readAll(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Sort sort, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all domain instances using a structured query string to drive the query criteria.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.readAllByOfferCodeIds(Set<String> offerCodeIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve allSharedCodeAuditSummaryrecords that relate to the provided offer code 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.readByOfferCodeId(String offerCodeId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theSharedCodeAuditSummaryrecord for the provided offer code ID.voidsetMapper(com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager mapper)
-
Constructor Details
-
Method Details
-
readByContextId
public P readByContextId(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SharedCodeSummaryServiceRead a single instance of an entity in the form of a business domain.- Specified by:
readByContextIdin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- 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:SharedCodeSummaryServiceRetrieve all business instances based on a list of context ids.- Specified by:
readAllByContextIdin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- 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:SharedCodeSummaryServiceRead a page of narrowed instances in the form of the business instance.- Specified by:
readAllin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- 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:SharedCodeSummaryServiceRead a list of narrowed instances in the form of the business instance.- Specified by:
readAllin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- 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:SharedCodeSummaryServiceRead a list of narrowed instances in the form of the business instance. Also apply the given sort.- Specified by:
readAllin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- 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
-
readAll
public List<P> readAll(@NonNull cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Sort sort, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SharedCodeSummaryServiceRetrieve all domain instances using a structured query string to drive the query criteria. The filters string is parsed by an internal implementation and the result is added to the query before executing the fetch against the persistence store. SeeFilterParserfor more information.This version also accepts a formatted sort string that declares the sorting characteristics for the query. See
SortParserfor more information.- Specified by:
readAllin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- Parameters:
filters- the RSQLNodeused to restrict result, must not be nullsort- The string containing the structured list of sorts to applycontext- Request context information around sandbox and multitenant state- Returns:
- The list of narrowed, sorted entities
-
readAll
public List<P> readAll(@NonNull cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SharedCodeSummaryServiceRetrieve all domain instances using a structured query string to drive the query criteria. The filters string is parsed by an internal implementation and the result is added to the query before executing the fetch against the persistence store. SeeFilterParserfor more information.- Specified by:
readAllin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- Parameters:
filters- the RSQLNodeused to restrict result, must not be nullcontext- Request context information around sandbox and multitenant state- Returns:
- The list of narrowed, sorted entities
-
readAll
public org.springframework.data.domain.Page<P> readAll(@NonNull cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Sort sort, @NonNull org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SharedCodeSummaryServiceRetrieve all domain instances using a structured query string to drive the query criteria. The filters string is parsed by an internal implementation and the result is added to the query before executing the fetch against the persistence store. SeeFilterParserfor more information.This version also accepts a Sort to apply to the result set
- Specified by:
readAllin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- Parameters:
filters- the RSQLNodeused to restrict result, must not be nullsort- sort to apply to the querypageable- may bePageable.unpaged(), must not be null.context- Request context information around sandbox and multitenant state- Returns:
- The subset (page) of narrowed entities
-
readAll
public org.springframework.data.domain.Page<P> readAll(@NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SharedCodeSummaryServiceRetrieve all domain instances using a structured query string to drive the query criteria. The filters string is parsed by an internal implementation and the result is added to the query before executing the fetch against the persistence store. SeeFilterParserfor more information.- Specified by:
readAllin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- Parameters:
filters- the RSQLNodeused to restrict result, must not be nullpageable- may bePageable.unpaged(), must not be null.context- Request context information around sandbox and multitenant state- Returns:
- The subset (page) of narrowed entities
-
createOrUpdateAndIncrement
public P createOrUpdateAndIncrement(String offerCodeId, String offerCode, @Nullable javax.money.MonetaryAmount totalSavings, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SharedCodeSummaryServiceCreate an instance ofSharedCodeAuditSummary, or atomically update an existing one. This flow also will not end up creating duplicate summaries for the same offer.- Specified by:
createOrUpdateAndIncrementin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- Parameters:
offerCodeId- The id of the related offerofferCode- The string offer code 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:SharedCodeSummaryServicePerform 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:
deletein interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- 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.
-
readByOfferCodeId
@Nullable public P readByOfferCodeId(String offerCodeId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:SharedCodeSummaryServiceRetrieve theSharedCodeAuditSummaryrecord for the provided offer code ID.- Specified by:
readByOfferCodeIdin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- Parameters:
offerCodeId- the offer code ID to find summary record forcontextInfo- the context to perform the operation in- Returns:
- the
SharedCodeAuditSummaryrecord that relates to the provided offer code ID
-
readAllByOfferCodeIds
public List<P> readAllByOfferCodeIds(@NonNull Set<String> offerCodeIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:SharedCodeSummaryServiceRetrieve allSharedCodeAuditSummaryrecords that relate to the provided offer code IDs.- Specified by:
readAllByOfferCodeIdsin interfaceSharedCodeSummaryService<P extends SharedCodeAuditSummary>- Parameters:
offerCodeIds- the list of offer code IDs to find summary records forcontextInfo- the context to perform the operation in- Returns:
- the
SharedCodeAuditSummaryrecords that relate to the provided offer code IDs
-
convertFromPersistentDomain
protected P convertFromPersistentDomain(com.broadleafcommerce.data.tracking.core.Trackable domain, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getRepository
@NonNull protected SharedCodeAuditSummaryRepository<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) -
getRsqlHelper
@NonNull protected com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper getRsqlHelper() -
getHelper
@NonNull protected com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper getHelper()
-