Class MongoStockRepository
java.lang.Object
com.truebubo.maniflow.stock.MongoStockRepository
- All Implemented Interfaces:
StockRepository
Repository used for dealing with storage and retrieval of stock using MongoDB
-
Constructor Summary
ConstructorsConstructorDescriptionMongoStockRepository
(com.mongodb.client.MongoClient mongoClient) Creates mongo repository -
Method Summary
-
Constructor Details
-
MongoStockRepository
public MongoStockRepository(@NonNull com.mongodb.client.MongoClient mongoClient) Creates mongo repository- Parameters:
mongoClient
- Mongo client to be used
-
-
Method Details
-
saveStock
Description copied from interface:StockRepository
Saves the stock to storage- Specified by:
saveStock
in interfaceStockRepository
- Parameters:
stock
- Stock saved- Returns:
- stock saved
-
deleteStock
Description copied from interface:StockRepository
Removes the stock with given ticket- Specified by:
deleteStock
in interfaceStockRepository
- Parameters:
ticket
- Ticket associated with the stock
-
getStock
Description copied from interface:StockRepository
Finds the stock in storage- Specified by:
getStock
in interfaceStockRepository
- Parameters:
ticket
- Ticket associated with the stock- Returns:
- Stock if found or empty if not
-
getStocks
Description copied from interface:StockRepository
Finds all the stocks saved- Specified by:
getStocks
in interfaceStockRepository
- Returns:
- List of all the stocks saved
-