# danieibazgc/sistema_hotelero architecture

> Architecture diagram of the GitHub repository danieibazgc/sistema_hotelero, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danieibazgc/sistema_hotelero
- Repository: https://github.com/danieibazgc/sistema_hotelero

## Overview

##### Project type and purpose
- Hotel DG is a full-stack web application (Java EE) for hotel management.
- It supports reservation management, room occupancy, billing, customer records, inventory and reporting, using a layered architecture and a relational database.

##### File structure
- Top-level artifacts:
- pom.xml (Maven build)
- apache-tomcat zip (deployment target)
- dbHotel.zip (database script)
- src/main/java:
- Controlador (Servlet layer / Controllers)
- DAO (Data Access Objects)
- Interfaces (DAO interfaces)
- Modelo (Domain-model POJOs)
- librerias (third-party JARs: MySQL driver, iText, Apache POI, Jakarta EE)
- src/main/resources: persistence.xml (JPA config)
- src/main/webapp:
- JSPs and static assets (CSS, JS, images)
- Excel and PDF view generators (.jsp files)
- WEB-INF (beans.xml, web.xml)

##### README
- Confirms Java (NetBeans), MySQL, layered architecture.
- Describes core modules: reservations, rooms, clients, billing, reporting.

##### Main components & interactions
a. Presentation tier (Web layer)
- JSP pages, static assets (JS/CSS), Excel/PDF JSP generators.
- Lives in Tomcat’s web container.
b. Controller layer
- CategoriahabitacionServlet, ClienteServlet, HabitacionServlet, etc.
- Receives HTTP requests, interacts with DAOs, sets attributes, forwards to JSPs.
c. Service/DAO layer
- DAO classes implement CRUD operations via JDBC or JPA (persistence.xml).
- Interfaces (IUsuarioDAO) define contracts.
d. Domain model
- POJOs: Cliente, Habitacion, Producto, Registroalojamiento, Usuario, etc.
e. Database
- MySQL schema (dbHotel.sql).
- Persistence managed via JDBC/DataSource configured in context.xml.
f. External libraries
- iText for PDF, Apache POI for Excel exports, Jakarta EE API, jCalendar, other JS plugins.

##### Architectural patterns & principles
- Layered (presentation → controller → DAO → database)
- MVC: JSP = view, Servlets = controller, Model = domain objects.
- Dependency inversion via DAO interfaces.
- Build & deploy via Maven to Tomcat.

##### Detail level
- DAO interfaces and implementations.
- Persistence.xml/DataSource configuration as the bridge between DAO layer and DB.
- Static assets and JSP generators under the Presentation tier.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["User Browser"]:::client

    %% Build & Deployment Artifacts
    subgraph "Build & Deployment Artifacts"
        Pom["pom.xml"]:::config
        TomcatZip["apache-tomcat-10.1.33.zip"]:::config
        DbScripts["dbHotel.zip"]:::config
    end

    %% Web Application in Tomcat
    subgraph "Web Application (Tomcat)"
        %% Presentation Tier
        subgraph "Presentation Tier"
            JSPViews["JSP Views"]:::presentation
            LoginHome["login.jsp / index.jsp"]:::presentation
            ExcelGen["Excel Generators"]:::presentation
            PDFGen["PDF Generators"]:::presentation
            CSS["CSS Files"]:::presentation
            JS["JS & Plugins"]:::presentation
        end

        %% Controller Tier
        subgraph "Controller Tier"
            CategoriaServlet["CategoriahabitacionServlet"]:::controller
            ClienteServlet["ClienteServlet"]:::controller
            HabitacionServlet["HabitacionServlet"]:::controller
            LoginServlet["LoginServlet"]:::controller
            PisohabitacionServlet["PisohabitacionServlet"]:::controller
            ProductoServlet["ProductoServlet"]:::controller
            RAocupadoServlet["RAocupadoServlet"]:::controller
            RAreservadoServlet["RAreservadoServlet"]:::controller
            SignupServlet["SignupServlet"]:::controller
            UsuarioServlet["UsuarioServlet"]:::controller
            Conexion["Conexion / ConexionCli"]:::controller
        end

        %% DAO Tier
        subgraph "DAO Tier"
            DAOInterfaces["IUsuarioDAO"]:::data
            DAOImpl["DAO Implementations"]:::data
        end

        %% Domain Model
        subgraph "Domain Model"
            Modelo["POJOs"]:::model
        end

        %% Configuration & Libraries
        subgraph "Configuration & Libraries"
            PersistConf["persistence.xml"]:::config
            WebConf["web.xml / beans.xml / context.xml"]:::config
            Libs["External Libraries"]:::external
        end
    end

    %% Database
    DB["MySQL Database"]:::database

    %% Connections
    Browser -->|"HTTP/S"| LoginServlet
    Browser -->|"HTTP/S"| JSPViews
    LoginServlet -->|"forwards"| JSPViews
    JSPViews -->|"HTTP Response"| Browser
    LoginServlet -->|"uses JDBC/JPA"| DAOImpl
    DAOImpl -->|"JDBC/DataSource"| DB
    ExcelGen -->|"uses POI"| Libs
    PDFGen -->|"uses iText"| Libs

    TomcatZip -->|"deployment target"| WebConf
    Pom -->|"builds"| JSPViews
    Pom -->|"builds"| DAOImpl
    Pom -->|"builds"| DBScripts

    %% Click Events
    click JSPViews "https://github.com/danieibazgc/sistema_hotelero/tree/main/src/main/webapp/vistas"
    click LoginHome "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/webapp/login.jsp"
    click ExcelGen "https://github.com/danieibazgc/sistema_hotelero/tree/main/src/main/webapp/Excels/"
    click PDFGen "https://github.com/danieibazgc/sistema_hotelero/tree/main/src/main/webapp/PDFs/"
    click CSS "https://github.com/danieibazgc/sistema_hotelero/tree/main/src/main/webapp/css/"
    click JS "https://github.com/danieibazgc/sistema_hotelero/tree/main/src/main/webapp/js/"
    click CategoriaServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/CategoriahabitacionServlet.java"
    click ClienteServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/ClienteServlet.java"
    click HabitacionServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/HabitacionServlet.java"
    click LoginServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/LoginServlet.java"
    click PisohabitacionServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/PisohabitacionServlet.java"
    click ProductoServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/ProductoServlet.java"
    click RAocupadoServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/RAocupadoServlet.java"
    click RAreservadoServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/RAreservadoServlet.java"
    click SignupServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/SignupServlet.java"
    click UsuarioServlet "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/UsuarioServlet.java"
    click Conexion "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Controlador/Conexion.java"
    click DAOInterfaces "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/java/Interfaces/IUsuarioDAO.java"
    click DAOImpl "https://github.com/danieibazgc/sistema_hotelero/tree/main/src/main/java/DAO"
    click Modelo "https://github.com/danieibazgc/sistema_hotelero/tree/main/src/main/java/Modelo"
    click PersistConf "https://github.com/danieibazgc/sistema_hotelero/blob/main/src/main/resources/META-INF/persistence.xml"
    click WebConf "https://github.com/danieibazgc/sistema_hotelero/tree/main/src/main/webapp/WEB-INF/"
    click Libs "https://github.com/danieibazgc/sistema_hotelero/tree/main/src/main/java/librerias"
    click Pom "https://github.com/danieibazgc/sistema_hotelero/blob/main/pom.xml"
    click TomcatZip "https://github.com/danieibazgc/sistema_hotelero/blob/main/apache-tomcat-10.1.33.zip"
    click DbScripts "https://github.com/danieibazgc/sistema_hotelero/blob/main/dbHotel.zip"

    %% Styles
    classDef presentation fill:#cce5ff,stroke:#2B579A,color:#000;
    classDef controller fill:#d4edda,stroke:#155724,color:#000;
    classDef data fill:#fff3cd,stroke:#856404,color:#000;
    classDef model fill:#f8d7da,stroke:#721c24,color:#000;
    classDef config fill:#e2e3e5,stroke:#6c757d,color:#000;
    classDef external fill:#d6d8db,stroke:#1b1e21,color:#000;
    classDef database fill:#bee5eb,stroke:#0c5460,color:#000;
    classDef client fill:#f1f1f1,stroke:#000,color:#000;
```
