# marogon2003/hotel_alura architecture

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

- Interactive diagram: https://gitdiagram.com/marogon2003/hotel_alura
- Repository: https://github.com/marogon2003/hotel_alura

## Overview

##### Main Components
- User Interface Layer: Represented by the “views” package which contains classes like Login, MenuPrincipal, RegistroHuesped, ReservasView, etc. These are the GUI screens where users interact.
- Controller Layer: Located in the “controller” package. Controllers are responsible for handling input from the UI, managing user requests (e.g., HuespedController, ReservaController, UsuarioController) and orchestrating actions.
- Data Access Layer (DAO): In the “DAO” package. This layer includes classes (HuespedDAO, ReservaDAO) that encapsulate database interactions.
- Domain/Model Layer: The “modelo” package contains entity definitions (Huesped, Reserva, Usuario) that represent the business objects.
- Factory/Utility Layer: The “factory” package, which includes the ConnectionFactory class (and testConexion), providing database connection abstractions.
- External Resources & Configuration: Although not explicitly disposed as a separate service, the pom.xml and Maven settings indicate dependency management and build configuration.
- Database: Although not hosted in the project tree, the README mentions MySQL, which forms an external yet critical component.

##### Relationships and Data Flow
- Controllers then use DAO classes to retrieve or persist data, which is represented as model objects.
- The ConnectionFactory serves as a helper for the DAO classes to create database connections to MySQL.
- Dependency directions: for instance, views depend on controllers; controllers depend on DAOs and models; DAOs depend on utilities (ConnectionFactory).

##### Architectural Patterns & Technologies
- MVC Pattern: Separate the concerns between the presentation (views), the business logic (controllers), and the data model (DAO and model classes).
- Use of a Factory Pattern: The ConnectionFactory indicates the use of a factory pattern for creating database connections.
- Java Ecosystem: Technologies include core Java, Eclipse IDE, Maven (as indicated by pom.xml) for dependency and build management, and external libraries like JCalendar.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer - Views
    subgraph "UI Layer - Views"
        UI1("Login"):::views
        UI2("MenuPrincipal"):::views
        UI3("RegistroHuesped"):::views
        UI4("ReservasView"):::views
        UI5("Busqueda"):::views
        UI6("Exito"):::views
        UI7("MenuUsuario"):::views
    end

    %% Controller Layer
    subgraph "Controller Layer"
        C1("HuespedController"):::controller
        C2("ReservaController"):::controller
        C3("UsuarioController"):::controller
    end

    %% DAO Layer
    subgraph "DAO Layer"
        D1("HuespedDAO"):::dao
        D2("ReservaDAO"):::dao
    end

    %% Model Entities
    subgraph "Model Entities"
        M1("Huesped"):::model
        M2("Reserva"):::model
        M3("Usuario"):::model
    end

    %% Factory/Utility Layer
    subgraph "Factory/Utility Layer"
        F1("ConnectionFactory"):::factory
        F2("testConexion"):::factory
    end

    %% External Database and Configuration
    DB("MySQL Database"):::database
    Maven("pom.xml (Maven Config)"):::config

    %% UI Layer to Controller Layer (User Events)
    UI1 -->|"login_event"| C1
    UI2 -->|"menu_navigation"| C3
    UI3 -->|"guest_registration"| C1
    UI4 -->|"reservation_request"| C2
    UI5 -->|"search_booking"| C2
    UI6 -->|"success_confirmation"| C1
    UI7 -->|"user_menu_actions"| C3

    %% Controller Layer to DAO Layer
    C1 -->|"process_guest_info"| D1
    C2 -->|"process_reservation"| D2
    C3 -->|"process_user_data"| D1

    %% Controller directly creates Model Entity for user
    C3 -->|"create_user_model"| M3

    %% DAO Layer to Model Entities
    D1 -->|"map_guest_data"| M1
    D2 -->|"map_reservation_data"| M2

    %% DAO Layer to MySQL Database (Data Operations)
    D1 -->|"db_operations"| DB
    D2 -->|"db_operations"| DB

    %% DAO Layer uses ConnectionFactory
    D1 -->|"uses_connection"| F1
    D2 -->|"uses_connection"| F1

    %% ConnectionFactory creates connection to Database
    F1 -->|"creates_connection"| DB

    %% External Configuration used by Factory
    Maven -->|"build_config"| F1

    %% Styling Classes
    classDef views fill:#ffe6f2,stroke:#ff66a3,stroke-width:2px;
    classDef controller fill:#e6f7ff,stroke:#66b3ff,stroke-width:2px;
    classDef dao fill:#e6ffe6,stroke:#66ff66,stroke-width:2px;
    classDef model fill:#fff9e6,stroke:#ffcc66,stroke-width:2px;
    classDef factory fill:#fff0e6,stroke:#ff9966,stroke-width:2px;
    classDef database fill:#cce6ff,stroke:#3399ff,stroke-width:2px,stroke-dasharray:5 5;
    classDef config fill:#f2f2f2,stroke:#b3b3b3,stroke-width:2px;

    %% Click Events for UI Layer (Views)
    click UI1 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/views/Login.java"
    click UI2 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/views/MenuPrincipal.java"
    click UI3 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/views/RegistroHuesped.java"
    click UI4 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/views/ReservasView.java"
    click UI5 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/views/Busqueda.java"
    click UI6 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/views/Exito.java"
    click UI7 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/views/MenuUsuario.java"

    %% Click Events for Controller Layer
    click C1 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/controller/HuespedController.java"
    click C2 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/controller/ReservaController.java"
    click C3 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/controller/UsuarioController.java"

    %% Click Events for DAO Layer
    click D1 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/DAO/HuespedDAO.java"
    click D2 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/DAO/ReservaDAO.java"

    %% Click Events for Model Entities
    click M1 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/modelo/Huesped.java"
    click M2 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/modelo/Reserva.java"
    click M3 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/modelo/Usuario.java"

    %% Click Events for Factory/Utility Layer
    click F1 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/factory/ConnectionFactory.java"
    click F2 "https://github.com/marogon2003/hotel_alura/blob/master/src/main/java/factory/testConexion.java"

    %% Click Event for External Configuration
    click Maven "https://github.com/marogon2003/hotel_alura/blob/master/pom.xml"
```
