Package com.masai.Dao
Class AdminDaoImpl
java.lang.Object
com.masai.Dao.AdminDaoImpl
- All Implemented Interfaces:
AdminDao
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieve all active buyers.Retrieve all products.getAllProductsByCategory
(String CatName) Retrieve all products belonging to a specific category.Retrieve all products sorted in ascending order of price.getAllProductsByQuantity
(int from, int to) Retrieve all products within a specified quantity range.getAllProductsBySellerUsername
(String username) Retrieve all products belonging to a specific seller's username.Retrieve all active sellers.Retrieve all sold products.Retrieve all transactions.getAllTransactionbyDateRange
(LocalDate startDate, LocalDate endDate) Retrieve all transactions within a specific date range.Retrieve all transactions sorted by GST percentage.Retrieve all transactions sorted by purchase date.Retrieve all transactions sorted by quantity.Retrieve all transactions sorted by total price.getTransactionById
(int id) Retrieve a transaction by its ID.loginAdmin
(String adminId, String password) Login as an admin.
-
Constructor Details
-
AdminDaoImpl
public AdminDaoImpl()
-
-
Method Details
-
loginAdmin
Login as an admin.- Specified by:
loginAdmin
in interfaceAdminDao
- Parameters:
adminId
- The admin ID.password
- The admin password.- Returns:
- True if the login is successful, False otherwise.
- Throws:
InvalidCredentialsException
- If the admin ID or password is invalid.
-
getAllBuyer
Retrieve all active buyers.- Specified by:
getAllBuyer
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all active buyers.
- Throws:
RecordNotFoundException
- If no active buyers are found.
-
getAllSeller
Retrieve all active sellers.- Specified by:
getAllSeller
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all active sellers.
- Throws:
RecordNotFoundException
- If no active sellers are found.
-
getAllProducts
Retrieve all products.- Specified by:
getAllProducts
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all products.
- Throws:
RecordNotFoundException
- If no products are found.
-
getAllSoldProducts
Retrieve all sold products.- Specified by:
getAllSoldProducts
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all sold products.
- Throws:
RecordNotFoundException
- If no sold products are found.
-
getAllProductsByCategory
Retrieve all products belonging to a specific category.- Specified by:
getAllProductsByCategory
in interfaceAdminDao
- Parameters:
categoryName
- The name of the category.- Returns:
- A ResultSet containing information about all products in the specified category.
- Throws:
RecordNotFoundException
- If no products are found in the specified category.
-
getAllProductsBySellerUsername
Retrieve all products belonging to a specific seller's username.- Specified by:
getAllProductsBySellerUsername
in interfaceAdminDao
- Parameters:
username
- The username of the seller.- Returns:
- A ResultSet containing information about all products belonging to the specified seller.
- Throws:
RecordNotFoundException
- If no products are found for the specified seller.
-
getAllProductsByInAccendingOrderByPrice
Retrieve all products sorted in ascending order of price.- Specified by:
getAllProductsByInAccendingOrderByPrice
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all products sorted by price in ascending order.
- Throws:
RecordNotFoundException
- If no products are found.
-
getAllProductsByQuantity
Retrieve all products within a specified quantity range.- Specified by:
getAllProductsByQuantity
in interfaceAdminDao
- Parameters:
from
- The minimum quantity.to
- The maximum quantity.- Returns:
- A ResultSet containing information about all products within the specified quantity range.
- Throws:
RecordNotFoundException
- If no products are found within the specified quantity range.
-
getAllTransaction
Retrieve all transactions.- Specified by:
getAllTransaction
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all transactions.
- Throws:
RecordNotFoundException
- If no transactions are found.
-
getAllTransactionbyDateRange
public ResultSet getAllTransactionbyDateRange(LocalDate startDate, LocalDate endDate) throws RecordNotFoundException Retrieve all transactions within a specific date range.- Specified by:
getAllTransactionbyDateRange
in interfaceAdminDao
- Parameters:
startDate
- The start date of the range.endDate
- The end date of the range.- Returns:
- A ResultSet containing information about all transactions within the specified date range.
- Throws:
RecordNotFoundException
- If no transactions are found within the specified date range.
-
getTransactionById
Retrieve a transaction by its ID.- Specified by:
getTransactionById
in interfaceAdminDao
- Parameters:
id
- The ID of the transaction.- Returns:
- A ResultSet containing information about the transaction with the specified ID.
- Throws:
RecordNotFoundException
- If no transaction is found with the specified ID.
-
getAllTransactionByPurchaseDate
Retrieve all transactions sorted by purchase date.- Specified by:
getAllTransactionByPurchaseDate
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all transactions sorted by purchase date.
- Throws:
RecordNotFoundException
- If no transactions are found.
-
getAllTransactionByQuantity
Retrieve all transactions sorted by quantity.- Specified by:
getAllTransactionByQuantity
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all transactions sorted by quantity.
- Throws:
RecordNotFoundException
- If no transactions are found.
-
getAllTransactionByGSTPercentage
Retrieve all transactions sorted by GST percentage.- Specified by:
getAllTransactionByGSTPercentage
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all transactions sorted by GST percentage.
- Throws:
RecordNotFoundException
- If no transactions are found.
-
getAllTransactionByTotalPrice
Retrieve all transactions sorted by total price.- Specified by:
getAllTransactionByTotalPrice
in interfaceAdminDao
- Returns:
- A ResultSet containing information about all transactions sorted by total price.
- Throws:
RecordNotFoundException
- If no transactions are found.
-