Class CustomerSegmentServiceImpl
java.lang.Object
com.broadleafcommerce.customersegment.service.CustomerSegmentServiceImpl
- All Implemented Interfaces:
CustomerSegmentService
@Service("blCustomerSegmentService")
public class CustomerSegmentServiceImpl
extends Object
implements CustomerSegmentService
Service to programatically add customers to segments, determine if a customer
is part of a segment, or find all segments for which a customer is a member.
- Author:
- bpolster
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.broadleafcommerce.common.crossapp.service.CrossAppAuthServiceprotected CustomerSegmentDao -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintarchiveCustomerPurchaseBasedCustomerSegmentXrefs(List<Long> customerIds, Long segmentId) booleancheckCustomerSegmentMembership(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Returns true if the passed in customer is a member of the passed in segment.protected booleancheckCustomerSetCustomerSegmentMembership(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Returns true if the passed in customer is a member of the passed in CustomerSegmentprotected booleancheckForPreviewCustomerSegmentOverride(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) protected booleancheckPurchaseCustomerSegmentMembership(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) protected booleancheckRequestBasedCustomerSegmentMembership(CustomerSegment customerSegment) protected booleancheckRuleBasedCustomerSegmentMembership(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Returns true if the passed in customer is a member of the passed in CustomerSegmentvoidclear()booleancustomerIdentifiesWithCustomerSegment(Long segmentId, org.broadleafcommerce.profile.core.domain.Customer customer) voidDeletes the passed PurchaseCustomerCustomerSegmentXreffindAllCustomersInSegmentWithLatestPurchaseBeforeDate(CustomerSegment customerSegment, Date cutoffDate) Finds all customers for a customer segment that made a qualifying purchase before the cutoff datefindAllCustomersWithPurchasesInDateRange(int size, int start, PurchBasedCustSegConfigDTO config) Returns the list of OfferCustomerSegmentXrefs for the given Offer id.Finds all customer segments that have purchase requirementsfindAllPurchaseBasedCustomersInSegment(int size, int start, CustomerSegment segment) findAllPurchaseBasedCustomersInSegment(CustomerSegment customerSegment) findBatchCustomerCustomerSegXrefs(int firstRecord, int count) findBatchCustomerCustomerSegXrefs(Long firstId, int count) Returns list of CustomerCustomerSegmentXrefs starting at start up to start+count.findBatchXrefsForCustomerSegment(Long customerSegmentId, Integer recordNumber, int count) findBatchXrefsForCustomerSegment(Long customerSegmentId, Long firstId, int count) Returns list of CustomerCustomerSegmentXrefs for a specific CustomerSegment starting at start up to start+count.intintfindCustomerForPurchaseBasedSegment(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Finds a specific customer in a purchase based customer segment.Returns the CustomerSegment for the given id.findCustomerSegmentByIds(List<Long> ids) Returns the CustomerSegment for the given name.findCustomerSegmentsByFilterAndLimit(String filter, Integer limit) findCustomerSegmentsWithMember(org.broadleafcommerce.profile.core.domain.Customer customer) Returns the list of customer segments for which the customer is a member.getNumberOfXrefsForCustomerSegment(Long customerSegmentId) protected booleanIf you are cross-app authenticated and you are not a CSR, then you can preview segments.Returns the total number of Customer Segments for the current site.save(CustomerSegment customerSegment) Saves and returns the passed customer segment.save(CustPrchBasedCustSegXref xref) Saves and returns the passed PurchaseCustomerCustomerSegmentXrefvoidsetCrossAppAuthService(org.broadleafcommerce.common.crossapp.service.CrossAppAuthService crossAppAuthService) voidsetCustomerSegmentDao(CustomerSegmentDao customerSegmentDao)
-
Field Details
-
customerSegmentDao
-
crossAppAuthService
protected org.broadleafcommerce.common.crossapp.service.CrossAppAuthService crossAppAuthService
-
-
Constructor Details
-
CustomerSegmentServiceImpl
public CustomerSegmentServiceImpl()
-
-
Method Details
-
setCustomerSegmentDao
@Autowired @Qualifier("blCustomerSegmentDao") public void setCustomerSegmentDao(CustomerSegmentDao customerSegmentDao) -
setCrossAppAuthService
@Autowired(required=false) public void setCrossAppAuthService(org.broadleafcommerce.common.crossapp.service.CrossAppAuthService crossAppAuthService) -
save
Description copied from interface:CustomerSegmentServiceSaves and returns the passed customer segment.- Specified by:
savein interfaceCustomerSegmentService- Returns:
-
save
@Transactional("blTransactionManager") public CustPrchBasedCustSegXref save(CustPrchBasedCustSegXref xref) Description copied from interface:CustomerSegmentServiceSaves and returns the passed PurchaseCustomerCustomerSegmentXref- Specified by:
savein interfaceCustomerSegmentService- Returns:
-
delete
Description copied from interface:CustomerSegmentServiceDeletes the passed PurchaseCustomerCustomerSegmentXref- Specified by:
deletein interfaceCustomerSegmentService
-
findCustomerSegmentsByFilterAndLimit
- Specified by:
findCustomerSegmentsByFilterAndLimitin interfaceCustomerSegmentService
-
findCustomerSegmentsByLimit
- Specified by:
findCustomerSegmentsByLimitin interfaceCustomerSegmentService
-
findCustomerSegmentById
Description copied from interface:CustomerSegmentServiceReturns the CustomerSegment for the given id.- Specified by:
findCustomerSegmentByIdin interfaceCustomerSegmentService- Returns:
-
findCustomerSegmentByIds
- Specified by:
findCustomerSegmentByIdsin interfaceCustomerSegmentService
-
findCustomerSegmentByName
Description copied from interface:CustomerSegmentServiceReturns the CustomerSegment for the given name.- Specified by:
findCustomerSegmentByNamein interfaceCustomerSegmentService- Returns:
-
readNumberOfCustomerSegments
Description copied from interface:CustomerSegmentServiceReturns the total number of Customer Segments for the current site.- Specified by:
readNumberOfCustomerSegmentsin interfaceCustomerSegmentService- Returns:
- total number of Customer Segments for the current site.
-
checkCustomerSegmentMembership
public boolean checkCustomerSegmentMembership(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Description copied from interface:CustomerSegmentServiceReturns true if the passed in customer is a member of the passed in segment.- Specified by:
checkCustomerSegmentMembershipin interfaceCustomerSegmentService- Parameters:
customerSegment- The segment to checkcustomer- The customer to check- Returns:
-
checkForPreviewCustomerSegmentOverride
protected boolean checkForPreviewCustomerSegmentOverride(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) -
isAuthorizedToPreviewSegments
protected boolean isAuthorizedToPreviewSegments()If you are cross-app authenticated and you are not a CSR, then you can preview segments. -
checkCustomerSetCustomerSegmentMembership
protected boolean checkCustomerSetCustomerSegmentMembership(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Returns true if the passed in customer is a member of the passed in CustomerSegment- Parameters:
customerSegment-customer-- Returns:
-
checkRuleBasedCustomerSegmentMembership
protected boolean checkRuleBasedCustomerSegmentMembership(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Returns true if the passed in customer is a member of the passed in CustomerSegment- Parameters:
customerSegment-- Returns:
-
checkPurchaseCustomerSegmentMembership
protected boolean checkPurchaseCustomerSegmentMembership(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) -
checkRequestBasedCustomerSegmentMembership
-
findCustomerSegmentsWithMember
public List<CustomerSegment> findCustomerSegmentsWithMember(org.broadleafcommerce.profile.core.domain.Customer customer) Description copied from interface:CustomerSegmentServiceReturns the list of customer segments for which the customer is a member.- Specified by:
findCustomerSegmentsWithMemberin interfaceCustomerSegmentService- Returns:
-
findAllOfferCustomerSegmentXrefsByOfferId
Description copied from interface:CustomerSegmentServiceReturns the list of OfferCustomerSegmentXrefs for the given Offer id.- Specified by:
findAllOfferCustomerSegmentXrefsByOfferIdin interfaceCustomerSegmentService- Returns:
- list of OfferCustomerSegmentXrefs
-
findAllPurchaseBasedCustomerSegments
Description copied from interface:CustomerSegmentServiceFinds all customer segments that have purchase requirements- Specified by:
findAllPurchaseBasedCustomerSegmentsin interfaceCustomerSegmentService- Returns:
-
findAllCustomersInSegmentWithLatestPurchaseBeforeDate
public List<CustPrchBasedCustSegXref> findAllCustomersInSegmentWithLatestPurchaseBeforeDate(CustomerSegment customerSegment, Date cutoffDate) Description copied from interface:CustomerSegmentServiceFinds all customers for a customer segment that made a qualifying purchase before the cutoff date- Specified by:
findAllCustomersInSegmentWithLatestPurchaseBeforeDatein interfaceCustomerSegmentService- Returns:
-
findAllPurchaseBasedCustomersInSegment
public List<CustPrchBasedCustSegXref> findAllPurchaseBasedCustomersInSegment(CustomerSegment customerSegment) - Specified by:
findAllPurchaseBasedCustomersInSegmentin interfaceCustomerSegmentService
-
findCustomerForPurchaseBasedSegment
public CustPrchBasedCustSegXref findCustomerForPurchaseBasedSegment(CustomerSegment customerSegment, org.broadleafcommerce.profile.core.domain.Customer customer) Description copied from interface:CustomerSegmentServiceFinds a specific customer in a purchase based customer segment.- Specified by:
findCustomerForPurchaseBasedSegmentin interfaceCustomerSegmentService- Returns:
-
findAllPurchaseBasedCustomersInSegment
public List<CustPrchBasedCustSegXref> findAllPurchaseBasedCustomersInSegment(int size, int start, CustomerSegment segment) - Specified by:
findAllPurchaseBasedCustomersInSegmentin interfaceCustomerSegmentService
-
findCountAllCustomersWithPurchasesInDateRange
- Specified by:
findCountAllCustomersWithPurchasesInDateRangein interfaceCustomerSegmentService
-
findAllCustomersWithPurchasesInDateRange
public List<Long> findAllCustomersWithPurchasesInDateRange(int size, int start, PurchBasedCustSegConfigDTO config) - Specified by:
findAllCustomersWithPurchasesInDateRangein interfaceCustomerSegmentService
-
findCountAllPurchaseBasedCustomersInSegment
- Specified by:
findCountAllPurchaseBasedCustomersInSegmentin interfaceCustomerSegmentService
-
archiveCustomerPurchaseBasedCustomerSegmentXrefs
- Specified by:
archiveCustomerPurchaseBasedCustomerSegmentXrefsin interfaceCustomerSegmentService
-
customerIdentifiesWithCustomerSegment
public boolean customerIdentifiesWithCustomerSegment(Long segmentId, org.broadleafcommerce.profile.core.domain.Customer customer) - Specified by:
customerIdentifiesWithCustomerSegmentin interfaceCustomerSegmentService
-
findBatchCustomerCustomerSegXrefs
Description copied from interface:CustomerSegmentServiceReturns list of CustomerCustomerSegmentXrefs starting at start up to start+count.- Specified by:
findBatchCustomerCustomerSegXrefsin interfaceCustomerSegmentService
-
findBatchCustomerCustomerSegXrefs
public List<CustomerCustomerSegmentXref> findBatchCustomerCustomerSegXrefs(int firstRecord, int count) - Specified by:
findBatchCustomerCustomerSegXrefsin interfaceCustomerSegmentService
-
findBatchXrefsForCustomerSegment
public List<CustomerCustomerSegmentXref> findBatchXrefsForCustomerSegment(Long customerSegmentId, Long firstId, int count) Description copied from interface:CustomerSegmentServiceReturns list of CustomerCustomerSegmentXrefs for a specific CustomerSegment starting at start up to start+count.- Specified by:
findBatchXrefsForCustomerSegmentin interfaceCustomerSegmentService
-
findBatchXrefsForCustomerSegment
public List<CustomerCustomerSegmentXref> findBatchXrefsForCustomerSegment(Long customerSegmentId, Integer recordNumber, int count) - Specified by:
findBatchXrefsForCustomerSegmentin interfaceCustomerSegmentService
-
getNumberOfCustomerCustomerSegXrefs
- Specified by:
getNumberOfCustomerCustomerSegXrefsin interfaceCustomerSegmentService
-
getNumberOfXrefsForCustomerSegment
- Specified by:
getNumberOfXrefsForCustomerSegmentin interfaceCustomerSegmentService
-
clear
public void clear()- Specified by:
clearin interfaceCustomerSegmentService
-