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

    Constructors
    Constructor
    Description
    DefaultSharedCodeSummaryService(SharedCodeAuditSummaryRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper rsqlHelper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected P
    convertFromPersistentDomain(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 of SharedCodeAuditSummary, or atomically update an existing one.
    void
    delete(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    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 SharedCodeAuditSummaryRepository<com.broadleafcommerce.data.tracking.core.Trackable>
     
    protected com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper
     
    readAll(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 all SharedCodeAuditSummary records 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 the SharedCodeAuditSummary record for the provided offer code ID.
    void
    setMapper(com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager mapper)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultSharedCodeSummaryService

      public DefaultSharedCodeSummaryService(SharedCodeAuditSummaryRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper rsqlHelper)
  • Method Details

    • readByContextId

      public P readByContextId(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: SharedCodeSummaryService
      Read a single instance of an entity in the form of a business domain.
      Specified by:
      readByContextId in interface SharedCodeSummaryService<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: SharedCodeSummaryService
      Retrieve all business instances based on a list of context ids.
      Specified by:
      readAllByContextId in interface SharedCodeSummaryService<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: SharedCodeSummaryService
      Read a page of narrowed instances in the form of the business instance.
      Specified by:
      readAll in interface SharedCodeSummaryService<P extends SharedCodeAuditSummary>
      Parameters:
      pageable - The current page information
      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 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: SharedCodeSummaryService
      Read a list of narrowed instances in the form of the business instance.
      Specified by:
      readAll in interface SharedCodeSummaryService<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: SharedCodeSummaryService
      Read a list of narrowed instances in the form of the business instance. Also apply the given sort.
      Specified by:
      readAll in interface SharedCodeSummaryService<P extends SharedCodeAuditSummary>
      Parameters:
      sort - The sort to be performed on the results
      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 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: SharedCodeSummaryService
      Retrieve 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. See FilterParser for more information.

      This version also accepts a formatted sort string that declares the sorting characteristics for the query. See SortParser for more information.

      Specified by:
      readAll in interface SharedCodeSummaryService<P extends SharedCodeAuditSummary>
      Parameters:
      filters - the RSQL Node used to restrict result, must not be null
      sort - The string containing the structured list of sorts to apply
      context - 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: SharedCodeSummaryService
      Retrieve 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. See FilterParser for more information.
      Specified by:
      readAll in interface SharedCodeSummaryService<P extends SharedCodeAuditSummary>
      Parameters:
      filters - the RSQL Node used to restrict result, must not be null
      context - 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: SharedCodeSummaryService
      Retrieve 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. See FilterParser for more information.

      This version also accepts a Sort to apply to the result set

      Specified by:
      readAll in interface SharedCodeSummaryService<P extends SharedCodeAuditSummary>
      Parameters:
      filters - the RSQL Node used to restrict result, must not be null
      sort - sort to apply to the query
      pageable - may be Pageable.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: SharedCodeSummaryService
      Retrieve 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. See FilterParser for more information.
      Specified by:
      readAll in interface SharedCodeSummaryService<P extends SharedCodeAuditSummary>
      Parameters:
      filters - the RSQL Node used to restrict result, must not be null
      pageable - may be Pageable.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: SharedCodeSummaryService
      Create an instance of SharedCodeAuditSummary, or atomically update an existing one. This flow also will not end up creating duplicate summaries for the same offer.
      Specified by:
      createOrUpdateAndIncrement in interface SharedCodeSummaryService<P extends SharedCodeAuditSummary>
      Parameters:
      offerCodeId - The id of the related offer
      offerCode - The string offer code of the related offer
      totalSavings - The total savings applied to record for this offer
      context - 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: SharedCodeSummaryService
      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 through DomainMapper.deleteMap(Object, ContextInfo).
      Specified by:
      delete in interface SharedCodeSummaryService<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: SharedCodeSummaryService
      Retrieve the SharedCodeAuditSummary record for the provided offer code ID.
      Specified by:
      readByOfferCodeId in interface SharedCodeSummaryService<P extends SharedCodeAuditSummary>
      Parameters:
      offerCodeId - the offer code ID to find summary record for
      contextInfo - the context to perform the operation in
      Returns:
      the SharedCodeAuditSummary record 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: SharedCodeSummaryService
      Retrieve all SharedCodeAuditSummary records that relate to the provided offer code IDs.
      Specified by:
      readAllByOfferCodeIds in interface SharedCodeSummaryService<P extends SharedCodeAuditSummary>
      Parameters:
      offerCodeIds - the list of offer code IDs to find summary records for
      contextInfo - the context to perform the operation in
      Returns:
      the SharedCodeAuditSummary records 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()