Package com.masai.Dao
Class ProductDaoImpl
java.lang.Object
com.masai.Dao.ProductDaoImpl
- All Implemented Interfaces:
ProductDao
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
addProductBySeller
(Product product) Adds a new product by a seller.int
getGStPercentage
(int productId) Retrieves the GST percentage of a product based on its product ID.getProductById
(int productId) Retrieves a product based on its product ID.int
getProductIdByCategoryName
(String catgoryName) Retrieves the product ID based on the category name.boolean
returnProduct
(ReturnProduct returnProduct) Processes the return of a product.boolean
updateProductBySeller
(Product product, int id) Updates a product by a seller.boolean
updateQuantity
(int productId, int quantity) Updates the quantity of a product based on its product ID.
-
Constructor Details
-
ProductDaoImpl
public ProductDaoImpl()
-
-
Method Details
-
updateQuantity
public boolean updateQuantity(int productId, int quantity) Updates the quantity of a product based on its product ID.- Specified by:
updateQuantity
in interfaceProductDao
- Parameters:
productId
- The ID of the product.quantity
- The new quantity of the product.- Returns:
true
if the quantity was successfully updated,false
otherwise.
-
getGStPercentage
public int getGStPercentage(int productId) Retrieves the GST percentage of a product based on its product ID.- Specified by:
getGStPercentage
in interfaceProductDao
- Parameters:
productId
- The ID of the product.- Returns:
- The GST percentage of the product.
-
getProductById
Retrieves a product based on its product ID.- Specified by:
getProductById
in interfaceProductDao
- Parameters:
productId
- The ID of the product.- Returns:
- The product object.
-
updateProductBySeller
Updates a product by a seller.- Specified by:
updateProductBySeller
in interfaceProductDao
- Parameters:
product
- The updated product object.id
- The ID of the product to update.- Returns:
true
if the product was successfully updated,false
otherwise.
-
addProductBySeller
Adds a new product by a seller.- Specified by:
addProductBySeller
in interfaceProductDao
- Parameters:
product
- The product object to add.- Returns:
true
if the product was successfully added,false
otherwise.
-
getProductIdByCategoryName
Retrieves the product ID based on the category name.- Specified by:
getProductIdByCategoryName
in interfaceProductDao
- Parameters:
categoryName
- The name of the category.- Returns:
- The product ID associated with the category.
-
returnProduct
Processes the return of a product.- Specified by:
returnProduct
in interfaceProductDao
- Parameters:
returnProduct
- The return product object.- Returns:
true
if the return was successfully processed,false
otherwise.
-