Interface SegmentMemberService<P extends SegmentMember,S extends CustomerSegment>
- Type Parameters:
P-SegmentMemberor a subclass
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- All Known Implementing Classes:
DefaultSegmentMemberService
public interface SegmentMemberService<P extends SegmentMember,S extends CustomerSegment>
extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Interface for managing segment/customer relationships.
-
Method Summary
Modifier and TypeMethodDescriptioncreateSegmentMember(P segmentMember, String source, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Creates and adds a customer/segment relationship.readAllByCustomerEmailOrCustomerId(String customerEmail, String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the segment members for the specified customer segment id and customer email addresses.readAllBySegmentId(String segmentId, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the segment members for the specified customer segment id matching the given filters.readAllBySegmentIdAndCustomerEmail(String segmentId, Set<String> emailAddresses, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the segment members for the specified customer segment id and customer email addresses.readAllBySegmentIdAndCustomerIds(String segmentId, Set<String> customerIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the segment members for the specified customer segment id and customer ids.readMemberInSegment(String segmentId, String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Returns a particular customer/segment relationship with the designated customer and segment IDs.org.springframework.data.domain.Page<P>readMembersInSegment(String segmentId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a page of customers who are members of a segment.voidremoveAllMembersFromSegment(String segmentId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Removes all customer/segment relationships from a particular segment.voidremoveAllMembersNoLongerInSegment(S segment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Removes all customer/segment relationships for customers that no longer meet the segment's conditions.voidremoveMemberFromSegment(String segmentId, String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Removes a particular customer/segment relationship with the designated customer and segment IDs.Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Method Details
-
readMembersInSegment
org.springframework.data.domain.Page<P> readMembersInSegment(String segmentId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a page of customers who are members of a segment.- Parameters:
segmentId- The segment IDfilters- An RSQL filter used to narrow query results. May beEmptyNodeif no filters should be applied.pageable- The requested page of results from the databasecontext- Context information surrounding sandboxing and multitenant state- Returns:
- A page of customer/segment relationships
-
readMemberInSegment
Optional<P> readMemberInSegment(String segmentId, String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Returns a particular customer/segment relationship with the designated customer and segment IDs.- Parameters:
segmentId- The segment IDcustomerId- The customer IDcontext- Context information surrounding sandboxing and multitenant state- Returns:
- The customer/segment relationship.
-
removeMemberFromSegment
void removeMemberFromSegment(String segmentId, String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Removes a particular customer/segment relationship with the designated customer and segment IDs.- Parameters:
segmentId- The segment IDcustomerId- The customer IDcontext- Context information surrounding sandboxing and multitenant state
-
removeAllMembersFromSegment
void removeAllMembersFromSegment(String segmentId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Removes all customer/segment relationships from a particular segment.- Parameters:
segmentId- The segment IDcontext- Context information surrounding sandboxing and multitenant state
-
removeAllMembersNoLongerInSegment
void removeAllMembersNoLongerInSegment(S segment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Removes all customer/segment relationships for customers that no longer meet the segment's conditions.- Parameters:
segment- The segmentcontext- Context information surrounding sandboxing and multitenant state
-
createSegmentMember
P createSegmentMember(P segmentMember, String source, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Creates and adds a customer/segment relationship.This differs from a standard create in that additional validation is performed based on the segment's type. For example, attempting to manually add a customer to a segment with the type
RULE_BASEDis not allowed and an exception should be thrown.For performance critical operations (e.g. a bulk import), use
CrudEntityService.create(Object, ContextInfo)- Parameters:
segmentMember- The customer/segment relationship to create.source- The source of this segment/customer relationship.context- Context information surrounding sandboxing and multitenant state- Returns:
- The customer/segment relationship if added successfully.
- See Also:
-
readAllBySegmentId
Stream<P> readAllBySegmentId(String segmentId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the segment members for the specified customer segment id matching the given filters.- Parameters:
segmentId- theCustomerSegmentidfilters- additional filters to apply in the querycontextInfo- Request context information around sandbox and multitenant state- Returns:
- the segment members for the specified customer segment id matching the given filters
-
readAllBySegmentIdAndCustomerEmail
List<P> readAllBySegmentIdAndCustomerEmail(String segmentId, Set<String> emailAddresses, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the segment members for the specified customer segment id and customer email addresses.- Parameters:
segmentId- theCustomerSegmentidemailAddresses- the set ofCustomeremailcontextInfo- Request context information around sandbox and multitenant state- Returns:
- the segment members for the specified customer segment id and customer email addresses
-
readAllByCustomerEmailOrCustomerId
List<P> readAllByCustomerEmailOrCustomerId(@Nullable String customerEmail, @Nullable String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the segment members for the specified customer segment id and customer email addresses.- Parameters:
customerEmail- Customer's emailcustomerId- Customer's IDcontextInfo- Request context information around sandbox and multitenant state- Returns:
- the segment members for the specified customer segment id and customer email addresses
-
readAllBySegmentIdAndCustomerIds
List<P> readAllBySegmentIdAndCustomerIds(String segmentId, Set<String> customerIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the segment members for the specified customer segment id and customer ids.- Parameters:
segmentId- theCustomerSegmentidcustomerIds- the set ofCustomeridcontextInfo- Request context information around sandbox and multitenant state- Returns:
- the segment members for the specified customer segment id and customer ids
-