Class DefaultAccountMemberService<M extends AccountMember>
- java.lang.Object
 - 
- com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
 - 
- com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<M>
 - 
- com.broadleafcommerce.customer.service.DefaultAccountMemberService<M>
 
 
 
 
- 
- All Implemented Interfaces:
 AccountMemberService<M>,com.broadleafcommerce.data.tracking.core.service.CrudEntityService<M>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<M>
public class DefaultAccountMemberService<M extends AccountMember> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<M> implements AccountMemberService<M>
Default implementation of theAccountMemberService.- Author:
 - Chris Kittrell (ckittrell)
 
 
- 
- 
Constructor Summary
Constructors Constructor Description DefaultAccountMemberService(AccountMemberRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, AccountService<Account> accountService, CustomerService<Customer> customerService, AccountRoleService<AccountRole> accountRoleService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassignRoleToCustomer(@NonNull RegisterAccountMemberRequest registerRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Assign the providedRegisterAccountMemberRequest.getRoleRef()to the related Customerprotected McreateAccountMember(@NonNull RegisterAccountMemberRequest registerRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Create anAccountMemberbased on theRegisterAccountMemberRequestvoiddelete(@NonNull String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)protected AccountRoleService<AccountRole>getAccountRoleService()protected AccountService<Account>getAccountService()protected CustomerService<Customer>getCustomerService()protected CustomergetOrCreateCustomer(@NonNull RegisterAccountMemberRequest registerRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Either gathers theCustomerbased on theRegisterAccountMemberRequest.getCustomerRef()or creates a new customerprotected AccountMemberRepository<com.broadleafcommerce.data.tracking.core.Trackable>getRepository()protected com.broadleafcommerce.common.extension.TypeFactorygetTypeFactory()org.springframework.data.domain.Page<M>readAllByAccountId(@NonNull 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.MreadByIdAndAccountId(@NonNull String id, @NonNull String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Finds theAccountMemberwhich has the given ID and parent account ID.MregisterAccountMember(@NonNull String accountId, @NonNull RegisterAccountMemberRequest registerRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)MupdateAccountMember(@NonNull String accountId, @NonNull String accountMemberId, @NonNull UpdateAccountMemberRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)- 
Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAll 
- 
Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort 
- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
DefaultAccountMemberService
public DefaultAccountMemberService(AccountMemberRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, AccountService<Account> accountService, CustomerService<Customer> customerService, AccountRoleService<AccountRole> accountRoleService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
 
 - 
 
- 
Method Detail
- 
readAllByAccountId
public org.springframework.data.domain.Page<M> readAllByAccountId(@NonNull @NonNull 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)
Description copied from interface:AccountMemberServiceReads all of the AccountMember relationships in the database associated with the given account context ID.- Specified by:
 readAllByAccountIdin interfaceAccountMemberService<M extends AccountMember>- Parameters:
 accountId- the account context ID to find the relationships forfilters- additional filters to apply in the query. Should beEmptyNodeif 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
 
 
- 
registerAccountMember
public M registerAccountMember(@NonNull @NonNull String accountId, @NonNull @NonNull RegisterAccountMemberRequest registerRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Description copied from interface:AccountMemberServiceRelates aCustomerwith theAccountidentified by theaccountId. If the customer cannot be found, then one is created.- Specified by:
 registerAccountMemberin interfaceAccountMemberService<M extends AccountMember>- Parameters:
 accountId- Id of theAccountthat theRegisterAccountMemberRequest.customerRefshould be related toregisterRequest- The payload that describes the requested relationship between the customer & the accountcontext- The context of the user's request- Returns:
 - The registered AccountMember
 
 
- 
updateAccountMember
public M updateAccountMember(@NonNull @NonNull String accountId, @NonNull @NonNull String accountMemberId, @NonNull @NonNull UpdateAccountMemberRequest updateRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Description copied from interface:AccountMemberService- Specified by:
 updateAccountMemberin interfaceAccountMemberService<M extends AccountMember>- Parameters:
 accountId- Id of theAccountin the relationshipaccountMemberId- Id of theAccountMemberthat is to be updatedupdateRequest- The payload that describes the requested changescontext- The context of the user's request- Returns:
 
 
- 
delete
public void delete(@NonNull @NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)- Specified by:
 deletein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<M extends AccountMember>- Overrides:
 deletein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<M extends AccountMember>
 
- 
readByIdAndAccountId
public M readByIdAndAccountId(@NonNull @NonNull String id, @NonNull @NonNull String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:AccountMemberServiceFinds theAccountMemberwhich has the given ID and parent account ID.- Specified by:
 readByIdAndAccountIdin interfaceAccountMemberService<M extends AccountMember>- Parameters:
 id- the context ID of theAccountMemberaccountId- the context ID of the owningAccountcontextInfo- context surrounding customer and multitenant state- Returns:
 - the account member that has the given ID and owning account ID
 
 
- 
getOrCreateCustomer
protected Customer getOrCreateCustomer(@NonNull @NonNull RegisterAccountMemberRequest registerRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Either gathers theCustomerbased on theRegisterAccountMemberRequest.getCustomerRef()or creates a new customer- Parameters:
 registerRequest- the request used to identify or describe the customercontext- the context within which the request has been made- Returns:
 - the customer that is to be added to the account
 
 
- 
createAccountMember
protected M createAccountMember(@NonNull @NonNull RegisterAccountMemberRequest registerRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Create anAccountMemberbased on theRegisterAccountMemberRequest- Parameters:
 registerRequest- the request data used to build the AccountMembercontext- the context in which the AccountMember should be created- Returns:
 - The persisted AccountMember
 
 
- 
assignRoleToCustomer
protected void assignRoleToCustomer(@NonNull @NonNull RegisterAccountMemberRequest registerRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Assign the providedRegisterAccountMemberRequest.getRoleRef()to the related Customer- Parameters:
 registerRequest- the request used specify which role to give the customer for this accountcontext- the context within which the request has been made
 
- 
getRepository
protected AccountMemberRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
- Overrides:
 getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<M extends AccountMember>
 
- 
getAccountService
protected AccountService<Account> getAccountService()
 
- 
getCustomerService
protected CustomerService<Customer> getCustomerService()
 
- 
getAccountRoleService
protected AccountRoleService<AccountRole> getAccountRoleService()
 
- 
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
 
 - 
 
 -