Class CustomerSegmentDaoImpl
java.lang.Object
com.broadleafcommerce.customersegment.dao.CustomerSegmentDaoImpl
- All Implemented Interfaces:
CustomerSegmentDao
@Repository("blCustomerSegmentDao")
public class CustomerSegmentDaoImpl
extends Object
implements CustomerSegmentDao
Provides database access for CustomerSegment
- Author:
- bpolster
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected jakarta.persistence.EntityManagerprotected org.broadleafcommerce.common.persistence.EntityConfigurationprotected CustomerSegmentDaoExtensionManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintarchiveCustomerPurchaseBasedCustomerSegmentXrefs(List<Long> customerIds, Long segmentId) protected List<jakarta.persistence.criteria.Predicate>buildPredicates(jakarta.persistence.criteria.Path xref, jakarta.persistence.criteria.Path customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer, jakarta.persistence.criteria.CriteriaBuilder builder) voidclear()booleancustomerIdentifiesWithCustomerSegment(Long segmentId, org.broadleafcommerce.profile.core.domain.Customer customer) Determines if the sent customer matches the identifying criteria for the customer segment with id segmentIdvoidDeletes the passed in PurchaseCustomerCustomerSegmentXref.voiddeleteCustomerSegment(CustomerSegment customerSegment) Removes the passed in CustomerSegment.protected jakarta.persistence.criteria.CriteriaQuery<CustPrchBasedCustSegXref>getAllPurchaseBasedCustomersQuery(CustomerSegment customerSegment) protected jakarta.persistence.criteria.CriteriaQuery<Long>protected jakarta.persistence.criteria.CriteriaQuery<Long>protected jakarta.persistence.criteria.CriteriaQuery<Long>getPotentialCustomerCriteria(PurchBasedCustSegConfigDTO config, boolean isCountQuery) booleanisCustomerInPurchaseBasedCustomerSegment(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Returns whether or not this customer qualified for the purchase requirements of this customer segmentreadAllCustomersInSegmentWithLatestPurchaseBeforeDate(CustomerSegment customerSegment, Date cutoffDate) Finds all customers for a customer segment that made a qualifying purchase before the cutoff datereadAllCustomersWithPurchasesInDateRange(int size, int start, PurchBasedCustSegConfigDTO config) Finds all customer segments that have purchase requirementsreadAllPurchaseBasedCustomersInSegment(int size, int start, CustomerSegment segment) readAllPurchaseBasedCustomersInSegment(CustomerSegment customerSegment) Read all CustomerSegmentsreadBatchCustomerCustomerSegXrefs(int firstRecord, int count) readBatchCustomerCustomerSegXrefs(Long firstId, int count) Returns list of CustomerCustomerSegmentXrefs starting at start up to start+count.readBatchXrefsForCustomerSegment(Long customerSegmentId, Integer firstRecord, int count) readBatchXrefsForCustomerSegment(Long customerSegmentId, Long firstId, int count) Returns list of CustomerCustomerSegmentXrefs for a specific CustomerSegment starting at start up to start+count.intintreadCustomerForPurchaseBasedSegment(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Finds a specific customer in a purchase based customer segmentFinds the CustomerSegment for the passed in id.readCustomerSegmentByIds(List<Long> ids) readCustomerSegmentsByFilterAndLimit(String filter, Integer limit) readListBasedCustomerSegmentsForCustomer(org.broadleafcommerce.profile.core.domain.Customer customer) Finds all CustomerSegments that contain this customer.Returns the total number of Customer Segments for the current site.readNumberOfXrefsForCustomerSegment(Long customerSegmentId) save(CustPrchBasedCustSegXref xref) Creates or updates the passed in PurchaseCustomerCustomerSegmentXref.saveCustomerSegment(CustomerSegment customerSegment) Creates or updates the passed in CustomerSegment.
-
Field Details
-
BLC_ARCHIVE_PURCHASE_BASED_CUSTOMERS
- See Also:
-
em
protected jakarta.persistence.EntityManager em -
entityConfiguration
protected org.broadleafcommerce.common.persistence.EntityConfiguration entityConfiguration -
extensionManager
-
-
Constructor Details
-
CustomerSegmentDaoImpl
public CustomerSegmentDaoImpl()
-
-
Method Details
-
readAllRuleBasedCustomerSegments
Description copied from interface:CustomerSegmentDaoRead all CustomerSegments- Specified by:
readAllRuleBasedCustomerSegmentsin interfaceCustomerSegmentDao- Returns:
-
clear
public void clear()- Specified by:
clearin interfaceCustomerSegmentDao
-
readBatchCustomerCustomerSegXrefs
Description copied from interface:CustomerSegmentDaoReturns list of CustomerCustomerSegmentXrefs starting at start up to start+count.- Specified by:
readBatchCustomerCustomerSegXrefsin interfaceCustomerSegmentDao
-
readBatchCustomerCustomerSegXrefs
public List<CustomerCustomerSegmentXref> readBatchCustomerCustomerSegXrefs(int firstRecord, int count) - Specified by:
readBatchCustomerCustomerSegXrefsin interfaceCustomerSegmentDao
-
readBatchXrefsForCustomerSegment
public List<CustomerCustomerSegmentXref> readBatchXrefsForCustomerSegment(Long customerSegmentId, Long firstId, int count) Description copied from interface:CustomerSegmentDaoReturns list of CustomerCustomerSegmentXrefs for a specific CustomerSegment starting at start up to start+count.- Specified by:
readBatchXrefsForCustomerSegmentin interfaceCustomerSegmentDao
-
readBatchXrefsForCustomerSegment
public List<CustomerCustomerSegmentXref> readBatchXrefsForCustomerSegment(Long customerSegmentId, Integer firstRecord, int count) - Specified by:
readBatchXrefsForCustomerSegmentin interfaceCustomerSegmentDao
-
readNumberOfCustomerCustomerSegXrefs
- Specified by:
readNumberOfCustomerCustomerSegXrefsin interfaceCustomerSegmentDao
-
readNumberOfXrefsForCustomerSegment
- Specified by:
readNumberOfXrefsForCustomerSegmentin interfaceCustomerSegmentDao
-
readCustomerSegmentsByFilterAndLimit
- Specified by:
readCustomerSegmentsByFilterAndLimitin interfaceCustomerSegmentDao
-
readCustomerSegmentsByLimit
- Specified by:
readCustomerSegmentsByLimitin interfaceCustomerSegmentDao
-
readAllPurchaseBasedCustomerSegments
Description copied from interface:CustomerSegmentDaoFinds all customer segments that have purchase requirements- Specified by:
readAllPurchaseBasedCustomerSegmentsin interfaceCustomerSegmentDao- Returns:
-
readCustomerSegmentById
Description copied from interface:CustomerSegmentDaoFinds the CustomerSegment for the passed in id.- Specified by:
readCustomerSegmentByIdin interfaceCustomerSegmentDao- Returns:
-
readCustomerSegmentByName
- Specified by:
readCustomerSegmentByNamein interfaceCustomerSegmentDao
-
readCustomerSegmentByIds
- Specified by:
readCustomerSegmentByIdsin interfaceCustomerSegmentDao
-
readNumberOfCustomerSegments
Description copied from interface:CustomerSegmentDaoReturns the total number of Customer Segments for the current site.- Specified by:
readNumberOfCustomerSegmentsin interfaceCustomerSegmentDao- Returns:
- total number of Customer Segments for the current site
-
isCustomerInPurchaseBasedCustomerSegment
public boolean isCustomerInPurchaseBasedCustomerSegment(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Description copied from interface:CustomerSegmentDaoReturns whether or not this customer qualified for the purchase requirements of this customer segment- Specified by:
isCustomerInPurchaseBasedCustomerSegmentin interfaceCustomerSegmentDao- Returns:
-
saveCustomerSegment
@Transactional("blTransactionManager") public CustomerSegment saveCustomerSegment(CustomerSegment customerSegment) Creates or updates the passed in CustomerSegment.- Specified by:
saveCustomerSegmentin interfaceCustomerSegmentDao- Parameters:
customerSegment-- Returns:
-
save
@Transactional("blTransactionManager") public CustPrchBasedCustSegXref save(CustPrchBasedCustSegXref xref) Creates or updates the passed in PurchaseCustomerCustomerSegmentXref.- Specified by:
savein interfaceCustomerSegmentDao- Parameters:
xref-- Returns:
-
delete
Deletes the passed in PurchaseCustomerCustomerSegmentXref.- Specified by:
deletein interfaceCustomerSegmentDao- Parameters:
xref-
-
deleteCustomerSegment
Removes the passed in CustomerSegment.- Specified by:
deleteCustomerSegmentin interfaceCustomerSegmentDao- Parameters:
customerSegment-
-
readAllOfferCustomerSegmentXrefsByOfferId
- Specified by:
readAllOfferCustomerSegmentXrefsByOfferIdin interfaceCustomerSegmentDao
-
readAllPurchaseBasedCustomersInSegment
public List<CustPrchBasedCustSegXref> readAllPurchaseBasedCustomersInSegment(int size, int start, CustomerSegment segment) - Specified by:
readAllPurchaseBasedCustomersInSegmentin interfaceCustomerSegmentDao
-
readCountAllPurchaseBasedCustomersInSegment
- Specified by:
readCountAllPurchaseBasedCustomersInSegmentin interfaceCustomerSegmentDao
-
readAllPurchaseBasedCustomersInSegment
public List<CustPrchBasedCustSegXref> readAllPurchaseBasedCustomersInSegment(CustomerSegment customerSegment) - Specified by:
readAllPurchaseBasedCustomersInSegmentin interfaceCustomerSegmentDao
-
getAllPurchaseBasedCustomersQuery
protected jakarta.persistence.criteria.CriteriaQuery<CustPrchBasedCustSegXref> getAllPurchaseBasedCustomersQuery(CustomerSegment customerSegment) -
readAllCustomersInSegmentWithLatestPurchaseBeforeDate
public List<CustPrchBasedCustSegXref> readAllCustomersInSegmentWithLatestPurchaseBeforeDate(CustomerSegment customerSegment, Date cutoffDate) Description copied from interface:CustomerSegmentDaoFinds all customers for a customer segment that made a qualifying purchase before the cutoff date- Specified by:
readAllCustomersInSegmentWithLatestPurchaseBeforeDatein interfaceCustomerSegmentDao- Returns:
-
readCustomerForPurchaseBasedSegment
public CustPrchBasedCustSegXref readCustomerForPurchaseBasedSegment(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Description copied from interface:CustomerSegmentDaoFinds a specific customer in a purchase based customer segment- Specified by:
readCustomerForPurchaseBasedSegmentin interfaceCustomerSegmentDao- Returns:
-
readCountAllCustomersWithPurchasesInDateRange
- Specified by:
readCountAllCustomersWithPurchasesInDateRangein interfaceCustomerSegmentDao
-
readAllCustomersWithPurchasesInDateRange
public List<Long> readAllCustomersWithPurchasesInDateRange(int size, int start, PurchBasedCustSegConfigDTO config) - Specified by:
readAllCustomersWithPurchasesInDateRangein interfaceCustomerSegmentDao
-
getPotentialCustomerCountCriteria
protected jakarta.persistence.criteria.CriteriaQuery<Long> getPotentialCustomerCountCriteria(PurchBasedCustSegConfigDTO config) -
getPotentialCustomerCriteria
protected jakarta.persistence.criteria.CriteriaQuery<Long> getPotentialCustomerCriteria(PurchBasedCustSegConfigDTO config) -
getPotentialCustomerCriteria
protected jakarta.persistence.criteria.CriteriaQuery<Long> getPotentialCustomerCriteria(PurchBasedCustSegConfigDTO config, boolean isCountQuery) -
readListBasedCustomerSegmentsForCustomer
public List<CustomerSegment> readListBasedCustomerSegmentsForCustomer(org.broadleafcommerce.profile.core.domain.Customer customer) Description copied from interface:CustomerSegmentDaoFinds all CustomerSegments that contain this customer. Returns an empty List if customer is anonymous to preventIllegalArgumentException, since anonymous customers will have null customerId.- Specified by:
readListBasedCustomerSegmentsForCustomerin interfaceCustomerSegmentDao- Returns:
-
archiveCustomerPurchaseBasedCustomerSegmentXrefs
- Specified by:
archiveCustomerPurchaseBasedCustomerSegmentXrefsin interfaceCustomerSegmentDao
-
customerIdentifiesWithCustomerSegment
public boolean customerIdentifiesWithCustomerSegment(Long segmentId, org.broadleafcommerce.profile.core.domain.Customer customer) Determines if the sent customer matches the identifying criteria for the customer segment with id segmentId- Specified by:
customerIdentifiesWithCustomerSegmentin interfaceCustomerSegmentDao- Parameters:
segmentId- the Customer Segment id to check againstcustomer- the customer we're checking to see if matches the given customer segment or not- Returns:
- true if the customer sent identifies with the customer segment sent
-
buildPredicates
protected List<jakarta.persistence.criteria.Predicate> buildPredicates(jakarta.persistence.criteria.Path xref, jakarta.persistence.criteria.Path customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer, jakarta.persistence.criteria.CriteriaBuilder builder)
-