Interface CustomerSegmentService<P extends CustomerSegment>
- Type Parameters:
P-CustomerSegmentor a subclass
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- All Known Implementing Classes:
DefaultCustomerSegmentService
public interface CustomerSegmentService<P extends CustomerSegment>
extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Service for delegation of CRUD based operations on
CustomerSegments- Author:
- Chris Schneider (cschneider), Nathan Moore (nathandmoore)
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanManuallyAddCustomerToSegment(String segmentId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Evaluates whether the customer segment with the given ID allows manually adding customers.readAccountsBySegments(Set<String> includeSegmentIds, Set<String> excludeSegmentIds, Set<String> accountIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Group the requested account ids by the requested segments that match those accounts.readAllRuleBasedCustomerSegmentsByRuleEvaluationType(String evaluationType, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads all the matchingCustomerSegmentsbyCustomerSegment.getCustomerSegmentType()andCustomerSegment.getRuleEvaluationType().resolveCustomerSegmentsForRequest(ResolveCustomerSegmentsRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) ResolvesCustomerSegmentsthat apply to a given request.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
-
resolveCustomerSegmentsForRequest
ResolveCustomerSegmentResponse resolveCustomerSegmentsForRequest(ResolveCustomerSegmentsRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) ResolvesCustomerSegmentsthat apply to a given request.- Parameters:
request- Request with user details for customer segments to target and be evaluated against.context- Additional multitenant and sandbox info.- Returns:
- The list of matching segments if any.
-
readAllRuleBasedCustomerSegmentsByRuleEvaluationType
List<P> readAllRuleBasedCustomerSegmentsByRuleEvaluationType(String evaluationType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads all the matchingCustomerSegmentsbyCustomerSegment.getCustomerSegmentType()andCustomerSegment.getRuleEvaluationType().- Parameters:
evaluationType- The type of rule evaluation. SeeDefaultCustomerSegmentRuleEvaluationType.context- Additional sandbox and multitenant info.- Returns:
- The matching
CustomerSegments.
-
canManuallyAddCustomerToSegment
boolean canManuallyAddCustomerToSegment(String segmentId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Evaluates whether the customer segment with the given ID allows manually adding customers.As an example, using the default customer segment types,
CUSTOMER_SETandRULE_BASED, only sets support manually adding customers, as rule based segments are derived.- Parameters:
segmentId- The ID of the segment to evaluatecontext- Context information regarding sandboxing and multitenant state- Returns:
trueif customers may be manually added to this segment, elsefalse
-
readAccountsBySegments
FilteredAccounts readAccountsBySegments(@Nullable Set<String> includeSegmentIds, @Nullable Set<String> excludeSegmentIds, Set<String> accountIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Group the requested account ids by the requested segments that match those accounts.- Parameters:
includeSegmentIds- The ids of candidateCustomerSegments whose matching accounts should be includedexcludeSegmentIds- The ids of candidateCustomerSegments whose matching accounts should be excluded from the include resultsaccountIds- The ids of candidateAccountscontext- Context information surrounding sandboxing and multitenant state- Returns:
- A map of segment ids to the accounts that match those segments
-