TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/kenri89/PROYECTO_UTP_AED_1_1/llms.txt
Use this file to discover all available pages before exploring further.
dao package is the single point of contact between the application’s in-memory data structures and the SQL Server database. It defines four interfaces — IEstudianteDAO, ICursoDAO, IMatriculaDAO, and IUsuarioDAO — each with a concrete implementation. Every write operation uses PreparedStatement with positional parameters, meaning no SQL is ever built by concatenating user-supplied strings. If the database is unreachable at runtime, each DAO method returns false or an empty list and logs a warning, allowing the GUI to continue working with in-memory state.
ConexionSQL
util.ConexionSQL is the single class responsible for opening JDBC connections. It reads five mandatory keys (plus two TLS flags) from config.properties on the classpath. If the file is absent, built-in defaults are used so that the application can start even without a custom configuration.
db.user / db.password) are passed separately to DriverManager.getConnection() rather than embedded in the URL string. Properties are cached after the first load so the file is only read once per JVM session.
The JDBC driver in use is mssql-jdbc 13.4.0 (Microsoft’s official SQL
Server JDBC driver). Make sure
mssql-jdbc-13.4.0.jre11.jar is on the
runtime classpath before launching the application.DAO Interface Overview
Each interface maps to one database table and exposes the minimum operations required by the GUI panels. The table below summarises the relationships:| Interface | Implementation | Managed Entity |
|---|---|---|
IEstudianteDAO | EstudianteDAO | Students — Estudiantes table (carnet PK) |
ICursoDAO | CursoDAO | Courses — Cursos table (codigo PK) |
IMatriculaDAO | MatriculaDAO | Enrollments — Matriculas table (carnet + codigo_curso FK pair) |
IUsuarioDAO | UsuarioDAO | Users / login — usuarios table |
IEstudianteDAO
IEstudianteDAO covers the full CRUD lifecycle for the Estudiantes table.
| Method | Parameters | Return | SQL |
|---|---|---|---|
insertar | carnet, nombre, carrera | boolean | INSERT INTO Estudiantes (carnet, nombre, carrera) VALUES (?, ?, ?) |
listar | — | List<String[]> | SELECT carnet, nombre, carrera FROM Estudiantes |
actualizar | carnet, nombre, carrera | boolean | UPDATE Estudiantes SET nombre = ?, carrera = ? WHERE carnet = ? |
eliminar | carnet | boolean | DELETE FROM Estudiantes WHERE carnet = ? |
Primary key — the student’s registration number (e.g.
"2024001"). Must be
unique across the Estudiantes table.Full name of the student (up to 100 characters).
Degree programme name (up to 100 characters, e.g.
"Computación").ICursoDAO
ICursoDAO manages the course catalogue stored in the Cursos table.
| Method | Parameters | Return | SQL |
|---|---|---|---|
insertar | codigo, nombre, creditos, semestre | boolean | INSERT INTO Cursos (codigo, nombre, creditos, semestre) VALUES (?, ?, ?, ?) |
listar | — | List<String[]> | SELECT codigo, nombre, creditos, semestre FROM Cursos |
actualizar | codigo, nombre, creditos, semestre | boolean | UPDATE Cursos SET nombre = ?, creditos = ?, semestre = ? WHERE codigo = ? |
eliminar | codigo | boolean | DELETE FROM Cursos WHERE codigo = ? |
Primary key — the course code (e.g.
"AED101"). Up to 20 characters.Descriptive course title (up to 100 characters).
Number of academic credits assigned to the course.
Semester number in which the course is taught (typically 1–10).
IMatriculaDAO
IMatriculaDAO records which students are enrolled in which courses. The Matriculas table uses a surrogate auto-increment id, but enrollment uniqueness is enforced by the (carnet, codigo_curso) pair.
| Method | Parameters | Return | SQL |
|---|---|---|---|
insertar | carnet, codigoCurso | boolean | INSERT INTO Matriculas (carnet, codigo_curso) VALUES (?, ?) |
listar | — | List<String[]> | SELECT carnet, codigo_curso FROM Matriculas |
eliminar | carnet, codigoCurso | boolean | DELETE FROM Matriculas WHERE carnet = ? AND codigo_curso = ? |
Foreign key referencing
Estudiantes(carnet).Foreign key referencing
Cursos(codigo).IUsuarioDAO
IUsuarioDAO has a single method used exclusively for login.
| Method | Parameters | Return |
|---|---|---|
autenticar | username, password, rolSeleccionado | Usuario or null |
UsuarioDAO.autenticar() queries usuarios with a case-insensitive username match (LOWER(username) = LOWER(?)). If the database is unavailable or the credentials are not found in the table, it automatically falls back to autenticarFallback(), which checks hardcoded default accounts (admin/1234, secretaria/1234) or delegates student authentication to CuentasEstudiantes.
Login username, matched case-insensitively against the
usuarios table.Plain-text password compared against the stored value after trimming
whitespace.
Role selected in the login form (
"Administrador", "Secretaria", or
"Estudiante"). Used by the fallback path to route student credentials to
CuentasEstudiantes.listar() Return Convention
All three data-access interfaces share the samelistar() return type: List<String[]>. Each element is a String[] whose positions match the column order of the SELECT statement.
EstudianteDAO.listar()
row[0] = carnetrow[1] = nombrerow[2] = carreraCursoDAO.listar()
row[0] = codigorow[1] = nombrerow[2] = creditos (String)row[3] = semestre (String)MatriculaDAO.listar()
row[0] = carnetrow[1] = codigo_cursocreditos and semestre are stored as String in the array (via String.valueOf(rs.getInt(...))). The caller is responsible for parsing them back to int when constructing domain objects.
Typical Usage Pattern
The application bootstraps each panel by callinglistar() once to hydrate the in-memory data structures, then calls insertar, actualizar, or eliminar in response to user actions.
boolean return values indicate whether at least one row was affected
(executeUpdate() > 0). A false result can mean either a genuine database
error or that no matching row existed — check the SLF4J log output to
distinguish between the two cases.Offline / Fallback Behaviour
The SQL Server connection is opportunistic. Every DAO method wraps its logic in atry-with-resources block and catches Exception. On failure it logs a warning at WARN level and returns false / an empty list without throwing. This means:
- GUI panels continue to function using the in-memory data structures.
- Any changes made while offline are held in RAM only.
PersistenciaAcademica.guardar()can still write those changes to the TSV fallback files on disk.