Class MongoIncomeRepository
java.lang.Object
com.truebubo.maniflow.income.MongoIncomeRepository
- All Implemented Interfaces:
IncomeRepository
Repository used for dealing with storage and retrieval of income using MongoDB
-
Constructor Summary
ConstructorsConstructorDescriptionMongoIncomeRepository
(com.mongodb.client.MongoClient mongoClient) Creates mongo repository -
Method Summary
Modifier and TypeMethodDescriptionchangeIncome
(int id, BigDecimal newAmount) Changes the income with given IDgetIncome
(int id) Finds the income with given idFinds all the incomes savedsaveIncome
(Income income) Saves the income to storage
-
Constructor Details
-
MongoIncomeRepository
public MongoIncomeRepository(@NonNull com.mongodb.client.MongoClient mongoClient) Creates mongo repository- Parameters:
mongoClient
- Mongo client to be used
-
-
Method Details
-
saveIncome
Description copied from interface:IncomeRepository
Saves the income to storage- Specified by:
saveIncome
in interfaceIncomeRepository
- Parameters:
income
- Income saved- Returns:
- income saved
-
getIncome
Description copied from interface:IncomeRepository
Finds the income with given id- Specified by:
getIncome
in interfaceIncomeRepository
- Parameters:
id
- as shown in list- Returns:
- Income if found else empty
-
getIncomes
Description copied from interface:IncomeRepository
Finds all the incomes saved- Specified by:
getIncomes
in interfaceIncomeRepository
- Returns:
- List of all the incomes saved
-
changeIncome
Description copied from interface:IncomeRepository
Changes the income with given ID- Specified by:
changeIncome
in interfaceIncomeRepository
- Parameters:
id
- ID identifying the income. It is the left value displayed when calling showIncomesnewAmount
- Will update the value to this value. If set to zero. The value will be removed- Returns:
- new income if changed, else empty
-