The Product module provides application-level use cases for querying and retrieving product information from the e-commerce catalog. These use cases implement the business logic for product operations.
REST Controller Not Implemented: The product use cases are implemented but not yet exposed through REST endpoints. To use these features, you’ll need to create a ProductoRestController in the infrastructure layer.
Retrieves detailed information for a specific product by its name.Location: src/main/java/com/example/demo/producto/application/usecases/ConsultarProductoDetalladoUC.javaMethod Signature:
ConsultarProductoDetalladoUC.java
@Servicepublic class ConsultarProductoDetalladoUC { private final ProductoRepository productoRepository; public ConsultarProductoDetalladoUC(ProductoRepository productoRepository) { this.productoRepository = productoRepository; } public ProductoPOJO execute(String nombre) { return productoRepository.getProductByNombre(nombre); }}
Parameters:
nombre (String): The exact name of the product to retrieve. Product names are case-sensitive.
Returns:
ProductoPOJO object with product details (id, nombre, precio)
Retrieves the complete list of all products in the catalog.Location: src/main/java/com/example/demo/producto/application/usecases/RecuperarTodosLosProductosUC.javaMethod Signature:
RecuperarTodosLosProductosUC.java
@Servicepublic class RecuperarTodosLosProductosUC { private final ProductoRepository productoRepository; public RecuperarTodosLosProductosUC(ProductoRepository productoRepository) { this.productoRepository = productoRepository; } public List<ProductoPOJO> execute() { return productoRepository.findAll(); }}
Parameters: NoneReturns:
List<ProductoPOJO> containing all products in the catalog