Package entity
Class TransactionLog
java.lang.Object
entity.TransactionLog
Represents a transaction log entry in the banking system.
Stores details of deposit/withdrawal transactions, including metadata and audit info.
This class tracks balances before and after the transaction, the user who initiated it, and the status of the operation.
- Author:
- TAMIL
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing the status of a transaction.static enum
Enum representing the type of transaction.static enum
Enum representing the user type who initiated the transaction. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private BigDecimal
private BigDecimal
private BigDecimal
private Integer
private TransactionLog.UserType
private String
private TransactionLog.TransactionStatus
private LocalDateTime
private Long
private TransactionLog.TransactionType
-
Constructor Summary
ConstructorsConstructorDescriptionDefault no argument constructor.TransactionLog
(int accountNo, TransactionLog.TransactionType transactionType, BigDecimal amount, BigDecimal balanceBefore, BigDecimal balanceAfter, TransactionLog.TransactionStatus status) Constructs a basic transaction log entry.TransactionLog
(int accountNo, TransactionLog.TransactionType transactionType, BigDecimal amount, BigDecimal balanceBefore, BigDecimal balanceAfter, TransactionLog.TransactionStatus status, String description, Integer createdByUserId, TransactionLog.UserType createdByUserType) Constructs a transaction log entry with additional audit fields. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the account number involved in the transaction.Gets the transaction amount.Gets the balance after the transaction.Gets the balance before the transaction.Gets the user ID of the person who initiated the transaction.Gets the user type of the person who created the transaction.Gets the optional transaction description.Gets the transaction status.Gets the date and time of the transaction.Gets the transaction ID.Gets the transaction type.void
setAccountNo
(int accountNo) Sets the Account no.void
setAmount
(BigDecimal amount) Sets the Amount.void
setBalanceAfter
(BigDecimal balanceAfter) Sets the Balance after transaction.void
setBalanceBefore
(BigDecimal balanceBefore) void
setCreatedByUserId
(Integer createdByUserId) void
setCreatedByUserType
(TransactionLog.UserType createdByUserType) void
setDescription
(String description) void
void
setTransactionDate
(LocalDateTime transactionDate) void
setTransactionId
(Long transactionId) Sets the transaction ID.void
setTransactionType
(TransactionLog.TransactionType transactionType) Sets the transaction Type.toString()
-
Field Details
-
transactionId
-
accountNo
private int accountNo -
transactionType
-
amount
-
balanceBefore
-
balanceAfter
-
transactionDate
-
status
-
description
-
createdByUserId
-
createdByUserType
-
-
Constructor Details
-
TransactionLog
public TransactionLog()Default no argument constructor. -
TransactionLog
public TransactionLog(int accountNo, TransactionLog.TransactionType transactionType, BigDecimal amount, BigDecimal balanceBefore, BigDecimal balanceAfter, TransactionLog.TransactionStatus status) Constructs a basic transaction log entry.- Parameters:
accountNo
- the account number involvedtransactionType
- type of transaction (deposit or withdrawal)amount
- the transaction amountbalanceBefore
- balance before transactionbalanceAfter
- balance after transactionstatus
- transaction status (success or failed)
-
TransactionLog
public TransactionLog(int accountNo, TransactionLog.TransactionType transactionType, BigDecimal amount, BigDecimal balanceBefore, BigDecimal balanceAfter, TransactionLog.TransactionStatus status, String description, Integer createdByUserId, TransactionLog.UserType createdByUserType) Constructs a transaction log entry with additional audit fields.- Parameters:
accountNo
- the account number involvedtransactionType
- type of transactionamount
- the transaction amountbalanceBefore
- balance before transactionbalanceAfter
- balance after transactionstatus
- transaction statusdescription
- optional transaction descriptioncreatedByUserId
- user ID of the person who created the transactioncreatedByUserType
- type of user who initiated the transaction
-
-
Method Details
-
getTransactionId
Gets the transaction ID.- Returns:
- the transaction ID
-
setTransactionId
Sets the transaction ID.- Parameters:
transactionId
- the transaction ID
-
getAccountNo
public int getAccountNo()Gets the account number involved in the transaction.- Returns:
- the account number
-
setAccountNo
public void setAccountNo(int accountNo) Sets the Account no.- Parameters:
accountNo
- the accountNo
-
getTransactionType
Gets the transaction type.- Returns:
- the transaction type
-
setTransactionType
Sets the transaction Type.- Parameters:
transactionType
- the transaction Type
-
getAmount
Gets the transaction amount.- Returns:
- the amount
-
setAmount
Sets the Amount.- Parameters:
amount
- the amount to be set
-
getBalanceBefore
Gets the balance before the transaction.- Returns:
- the balance before transaction
-
setBalanceBefore
-
getBalanceAfter
Gets the balance after the transaction.- Returns:
- the balance after transaction
-
setBalanceAfter
Sets the Balance after transaction.- Parameters:
balanceAfter
- the balanceAfter transaction
-
getTransactionDate
Gets the date and time of the transaction.- Returns:
- the transaction date
-
setTransactionDate
-
getStatus
Gets the transaction status.- Returns:
- the status
-
setStatus
-
getDescription
Gets the optional transaction description.- Returns:
- the description
-
setDescription
-
getCreatedByUserId
Gets the user ID of the person who initiated the transaction.- Returns:
- the creator user ID
-
setCreatedByUserId
-
getCreatedByUserType
Gets the user type of the person who created the transaction.- Returns:
- the user type
-
setCreatedByUserType
-
toString
-