Package job
Class InterestCalculationJob
java.lang.Object
job.InterestCalculationJob
- All Implemented Interfaces:
BankingJob
Background job that calculates and credits monthly interest to savings accounts.
Runs automatically when Web application starts.
- Author:
- TAMIL MUGHILAN
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final BigDecimal
private final DataStorage
private static final Logger
private static final BigDecimal
-
Constructor Summary
ConstructorsConstructorDescriptionInterestCalculationJob
(DataStorage dataStorage) Creates Interest Calculation Job -
Method Summary
Modifier and TypeMethodDescriptionprivate BigDecimal
calculateAndCreditInterest
(SavingsAccount account) Calculates and credits interest to a single account.void
execute()
Executes the interest calculation for all savings accounts.Gets the description of what this job does.Gets the name of this job.
-
Field Details
-
logger
-
ANNUAL_INTEREST_RATE
-
MONTHS_IN_YEAR
-
dataStorage
-
-
Constructor Details
-
InterestCalculationJob
Creates Interest Calculation Job- Parameters:
dataStorage
- the data storage to access DB
-
-
Method Details
-
execute
public void execute()Executes the interest calculation for all savings accounts. Processes accounts from all branches and credits monthly interest.- Specified by:
execute
in interfaceBankingJob
-
calculateAndCreditInterest
Calculates and credits interest to a single account.- Parameters:
account
- the savings account to process- Returns:
- the amount of interest credited
-
getJobName
Gets the name of this job.- Specified by:
getJobName
in interfaceBankingJob
- Returns:
- the job name
-
getJobDescription
Gets the description of what this job does.- Specified by:
getJobDescription
in interfaceBankingJob
- Returns:
- the job description
-