Class DefaultOfferOptInService<P extends OfferOptIn>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.promotion.offer.service.DefaultOfferOptInService<P>
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>, OfferOptInService<P>, EventListener, org.springframework.context.ApplicationListener<PromotionCacheInvalidationEvent>

public class DefaultOfferOptInService<P extends OfferOptIn> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P> implements OfferOptInService<P>, org.springframework.context.ApplicationListener<PromotionCacheInvalidationEvent>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultOfferOptInService(OfferOptInRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    buildOptIn(Offer offer, boolean isMutable)
    Build an opt-in for the given offer.
    protected com.broadleafcommerce.common.extension.cache.CacheStateManager
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    void
     
    org.springframework.data.domain.Page<P>
    readAllByOfferIds(Collection<String> offerIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find all optIns matched against their related offers.
    readByOfferId(String offerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find the optIn matched against its related offer.
    replace(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    void
    setCacheStateManager(com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
     
    void
    setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
     
    update(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService

    getRsqlHelper, readAll, readAll, readAll, readAll

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService

    convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getRepository, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, updateAll, updateAllAllowingPartialSuccess, updateSort

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.context.ApplicationListener

    supportsAsyncExecution

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, updateAll, updateAllAllowingPartialSuccess, updateSort

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService

    readAll, readAll, readAll, readAll
  • Field Details

  • Constructor Details

    • DefaultOfferOptInService

      public DefaultOfferOptInService(OfferOptInRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
  • Method Details

    • onApplicationEvent

      public void onApplicationEvent(PromotionCacheInvalidationEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<P extends OfferOptIn>
    • readAllByOfferIds

      public org.springframework.data.domain.Page<P> readAllByOfferIds(Collection<String> offerIds, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OfferOptInService
      Find all optIns matched against their related offers.
      Specified by:
      readAllByOfferIds in interface OfferOptInService<P extends OfferOptIn>
      Parameters:
      offerIds - The ids of the offers
      filters - Any RSQL filters to apply for refining the query
      pageInfo - The paging information
      contextInfo - The tenant contenxt information
      Returns:
      A page of opt in query results
    • readByOfferId

      public Optional<P> readByOfferId(String offerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OfferOptInService
      Find the optIn matched against its related offer.
      Specified by:
      readByOfferId in interface OfferOptInService<P extends OfferOptIn>
      Parameters:
      offerId - The id of the offer
      contextInfo - The tenant contenxt information
      Returns:
      A page of opt in query results
    • update

      public P update(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Specified by:
      update in interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends OfferOptIn>
      Overrides:
      update in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends OfferOptIn>
    • replace

      public P replace(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Specified by:
      replace in interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends OfferOptIn>
      Overrides:
      replace in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends OfferOptIn>
    • buildOptIn

      public OfferOptIn buildOptIn(Offer offer, boolean isMutable)
      Description copied from interface: OfferOptInService
      Build an opt-in for the given offer.
      Specified by:
      buildOptIn in interface OfferOptInService<P extends OfferOptIn>
      Parameters:
      offer - The offer to build the opt-in for
      isMutable - Whether the opt-in should be mutable or not
      Returns:
      The built opt-in
    • getCacheStateManager

      @Nullable protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager()
    • setCacheStateManager

      @Autowired(required=false) public void setCacheStateManager(com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • setTypeFactory

      @Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)