Interface SegmentMemberService<P extends SegmentMember,S extends CustomerSegment>
-
- Type Parameters:
P
-SegmentMember
or 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description P
createSegmentMember(P segmentMember, String source, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Creates and adds a customer/segment relationship.Stream<P>
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.List<P>
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.Optional<P>
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.void
removeAllMembersFromSegment(String segmentId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Removes all customer/segment relationships from a particular segment.void
removeMemberFromSegment(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, updateSort
-
-
-
-
Method Detail
-
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 beEmptyNode
if 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
-
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_BASED
is 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:
CustomerSegmentType.canManuallyAddCustomers()
,SegmentMemberSource
-
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
- theCustomerSegment
idfilters
- 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
- theCustomerSegment
idemailAddresses
- the set ofCustomer
emailcontextInfo
- Request context information around sandbox and multitenant state- Returns:
- the segment members for the specified customer segment id and customer email addresses
-
-