Class DefaultCreditAccountService<P extends CreditAccount>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.creditaccount.service.DefaultCreditAccountService<P>
- All Implemented Interfaces:
CreditAccountService<P>,com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
public class DefaultCreditAccountService<P extends CreditAccount>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements CreditAccountService<P>
The default implementation for the
CreditAccountService.- Author:
- Dima Myroniuk (dmyroniuk)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCreditAccountService(CreditAccountRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, TransactionService<Transaction> transactionService, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateCreditAccount(@NonNull CreateCreditAccountRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates the credit account for the provided request.protected PcreateCreditAccountForRequest(@NonNull CreateCreditAccountRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected PexecuteCreditTransactionForAccount(@NonNull CreateCreditAccountRequest request, P creditAccount, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<P>findAllByAccountNumberIn(List<String> accountNumbers, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all credit accounts for the specified credit account numbers.protected org.springframework.context.MessageSourceprotected CreditAccountRepository<com.broadleafcommerce.data.tracking.core.Trackable>protected CreditAccountTransactionExecutionServiceprotected TransactionService<Transaction>protected com.broadleafcommerce.common.extension.TypeFactoryreadAllByContextIdAndMatchingTenant(Iterable<String> creditAccountIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the credit accounts matching the provided IDs and the tenant fromContextInfoif present.org.springframework.data.domain.Page<P>readAllByOwningUserTypeAndOwningUserRefAndType(@NonNull String owningUserType, @NonNull String owningUserRef, @NonNull String creditAccountType, @NonNull CurrencyContext currencyContext, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all credit account for the specified owning user type, user reference (customer id, account id, email etc), credit account type and currency context.org.springframework.data.domain.Page<P>readAllByOwningUserTypeAndOwningUserRefAndType(@NonNull String owningUserType, @NonNull String owningUserRef, @NonNull String creditAccountType, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all credit account for the specified owning user type, user reference (customer id, account id, email etc) and credit account type.org.springframework.data.domain.Page<P>readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberIn(@NonNull String owningUserType, @NonNull String owningUserRef, @NonNull String creditAccountType, @NonNull List<String> accountNumbers, @NonNull CurrencyContext currencyContext, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all credit accounts for the specified owning user type, user reference (customer id, account id, email etc), credit account type, credit account numbers, and currency context.org.springframework.data.domain.Page<P>readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberIn(@NonNull String owningUserType, @NonNull String owningUserRef, @NonNull String creditAccountType, @NonNull List<String> accountNumbers, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all credit accounts for the specified owning user type, user reference (customer id, account id, email etc), credit account type, and credit account numbers.org.springframework.data.domain.Page<P>readAllByOwningUserTypeAndType(@NonNull String owningUserType, @NonNull String creditAccountType, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all credit account for the specified owning user type and credit account type.readByAccountNumber(String accountNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the credit account for the specified account number.readByByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumber(@NonNull String owningUserType, @NonNull String owningUserRef, @NonNull String creditAccountType, @NonNull String accountNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Searches the credit account for the specified owning user type, owning user reference (customer id, account id, email etc), credit account type and account number.readByByOwningUserTypeAndTypeAndAccountNumber(@NonNull String owningUserType, @NonNull String creditAccountType, @NonNull String accountNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Searches the credit account for the specified owning user type, credit account type and account number.readByTypeAndAccountNumber(@NonNull String creditAccountType, @NonNull String accountNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the credit account for the specified type and account number.voidsetMessageSource(org.springframework.context.MessageSource messageSource) voidsetTransactionExecutionService(CreditAccountTransactionExecutionService transactionExecutionService) 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, 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
-
Constructor Details
-
DefaultCreditAccountService
public DefaultCreditAccountService(CreditAccountRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, TransactionService<Transaction> transactionService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
readByAccountNumber
public Optional<P> readByAccountNumber(String accountNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceReads the credit account for the specified account number.- Specified by:
readByAccountNumberin interfaceCreditAccountService<P extends CreditAccount>- Parameters:
accountNumber- the credit account numbercontextInfo- context information related to multitenancy- Returns:
- the credit account for the specified type and account number
-
readByTypeAndAccountNumber
public Optional<P> readByTypeAndAccountNumber(@NonNull @NonNull String creditAccountType, @NonNull @NonNull String accountNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceReads the credit account for the specified type and account number.- Specified by:
readByTypeAndAccountNumberin interfaceCreditAccountService<P extends CreditAccount>- Parameters:
creditAccountType- the credit account typeaccountNumber- the credit account numbercontextInfo- context information related to multitenancy- Returns:
- the credit account for the specified type and account number
-
readByByOwningUserTypeAndTypeAndAccountNumber
public Optional<P> readByByOwningUserTypeAndTypeAndAccountNumber(@NonNull @NonNull String owningUserType, @NonNull @NonNull String creditAccountType, @NonNull @NonNull String accountNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceSearches the credit account for the specified owning user type, credit account type and account number.- Specified by:
readByByOwningUserTypeAndTypeAndAccountNumberin interfaceCreditAccountService<P extends CreditAccount>- Parameters:
owningUserType- the owning user typecreditAccountType- the credit account typeaccountNumber- the credit account numbercontextInfo- context information related to multitenancy- Returns:
- the credit account for the specified owning user type, credit account type and account number
-
readByByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumber
public Optional<P> readByByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumber(@NonNull @NonNull String owningUserType, @NonNull @NonNull String owningUserRef, @NonNull @NonNull String creditAccountType, @NonNull @NonNull String accountNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceSearches the credit account for the specified owning user type, owning user reference (customer id, account id, email etc), credit account type and account number.- Specified by:
readByByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberin interfaceCreditAccountService<P extends CreditAccount>- Parameters:
owningUserType- the owning user typeowningUserRef- the reference to the user that owns this credit accountcreditAccountType- the type of the credit accountaccountNumber- the credit account numbercontextInfo- context information related to multitenancy- Returns:
- the credit account for the specified owning user type, credit account type, owning user reference and account number
-
readAllByOwningUserTypeAndOwningUserRefAndType
public org.springframework.data.domain.Page<P> readAllByOwningUserTypeAndOwningUserRefAndType(@NonNull @NonNull String owningUserType, @NonNull @NonNull String owningUserRef, @NonNull @NonNull String creditAccountType, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceReads all credit account for the specified owning user type, user reference (customer id, account id, email etc) and credit account type.- Specified by:
readAllByOwningUserTypeAndOwningUserRefAndTypein interfaceCreditAccountService<P extends CreditAccount>- Parameters:
owningUserType- the owning user typeowningUserRef- the reference to the user that owns this credit accountcreditAccountType- the type of the credit accountpage- information about which page of results to return from the databasecontextInfo- context information related to multitenancy- Returns:
- the credit accounts
-
readAllByOwningUserTypeAndOwningUserRefAndType
public org.springframework.data.domain.Page<P> readAllByOwningUserTypeAndOwningUserRefAndType(@NonNull @NonNull String owningUserType, @NonNull @NonNull String owningUserRef, @NonNull @NonNull String creditAccountType, @NonNull @NonNull CurrencyContext currencyContext, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceReads all credit account for the specified owning user type, user reference (customer id, account id, email etc), credit account type and currency context.- Specified by:
readAllByOwningUserTypeAndOwningUserRefAndTypein interfaceCreditAccountService<P extends CreditAccount>- Parameters:
owningUserType- the owning user typeowningUserRef- the reference to the user that owns this credit accountcreditAccountType- the type of the credit accountcurrencyContext- the currency context to read the credit accountpage- information about which page of results to return from the databasecontextInfo- context information related to multitenancy- Returns:
- the credit accounts
-
readAllByOwningUserTypeAndType
public org.springframework.data.domain.Page<P> readAllByOwningUserTypeAndType(@NonNull @NonNull String owningUserType, @NonNull @NonNull String creditAccountType, @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:CreditAccountServiceReads all credit account for the specified owning user type and credit account type.- Specified by:
readAllByOwningUserTypeAndTypein interfaceCreditAccountService<P extends CreditAccount>- Parameters:
owningUserType- the owning user typecreditAccountType- the type of the credit accountfilters- An RSQL filter used to narrow query resultspage- information about which page of results to return from the databasecontextInfo- context information related to multitenancy- Returns:
- the credit accounts
-
createCreditAccount
@Transactional("creditAccountTransactionManager") public P createCreditAccount(@NonNull @NonNull CreateCreditAccountRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceCreates the credit account for the provided request.- Specified by:
createCreditAccountin interfaceCreditAccountService<P extends CreditAccount>- Parameters:
request- the request to create the credit accountcontextInfo- context information related to multitenancy- Returns:
- the created account
-
findAllByAccountNumberIn
public org.springframework.data.domain.Page<P> findAllByAccountNumberIn(List<String> accountNumbers, @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:CreditAccountServiceReads all credit accounts for the specified credit account numbers.- Specified by:
findAllByAccountNumberInin interfaceCreditAccountService<P extends CreditAccount>- Parameters:
accountNumbers- the credit account numbersfilters- An RSQL filter used to narrow query resultspage- information about which page of results to return from the databasecontextInfo- context information related to multitenancy- Returns:
- the credit accounts
-
readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberIn
public org.springframework.data.domain.Page<P> readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberIn(@NonNull @NonNull String owningUserType, @NonNull @NonNull String owningUserRef, @NonNull @NonNull String creditAccountType, @NonNull @NonNull List<String> accountNumbers, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceReads all credit accounts for the specified owning user type, user reference (customer id, account id, email etc), credit account type, and credit account numbers.- Specified by:
readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberInin interfaceCreditAccountService<P extends CreditAccount>- Parameters:
owningUserType- the owning user typeowningUserRef- the reference to the user that owns this credit accountcreditAccountType- the type of the credit accountaccountNumbers- the credit account numberspage- information about which page of results to return from the databasecontextInfo- context information related to multitenancy- Returns:
- the credit accounts
-
readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberIn
public org.springframework.data.domain.Page<P> readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberIn(@NonNull @NonNull String owningUserType, @NonNull @NonNull String owningUserRef, @NonNull @NonNull String creditAccountType, @NonNull @NonNull List<String> accountNumbers, @NonNull @NonNull CurrencyContext currencyContext, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceReads all credit accounts for the specified owning user type, user reference (customer id, account id, email etc), credit account type, credit account numbers, and currency context.- Specified by:
readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberInin interfaceCreditAccountService<P extends CreditAccount>- Parameters:
owningUserType- the owning user typeowningUserRef- the reference to the user that owns this credit accountcreditAccountType- the type of the credit accountaccountNumbers- the credit account numberscurrencyContext- the currency context to read the credit accountpage- information about which page of results to return from the databasecontextInfo- context information related to multitenancy- Returns:
- the credit accounts
-
readAllByContextIdAndMatchingTenant
public Iterable<P> readAllByContextIdAndMatchingTenant(Iterable<String> creditAccountIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountServiceRetrieves the credit accounts matching the provided IDs and the tenant fromContextInfoif present.Returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation finds all records within the tenant regardless of whether they're associated to an application.
- Specified by:
readAllByContextIdAndMatchingTenantin interfaceCreditAccountService<P extends CreditAccount>- Parameters:
creditAccountIds- the credit account context idscontextInfo- context information related to multitenancy- Returns:
- the credit accounts for specified ids
-
createCreditAccountForRequest
protected P createCreditAccountForRequest(@NonNull @NonNull CreateCreditAccountRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
executeCreditTransactionForAccount
protected P executeCreditTransactionForAccount(@NonNull @NonNull CreateCreditAccountRequest request, @NonNull P creditAccount, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getRepository
protected CreditAccountRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()- Overrides:
getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends CreditAccount>
-
getTransactionService
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setTransactionExecutionService
@Autowired @Lazy public void setTransactionExecutionService(CreditAccountTransactionExecutionService transactionExecutionService) -
getTransactionExecutionService
-
getMessageSource
protected org.springframework.context.MessageSource getMessageSource() -
setMessageSource
@Autowired public void setMessageSource(org.springframework.context.MessageSource messageSource)
-