Class JpaCustomizedOfferRepository<D extends JpaOffer>

    • Constructor Detail

      • JpaCustomizedOfferRepository

        public JpaCustomizedOfferRepository​(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil,
                                            com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder criteriaBuilder)
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      • findAutomaticAndCodeAndCustomerOffers

        public Stream<D> findAutomaticAndCodeAndCustomerOffers​(Iterable<? extends UserTarget> userTargets,
                                                               Iterable<String> codes,
                                                               Iterable<String> trackingIds,
                                                               @Nullable
                                                               com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Description copied from interface: CustomizedOfferRepository
        Read all offers where Offer#getAutomaticallyConsidered is true, Offer.getCampaignTrackingIds() intersects with the provided tracking ids, Offer.getSharedCodes() intersects with the provided codes, or offers that contain the provided user targets. Intended to be used with the Campaign module and com.broadleafcommerce.promotion.campaign.domain.Campaign#id.
        Specified by:
        findAutomaticAndCodeAndCustomerOffers in interface CustomizedOfferRepository<D extends JpaOffer>
        Parameters:
        userTargets - The targets to match offers against
        codes - codes the returned Offer(s) are associated with.
        trackingIds - tracking ids the returned Offer(s) are associated with.
        context - Context information around sandbox and multitenant state.
        Returns:
        all offers where Offer#getAutomaticallyConsidered is true, or the offer is associated with the provided codes, tracking ids, or user targets.
      • findVoucherOffers

        public Stream<D> findVoucherOffers​(Iterable<? extends UserTarget> userTargets,
                                           Iterable<String> codes,
                                           Iterable<String> trackingIds,
                                           com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Description copied from interface: CustomizedOfferRepository
        Read all voucher offers where Offer#getAutomaticallyConsidered is true, Offer.getCampaignTrackingIds() intersects with the provided tracking ids, Offer.getSharedCodes() intersects with the provided codes, or offers that contain the provided user targets. Skips active date narrowing to fetch voucher offers for validation against submitted orders.
        Specified by:
        findVoucherOffers in interface CustomizedOfferRepository<D extends JpaOffer>
        Parameters:
        userTargets - The targets to match offers against
        codes - codes the returned Offer(s) are associated with.
        trackingIds - tracking ids the returned Offer(s) are associated with.
        context - Context information around sandbox and multitenant state.
        Returns:
        all voucher offers where Offer#getAutomaticallyConsidered is true, or the offer is associated with the provided codes, tracking ids, or user targets.
      • findAllCustomerOffers

        public Stream<D> findAllCustomerOffers​(Iterable<? extends UserTarget> userTargets,
                                               @Nullable
                                               com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CustomizedOfferRepository
        Read all offers that have no user targets or contain the provided user targets.
        Specified by:
        findAllCustomerOffers in interface CustomizedOfferRepository<D extends JpaOffer>
        Parameters:
        userTargets - The targets to match offers against
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        all offers that have no user targets or contain the provided user targets.
      • buildUserTargetSubquery

        protected javax.persistence.criteria.Subquery<String> buildUserTargetSubquery​(javax.persistence.criteria.CriteriaQuery<JpaOffer> criteria,
                                                                                      javax.persistence.criteria.CriteriaBuilder builder,
                                                                                      int userTargetsSize)
      • buildSharedCodesSubquery

        protected javax.persistence.criteria.Subquery<String> buildSharedCodesSubquery​(javax.persistence.criteria.CriteriaQuery<JpaOffer> criteria,
                                                                                       javax.persistence.criteria.CriteriaBuilder builder)
      • buildTrackingSubquery

        protected javax.persistence.criteria.Subquery<String> buildTrackingSubquery​(javax.persistence.criteria.CriteriaQuery<JpaOffer> criteria,
                                                                                    javax.persistence.criteria.CriteriaBuilder builder)
      • buildAutomaticOrCodeOrCustomerOffersPredicate

        protected javax.persistence.criteria.Predicate buildAutomaticOrCodeOrCustomerOffersPredicate​(Iterable<? extends UserTarget> userTargets,
                                                                                                     Iterable<String> codes,
                                                                                                     Iterable<String> trackingIds,
                                                                                                     javax.persistence.criteria.CriteriaQuery<JpaOffer> criteria,
                                                                                                     javax.persistence.criteria.CriteriaBuilder builder,
                                                                                                     javax.persistence.criteria.Root<JpaOffer> topRoot,
                                                                                                     Map<String,​Object> params)