Class DefaultCustomerAccountService<P extends CustomerAccount,D extends com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware & com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable>

java.lang.Object
com.broadleafcommerce.auth.user.service.DefaultCustomerAccountService<P,D>
All Implemented Interfaces:
CustomerAccountService<P>

public class DefaultCustomerAccountService<P extends CustomerAccount,D extends com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware & com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable> extends Object implements CustomerAccountService<P>
  • Field Details

  • Constructor Details

    • DefaultCustomerAccountService

      public DefaultCustomerAccountService(CustomerAccountRepository<D> repository, SimplePayloadMapper mapper, @Nullable com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
  • Method Details

    • readByAccountId

      public Optional<P> readByAccountId(String accountId)
      Description copied from interface: CustomerAccountService
      Find a CustomerAccount by its account id.
      Specified by:
      readByAccountId in interface CustomerAccountService<P extends CustomerAccount>
      Parameters:
      accountId - The account id to look-up the CustomerAccount.
      Returns:
      The CustomerAccount for the given account id.
    • readAllByParentAccountIdIn

      public List<P> readAllByParentAccountIdIn(Collection<String> parentAccountIds)
      Description copied from interface: CustomerAccountService
      Find a list of CustomerAccount by their parent account ids.
      Specified by:
      readAllByParentAccountIdIn in interface CustomerAccountService<P extends CustomerAccount>
      Parameters:
      parentAccountIds - The parent account id to look-up the CustomerAccount.
      Returns:
      The list of CustomerAccount for the given parent account id.
    • save

      public P save(P customerAccount)
      Description copied from interface: CustomerAccountService
      Specified by:
      save in interface CustomerAccountService<P extends CustomerAccount>
      Parameters:
      customerAccount - The CustomerAccount to save.
      Returns:
      The persisted CustomerAccount.
    • delete

      public void delete(P customerAccount)
      Description copied from interface: CustomerAccountService
      Delete a CustomerAccount.
      Specified by:
      delete in interface CustomerAccountService<P extends CustomerAccount>
      Parameters:
      customerAccount - The CustomerAccount to delete.
    • getAccountAncestors

      public List<String> getAccountAncestors(String accountId)
      Description copied from interface: CustomerAccountService
      Get a list of all parent accounts for the account with the given id. The returned list does not include the given account id.
      Specified by:
      getAccountAncestors in interface CustomerAccountService<P extends CustomerAccount>
      Parameters:
      accountId - The id of the account for which to lookup ancestors
      Returns:
      A list of ids of ancestors to the given account id.
    • getAllAccountsDescendants

      public List<String> getAllAccountsDescendants(@NonNull @NonNull Collection<String> accountIds)
      Description copied from interface: CustomerAccountService
      Gets a list of all child accounts/sub-accounts for the accounts with the given ids. The returned list does not include the given account ids.
      Specified by:
      getAllAccountsDescendants in interface CustomerAccountService<P extends CustomerAccount>
      Parameters:
      accountIds - The id of the account for which to lookup descendants
      Returns:
      A list of ids of descendants for the given account ids.
    • getAccountAncestorsInternal

      protected List<String> getAccountAncestorsInternal(String accountId)
      Get a list of all parent accounts for the account with the given id. The returned list does not include the given account id.
      Parameters:
      accountId - The id of the account for which to lookup ancestors
      Returns:
      A list of ids of ancestors to the given account id.
    • getAccountDescendantsInternal

      protected List<String> getAccountDescendantsInternal(@NonNull @NonNull Collection<String> accountIds)
      Recursively traces the accounts' descendants and returns a list them all for the accounts with the given id. The returned list does not include the originally provided account ids as those are not descendents.
      Parameters:
      accountIds - The ids of the accounts for which to lookup descendants
      Returns:
      A list of ids of descendants to the given account id.
    • getRepository

      protected CustomerAccountRepository<D> getRepository()
    • getMapper

      protected SimplePayloadMapper getMapper()
    • getCacheStateManager

      @Nullable protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager()
    • setAncestorAccountCacheByAccountId

      @Autowired @Qualifier("ancestorAccountCacheByAccountId") public void setAncestorAccountCacheByAccountId(@Nullable com.broadleafcommerce.common.extension.cache.key.ContextKeyGen ancestorAccountCacheByAccountId)
      See Also:
    • getAncestorAccountCacheByAccountId

      @Nullable protected com.broadleafcommerce.common.extension.cache.key.ContextKeyGen getAncestorAccountCacheByAccountId()
      See Also:
    • setDescendantAccountCacheByAccountId

      @Autowired @Qualifier("descendantAccountCacheByAccountId") public void setDescendantAccountCacheByAccountId(@Nullable com.broadleafcommerce.common.extension.cache.key.ContextKeyGen descendantAccountCacheByAccountId)
      See Also:
    • getDescendantAccountCacheByAccountId

      @Nullable protected com.broadleafcommerce.common.extension.cache.key.ContextKeyGen getDescendantAccountCacheByAccountId()
      See Also: