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 P
createCreditAccountForRequest
(@NonNull CreateCreditAccountRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected P
executeCreditTransactionForAccount
(@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.MessageSource
protected CreditAccountRepository<com.broadleafcommerce.data.tracking.core.Trackable>
protected CreditAccountTransactionExecutionService
protected TransactionService<Transaction>
protected com.broadleafcommerce.common.extension.TypeFactory
readAllByContextIdAndMatchingTenant
(Iterable<String> creditAccountIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the credit accounts matching the provided IDs and the tenant fromContextInfo
if 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.void
setMessageSource
(org.springframework.context.MessageSource messageSource) void
setTransactionExecutionService
(CreditAccountTransactionExecutionService transactionExecutionService) 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, delete, 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, 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
-
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:CreditAccountService
Reads the credit account for the specified account number.- Specified by:
readByAccountNumber
in 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:CreditAccountService
Reads the credit account for the specified type and account number.- Specified by:
readByTypeAndAccountNumber
in 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:CreditAccountService
Searches the credit account for the specified owning user type, credit account type and account number.- Specified by:
readByByOwningUserTypeAndTypeAndAccountNumber
in 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:CreditAccountService
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.- Specified by:
readByByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumber
in 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:CreditAccountService
Reads all credit account for the specified owning user type, user reference (customer id, account id, email etc) and credit account type.- Specified by:
readAllByOwningUserTypeAndOwningUserRefAndType
in 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:CreditAccountService
Reads 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:
readAllByOwningUserTypeAndOwningUserRefAndType
in 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:CreditAccountService
Reads all credit account for the specified owning user type and credit account type.- Specified by:
readAllByOwningUserTypeAndType
in 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:CreditAccountService
Creates the credit account for the provided request.- Specified by:
createCreditAccount
in 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:CreditAccountService
Reads all credit accounts for the specified credit account numbers.- Specified by:
findAllByAccountNumberIn
in 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:CreditAccountService
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.- Specified by:
readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberIn
in 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:CreditAccountService
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.- Specified by:
readAllByOwningUserTypeAndOwningUserRefAndTypeAndAccountNumberIn
in 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:CreditAccountService
Retrieves the credit accounts matching the provided IDs and the tenant fromContextInfo
if 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:
readAllByContextIdAndMatchingTenant
in 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:
getRepository
in 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)
-