69 lines
1.1 KiB
Java
69 lines
1.1 KiB
Java
package org.palomafp.aadd.ss;
|
|
|
|
import java.util.List;
|
|
|
|
import org.palomafp.aadd.ss.dao.IContinenteDAO;
|
|
import org.palomafp.aadd.ss.dao.impl.ContinenteDaoCSV;
|
|
import org.palomafp.aadd.ss.model.Continente;
|
|
|
|
public class GestorMapaMundi {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
int opcion = Integer.parseInt(args[0]);
|
|
|
|
IContinenteDAO continenteDao = new ContinenteDaoCSV();
|
|
Continente continente = null;
|
|
|
|
switch(opcion) {
|
|
case 1:
|
|
List<Continente> continentes = continenteDao.obtenerTodos();
|
|
|
|
for(Continente c : continentes) {
|
|
System.out.println(c);
|
|
}
|
|
break;
|
|
|
|
case 2:
|
|
continente = continenteDao.obtenerPorCodigo(args[1]);
|
|
System.out.println("El continente es: " + continente);
|
|
break;
|
|
|
|
case 3:
|
|
continente = new Continente(args[1], args[2]);
|
|
continenteDao.insertar(continente);
|
|
break;
|
|
|
|
case 4:
|
|
continenteDao.eliminar(args[1]);
|
|
break;
|
|
|
|
case 5:
|
|
continente = new Continente(args[1], args[2]);
|
|
continenteDao.actualizar(continente);
|
|
break;
|
|
default:
|
|
System.out.println("Opcion incorrecta...");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|