Class DefaultAccountInviteService<P extends AccountInvite>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.customer.service.DefaultAccountInviteService<P>
- All Implemented Interfaces:
 AccountInviteService<P>,com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
public class DefaultAccountInviteService<P extends AccountInvite>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements AccountInviteService<P>
- 
Field Summary
Fields - 
Constructor Summary
ConstructorsConstructorDescriptionDefaultAccountInviteService(AccountService<Account> accountService, AccountMemberService<AccountMember> accountMemberService, CustomerService<Customer> customerService, SendAccountInvitationService sendAccountInvitationService, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.RSQLFilterParser rsqlFilterParser, AccountInviteRepository<com.broadleafcommerce.data.tracking.core.Trackable> accountInviteRepository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, AccountInviteProperties accountInviteProperties)  - 
Method Summary
Modifier and TypeMethodDescriptionacceptInvite(String inviteId, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Accepts an account invitation.voidacceptPendingInvitesForCustomer(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Accepts the pending invites for theCustomer.protected PbuildAccountInvite(String accountId, AccountInviteRequest accountInviteRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidcheckExpired(P inviteToAccept) protected voidcheckIfAlreadyAccountMember(String accountId, AccountInviteRequest accountInviteRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected InstantdetermineAccountExpirationTime(String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected cz.jirutka.rsql.parser.ast.NodeenhanceWithAccountIdFilter(@NonNull String accountId, cz.jirutka.rsql.parser.ast.Node filters) findExistingInvite(String accountId, String email, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected AccountInvitePropertiesprotected AccountInviteRepository<com.broadleafcommerce.data.tracking.core.Trackable>protected AccountMemberService<AccountMember>protected AccountService<Account>protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtilsprotected CustomerService<Customer>getInviteDuration(String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Return the duration for which account invites will be active.protected com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.RSQLFilterParserprotected SendAccountInvitationServiceprotected com.broadleafcommerce.common.extension.TypeFactoryprotected voidhydrateAccount(P accountInvite, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidhydrateAccountAndSendInvite(P accountInvite, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidhydrateCustomer(P accountInvite, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) inviteToAccount(@NonNull String accountId, @NonNull AccountInviteRequest accountInviteRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Invite a new user to an account.protected booleanorg.springframework.data.domain.Page<P>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) Read a page of account invites by account ID.readByContextIdAndAccountId(String id, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read an account invite by its ID and account ID.protected PreadByContextIdAndAccountIdOrThrow(String id, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) readCurrentlyAuthenticatedCustomer(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<P>readMyInvites(org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read the currently authenticated user's account invites.resendInvite(String inviteId, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Re-send an account invitation.voidrevokeInvite(String inviteId, String accountId, String accountMemberId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Revoke an invite to an accountprotected voidsendAccountAcceptance(Customer customer, Account account, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidsendAccountInvite(P accountInvite, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected PupdateExistingAccountInvite(P existingInvite, String accountId, AccountInviteRequest accountInviteRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidvalidateAccountIdMatchesContext(String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidvalidateExistingFilter(cz.jirutka.rsql.parser.ast.Node filters) Validates that an account ID filter isn't already present on the filter query.protected CustomervalidateInviteMatchesCustomerEmail(P inviteToAccept, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAllMethods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getRepository, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 
- 
Field Details
- 
CUSTOMER_REF
- See Also:
 
 - 
INVITE_ID
- See Also:
 
 - 
ACCOUNT_ID_FILTER
- See Also:
 
 - 
EMAIL_FILTER
- See Also:
 
 - 
INVITATION_EXPIRY_DATE_FILTER
- See Also:
 
 - 
BLACKLISTED_FILTERS
 - 
DEFAULT_INVITE_DURATION
 
 - 
 - 
Constructor Details
- 
DefaultAccountInviteService
public DefaultAccountInviteService(AccountService<Account> accountService, AccountMemberService<AccountMember> accountMemberService, CustomerService<Customer> customerService, SendAccountInvitationService sendAccountInvitationService, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.RSQLFilterParser rsqlFilterParser, AccountInviteRepository<com.broadleafcommerce.data.tracking.core.Trackable> accountInviteRepository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, AccountInviteProperties accountInviteProperties)  
 - 
 - 
Method Details
- 
readAllByAccountId
public org.springframework.data.domain.Page<P> 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:AccountInviteServiceRead a page of account invites by account ID. Additional includes validation that the suppliedfiltersobject does not have an existing "accountId" filter.- Specified by:
 readAllByAccountIdin interfaceAccountInviteService<P extends AccountInvite>- Parameters:
 accountId- The account IDfilters- The filterspage- The pagecontextInfo- context surrounding customer and multitenant state- Returns:
 - A page of account invites
 
 - 
inviteToAccount
public Optional<P> inviteToAccount(@NonNull @NonNull String accountId, @NonNull @NonNull AccountInviteRequest accountInviteRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AccountInviteServiceInvite a new user to an account. If an invite already exists for the supplied account/email address, the existing invite's expiration time is reset. IfAccountInviteProperties.isAutoAcceptPendingInvitesOnRegistration()is true and the invited user already exists (has registered), then no invite is created since it's auto- accepted.- Specified by:
 inviteToAccountin interfaceAccountInviteService<P extends AccountInvite>- Parameters:
 accountId- The account ID.accountInviteRequest- The account invite requestcontextInfo- context surrounding customer and multitenant state- Returns:
 - The newly created account invite.
 
 - 
hydrateAccountAndSendInvite
protected void hydrateAccountAndSendInvite(P accountInvite, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
revokeInvite
public void revokeInvite(String inviteId, String accountId, String accountMemberId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AccountInviteServiceRevoke an invite to an account- Specified by:
 revokeInvitein interfaceAccountInviteService<P extends AccountInvite>- Parameters:
 inviteId- The invite IDaccountId- The account IDcontextInfo- context surrounding customer and multitenant state
 - 
resendInvite
public P resendInvite(String inviteId, String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AccountInviteServiceRe-send an account invitation. When an invite is re-sent, its expiration time is also reset.- Specified by:
 resendInvitein interfaceAccountInviteService<P extends AccountInvite>- Parameters:
 inviteId- The invite IDaccountId- The account IDcontextInfo- context surrounding customer and multitenant state- Returns:
 - The re-sent account invitation.
 
 - 
acceptInvite
public AccountMember acceptInvite(String inviteId, String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AccountInviteServiceAccepts an account invitation. If successful, creates and returns the newAccountMemberand deletes theAccountInvite.- Specified by:
 acceptInvitein interfaceAccountInviteService<P extends AccountInvite>- Parameters:
 inviteId- The invite IDaccountId- The account IDcontextInfo- context surrounding customer and multitenant state- Returns:
 - The newly created account member.
 
 - 
readMyInvites
public org.springframework.data.domain.Page<P> readMyInvites(@Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AccountInviteServiceRead the currently authenticated user's account invites.- Specified by:
 readMyInvitesin interfaceAccountInviteService<P extends AccountInvite>contextInfo- context surrounding customer and multitenant state- Returns:
 - The currently logged in user's account invites.
 
 - 
acceptPendingInvitesForCustomer
public void acceptPendingInvitesForCustomer(String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AccountInviteServiceAccepts the pending invites for theCustomer.- Specified by:
 acceptPendingInvitesForCustomerin interfaceAccountInviteService<P extends AccountInvite>- Parameters:
 customerId- The id of the customer whose invites to read.contextInfo- context surrounding customer and multitenant state
 - 
readByContextIdAndAccountId
public Optional<P> readByContextIdAndAccountId(String id, String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AccountInviteServiceRead an account invite by its ID and account ID.- Specified by:
 readByContextIdAndAccountIdin interfaceAccountInviteService<P extends AccountInvite>- Parameters:
 id- The invite IDaccountId- The account IDcontextInfo- context surrounding customer and multitenant state- Returns:
 - The account invite, if found.
 
 - 
getInviteDuration
public Duration getInviteDuration(@Nullable String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AccountInviteServiceReturn the duration for which account invites will be active.- Specified by:
 getInviteDurationin interfaceAccountInviteService<P extends AccountInvite>- Parameters:
 accountId- The account IDcontextInfo- context surrounding customer and multitenant state- Returns:
 - The duration for which account invites should be active.
 
 - 
validateAccountIdMatchesContext
protected void validateAccountIdMatchesContext(String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
sendAccountInvite
protected void sendAccountInvite(P accountInvite, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
sendAccountAcceptance
 - 
hydrateAccount
protected void hydrateAccount(@NonNull P accountInvite, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
hydrateCustomer
protected void hydrateCustomer(@NonNull P accountInvite, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
findExistingInvite
 - 
validateInviteMatchesCustomerEmail
 - 
readByContextIdAndAccountIdOrThrow
 - 
checkIfAlreadyAccountMember
protected void checkIfAlreadyAccountMember(String accountId, AccountInviteRequest accountInviteRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
buildAccountInvite
protected P buildAccountInvite(String accountId, AccountInviteRequest accountInviteRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
updateExistingAccountInvite
protected P updateExistingAccountInvite(P existingInvite, String accountId, AccountInviteRequest accountInviteRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
determineAccountExpirationTime
 - 
checkExpired
 - 
isActive
 - 
enhanceWithAccountIdFilter
protected cz.jirutka.rsql.parser.ast.Node enhanceWithAccountIdFilter(@NonNull @NonNull String accountId, @Nullable cz.jirutka.rsql.parser.ast.Node filters)  - 
validateExistingFilter
protected void validateExistingFilter(cz.jirutka.rsql.parser.ast.Node filters) Validates that an account ID filter isn't already present on the filter query.- Parameters:
 filters- The filters to validate
 - 
readCurrentlyAuthenticatedCustomer
 - 
getAccountMemberService
 - 
getAccountService
 - 
getCustomerService
 - 
getSendAccountInvitationService
 - 
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() - 
getRsqlFilterParser
protected com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.RSQLFilterParser getRsqlFilterParser() - 
getAuthenticationUtils
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils() - 
getAccountInviteRepository
protected AccountInviteRepository<com.broadleafcommerce.data.tracking.core.Trackable> getAccountInviteRepository() - 
getAccountInviteProperties
 
 -