Skip to main content

Documentation 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.

Enrollment is managed through two complementary panels. PanelMatricula is available to Administrator and Secretary roles and provides the full enrollment management interface — register, update, cancel, and undo. PanelMisMatriculas is exclusive to Students and shows only their own enrolled courses. Both panels share the same ListaMatricula singly-linked list as the in-memory store, backed by MatriculaDAO for SQL Server persistence. PanelMatricula also holds a reference to the shared PilaAcciones_U3 stack, which it reads (pops) to implement the Deshacer (undo) feature that reverses recent enrollment operations.

The Matricula Data Model

A Matricula record links one Estudiante to one Curso. It has no independent scalar fields of its own — its logical identity is the composite key (carnet, codigoCurso).
FieldTypeDescriptionConstraint
estudianteEstudianteThe enrolled student (full object reference).Non-null (Guava checkNotNull)
cursoCursoThe course being enrolled in.Non-null (Guava checkNotNull)
public Matricula(Estudiante estudiante, Curso curso) {
    this.estudiante = checkNotNull(estudiante, "El estudiante no puede ser nulo");
    this.curso      = checkNotNull(curso,      "El curso no puede ser nulo");
}
Both referenced objects are resolved from their respective in-memory structures (ArbolEstudiantes and ListaCursos) before the Matricula is constructed, ensuring referential integrity at the application layer.

ListaMatricula — The Core Structure

ListaMatricula is a custom singly-linked list whose nodes each hold a Matricula reference and a pointer to the next node. It supports O(n) traversal, O(n) search by composite key, and O(1) head deletion. Key methods used by the enrollment panels:
MethodDescription
agregar(Matricula)Appends a new node at the tail.
buscar(carnet, codigoCurso)Linear scan returning the matching Matricula or null.
buscarPorCarnet(carnet)Returns a List<Matricula> filtered by student carnet.
eliminar(carnet, codigoCurso)Removes the node matching the composite key; returns true on success.
recorrer(Consumer<Matricula>)Iterates all nodes, used for table rendering and export.
limpiar()Resets the list to empty (called before reloading from SQL).

Enrollment Operations

1

Enroll a Student (Registrar)

Select a Carnet and a Código Curso from the combo-boxes (populated from ArbolEstudiantes.inorden() and ListaCursos.recorrer() respectively), then click Registrar.The panel resolves both objects from their structures, calls MatriculaDAO.insertar(carnet, codigo), and on success reloads the list from SQL. It also registers the student account via CuentasEstudiantes.registrarPorMatricula(carnet).
Estudiante est = arbolEstudiantes.buscar(carnet);
Curso curso    = listaCursos.buscar(codigo);

if (est == null || curso == null) {
    JOptionPane.showMessageDialog(this, "Estudiante o curso no encontrado.");
    return;
}

dao.MatriculaDAO matriculaDAO = new dao.MatriculaDAO();
boolean exitoSQL = matriculaDAO.insertar(carnet, codigo);
if (exitoSQL) {
    CuentasEstudiantes.registrarPorMatricula(carnet);
    cargarMatriculasDesdeSQL();
}
2

Search Enrollments by Student

ListaMatricula.buscarPorCarnet(carnet) performs a linear scan and returns every Matricula whose student carnet matches (case-insensitive). This is used both by the admin table view and by PanelMisMatriculas for the student self-view.
List<Matricula> misMatriculas = listaMatricula.buscarPorCarnet("2024001");
3

Search a Specific Enrollment

When a row is selected in the context menu for update, the panel looks up the exact Matricula by the composite key:
Matricula encontrada = listaMatricula.buscar(carnet, codigoCurso);
4

Cancel an Enrollment (Eliminar)

Right-click a row and choose Eliminar. A confirmation dialog is shown. On approval, MatriculaDAO.eliminar(carnet, codigoCurso) removes the record from SQL and cargarMatriculasDesdeSQL() rebuilds the in-memory list.
dao.MatriculaDAO matriculaDAO = new dao.MatriculaDAO();
matriculaDAO.eliminar(carnet, codigo);
cargarMatriculasDesdeSQL();
5

Undo the Last Action (Deshacer)

Click Deshacer to pop the most recent action from PilaAcciones_U3 and reverse it. The stack supports three reversible action types:
Action typeUndo behaviour
"REGISTRO"Calls MatriculaDAO.eliminar() to remove the enrollment.
"ELIMINACIÓN"Calls MatriculaDAO.insertar() to restore the enrollment.
"ACTUALIZACIÓN"Removes the current record and re-inserts the previous state.
AccionMatricula ultima = pilaHistorial.desapilar();
// ...switch on ultima.getTipo() to invert the operation

Student Self-View (PanelMisMatriculas)

When a student logs in, the PanelMisMatriculas panel is shown instead of the full enrollment manager. It receives the logged-in student’s carnet (from Usuario.getCarnet()) and uses buscarPorCarnet to filter only their own records:
List<Matricula> mis = listaMatricula.buscarPorCarnet(carnet);
for (Matricula m : mis) {
    modelo.addRow(new Object[]{
        m.getCurso().getCodigo(),
        m.getCurso().getNombre(),
        m.getCurso().getCreditos(),
        m.getCurso().getSemestre()
    });
}
The table shows Código, Curso, Créditos, and Semestre columns (course-centric view, not admin-centric). The student can also download their own enrollment report using the Descargar reporte button.
If the logged-in student has no carnet linked to their user account, or has not yet been enrolled by the secretary, the panel displays an informational dialog instructing them to contact the secretariat.

Action History Tracking

PanelMatricula receives the shared PilaAcciones_U3 pilaHistorial reference from MenuPrincipal. The Deshacer button pops the most recent AccionMatricula off the stack and reverses the corresponding database operation. The stack is populated externally — for example by other components or future integrations that call pilaHistorial.apilar(new AccionMatricula(...)). See the History page for full details on the stack structure and AccionMatricula fields.

Excel Export

Both panels support exporting enrollments to Excel. Click Exportar a Excel (admin panel) or Descargar reporte (student panel). A file-chooser opens:
  • Admin panel default filename: matriculas.xlsx
  • Student panel default filename: reporte_matriculas.xls
The export calls:
ExportadorExcel.exportarMatriculas(listaMatricula, archivo);
For the student report, a filtered ListaMatricula containing only that student’s records is passed instead. The exported sheet contains four columns:
Column AColumn BColumn CColumn D
CarnetEstudianteCódigo CursoCurso

Full Usage Example

// Persist enrollment via DAO (PanelMatricula delegates to SQL)
dao.MatriculaDAO matriculaDAO = new dao.MatriculaDAO();
boolean ok = matriculaDAO.insertar("2024001", "AED101");
if (ok) {
    CuentasEstudiantes.registrarPorMatricula("2024001");
    cargarMatriculasDesdeSQL(); // rebuilds ListaMatricula from SQL
}

// Student self-view: filter enrollments by carnet
List<Matricula> misMatriculas = listaMatricula.buscarPorCarnet("2024001");

// Search a specific enrollment by composite key
Matricula encontrada = listaMatricula.buscar("2024001", "AED101");

// Cancel a specific enrollment via DAO
matriculaDAO.eliminar("2024001", "AED101");
cargarMatriculasDesdeSQL();

// Undo the last stack action (if any was pushed externally)
if (!pilaHistorial.estaVacia()) {
    AccionMatricula ultima = pilaHistorial.desapilar();
    // reverse the operation based on ultima.getTipo()
}
The combo-boxes in PanelMatricula are populated with arbolEstudiantes.inorden() and listaCursos.recorrer() respectively. If a newly registered student or course does not appear in the drop-downs, switch to the Students or Courses panel and refresh — the in-memory structures will be reloaded from the database, and returning to the Enrollment panel will repopulate the combos.

Build docs developers (and LLMs) love