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 Type
    Method
    Description
    createActiveFromInviteAndCustomer(Customer customer, String accountId, AccountInviteRequest accountInviteRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Creates an active AccountMember 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.
    hydrate(M accountMember, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Hydrates the relationships onto the AccountMember.
    void
    hydrate(M accountMember, List<Customer> customers, List<Account> accounts)
    Hydrates the relationships onto the AccountMember.
    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 the AccountMembers.
    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 ID
    readByEmailAndAccountId(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 the AccountMember which has the given ID and parent account ID.
    registerAccountMember(String accountId, RegisterAccountMemberRequest registerAccountMemberRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Relates a Customer with the Account identified by the accountId.
    updateAccountMember(String accountId, String accountMemberId, UpdateAccountMemberRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Updates the relationship between an Account & a Customer - ie an AccountMember.
    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 active AccountMember 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 invited
      accountId - The account invited to
      accountInviteRequest - The invite request
      contextInfo - 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 for
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      page - the requested page of results from the database
      contextInfo - 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 member
      accountId - The id of the inviting account
      customer - The newly registered customer user that accepted the invite
      contextInfo - 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 invite
      customer - The newly registered customer user that accepted the invite
      contextInfo - 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 a Customer with the Account identified by the accountId. If the customer cannot be found, then one is created.
      Parameters:
      accountId - Id of the Account that the RegisterAccountMemberRequest.getCustomer() should be related to
      registerAccountMemberRequest - The payload that describes the requested relationship between the customer & the account
      context - The context of the user's request
      Returns:
      The registered AccountMember
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if the related Account or Customer are not found
    • readByIdAndAccountId

      M readByIdAndAccountId(String id, String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds the AccountMember which has the given ID and parent account ID.
      Parameters:
      id - the context ID of the AccountMember
      accountId - the context ID of the owning Account
      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 such AccountMember was found
    • updateAccountMember

      M updateAccountMember(String accountId, String accountMemberId, UpdateAccountMemberRequest updateRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Updates the relationship between an Account & a Customer - ie an AccountMember.
      Parameters:
      accountId - Id of the Account in the relationship
      accountMemberId - Id of the AccountMember that is to be updated
      updateRequest - The payload that describes the requested changes
      context - 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 for
      customer - The customer
      context - 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 ID
      accountId - The account ID
      contextInfo - 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 ID
      page - The page
      contextInfo - 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 ID
      page - The page
      contextInfo - 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 ID
      contextInfo - The context of the user's request
      Returns:
      The AccountMember
    • hydrate

      void hydrate(M accountMember, List<Customer> customers, List<Account> accounts)
      Hydrates the relationships onto the AccountMember.
      Parameters:
      accountMember - the member to hydrate
      customers - list of customers retrieved by context ID
      accounts - 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 the AccountMember.
      Parameters:
      accountMember - The member to hydrate
      context - Additional sandbox and multitenant info
      Returns:
      They hydrated accountMember.
    • readAllByAccountIdAndActiveTrue

      org.springframework.data.domain.Page<M> readAllByAccountIdAndActiveTrue(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)
    • 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 the AccountMembers.
      Parameters:
      accountMembers - The members to hydrate
      contextInfo - Additional sandbox and multitenant info
      Returns:
      They hydrated accountMembers.
    • readByEmailAndAccountId

      Optional<M> readByEmailAndAccountId(String email, String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)