How joaquinpralong2002/tallerpoo works
Project type and purpose
• This is a monolithic desktop application written in Java, using JavaFX for the UI and Hibernate (via a GlobalSessionFactory) for persistence.
• It follows an MVC-style pattern: FXML views + JavaFX controllers → business logic in controller classes → DAO layer for database access → MySQL backend.
• It was built as an Object-Oriented Programming workshop (“Taller de POO”) with optional test-data creation at startup.
File structure
• src/main/java/controllers: JavaFX controllers (divided into subpackages by role: Administración, AtencionPaciente, Enfermero, Médico, Sistemas, plus singletons).
• src/main/java/model: JPA/Hibernate entity classes and enums.
• src/main/java/datasource: DAO classes implementing database operations against MySQL, plus a GenericoDAO interface.
• src/main/java/util: GlobalSessionFactory, which boots up Hibernate and provides Session objects.
• src/main/java/org/example: Application.java and CreacionDatos.java (entrypoint and test-data generator).
• src/main/resources/views: FXML view files, organized by user role.
• pom.xml: Maven build and dependency management.
README for additional insights
• The application expects optional command-line args to control whether to seed test data, and to override DB URL/user/password.
• Defaults to “jdbc:mysql://localhost:3306/tallerdb” with a specified driver.
• JavaFX setup instructions via a referenced tutorial.
Main components & their relationships
a. UI Layer (JavaFX Desktop):
– FXML view files under src/main/resources/views
– ViewController classes in controllers/* that bind to the FXML
b. Controller Layer (Business Logic):
– Controllers coordinate user actions, validate inputs, orchestrate service calls.
– Singletons classes provide central entry-points per role.
c. Persistence Layer (DAO + Hibernate):
– DAO classes in datasource/ implement CRUD over model entities.
– GenericoDAO interface defines common methods.
– GlobalSessionFactory in util initializes Hibernate SessionFactory.
d. Model Layer:
– Entity classes (model/*.java) annotated for Hibernate.
– Enumerations define domain constants like Roles, Triage variables, etc.
e. Database:
– MySQL database “tallerdb” (or custom URL).
– Schema auto-generated or manually provisioned.
f. Bootstrap & Configuration:
– org.example.Application loads JavaFX and kicks off the first view.
– org.example.CreacionDatos optionally seeds test data.
g. Build & Deployment:
– pom.xml drives compilation, resource packaging, and dependency injection.
Important architectural patterns & design principles
• MVC (Model–View–Controller) separation: FXML+controllers vs. model vs. DAO.
• DAO pattern encapsulates all persistence logic, keeping controllers unaware of SQL.
• Singleton pattern for shared controller instances (SingletonUsuario, SingletonMedico, etc.).
• Factory/Utility (GlobalSessionFactory) to centralize Hibernate initialization.