How marcsastrecabre/sistemagestiohotel works
Project Type and Purpose
• This is a Java-based desktop application built using JavaFX (as indicated by the FXML files) and Maven (see pom.xml).
• Its purpose is to manage hotel operations including the management of persons (clients and employees), reservations, tasks, and invoicing. It connects directly with an SQL database where eight interrelated tables store the core domain data.
File Structure Analysis
• The project uses a typical Maven structure. Under src/main/java/com/mycompany/s_gestio_hotel, you find the core application entry point (App.java), along with several controller classes (FacturaController, IniciController, PersonaController, ReservaController, TascaController) that handle UI interactions.
• The model package contains Java classes for every domain entity (Client, Empleat, Factura, Habitacio, Reserva, etc.) and utility classes like Connexio, GesitioDades, and a Model class holding the in-memory representation.
• The src/main/resources folder contains FXML files for each screen (factura.fxml, inici.fxml, persona.fxml, reserva.fxml, tasca.fxml) that form the presentation layer.
• Build and project configuration files (e.g., pom.xml, nbactions.xml) show that Maven is used for dependency management and building.
README Insights
• The README details both the conceptual and logical/relational designs of the database, showing how tables like PERSONA, EMPLEAT, CLIENT, etc., are connected via foreign keys.
• It explains that on startup, the application loads all data into memory, and further changes in the UI are synchronized with the database.
a. Main Components:
• Presentation Layer: FXML views (in resources) and user interactions.
• Controller Layer: Controller classes (FacturaController, IniciController, PersonaController, ReservaController, TascaController) handling UI events.
• Domain/Model Layer: Model classes corresponding to each database table (Client, Empleat, Factura, Habitacio, Reserva, etc.), plus classes managing data (Model, GesitioDades).
• Persistence Layer (Database): Eight interrelated tables described in the README (PERSONA, EMPLEAT, CLIENT, TASCA, EMPLEAT_TASCA, FACTURA, HABITACIÓ, RESERVA).
• Infrastructure: Connection management (Connexio) and configuration (Maven, pom.xml).
b. Relationships and Interactions:
• From the UI (FXML Views) to Controllers.
• From Controllers to the Model layer where core business logic is maintained.
• From the Model to the Database (via connection and data management classes) and vice versa.
• That changes in the UI trigger updates in the in-memory model and automatically sync with the database.
• Relations reflecting the database foreign key associations (e.g., CLIENT links to PERSONA; RESERVA links to CLIENT, HABITACIÓ, and FACTURA).
c. Architectural Patterns and Design Principles:
• Model-View-Controller (MVC): Controllers mediate user input from the FXML-based views and update the Model.
• Tight coupling between the UI, model, and database for direct, immediate update propagation.
• Use of Maven for dependency/build management indicates standard modularity and separation of concerns.
d. Technologies and Frameworks:
• Java (core language).
• JavaFX (for the UI, using FXML files).
• Maven (build and dependency management).
• JDBC or similar (for database connectivity; see class Connexio and GesitioDades).
• SQL (as evident from the SQL scripts in the README).