Primer Commit

This commit is contained in:
2026-10-23 17:17:52 +02:00
commit d476e982c4
6 changed files with 214 additions and 0 deletions
@@ -0,0 +1,65 @@
package org.palomafp.aadd.aqv;
import java.util.List;
import org.palomafp.aadd.aqv.dao.impl.ContinenteDAO;
import org.palomafp.aadd.aqv.model.Continente;
public class GestorMapaMundi {
public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Debes proporcionar al menos el código de operación (1-5).");
return;
}
int operacion = Integer.parseInt(args[0]);
ContinenteDAO dao = new ContinenteDAO();
switch (operacion) {
case 1:
List<Continente> lista = dao.obtenerTodos();
lista.forEach(System.out::println);
break;
case 2:
if (args.length >= 2) {
Continente c = dao.obtenerPorCodigo(args[1]);
if (c != null) {
System.out.println(c);
} else {
System.out.println("Continente no encontrado.");
}
} else {
System.out.println("Falta el parámetro: Código de Continente.");
}
break;
case 3:
if (args.length >= 3) {
dao.insertar(new Continente(args[1], args[2]));
} else {
System.out.println("Faltan parámetros: Código y/o Nombre.");
}
break;
case 4:
if (args.length >= 2) {
dao.eliminar(args[1]);
} else {
System.out.println("Falta el parámetro: Código de Continente.");
}
break;
case 5:
if (args.length >= 3) {
dao.actualizar(new Continente(args[1], args[2]));
} else {
System.out.println("Faltan parámetros: Código y/o Nombre.");
}
break;
default:
System.out.println("Operación no válida. Debe ser del 1 al 5.");
}
}
}