Class TransactionOrchestrator
java.lang.Object
com.bluebell.greenhouse.planter.orchestrators.transaction.TransactionOrchestrator
- All Implemented Interfaces:
GenericOrchestrator
@Service
@Transactional
public class TransactionOrchestrator
extends Object
implements GenericOrchestrator
Owns the unit of work for the
Transaction endpoints.- Version:
- 3.0.5
- Author:
- Stephen Prizio
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAssignsTransactions to a position and refreshes the account.createNewTransaction(AccountRequestContext context, CreateUpdateTransactionDTO data) Creates aTransactionon an owned account and refreshes it.voidDeletes an ownedTransactionand refreshes its account.generateTransactionReport(AccountRequestContext context, String headerProfile) Generates the downloadable transaction report for an owned account.Obtains the most recentTransactions on an owned account.Obtains one ownedTransaction.getTransactionsWithinIntervalPaged(AccountRequestContext context, TransactionSearchRequest searchRequest) Obtains a page ofTransactions matching the given search request.voidimportTransactions(AccountRequestContext context, InputStream inputStream, String fileName, ZoneId zoneId) Imports transactions into an owned account.updateTransaction(TransactionRequestContext context, CreateUpdateTransactionDTO data) Updates an ownedTransactionand refreshes its account.
-
Constructor Details
-
TransactionOrchestrator
public TransactionOrchestrator()
-
-
Method Details
-
getRecentTransactionsForAccount
@Transactional(readOnly=true) public List<TransactionDTO> getRecentTransactionsForAccount(AccountRequestContext context) Obtains the most recentTransactions on an owned account.- Parameters:
context-AccountRequestContext- Returns:
TransactionDTOs
-
getTransactionForNumberAndAccount
@Transactional(readOnly=true) public TransactionDTO getTransactionForNumberAndAccount(TransactionRequestContext context) Obtains one ownedTransaction.- Parameters:
context-TransactionRequestContext- Returns:
TransactionDTO
-
getTransactionsWithinIntervalPaged
@Transactional(readOnly=true) public PaginatedTransactionDTO getTransactionsWithinIntervalPaged(AccountRequestContext context, TransactionSearchRequest searchRequest) Obtains a page ofTransactions matching the given search request.- Parameters:
context-AccountRequestContextsearchRequest-TransactionSearchRequest- Returns:
PaginatedTransactionDTO
-
generateTransactionReport
@Transactional(readOnly=true) public File generateTransactionReport(AccountRequestContext context, String headerProfile) throws IOException Generates the downloadable transaction report for an owned account.- Parameters:
context-AccountRequestContextheaderProfile- report header profile- Returns:
- generated
File - Throws:
IOException- when the report cannot be written
-
importTransactions
@Transactional(rollbackFor=IOException.class) public void importTransactions(AccountRequestContext context, InputStream inputStream, String fileName, ZoneId zoneId) throws IOException Imports transactions into an owned account.Rolls back on
IOException: the importers persist their rows and then delete the temporary upload in afinallyblock, so a checked exception can reach this method after the writes. Spring rolls back only on unchecked exceptions by default, which would commit a half-imported file.- Parameters:
context-AccountRequestContextinputStream- uploaded file contentsfileName- uploaded file namezoneId- resolvedZoneId- Throws:
IOException- when the upload cannot be read
-
createNewTransaction
public TransactionDTO createNewTransaction(AccountRequestContext context, CreateUpdateTransactionDTO data) Creates aTransactionon an owned account and refreshes it.- Parameters:
context-AccountRequestContextdata-CreateUpdateTransactionDTO- Returns:
TransactionDTO
-
assignTransactionsToPosition
public List<TransactionDTO> assignTransactionsToPosition(AccountRequestContext context, AssignTransactionsToPositionDTO data) AssignsTransactions to a position and refreshes the account.- Parameters:
context-AccountRequestContextdata-AssignTransactionsToPositionDTO- Returns:
TransactionDTOs
-
updateTransaction
public TransactionDTO updateTransaction(TransactionRequestContext context, CreateUpdateTransactionDTO data) Updates an ownedTransactionand refreshes its account.- Parameters:
context-TransactionRequestContextdata-CreateUpdateTransactionDTO- Returns:
TransactionDTO
-
deleteTransaction
Deletes an ownedTransactionand refreshes its account.- Parameters:
context-TransactionRequestContext
-