Interface AccountMemberService<M extends AccountMember>
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<M>
,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<M>
- All Known Implementing Classes:
DefaultAccountMemberService
public interface AccountMemberService<M extends AccountMember>
extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<M>
Service API for
AccountMembers
. Supported by
AccountMemberRepository
.- Author:
- Chris Kittrell (ckittrell)
-
Method Summary
Modifier and TypeMethodDescriptioncreateActiveFromInviteAndCustomer
(Customer customer, String accountId, AccountInviteRequest accountInviteRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates an activeAccountMember
from the given invite request and customer.createInactiveFromAccountInvite
(AccountInvite accountInvite, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) createInactiveFromAccountInviteAndCustomer
(AccountInvite accountInvite, Customer customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Create an account member from an account invitation and customer.Hydrates the relationships onto theAccountMember
.void
Hydrates the relationships onto theAccountMember
.org.springframework.data.domain.Page<M>
hydrateAll
(org.springframework.data.domain.Page<M> accountMembers, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates the relationships onto theAccountMembers
.readActiveByCustomerId
(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read account memberships for a customer where the membership is active.org.springframework.data.domain.Page<M>
readActiveByCustomerId
(String customerId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read account memberships for a customer where the membership is active.org.springframework.data.domain.Page<M>
readAllByAccountId
(String accountId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all of the AccountMember relationships in the database associated with the given account context ID.org.springframework.data.domain.Page<M>
readAllByAccountIdAndActiveTrue
(String accountId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<M>
readByCustomerId
(String customerId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read account memberships for a customer.readByCustomerIdAndAccountId
(String customerId, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read an account member by customer and account IDreadByEmailAndAccountId
(String email, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) readByIdAndAccountId
(String id, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds theAccountMember
which has the given ID and parent account ID.registerAccountMember
(String accountId, RegisterAccountMemberRequest registerAccountMemberRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) updateAccountMember
(String accountId, String accountMemberId, UpdateAccountMemberRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) updateAfterInviteAccepted
(String email, String accountId, Customer customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles updating the account member after accepting a pending invite.updateAfterInviteAccepted
(M accountMember, Customer customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles updating the account member after accepting a pending invite.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
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Method Details
-
createActiveFromInviteAndCustomer
M createActiveFromInviteAndCustomer(Customer customer, String accountId, AccountInviteRequest accountInviteRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates an activeAccountMember
from the given invite request and customer. This is used when an invitation is auto-accepted due to the customer already being registered.- Parameters:
customer
- The registered customer invitedaccountId
- The account invited toaccountInviteRequest
- The invite requestcontextInfo
- Additional multitenant and sandbox info- Returns:
- The new account member.
-
readAllByAccountId
org.springframework.data.domain.Page<M> readAllByAccountId(String accountId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all of the AccountMember relationships in the database associated with the given account context ID.- Parameters:
accountId
- the account context ID to find the relationships forfilters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.page
- the requested page of results from the databasecontextInfo
- the context to query within- Returns:
- the AccountMember relationships in the database that match the given account context ID
-
updateAfterInviteAccepted
M updateAfterInviteAccepted(String email, String accountId, Customer customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles updating the account member after accepting a pending invite. This usually happens after a user registers after receiving an invite as oppposed to an existing user accepting an invite.- Parameters:
email
- The email of the invited memberaccountId
- The id of the inviting accountcustomer
- The newly registered customer user that accepted the invitecontextInfo
- Additional sandbox and multitenant info- Returns:
- The updated account member.
-
updateAfterInviteAccepted
M updateAfterInviteAccepted(M accountMember, Customer customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles updating the account member after accepting a pending invite. This usually happens after a user registers after receiving an invite as oppposed to an existing user accepting an invite.- Parameters:
accountMember
- The member who accepted the invitecustomer
- The newly registered customer user that accepted the invitecontextInfo
- Additional sandbox and multitenant info- Returns:
- The updated account member.
-
registerAccountMember
M registerAccountMember(String accountId, RegisterAccountMemberRequest registerAccountMemberRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Relates aCustomer
with theAccount
identified by theaccountId
. If the customer cannot be found, then one is created.- Parameters:
accountId
- Id of theAccount
that theRegisterAccountMemberRequest.getCustomer()
should be related toregisterAccountMemberRequest
- The payload that describes the requested relationship between the customer & the accountcontext
- The context of the user's request- Returns:
- The registered AccountMember
- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if the relatedAccount
orCustomer
are not found
-
readByIdAndAccountId
M readByIdAndAccountId(String id, String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds theAccountMember
which has the given ID and parent account ID.- Parameters:
id
- the context ID of theAccountMember
accountId
- the context ID of the owningAccount
contextInfo
- context surrounding customer and multitenant state- Returns:
- the account member that has the given ID and owning account ID
- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if no suchAccountMember
was found
-
updateAccountMember
M updateAccountMember(String accountId, String accountMemberId, UpdateAccountMemberRequest updateRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Parameters:
accountId
- Id of theAccount
in the relationshipaccountMemberId
- Id of theAccountMember
that is to be updatedupdateRequest
- The payload that describes the requested changescontext
- The context of the user's request- Returns:
- The updated
AccountMember
.
-
createInactiveFromAccountInviteAndCustomer
M createInactiveFromAccountInviteAndCustomer(AccountInvite accountInvite, Customer customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Create an account member from an account invitation and customer. This account member will not be active yet and must accept the invitation.This method performs no validation so it is assumed the invitation has been pre-validated before being passed to this method. See
DefaultAccountInviteService.acceptInvite(String, String, ContextInfo)
.- Parameters:
accountInvite
- The account invite to create the account member forcustomer
- The customercontext
- The context of the user's request- Returns:
- The created account member
-
createInactiveFromAccountInvite
M createInactiveFromAccountInvite(AccountInvite accountInvite, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
readByCustomerIdAndAccountId
Optional<M> readByCustomerIdAndAccountId(String customerId, String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read an account member by customer and account ID- Parameters:
customerId
- The customer IDaccountId
- The account IDcontextInfo
- The context of the user's request- Returns:
- The account member, if they're a member of the account.
-
readByCustomerId
org.springframework.data.domain.Page<M> readByCustomerId(String customerId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read account memberships for a customer.- Parameters:
customerId
- The customer IDpage
- The pagecontextInfo
- The context of the user's request- Returns:
- The
AccountMember
-
readActiveByCustomerId
org.springframework.data.domain.Page<M> readActiveByCustomerId(String customerId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read account memberships for a customer where the membership is active.- Parameters:
customerId
- The customer IDpage
- The pagecontextInfo
- The context of the user's request- Returns:
- The
AccountMember
-
readActiveByCustomerId
List<M> readActiveByCustomerId(String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read account memberships for a customer where the membership is active.- Parameters:
customerId
- The customer IDcontextInfo
- The context of the user's request- Returns:
- The
AccountMember
-
hydrate
Hydrates the relationships onto theAccountMember
.- Parameters:
accountMember
- the member to hydratecustomers
- list of customers retrieved by context IDaccounts
- list of accounts retrieved by context ID
-
hydrate
M hydrate(M accountMember, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Hydrates the relationships onto theAccountMember
.- Parameters:
accountMember
- The member to hydratecontext
- Additional sandbox and multitenant info- Returns:
- They hydrated
accountMember
.
-
readAllByAccountIdAndActiveTrue
-
hydrateAll
org.springframework.data.domain.Page<M> hydrateAll(org.springframework.data.domain.Page<M> accountMembers, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates the relationships onto theAccountMembers
.- Parameters:
accountMembers
- The members to hydratecontextInfo
- Additional sandbox and multitenant info- Returns:
- They hydrated
accountMembers
.
-
readByEmailAndAccountId
-