Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/dinogamer089/SiCom/llms.txt

Use this file to discover all available pages before exploring further.

SiCom is structured as a four-module Maven project (group ID mx.avanti.desarollo, parent artifact guia). Each module owns one well-defined layer of the application: JPA entities, data-access objects, business facades, and JSF views. Dependencies flow strictly downward — the view layer depends on the business layer, which depends on persistence, which depends on the entity model. No layer may reference a higher one, keeping concerns cleanly separated and the codebase independently testable.

Module Overview

ModuleArtifact IDRoot PackageResponsibility
Entity modelentidadmx.desarollo.entityJPA @Entity classes, enums, and value objects
Persistencepersistenciamx.avanti.desarolloAbstractDAO, HibernateUtil, concrete DAOs, ServiceLocator
Businessnegociomx.desarolloFacade classes, Delegate classes, ServiceFacadeLocator
Web / Viewvistaui, helperCDI @Named beans, Helper classes, JSF XHTML pages, servlets
All four modules compile to Java 21 (maven.compiler.source=21). The vista module is the only one packaged as a WAR; the others produce JARs that are bundled inside it.

Layer Details

entidad — JPA Entity Model

Package: mx.desarollo.entity The entidad module contains every JPA @Entity class and supporting enums. Hibernate 6 maps these classes to the MySQL schema; Hibernate validates the schema on every startup (hbm2ddl.auto=validate). Entities registered in persistence.xml:
EntityTablePurpose
ArticuloarticuloRentable item — name, Categoria, price, stock, active flag, Imagen FK
ImagenimagenBinary image data and MIME type for an article
RentarentaQuotation or rental record — state, dates, client, employee, total
DetallerentadetallerentaLine item of a rental (article + quantity + subtotal)
ClienteclienteClient contact and authentication data
EmpleadoempleadoEmployee contact and authentication data
AdministradoradministradorAdministrator credentials
CombinacionMesacombinacion_mesaPreset table-and-linen pairings for quick cart additions
ComentariocomentarioNotes attached to a rental by any user
StockDiariostock_diarioAbsolute stock snapshot per article per calendar day
StockReservadoDiariostock_reservado_diarioReserved units per article per day (drives availability checks)
MovimientoAlmacenmovimiento_almacenAudit log of stock entries and exits
Supporting enums:
  • CategoriaMESA, TEXTIL, SILLA, CARPA, COOLER, CALENTON
  • FormaREDONDA, RECTANGULAR, UNIVERSAL
  • TextilTipoMANTEL, CAMINO, CUBREMANTEL
  • TipoMovimiento — warehouse movement direction

persistencia — Data Access Layer

Package: mx.avanti.desarollo The persistencia module initializes Hibernate and provides all data-access objects. The central utility class is HibernateUtil, which builds a single EntityManagerFactory from the persistence unit named persistencePU (defined in persistence.xml) and vends short-lived EntityManager instances on demand. HikariCP connection pooling is configured directly in persistence.xml:
PropertyValue
hibernate.hikari.minimumIdle5
hibernate.hikari.maximumPoolSize10
hibernate.hikari.idleTimeout30000 ms
AbstractDAO<T> is the generic base class for every DAO. It wraps every operation in its own EntityManager + EntityTransaction, commits on success, and rolls back on any RuntimeException. Concrete DAOs extend it and add domain-specific JPQL or native queries: ArticuloDAO, RentaDAO, ClienteDAO, EmpleadoDAO, AdministradorDAO, CombinacionMesaDAO, DetallerentaDAO, StockDiarioDAO, StockReservadoDAO, MovimientoAlmacenDAO, ComentarioDAO, DashboardDAO ServiceLocator is a static factory that instantiates each DAO with a fresh EntityManager obtained from HibernateUtil. It is the only class in the persistence layer that the business layer calls directly.

negocio — Business / Facade Layer

Package: mx.desarollo The negocio module provides two sub-layers per feature domain: a Facade and a Delegate. This pattern allows business rules (validation, state transitions, aggregation) to live in the Facade while the Delegate owns the wiring to ServiceLocator. Facade classes:
FacadeResponsibility
FacadeArticuloCatalog CRUD, soft-delete on constraint violation, duplicate-name guard
FacadeRentaQuotation registration, state machine transitions, rental updates with stock recalculation
FacadeDashboardAggregated metrics, funnel data, top-article ranking, client-growth series
FacadeEmpleadoEmployee CRUD and lookup
FacadeCarritoShopping-cart session logic and quote submission
FacadeCombinacionMesaPreset table-linen combination management
FacadeTarjetaAlmacenWarehouse card views and movement registration
FacadeLoginAuthentication for both Administrador and Empleado entities
Delegate classes (one per Facade) wrap ServiceLocator calls and translate between business objects and DAO parameters: DelegateArticulo, DelegateRenta, DelegateEmpleado, DelegateCarrito, DelegateCombinacionMesa, DelegateTarjetaAlmacen, DelegateDashboard, DelegateLogin ServiceFacadeLocator is a lazy-initializing static registry that vends singleton Facade instances to the view layer, mirroring the role that ServiceLocator plays for DAOs.

vista — Web / View Layer

Package: ui (CDI beans), helper (intermediate helpers), config (listeners), upload (servlet) The vista module is the only deployable artifact (WAR). It contains:
  • CDI @Named managed beans in the ui package — one per screen or feature, annotated @SessionScoped or @RequestScoped, named for EL expression binding in XHTML pages
  • Helper classes in the helper package — plain Java objects that translate between UI data transfer objects (DTOs) and Facade calls, keeping beans thin
  • XHTML views — PrimeFaces 14 component pages mapped to *.xhtml by the Faces Servlet
  • UploadImageServlet — handles multipart image uploads outside the JSF lifecycle for large binary payloads
  • UploadInitListener — a ServletContextListener that pre-configures the upload directory at application startup
Key @Named beans: LoginBeanUI, ArticuloBeanUI, ArticuloCatalogoBeanUI, CarritoBean, RentaBeanUI, EmpleadoBeanUI, EmpleadoRentaBeanUI, DashboardBeanUI, DashboardRentasBeanUI, DashboardCotizacionesBeanUI, DashboardClientesBeanUI, CombinacionMesaAdminBeanUI, CombinacionMesaClienteBeanUI, TarjetaAlmacenBeanUI, ContactoBean

Request Flow

A user action in the browser travels through every layer before reaching MySQL:
XHTML view (PrimeFaces)
   │  EL binding  #{articuloUI.guardarNuevo()}

CDI Bean  ui.ArticuloBeanUI  (@Named @SessionScoped)
   │  delegates to helper

Helper  helper.ArticuloHelper
   │  calls ServiceFacadeLocator

Facade  mx.desarollo.facade.FacadeArticulo
   │  validates business rules, calls delegate

Delegate  mx.desarollo.delegate.DelegateArticulo
   │  calls ServiceLocator

DAO  mx.avanti.desarollo.dao.ArticuloDAO  (extends AbstractDAO)
   │  EntityManager + EntityTransaction

MySQL 8  (via HikariCP pool, persistence unit "persistencePU")

Code Example — Bean → Helper → Facade

The following excerpt shows the real pattern used across the application. ArticuloBeanUI stays free of Facade imports; it only knows about ArticuloHelper. The helper calls ServiceFacadeLocator to reach the Facade, which in turn calls the Delegate and DAO.
// ui/ArticuloBeanUI.java  (@Named("articuloUI") @SessionScoped)
public class ArticuloBeanUI implements Serializable {

    private final ArticuloHelper articuloHelper;

    public ArticuloBeanUI() {
        articuloHelper = new ArticuloHelper();   // plain instantiation, no CDI injection
    }

    public void guardarNuevo() {
        // ... validation logic ...
        nuevoArticulo.setPrecio(nuevoPrecio);

        Imagen imagen = new Imagen();
        imagen.setDatos(imagenBytes);
        imagen.setMime(imagenMime);

        // delegate to helper — bean never touches the Facade directly
        articuloHelper.guardarConImagen(nuevoArticulo, imagen);

        articulosOriginales = articuloHelper.obtenerTodas();
    }
}

// helper/ArticuloHelper.java
public class ArticuloHelper {

    public void guardarConImagen(Articulo articulo, Imagen imagen) {
        // reaches across to the business layer via the locator
        ServiceFacadeLocator.getInstanceFacadeArticulo()
                            .crearArticuloConImagen(articulo, imagen);
    }

    public List<Articulo> obtenerTodas() {
        return ServiceFacadeLocator.getInstanceFacadeArticulo()
                                   .obtenerArticulos();
    }
}

// mx.desarollo.facade.FacadeArticulo
public class FacadeArticulo {

    private final DelegateArticulo delegateArticulo;

    public FacadeArticulo() {
        this.delegateArticulo = new DelegateArticulo();
    }

    public void crearArticuloConImagen(Articulo articulo, Imagen imagen) {
        if (delegateArticulo.existsArticuloByNombre(articulo.getNombre())) {
            throw new IllegalArgumentException("Ya existe un articulo con ese nombre");
        }
        articulo.setNombre(articulo.getNombre().trim());
        delegateArticulo.saveArticuloWithImage(articulo, imagen);
    }
}
The persistence unit is named persistencePU (declared in persistencia/src/main/resources/META-INF/persistence.xml). HibernateUtil bootstraps this unit once at class-loading time and shares the EntityManagerFactory for the lifetime of the application. Hibernate is configured with hbm2ddl.auto=validate, which means it checks that the database schema matches the entity mappings on every startup but never modifies the schema automatically. If the schema is missing or out of date, the application will fail to start — run the SQL migration scripts first.

What’s Next

Entity Reference

Full field-by-field reference for every JPA entity and enum.

DAO Layer

AbstractDAO API and custom query methods in each concrete DAO.

Facade API

Public methods of every Facade class and their business rules.

Rental States

Complete state machine diagram and allowed transitions.

Build docs developers (and LLMs) love