Class JpaCustomizedCartRepository<D extends JpaCart>

    • Constructor Detail

      • JpaCustomizedCartRepository

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

      • afterPropertiesSet

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

        @Autowired
        @Lazy
        public void setRepository​(CartRepository<D> repository)
      • findByStatusAndCustomerId

        public Optional<D> findByStatusAndCustomerId​(String status,
                                                     String customerId,
                                                     @Nullable
                                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CustomizedCartRepository
        Finds a cart with the given status for the customer ID provided. By default, if multiple are found, this selects the cart with the latest createDate.
        Specified by:
        findByStatusAndCustomerId in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        status - the status to find carts of
        customerId - the customer ID to find carts with
        contextInfo - the context to use for filtering the results
        Returns:
        the cart with requested details, or empty if none was found.
      • findByStatusAndCustomerIdAndAccountId

        public Optional<D> findByStatusAndCustomerIdAndAccountId​(String status,
                                                                 String customerId,
                                                                 @Nullable
                                                                 String accountId,
                                                                 @Nullable
                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CustomizedCartRepository
        Finds a cart with the given status for the customer ID and account ID provided. By default, if multiple are found, this selects the cart with the latest createDate.
        Specified by:
        findByStatusAndCustomerIdAndAccountId in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        status - the status to find carts of
        customerId - the customer ID to find carts with
        accountId - the account ID to find carts with
        contextInfo - the context to use for filtering the results
        Returns:
        the cart with requested details, or empty if none was found.
      • findByStatusAndCustomerRefCustomerId

        @Deprecated
        public Optional<D> findByStatusAndCustomerRefCustomerId​(String status,
                                                                String customerId,
                                                                @Nullable
                                                                com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Deprecated.
        Description copied from interface: CustomizedCartRepository
        Finds a cart with the given status for the customer ID provided. By default, if multiple are found, this selects the cart with the latest createDate.
        Specified by:
        findByStatusAndCustomerRefCustomerId in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        status - the status to find carts of
        customerId - the customer ID to find carts with
        contextInfo - the context to use for filtering the results
        Returns:
        the cart with requested details, or empty if none was found.
      • findAllByStatusesAndCustomerId

        public org.springframework.data.domain.Page<D> findAllByStatusesAndCustomerId​(Set<String> statuses,
                                                                                      String customerId,
                                                                                      @Nullable
                                                                                      org.springframework.data.domain.Pageable page,
                                                                                      @Nullable
                                                                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CustomizedCartRepository
        Finds all carts with the given status within the requested page
        Specified by:
        findAllByStatusesAndCustomerId in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        statuses - the status of the carts to consider
        customerId - the ID of the customer to find carts for
        page - the requested page of results from the database
        contextInfo - context information related to multitenancy
        Returns:
        a page of carts with the requested details
      • findAllByStatusesAndCustomerIdAndAccountId

        public org.springframework.data.domain.Page<D> findAllByStatusesAndCustomerIdAndAccountId​(Set<String> statuses,
                                                                                                  String customerId,
                                                                                                  @Nullable
                                                                                                  String accountId,
                                                                                                  @Nullable
                                                                                                  org.springframework.data.domain.Pageable page,
                                                                                                  @Nullable
                                                                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CustomizedCartRepository
        Finds all carts with the given status within the requested page. Account id can be null to find customer's personal non-account carts.
        Specified by:
        findAllByStatusesAndCustomerIdAndAccountId in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        statuses - the status of the carts to consider
        customerId - the ID of the customer to find carts for
        page - the requested page of results from the database
        contextInfo - context information related to multitenancy
        Returns:
        a page of carts with the requested details
      • findAllByStatusesAndCustomerRefCustomerId

        @Deprecated
        public org.springframework.data.domain.Page<D> findAllByStatusesAndCustomerRefCustomerId​(Set<String> statuses,
                                                                                                 String customerId,
                                                                                                 @Nullable
                                                                                                 org.springframework.data.domain.Pageable page,
                                                                                                 @Nullable
                                                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Deprecated.
        Description copied from interface: CustomizedCartRepository
        Finds all carts with the given status within the requested page
        Specified by:
        findAllByStatusesAndCustomerRefCustomerId in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        statuses - the status of the carts to consider
        customerId - the ID of the customer to find carts for
        page - the requested page of results from the database
        contextInfo - context information related to multitenancy
        Returns:
        a page of carts with the requested details
      • findHistoricalByCustomerIdAndDates

        public org.springframework.data.domain.Page<D> findHistoricalByCustomerIdAndDates​(String customerId,
                                                                                          Date startDate,
                                                                                          Date endDate,
                                                                                          @Nullable
                                                                                          org.springframework.data.domain.Pageable page,
                                                                                          @Nullable
                                                                                          com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CustomizedCartRepository
        Find all carts that are DefaultCartStatuses.CANCELLED or DefaultCartStatuses.SUBMITTED for the provided customer and dates.
        Specified by:
        findHistoricalByCustomerIdAndDates in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        customerId - the id of the customer who owns the carts
        startDate - the starting date to filter carts by
        endDate - the ending date to filter carts by
        page - the requested page of results from the database
        contextInfo - context information related to multitenancy
        Returns:
        all carts that are DefaultCartStatuses.CANCELLED or DefaultCartStatuses.SUBMITTED for the provided customer and dates.
      • findHistoricalByCustomerRefCustomerIdAndDates

        @Deprecated
        public org.springframework.data.domain.Page<D> findHistoricalByCustomerRefCustomerIdAndDates​(String customerId,
                                                                                                     Date startDate,
                                                                                                     Date endDate,
                                                                                                     @Nullable
                                                                                                     org.springframework.data.domain.Pageable page,
                                                                                                     @Nullable
                                                                                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Deprecated.
        Description copied from interface: CustomizedCartRepository
        Find all carts that are DefaultCartStatuses.SUBMITTED or DefaultCartStatuses.CANCELLED for the provided customer and dates.
        Specified by:
        findHistoricalByCustomerRefCustomerIdAndDates in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        customerId - the id of the customer who owns the carts
        startDate - the starting date to filter carts by
        endDate - the ending date to filter carts by
        page - the requested page of results from the database
        contextInfo - context information related to multitenancy
        Returns:
        all carts that are DefaultCartStatuses.SUBMITTED or DefaultCartStatuses.CANCELLED for the provided customer and dates.
      • deleteAbandonedAnonymousCarts

        @Transactional("cartTransactionManager")
        public int deleteAbandonedAnonymousCarts​(Instant deletePoint,
                                                 Collection<String> statuses,
                                                 @Nullable
                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CustomizedCartRepository
        Delete anonymous carts that have not been updated since the given date.
        Specified by:
        deleteAbandonedAnonymousCarts in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        deletePoint - Find carts that have not been updated since this Instant.
        statuses - Find carts that have one of these statuses.
        contextInfo - context information related to multitenancy.
        Returns:
        The number of carts deleted.
      • findPageMatchingTenantByStatus

        public org.springframework.data.domain.Page<D> findPageMatchingTenantByStatus​(String status,
                                                                                      @Nullable
                                                                                      org.springframework.data.domain.Pageable pageable,
                                                                                      @Nullable
                                                                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CustomizedCartRepository
        Finds a page of the carts with the given status and matching the tenant from the given ContextInfo.
        Specified by:
        findPageMatchingTenantByStatus in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        status - the status of the cart
        pageable - the requested page of results from the database
        contextInfo - context information related to multitenancy
        Returns:
        A page of the carts with the given status and matching the tenant from the given ContextInfo.
      • findAllMatchingTenantByIds

        public List<D> findAllMatchingTenantByIds​(List<String> ids,
                                                  @Nullable
                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CustomizedCartRepository
        Finds a list of the carts with the given ids and matching the tenant from the given ContextInfo.
        Specified by:
        findAllMatchingTenantByIds in interface CustomizedCartRepository<D extends JpaCart>
        Parameters:
        ids - the ids of the cart
        contextInfo - context information related to multitenancy
        Returns:
        Finds a list of the carts with the given ids and matching the tenant from the given ContextInfo.
      • getAbandonedCartPredicate

        @Deprecated
        protected javax.persistence.criteria.Predicate getAbandonedCartPredicate​(Instant abandonedPoint,
                                                                                 Collection<String> statuses,
                                                                                 javax.persistence.criteria.CriteriaBuilder builder,
                                                                                 javax.persistence.criteria.Root<D> entity)
        Build the Predicate to determine which carts are abandoned.
        Parameters:
        abandonedPoint - Consider carts that have not been updated since this Instant.
        statuses - Consider carts that have one of these statuses.
        builder - The CriteriaBuilder for this query.
        entity - The Root entity of this delete query.
        Returns:
        A Predicate to find carts that are abandoned.
      • getAbandonedCartPredicate

        protected javax.persistence.criteria.Predicate getAbandonedCartPredicate​(Instant abandonedPoint,
                                                                                 Collection<String> statuses,
                                                                                 javax.persistence.criteria.CriteriaBuilder builder,
                                                                                 javax.persistence.criteria.Root<D> entity,
                                                                                 @Nullable
                                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Build the Predicate to determine which carts are abandoned.
        Parameters:
        abandonedPoint - Consider carts that have not been updated since this Instant.
        statuses - Consider carts that have one of these statuses.
        builder - The CriteriaBuilder for this query.
        entity - The Root entity of this delete query.
        Returns:
        A Predicate to find carts that are abandoned.
      • buildTenantIdFilter

        protected javax.persistence.criteria.Predicate buildTenantIdFilter​(javax.persistence.criteria.Root<D> entity,
                                                                           javax.persistence.criteria.CriteriaBuilder builder,
                                                                           @Nullable
                                                                           com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • getTenantIdFromContext

        @Nullable
        protected String getTenantIdFromContext​(@Nullable
                                                com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • setPageableProperties

        protected void setPageableProperties​(javax.persistence.TypedQuery<D> query,
                                             @Nullable
                                             org.springframework.data.domain.Pageable pageable)
        Sets the Pageable properties for the given TypedQuery.
        Parameters:
        query - the TypedQuery to sets the Pageable properties for
        pageable - the Pageable to get the properties from
      • getNarrowingHelper

        protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper getNarrowingHelper()