Class CategoryService

java.lang.Object
com.esprit.services.products.CategoryService
All Implemented Interfaces:
IService<ProductCategory>

public class CategoryService extends Object implements IService<ProductCategory>
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • connection

      private final Connection connection
  • Constructor Details

    • CategoryService

      public CategoryService()
      Performs CategoryService operation.
  • Method Details

    • create

      public void create(ProductCategory productCategory)
      Specified by:
      create in interface IService<ProductCategory>
    • read

      public List<ProductCategory> read()
      Specified by:
      read in interface IService<ProductCategory>
    • update

      public void update(ProductCategory productCategory)
      Specified by:
      update in interface IService<ProductCategory>
    • delete

      public void delete(ProductCategory productCategory)
      Specified by:
      delete in interface IService<ProductCategory>
    • getCategory

      public ProductCategory getCategory(long categoryId)
      Retrieves the Category value.
      Returns:
      the Category value
    • getCategoryByName

      public ProductCategory getCategoryByName(String categoryName)
      Retrieves the CategoryByName value.
      Returns:
      the CategoryByName value
    • getAllCategoriesNames

      public List<String> getAllCategoriesNames()
      Retrieves the AllCategoriesNames value.
      Returns:
      the AllCategoriesNames value
    • getAllCategories

      public List<String> getAllCategories()
      Retrieves the AllCategories value.
      Returns:
      the AllCategories value
    • searchCategoriesByName

      public List<ProductCategory> searchCategoriesByName(String searchKeyword)
      Performs searchCategoriesByName operation.
      Returns:
      the result of the operation
    • getCategoriesForProduct

      public List<ProductCategory> getCategoriesForProduct(int productId)
      Retrieves the CategoriesForProduct value.
      Returns:
      the CategoriesForProduct value
    • addProductToCategory

      public void addProductToCategory(int productId, int categoryId)
      Performs addProductToCategory operation.
    • removeProductFromCategory

      public void removeProductFromCategory(int productId, int categoryId)
      Performs removeProductFromCategory operation.
    • getProductCountForCategory

      public int getProductCountForCategory(int categoryId)
      Retrieves the ProductCountForCategory value.
      Returns:
      the ProductCountForCategory value