Package com.masai.Dao
Interface BuyerDao
- All Known Implementing Classes:
BuyerDaoImpl
public interface BuyerDao
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddAmountToBuyerBalance(double amount, String unsername) Adds a specified amount to the buyer's balance.booleandeleteBuyer(String username, String password) Deletes a buyer based on their username and password.Retrieve all products available for sale.Retrieve all products by category.getAllReturnProduct(String username) Retrieves all return products for a buyer.getAllReturnProductOfBuyerByType(String username, String type) Retrieves all return products of a buyer by the specified type.doublegetBalance(String username) Retrieve buyer balance by username.getBuyerAllTransactionbyDateRange(LocalDate startDate, LocalDate endDate, String username) Retrieves all transactions of a buyer within a specified date range.getBuyerAllTransactionByGSTPercentage(String username) Retrieves all transactions of a buyer based on the GST percentage of the transactions.getBuyerAllTransactionByPurchaseDate(String username) Retrieves all transactions of a buyer based on the purchase date of the transactions.getBuyerAllTransactionByQuantity(String username) Retrieves all transactions of a buyer based on the quantity of the transactions.getBuyerAllTransactionByTotalPrice(String username) Retrieves all transactions of a buyer based on the total price of the transactions.getBuyerByUsername(String username) Retrieve buyer details by username.getProductsByProductId(int id) Retrieve product by product ID.booleanhideTransactions(String username) Hide buyer transactions .loginBuyer(String username, String password) Login as a buyer.purchaseItem(int productId, int quantity) Purchase an item.booleanpurchaseReturnItem(int productId, int quantity) Purchase return items.recoverBuyerAcount(String username, String password, LocalDate date) Recovers a buyer's account based on their username, password, and recovery date.Register a new buyer.booleanunhideTransactions(String username) Unhide buyer transactions .Update buyer details.View all transactions.
-
Method Details
-
loginBuyer
Login as a buyer.- Parameters:
username- The buyer's username.password- The buyer's password.- Returns:
- The Buyer object representing the logged-in buyer.
- Throws:
InvalidCredentialsException- If the username or password is invalid.
-
getBalance
Retrieve buyer balance by username.- Parameters:
username- The username of the buyer.- Returns:
- The balance of the buyer with the specified username.
-
getBuyerByUsername
Retrieve buyer details by username.- Parameters:
username- The username of the buyer.- Returns:
- The Buyer object representing the buyer with the specified username.
-
registerNewBuyer
Register a new buyer.- Parameters:
buyer- The Buyer object containing the buyer's information.- Returns:
- A message indicating the success or failure of the registration process.
-
updateBuyerDetails
Update buyer details.- Parameters:
buyer- The Buyer object containing the updated buyer's information.- Returns:
- A message indicating the success or failure of the update process.
-
getAllProductForSell
ResultSet getAllProductForSell()Retrieve all products available for sale.- Returns:
- A ResultSet containing information about all products available for sale.
- Throws:
RecordNotFoundException- If no products for sale are found.
-
purchaseReturnItem
boolean purchaseReturnItem(int productId, int quantity) Purchase return items.- Parameters:
productId- The ID of the product to return.quantity- Thequantity to return.- Returns:
- True if the return is successful, False otherwise.
-
purchaseItem
Purchase an item.- Parameters:
productId- The ID of the product to purchase.quantity- The quantity to purchase.- Returns:
- A message indicating the success or failure of the purchase process.
-
unhideTransactions
Unhide buyer transactions .- Parameters:
username- The username of the buyer.- Returns:
- True if the transactions are successfully unhidden, False otherwise.
-
hideTransactions
Hide buyer transactions .- Parameters:
username- The username of the buyer.- Returns:
- True if the transactions are successfully hidden, False otherwise.
-
viewAllTransactions
ResultSet viewAllTransactions()View all transactions.- Returns:
- A ResultSet containing information about all transactions.
-
getAllProductsByCategory
Retrieve all products by category.- Parameters:
category- The category of the products.- Returns:
- A ResultSet containing information about all products in the specified category.
- Throws:
RecordNotFoundException- If no products are found in the specified category.
-
getProductsByProductId
Retrieve product by product ID.- Parameters:
id- The ID of the product.- Returns:
- A ResultSet containing information about the product with the specified ID.
- Throws:
RecordNotFoundException- If no product is found with the specified ID.
-
addAmountToBuyerBalance
Adds a specified amount to the buyer's balance.- Parameters:
amount- The amount to add to the buyer's balance.username- The username of the buyer.- Returns:
trueif the balance was successfully updated,falseotherwise.
-
deleteBuyer
Deletes a buyer based on their username and password.- Parameters:
username- The username of the buyer.password- The password of the buyer.- Returns:
trueif the buyer was successfully deleted,falseotherwise.
-
recoverBuyerAcount
Recovers a buyer's account based on their username, password, and recovery date.- Parameters:
username- The username of the buyer.password- The password of the buyer.date- The recovery date of the buyer's account.- Returns:
- The recovered buyer account as a string.
-
getBuyerAllTransactionbyDateRange
ResultSet getBuyerAllTransactionbyDateRange(LocalDate startDate, LocalDate endDate, String username) throws RecordNotFoundException Retrieves all transactions of a buyer within a specified date range.- Parameters:
startDate- The start date of the date range.endDate- The end date of the date range.username- The username of the buyer.- Returns:
- A ResultSet containing the transactions within the date range.
- Throws:
RecordNotFoundException- If no transactions are found within the specified date range.
-
getBuyerAllTransactionByPurchaseDate
Retrieves all transactions of a buyer based on the purchase date of the transactions.- Parameters:
username- The username of the buyer.- Returns:
- A ResultSet containing the transactions.
- Throws:
RecordNotFoundException- If no transactions are found for the buyer.
-
getBuyerAllTransactionByQuantity
Retrieves all transactions of a buyer based on the quantity of the transactions.- Parameters:
username- The username of the buyer.- Returns:
- A ResultSet containing the transactions.
- Throws:
RecordNotFoundException- If no transactions are found for the buyer.
-
getBuyerAllTransactionByGSTPercentage
Retrieves all transactions of a buyer based on the GST percentage of the transactions.- Parameters:
username- The username of the buyer.- Returns:
- A ResultSet containing the transactions.
- Throws:
RecordNotFoundException- If no transactions are found for the buyer.
-
getBuyerAllTransactionByTotalPrice
Retrieves all transactions of a buyer based on the total price of the transactions.- Parameters:
username- The username of the buyer.- Returns:
- A ResultSet containing the transactions.
- Throws:
RecordNotFoundException- If no transactions are found for the buyer.
-
getAllReturnProduct
Retrieves all return products for a buyer.- Parameters:
username- The username of the buyer.- Returns:
- A ResultSet containing the return products.
-
getAllReturnProductOfBuyerByType
Retrieves all return products of a buyer by the specified type.- Parameters:
username- The username of the buyer.type- The type of return products to retrieve.- Returns:
- A ResultSet containing the return products.
-