commit inicial
This commit is contained in:
commit
8f0db0690f
41
.classpath
Normal file
41
.classpath
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-25">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
||||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/bin/
|
||||||
|
*.class
|
||||||
|
/target/
|
||||||
23
.project
Normal file
23
.project
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>AgenciaESA</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
13
.settings/org.eclipse.jdt.core.prefs
Normal file
13
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=24
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=24
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=24
|
||||||
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
||||||
13
configuracion/aplicacion.properties
Normal file
13
configuracion/aplicacion.properties
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Configuración de la aplicación AgenciaESA
|
||||||
|
# JDBC MySQL
|
||||||
|
jdbc.url=jdbc:mysql://192.168.1.36:3306/agencia_esa_xxx
|
||||||
|
jdbc.usuario=root
|
||||||
|
jdbc.password=mysql_123
|
||||||
|
|
||||||
|
# Fichero CSV
|
||||||
|
ruta.fichero.csv=ficheros-datos/tripulantes_sinmision.csv
|
||||||
|
csv.cabecera=num_tripulante|nombre|apellidos|id_esa|especialidad|fecha_ingreso
|
||||||
|
csv.separador=|
|
||||||
|
|
||||||
|
# Fichero XML Lectura
|
||||||
|
ruta.fichero.xml=ficheros-datos/operaciones_esa.xml
|
||||||
157
ficheros-datos/operaciones_esa.xml
Normal file
157
ficheros-datos/operaciones_esa.xml
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<operacionesESA fecha_generacion="2040-11-12"
|
||||||
|
centro_control_origen="ESOC Darmstadt"
|
||||||
|
version_xml="3.0"
|
||||||
|
md5="F1C92A88E23DF00A44AB9FF9982DE0AC">
|
||||||
|
|
||||||
|
<misiones>
|
||||||
|
<mision>
|
||||||
|
<nombre>Reabastecimiento Ares I</nombre>
|
||||||
|
<cod_nave>ESA-TRANS-02</cod_nave>
|
||||||
|
<cuerpo_celeste>Marte</cuerpo_celeste>
|
||||||
|
<fecha_inicio>2034-04-02</fecha_inicio>
|
||||||
|
<fecha_fin_estimada>2034-04-25</fecha_fin_estimada>
|
||||||
|
<estado>En curso</estado>
|
||||||
|
<objetivo>Entrega ampliada de repuestos en Base Ares</objetivo>
|
||||||
|
<presupuesto>18950000</presupuesto>
|
||||||
|
|
||||||
|
<tripulacion>
|
||||||
|
<tripulante ident_esa="2001">
|
||||||
|
<rol>Piloto</rol>
|
||||||
|
<nivel_estres>2</nivel_estres>
|
||||||
|
</tripulante>
|
||||||
|
<tripulante ident_esa="2004">
|
||||||
|
<rol>Ingeniero</rol>
|
||||||
|
<nivel_estres>3</nivel_estres>
|
||||||
|
</tripulante>
|
||||||
|
<tripulante ident_esa="2007">
|
||||||
|
<rol>Científico</rol>
|
||||||
|
<nivel_estres>2</nivel_estres>
|
||||||
|
</tripulante>
|
||||||
|
</tripulacion>
|
||||||
|
</mision>
|
||||||
|
|
||||||
|
<mision>
|
||||||
|
<nombre>Atmósfera Olympus I</nombre>
|
||||||
|
<cod_nave>ESA-SCIEN-03</cod_nave>
|
||||||
|
<cuerpo_celeste>Marte</cuerpo_celeste>
|
||||||
|
<fecha_inicio>2034-08-10</fecha_inicio>
|
||||||
|
<fecha_fin_estimada>2034-12-10</fecha_fin_estimada>
|
||||||
|
<estado>Planificada</estado>
|
||||||
|
|
||||||
|
<objetivo>Estudio atmosférico marciano</objetivo>
|
||||||
|
<presupuesto>14000000</presupuesto>
|
||||||
|
|
||||||
|
<tripulacion>
|
||||||
|
<tripulante ident_esa="2002">
|
||||||
|
<rol>Piloto</rol>
|
||||||
|
<nivel_estres>3</nivel_estres>
|
||||||
|
</tripulante>
|
||||||
|
<tripulante ident_esa="2008">
|
||||||
|
<rol>Ingeniero</rol>
|
||||||
|
<nivel_estres>2</nivel_estres>
|
||||||
|
</tripulante>
|
||||||
|
<tripulante ident_esa="2012">
|
||||||
|
<rol>Científico</rol>
|
||||||
|
<nivel_estres>3</nivel_estres>
|
||||||
|
</tripulante>
|
||||||
|
</tripulacion>
|
||||||
|
</mision>
|
||||||
|
|
||||||
|
<mision>
|
||||||
|
<nombre>Mantenimiento Avanzado Selene III</nombre>
|
||||||
|
<cod_nave>ESA-MANT-01</cod_nave>
|
||||||
|
<cuerpo_celeste>Luna</cuerpo_celeste>
|
||||||
|
<fecha_inicio>2036-02-01</fecha_inicio>
|
||||||
|
<fecha_fin_estimada>2037-10-10</fecha_fin_estimada>
|
||||||
|
<estado>Planificada</estado>
|
||||||
|
<objetivo>Mantenimiento avanzado de sistemas térmicos</objetivo>
|
||||||
|
|
||||||
|
<presupuesto>6900000</presupuesto>
|
||||||
|
<prioridad>Alta</prioridad>
|
||||||
|
<riesgo_estimado>Bajo</riesgo_estimado>
|
||||||
|
<comentarios_operativos>Prueba de nuevos trajes de aislamiento</comentarios_operativos>
|
||||||
|
|
||||||
|
<tripulacion>
|
||||||
|
<tripulante ident_esa="2002">
|
||||||
|
<rol>Piloto</rol>
|
||||||
|
<nivel_estres>2</nivel_estres>
|
||||||
|
<horas_entrenamiento_previas>105</horas_entrenamiento_previas>
|
||||||
|
</tripulante>
|
||||||
|
|
||||||
|
<tripulante ident_esa="2005">
|
||||||
|
<rol>Ingeniero</rol>
|
||||||
|
<nivel_estres>3</nivel_estres>
|
||||||
|
<nivel_experiencia_nuevo>7</nivel_experiencia_nuevo>
|
||||||
|
<observaciones>Aumento de experiencia tras misión en Armstrong</observaciones>
|
||||||
|
</tripulante>
|
||||||
|
|
||||||
|
<tripulante ident_esa="2011">
|
||||||
|
<rol>Comunicaciones</rol>
|
||||||
|
<nivel_estres>2</nivel_estres>
|
||||||
|
<nivel_experiencia_nuevo>6</nivel_experiencia_nuevo>
|
||||||
|
</tripulante>
|
||||||
|
|
||||||
|
<tripulante ident_esa="2019">
|
||||||
|
<rol>Científico</rol>
|
||||||
|
<nivel_estres>3</nivel_estres>
|
||||||
|
</tripulante>
|
||||||
|
</tripulacion>
|
||||||
|
</mision>
|
||||||
|
|
||||||
|
<mision>
|
||||||
|
<nombre>Exploración Criogénica Europa II</nombre>
|
||||||
|
<cod_nave>ESA-SCIEN-03</cod_nave>
|
||||||
|
<cuerpo_celeste>Europa</cuerpo_celeste>
|
||||||
|
<fecha_inicio>2040-03-01</fecha_inicio>
|
||||||
|
<fecha_fin_estimada>2040-05-20</fecha_fin_estimada>
|
||||||
|
<estado>Planificada</estado>
|
||||||
|
|
||||||
|
<objetivo>Análisis espectral del hielo profundo</objetivo>
|
||||||
|
<presupuesto>21200000</presupuesto>
|
||||||
|
|
||||||
|
<comentarios_operativos>Se requieren sondas perforadoras reforzadas</comentarios_operativos>
|
||||||
|
|
||||||
|
<tripulacion>
|
||||||
|
<tripulante ident_esa="2006">
|
||||||
|
<rol>Piloto</rol>
|
||||||
|
<nivel_estres>3</nivel_estres>
|
||||||
|
</tripulante>
|
||||||
|
<tripulante ident_esa="2101">
|
||||||
|
<rol>Ingeniero</rol>
|
||||||
|
<nivel_estres>2</nivel_estres>
|
||||||
|
<nuevo_tripulante>
|
||||||
|
<nombre>Elena</nombre>
|
||||||
|
<apellidos>Markovic</apellidos>
|
||||||
|
<pais>Serbia</pais>
|
||||||
|
<nivel_experiencia>4</nivel_experiencia>
|
||||||
|
<especialidad>Robótica Criogénica</especialidad>
|
||||||
|
</nuevo_tripulante>
|
||||||
|
</tripulante>
|
||||||
|
<tripulante ident_esa="2102">
|
||||||
|
<rol>Científico</rol>
|
||||||
|
<nivel_estres>3</nivel_estres>
|
||||||
|
<nuevo_tripulante>
|
||||||
|
<nombre>Rafael</nombre>
|
||||||
|
<apellidos>Bianchi</apellidos>
|
||||||
|
<pais>Italia</pais>
|
||||||
|
<nivel_experiencia>5</nivel_experiencia>
|
||||||
|
<especialidad>Espectrometría</especialidad>
|
||||||
|
</nuevo_tripulante>
|
||||||
|
</tripulante>
|
||||||
|
<tripulante ident_esa="2103">
|
||||||
|
<rol>Comunicaciones</rol>
|
||||||
|
<nivel_estres>1</nivel_estres>
|
||||||
|
<nuevo_tripulante>
|
||||||
|
<nombre>Freya</nombre>
|
||||||
|
<apellidos>Hansen</apellidos>
|
||||||
|
<pais>Dinamarca</pais>
|
||||||
|
<nivel_experiencia>3</nivel_experiencia>
|
||||||
|
<especialidad>Protocolos de enlace profundo</especialidad>
|
||||||
|
</nuevo_tripulante>
|
||||||
|
</tripulante>
|
||||||
|
|
||||||
|
</tripulacion>
|
||||||
|
</mision>
|
||||||
|
|
||||||
|
</misiones>
|
||||||
|
</operacionesESA>
|
||||||
4
ficheros-datos/tripulantes_sinmision.csv
Normal file
4
ficheros-datos/tripulantes_sinmision.csv
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
num_tripulante|nombre|apellidos|id_esa|especialidad|fecha_ingreso
|
||||||
|
18|Nicola|Winter|2018|Ingeniería|2022-11-23
|
||||||
|
19|John|McFall|2019|Comunicaciones|2022-11-23
|
||||||
|
20|Paolo|Nespoli|2020|Ingeniería|1998-05-01
|
||||||
|
30
pom.xml
Normal file
30
pom.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>eu.esa.gemis</groupId>
|
||||||
|
<artifactId>AgenciaESA</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>AgenciaESA</name>
|
||||||
|
<description>Aplicación Java con acceso a datos (AADD) para examen 2.º DAM</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>24</maven.compiler.source>
|
||||||
|
<maven.compiler.target>24</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- MySQL JDBC driver -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<version>9.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Jackson (para JsonNode) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>tools.jackson.dataformat</groupId>
|
||||||
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
11
src/.project
Normal file
11
src/.project
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>src</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
128
src/main/java/eu/esa/gemis/AplicacionAgenciaESA.java
Normal file
128
src/main/java/eu/esa/gemis/AplicacionAgenciaESA.java
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
package eu.esa.gemis;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.IMisionDAO;
|
||||||
|
import eu.esa.gemis.dao.impl.MisionDaoJDBC;
|
||||||
|
import eu.esa.gemis.excepcion.AgenciaEsaException;
|
||||||
|
import eu.esa.gemis.procesos.ProcesadorTripulantesCSV;
|
||||||
|
import eu.esa.gemis.procesos.ProcesadorXMLMision;
|
||||||
|
import eu.esa.gemis.util.ConversorTiposDatosYFormatos;
|
||||||
|
import eu.esa.gemis.vo.Mision;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* AplicacionAgenciaESA: Clase que realiza el tratamiento principal de la
|
||||||
|
* aplicación.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 nov 2025
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AplicacionAgenciaESA {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
AplicacionAgenciaESA app = new AplicacionAgenciaESA();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Tratamiento de lógica de negocio
|
||||||
|
app.realizarTratamientoAgenciaESA();
|
||||||
|
|
||||||
|
} catch (AgenciaEsaException e) {
|
||||||
|
String mensajeError = "Error en la clase %s al realizar una operación de %s";
|
||||||
|
String operacion = "Operación desconocida";
|
||||||
|
int codigoError = e.getCodigoError();
|
||||||
|
switch (codigoError) {
|
||||||
|
case AgenciaEsaException.ERROR_GESTION_CONEXION:
|
||||||
|
operacion = "Gestión de Conexión";
|
||||||
|
break;
|
||||||
|
case AgenciaEsaException.ERROR_CONSULTA:
|
||||||
|
operacion = "Consulta";
|
||||||
|
break;
|
||||||
|
case AgenciaEsaException.ERROR_INSERCION:
|
||||||
|
operacion = "Inserción";
|
||||||
|
break;
|
||||||
|
case AgenciaEsaException.ERROR_BORRADO:
|
||||||
|
operacion = "Borrado";
|
||||||
|
break;
|
||||||
|
case AgenciaEsaException.ERROR_ACTUALIZACION:
|
||||||
|
operacion = "Actualización";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mensajeError = String.format(mensajeError, e.getClaseOrigen().getName(), operacion);
|
||||||
|
System.out.println(mensajeError);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void realizarTratamientoAgenciaESA() throws AgenciaEsaException {
|
||||||
|
Scanner entrada = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("Menú:");
|
||||||
|
System.out.println(" 1: Almacenar en CSV los tripulantes sin misiones asignadas.");
|
||||||
|
System.out.println(" 2: Procesar fichero operaciones_esa.xml");
|
||||||
|
System.out.println(" 3: Imprimir en consola el listado de misiones inciadas en un año.");
|
||||||
|
System.out.println("----------------------------------------------------------");
|
||||||
|
System.out.println("Introduce la operación a realizar:");
|
||||||
|
// Operación recogida
|
||||||
|
String operacion = entrada.nextLine().trim();
|
||||||
|
|
||||||
|
while (!("123".contains(operacion))) {
|
||||||
|
System.out.println("Has seleccionado un operación errónea (ha de ser un número entre 1 y 3)");
|
||||||
|
System.out.print("Introduce la operación a realizar:");
|
||||||
|
|
||||||
|
// Operación recogida
|
||||||
|
operacion = entrada.nextLine();
|
||||||
|
}
|
||||||
|
System.out.println("Operación a realizar: " + operacion);
|
||||||
|
// Cerrar la entrada del Scanner
|
||||||
|
entrada.close();
|
||||||
|
|
||||||
|
ejecutarFuncionalidades(operacion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ejecutarFuncionalidades(String operacion) throws AgenciaEsaException {
|
||||||
|
switch (operacion) {
|
||||||
|
case "1": { // Almacenar en CSV los tripulantes sin misiones asignadas
|
||||||
|
// Almacenar tripulantes en fichero CSV
|
||||||
|
ProcesadorTripulantesCSV procesadorTripulantesCSV = new ProcesadorTripulantesCSV();
|
||||||
|
procesadorTripulantesCSV.almacenarTripulantesSinMisionEnFicheroCSV();
|
||||||
|
System.out.println("Tripulantes sin misión almacenados en fichero tripulantes_sin_mision.csv");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "2": { // Procesar Fichero operaciones_esa.xml
|
||||||
|
System.out.println("Ejecutar procesamiento fichero operaciones_esa.xml");
|
||||||
|
|
||||||
|
ProcesadorXMLMision procesadorXMLMision = new ProcesadorXMLMision();
|
||||||
|
procesadorXMLMision.procesarFicheroXMLMisiones();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "3": { // Imprimir en consola el listado de misiones inciadas en un año.
|
||||||
|
System.out.println("Obtener e imprimir en consola el listado de misiones iniciadas en un año.");
|
||||||
|
IMisionDAO iMisionDAO = new MisionDaoJDBC();
|
||||||
|
List<Mision> listaMisiones = iMisionDAO.obtenerMisionesIniciadasEnAnyo(2034);
|
||||||
|
|
||||||
|
for (Mision mision : listaMisiones) {
|
||||||
|
// System.out.println(mision);
|
||||||
|
// Formatear fecha a dd/MM/yyyy
|
||||||
|
String fechaFormateada = ConversorTiposDatosYFormatos.convertirAFechaConFormato(mision.getFechaInicio(),
|
||||||
|
"dd/MM/yyyy");
|
||||||
|
|
||||||
|
String textoImprimir = "La misión %s comenzó el %s con destino a %s (%s) utilizando la nave %s con capacidad para %d tripulantes.";
|
||||||
|
textoImprimir = String.format(textoImprimir, mision.getNombre(), fechaFormateada,
|
||||||
|
mision.getCuerpoCeleste().getNombre(), mision.getCuerpoCeleste().getTipo(),
|
||||||
|
mision.getNave().getCodigo(), mision.getNave().getCapacidadTripulacion());
|
||||||
|
System.out.println(textoImprimir);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
src/main/java/eu/esa/gemis/dao/IBaseDAO.java
Normal file
9
src/main/java/eu/esa/gemis/dao/IBaseDAO.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* IBaseDAO: Interfaz DAO para la entidad Base.
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
public interface IBaseDAO {
|
||||||
|
}
|
||||||
10
src/main/java/eu/esa/gemis/dao/ICuerpoCelesteDAO.java
Normal file
10
src/main/java/eu/esa/gemis/dao/ICuerpoCelesteDAO.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* ICuerpoCelesteDAO: Interfaz DAO para la entidad CuerpoCeleste.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
public interface ICuerpoCelesteDAO {
|
||||||
|
}
|
||||||
10
src/main/java/eu/esa/gemis/dao/IGeneradorPrincipalDAO.java
Normal file
10
src/main/java/eu/esa/gemis/dao/IGeneradorPrincipalDAO.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* IGeneradorPrincipalDAO: Interfaz DAO para la entidad GeneradorPrincipal.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
public interface IGeneradorPrincipalDAO {
|
||||||
|
}
|
||||||
19
src/main/java/eu/esa/gemis/dao/IMisionDAO.java
Normal file
19
src/main/java/eu/esa/gemis/dao/IMisionDAO.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* IMisionDAO: Interfaz DAO para la entidad Mision.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.esa.gemis.excepcion.AgenciaEsaException;
|
||||||
|
import eu.esa.gemis.vo.Mision;
|
||||||
|
|
||||||
|
public interface IMisionDAO {
|
||||||
|
|
||||||
|
List<Mision> obtenerMisionesIniciadasEnAnyo(int anyo) throws AgenciaEsaException;
|
||||||
|
|
||||||
|
void actualizarMisionPorNaveCuerpoFecha(Mision mision) throws AgenciaEsaException;
|
||||||
|
}
|
||||||
10
src/main/java/eu/esa/gemis/dao/INaveDAO.java
Normal file
10
src/main/java/eu/esa/gemis/dao/INaveDAO.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* INaveDAO: Interfaz DAO para la entidad Nave.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
public interface INaveDAO {
|
||||||
|
}
|
||||||
23
src/main/java/eu/esa/gemis/dao/ITripulanteDAO.java
Normal file
23
src/main/java/eu/esa/gemis/dao/ITripulanteDAO.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* ITripulanteDAO: Interfaz DAO para la entidad Tripulante.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.esa.gemis.excepcion.AgenciaEsaException;
|
||||||
|
import eu.esa.gemis.vo.Tripulante;
|
||||||
|
|
||||||
|
public interface ITripulanteDAO {
|
||||||
|
|
||||||
|
List<Tripulante> obtenerTripulantesSinMision() throws AgenciaEsaException;
|
||||||
|
|
||||||
|
Tripulante obtenerTripulantePorIdESA(int identificadorESA) throws AgenciaEsaException;
|
||||||
|
|
||||||
|
void actualizarTripulantePorIdESA(Tripulante tripulante) throws AgenciaEsaException;
|
||||||
|
|
||||||
|
void insertarTripulante(Tripulante tripulante) throws AgenciaEsaException;
|
||||||
|
}
|
||||||
10
src/main/java/eu/esa/gemis/dao/ITripulanteMisionDAO.java
Normal file
10
src/main/java/eu/esa/gemis/dao/ITripulanteMisionDAO.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* ITripulanteMisionDAO: Interfaz DAO para la entidad TripulanteMision.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
public interface ITripulanteMisionDAO {
|
||||||
|
}
|
||||||
16
src/main/java/eu/esa/gemis/dao/impl/BaseDaoJDBC.java
Normal file
16
src/main/java/eu/esa/gemis/dao/impl/BaseDaoJDBC.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package eu.esa.gemis.dao.impl;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.IBaseDAO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* BaseDaoJDBC: Clase que realiza la implementación del interfaz IBaseDAO.
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 nov 2025
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BaseDaoJDBC implements IBaseDAO {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package eu.esa.gemis.dao.impl;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.ICuerpoCelesteDAO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* CuerpoCelesteDaoJDBC: Clase que realiza la implementación del interfaz ICuerpoCelesteDAO.
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 nov 2025
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CuerpoCelesteDaoJDBC implements ICuerpoCelesteDAO {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package eu.esa.gemis.dao.impl;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.IGeneradorPrincipalDAO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* GeneradorPrincipalDaoJDBC: Clase que realiza la implementación del interfaz IGeneradorPrincipalDAO.
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 nov 2025
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GeneradorPrincipalDaoJDBC implements IGeneradorPrincipalDAO{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
127
src/main/java/eu/esa/gemis/dao/impl/MisionDaoJDBC.java
Normal file
127
src/main/java/eu/esa/gemis/dao/impl/MisionDaoJDBC.java
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
package eu.esa.gemis.dao.impl;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.IMisionDAO;
|
||||||
|
import eu.esa.gemis.excepcion.AgenciaEsaException;
|
||||||
|
import eu.esa.gemis.gestor.GestorConexionJDBC;
|
||||||
|
import eu.esa.gemis.vo.CuerpoCeleste;
|
||||||
|
import eu.esa.gemis.vo.Mision;
|
||||||
|
import eu.esa.gemis.vo.Nave;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* MisionDaoJDBC: Clase que realiza la implementación del interfaz IMisionDAO.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 nov 2025
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MisionDaoJDBC implements IMisionDAO {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Mision> obtenerMisionesIniciadasEnAnyo(int anyo) throws AgenciaEsaException {
|
||||||
|
List<Mision> listaMisiones = null;
|
||||||
|
|
||||||
|
String sentenciaSQL = """
|
||||||
|
select tm.nombre as nombre_mision, tm.fecha_inicio,
|
||||||
|
tn.codigo as codigo_nave, tn.capacidad_tripulacion,
|
||||||
|
tcc.nombre as nombre_cuerpo_celeste, tcc.tipo
|
||||||
|
from T_MISION tm join T_NAVE tn
|
||||||
|
on tm.cod_nave = tn.codigo
|
||||||
|
join T_CUERPO_CELESTE tcc
|
||||||
|
on tm.id_cuerpo_celeste = tcc.identificador
|
||||||
|
where year(tm.fecha_inicio) = ?
|
||||||
|
""";
|
||||||
|
// try con recursos "cerrables": Connection, PreparedStatement, ResultSet
|
||||||
|
try (Connection conexion = GestorConexionJDBC.obtenerConexion();
|
||||||
|
PreparedStatement pstm = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
// Establecer los parámetros de la sentencia
|
||||||
|
pstm.setInt(1, anyo);
|
||||||
|
// System.out.println(pstm);
|
||||||
|
|
||||||
|
ResultSet resultadoSentencia = pstm.executeQuery();
|
||||||
|
if (resultadoSentencia != null) {
|
||||||
|
listaMisiones = new ArrayList<Mision>();
|
||||||
|
}
|
||||||
|
while (resultadoSentencia.next()) {
|
||||||
|
Mision mision = new Mision();
|
||||||
|
String nombre= resultadoSentencia.getString("nombre_mision");
|
||||||
|
LocalDate fechaInicio= resultadoSentencia.getDate("tm.fecha_inicio").toLocalDate();
|
||||||
|
|
||||||
|
Nave nave = new Nave();
|
||||||
|
nave.setCodigo(resultadoSentencia.getString("codigo_nave"));
|
||||||
|
nave.setCapacidadTripulacion(resultadoSentencia.getInt("capacidad_tripulacion"));
|
||||||
|
|
||||||
|
CuerpoCeleste cuerpoCeleste = new CuerpoCeleste();
|
||||||
|
cuerpoCeleste.setNombre(resultadoSentencia.getString("nombre_cuerpo_celeste"));
|
||||||
|
cuerpoCeleste.setTipo(resultadoSentencia.getString("tipo"));
|
||||||
|
|
||||||
|
mision.setNombre(nombre);
|
||||||
|
mision.setFechaInicio(fechaInicio);
|
||||||
|
mision.setNave(nave);
|
||||||
|
mision.setCuerpoCeleste(cuerpoCeleste);
|
||||||
|
|
||||||
|
|
||||||
|
listaMisiones.add(mision);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new AgenciaEsaException(e, getClass(), AgenciaEsaException.ERROR_CONSULTA);
|
||||||
|
}
|
||||||
|
|
||||||
|
return listaMisiones;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actualizarMisionPorNaveCuerpoFecha(Mision mision) throws AgenciaEsaException {
|
||||||
|
String sentenciaSQL = """
|
||||||
|
UPDATE T_MISION
|
||||||
|
set nombre = ?,
|
||||||
|
fecha_fin_estimado=?,
|
||||||
|
fecha_fin=?,
|
||||||
|
estado=?,
|
||||||
|
objetivo_principal=?,
|
||||||
|
presupuesto_asignado=?
|
||||||
|
where cod_nave = ?
|
||||||
|
and id_cuerpo_celeste = (select tcc.identificador
|
||||||
|
from T_CUERPO_CELESTE tcc
|
||||||
|
where tcc.nombre = ?)
|
||||||
|
and fecha_inicio = ?
|
||||||
|
""";
|
||||||
|
|
||||||
|
// try con recursos "cerrables": Connection, PreparedStatement
|
||||||
|
try (Connection conexion = GestorConexionJDBC.obtenerConexion();
|
||||||
|
PreparedStatement pstm = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
// Establecer los parámetros de la sentencia
|
||||||
|
pstm.setString(1, mision.getNombre());
|
||||||
|
pstm.setDate(2, Date.valueOf(mision.getFechaFinEstimado()));
|
||||||
|
Date fechaFin = mision.getFechaFin() != null ? Date.valueOf(mision.getFechaFin()) : null;
|
||||||
|
pstm.setDate(3, fechaFin);
|
||||||
|
pstm.setString(4, mision.getEstado());
|
||||||
|
pstm.setString(5, mision.getObjetivoPrincipal());
|
||||||
|
pstm.setInt(6, mision.getPresupuestoAsignado());
|
||||||
|
pstm.setString(7, mision.getNave().getCodigo());
|
||||||
|
pstm.setString(8, mision.getCuerpoCeleste().getNombre());
|
||||||
|
pstm.setDate(9, Date.valueOf(mision.getFechaInicio()));
|
||||||
|
|
||||||
|
// System.out.println(pstm);
|
||||||
|
|
||||||
|
pstm.executeUpdate();
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new AgenciaEsaException(e, getClass(), AgenciaEsaException.ERROR_CONSULTA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
16
src/main/java/eu/esa/gemis/dao/impl/NaveDaoJDBC.java
Normal file
16
src/main/java/eu/esa/gemis/dao/impl/NaveDaoJDBC.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package eu.esa.gemis.dao.impl;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.INaveDAO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* NaveDaoJDBC: Clase que realiza la implementación del interfaz INaveDAO.
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 nov 2025
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class NaveDaoJDBC implements INaveDAO{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
178
src/main/java/eu/esa/gemis/dao/impl/TripulanteDaoJDBC.java
Normal file
178
src/main/java/eu/esa/gemis/dao/impl/TripulanteDaoJDBC.java
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
package eu.esa.gemis.dao.impl;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.ITripulanteDAO;
|
||||||
|
import eu.esa.gemis.excepcion.AgenciaEsaException;
|
||||||
|
import eu.esa.gemis.gestor.GestorConexionJDBC;
|
||||||
|
import eu.esa.gemis.vo.Tripulante;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* TripulanteDaoJDBC: Clase que realiza la implementación del interfaz
|
||||||
|
* ITripulanteDAO.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 nov 2025
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TripulanteDaoJDBC implements ITripulanteDAO {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Tripulante> obtenerTripulantesSinMision() throws AgenciaEsaException {
|
||||||
|
List<Tripulante> listaTripulantes = null;
|
||||||
|
|
||||||
|
String sentenciaSQL = """
|
||||||
|
select *
|
||||||
|
from T_TRIPULANTE tt
|
||||||
|
where tt.numero_tripulante not in (select ttm.num_tripulante
|
||||||
|
from T_TRIPULANTE_MISION ttm )
|
||||||
|
""";
|
||||||
|
// try con recursos "cerrables": Connection, Statement, ResultSet
|
||||||
|
try (Connection conexion = GestorConexionJDBC.obtenerConexion();
|
||||||
|
PreparedStatement pstm = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
System.out.println(pstm);
|
||||||
|
|
||||||
|
ResultSet resultadoSentencia = pstm.executeQuery();
|
||||||
|
if (resultadoSentencia != null) {
|
||||||
|
listaTripulantes = new ArrayList<Tripulante>();
|
||||||
|
}
|
||||||
|
while (resultadoSentencia.next()) {
|
||||||
|
int numeroTripulante = resultadoSentencia.getInt("tt.numero_tripulante");
|
||||||
|
String nombre = resultadoSentencia.getString("tt.nombre");
|
||||||
|
String apellidos = resultadoSentencia.getString("tt.apellidos");
|
||||||
|
int identificadorEsa = resultadoSentencia.getInt("tt.identificador_esa");
|
||||||
|
int nivelExperiencia = resultadoSentencia.getInt("tt.nivel_experiencia");
|
||||||
|
String especialidad = resultadoSentencia.getString("tt.especialidad");
|
||||||
|
LocalDate fechaIngresoEsa = resultadoSentencia.getDate("tt.fecha_ingreso_esa").toLocalDate();
|
||||||
|
|
||||||
|
Tripulante tripulante = new Tripulante();
|
||||||
|
tripulante.setNumeroTripulante(numeroTripulante);
|
||||||
|
tripulante.setNombre(nombre);
|
||||||
|
tripulante.setApellidos(apellidos);
|
||||||
|
tripulante.setIdentificadorEsa(identificadorEsa);
|
||||||
|
tripulante.setNivelExperiencia(nivelExperiencia);
|
||||||
|
tripulante.setEspecialidad(especialidad);
|
||||||
|
tripulante.setFechaIngresoEsa(fechaIngresoEsa);
|
||||||
|
|
||||||
|
listaTripulantes.add(tripulante);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new AgenciaEsaException(e, getClass(), AgenciaEsaException.ERROR_CONSULTA);
|
||||||
|
}
|
||||||
|
|
||||||
|
return listaTripulantes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Tripulante obtenerTripulantePorIdESA(int identificadorESA) throws AgenciaEsaException {
|
||||||
|
Tripulante tripulante = null;
|
||||||
|
String sentenciaSQL = """
|
||||||
|
SELECT *
|
||||||
|
from T_TRIPULANTE tt
|
||||||
|
where tt.identificador_esa = ?
|
||||||
|
""";
|
||||||
|
// try con recursos "cerrables": Connection, PreparedStatement, ResultSet
|
||||||
|
try (Connection conexion = GestorConexionJDBC.obtenerConexion();
|
||||||
|
PreparedStatement pstm = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
// Establecer los parámetros de la sentencia
|
||||||
|
pstm.setInt(1, identificadorESA);
|
||||||
|
// System.out.println(pstm);
|
||||||
|
|
||||||
|
ResultSet resultadoSentencia = pstm.executeQuery();
|
||||||
|
if (resultadoSentencia.next()) {
|
||||||
|
int numeroTripulante = resultadoSentencia.getInt("tt.numero_tripulante");
|
||||||
|
String nombre = resultadoSentencia.getString("tt.nombre");
|
||||||
|
String apellidos = resultadoSentencia.getString("tt.apellidos");
|
||||||
|
int identificadorEsa = resultadoSentencia.getInt("tt.identificador_esa");
|
||||||
|
int nivelExperiencia = resultadoSentencia.getInt("tt.nivel_experiencia");
|
||||||
|
String especialidad = resultadoSentencia.getString("tt.especialidad");
|
||||||
|
LocalDate fechaIngresoEsa = resultadoSentencia.getDate("tt.fecha_ingreso_esa").toLocalDate();
|
||||||
|
|
||||||
|
tripulante = new Tripulante();
|
||||||
|
tripulante.setNumeroTripulante(numeroTripulante);
|
||||||
|
tripulante.setNombre(nombre);
|
||||||
|
tripulante.setApellidos(apellidos);
|
||||||
|
tripulante.setIdentificadorEsa(identificadorEsa);
|
||||||
|
tripulante.setNivelExperiencia(nivelExperiencia);
|
||||||
|
tripulante.setEspecialidad(especialidad);
|
||||||
|
tripulante.setFechaIngresoEsa(fechaIngresoEsa);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new AgenciaEsaException(e, getClass(), AgenciaEsaException.ERROR_CONSULTA);
|
||||||
|
}
|
||||||
|
return tripulante;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actualizarTripulantePorIdESA(Tripulante tripulante) throws AgenciaEsaException {
|
||||||
|
String sentenciaSQL = """
|
||||||
|
UPDATE T_TRIPULANTE
|
||||||
|
SET nombre = ?,
|
||||||
|
apellidos = ?,
|
||||||
|
nivel_experiencia = ?,
|
||||||
|
especialidad = ?,
|
||||||
|
fecha_ingreso_esa = ?
|
||||||
|
WHERE identificador_esa = ?
|
||||||
|
""";
|
||||||
|
|
||||||
|
// try con recursos "cerrables": Connection, PreparedStatement
|
||||||
|
try (Connection conexion = GestorConexionJDBC.obtenerConexion();
|
||||||
|
PreparedStatement pstm = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
// Establecer los parámetros de la sentencia
|
||||||
|
pstm.setString(1, tripulante.getNombre());
|
||||||
|
pstm.setString(2, tripulante.getApellidos());
|
||||||
|
pstm.setInt(3, tripulante.getNivelExperiencia());
|
||||||
|
pstm.setString(4, tripulante.getEspecialidad());
|
||||||
|
pstm.setDate(5, Date.valueOf(tripulante.getFechaIngresoEsa()));
|
||||||
|
pstm.setInt(6, tripulante.getIdentificadorEsa());
|
||||||
|
// System.out.println(pstm);
|
||||||
|
|
||||||
|
pstm.executeUpdate();
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new AgenciaEsaException(e, getClass(), AgenciaEsaException.ERROR_ACTUALIZACION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertarTripulante(Tripulante tripulante) throws AgenciaEsaException {
|
||||||
|
String sentenciaSQL = """
|
||||||
|
INSERT INTO T_TRIPULANTE (nombre, apellidos, identificador_esa, nivel_experiencia, especialidad, fecha_ingreso_esa) VALUES
|
||||||
|
(?, ?, ?, ?, ?, ?)
|
||||||
|
""";
|
||||||
|
|
||||||
|
// try con recursos "cerrables": Connection, PreparedStatement
|
||||||
|
try (Connection conexion = GestorConexionJDBC.obtenerConexion();
|
||||||
|
PreparedStatement pstm = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
// Establecer los parámetros de la sentencia
|
||||||
|
pstm.setString(1, tripulante.getNombre());
|
||||||
|
pstm.setString(2, tripulante.getApellidos());
|
||||||
|
pstm.setInt(3, tripulante.getIdentificadorEsa());
|
||||||
|
pstm.setInt(4, tripulante.getNivelExperiencia());
|
||||||
|
pstm.setString(5, tripulante.getEspecialidad());
|
||||||
|
pstm.setDate(6, Date.valueOf(tripulante.getFechaIngresoEsa()));
|
||||||
|
// System.out.println(pstm);
|
||||||
|
|
||||||
|
pstm.executeUpdate();
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new AgenciaEsaException(e, getClass(), AgenciaEsaException.ERROR_INSERCION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package eu.esa.gemis.dao.impl;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.ITripulanteMisionDAO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* TripulanteMisionDaoJDBC: Clase que realiza la implementación del interfaz ITripulanteMisionDAO.
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 nov 2025
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TripulanteMisionDaoJDBC implements ITripulanteMisionDAO{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* AgenciaEsaException: excepción personalizada para la aplicación AgenciaESA.
|
||||||
|
* Incluye información del origen (clase que lanzó la excepción) y una constante
|
||||||
|
* que indica la operación que se estaba realizando.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.excepcion;
|
||||||
|
|
||||||
|
public class AgenciaEsaException extends Exception {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private int codigoError;
|
||||||
|
private Class<?> claseOrigen;
|
||||||
|
|
||||||
|
/** Operación genérica para identificar el contexto donde ocurre la excepción */
|
||||||
|
public static final int ERROR_GENERAL=0;
|
||||||
|
public static final int ERROR_GESTION_CONEXION=1;
|
||||||
|
public static final int ERROR_CONSULTA=2;
|
||||||
|
public static final int ERROR_INSERCION=3;
|
||||||
|
public static final int ERROR_ACTUALIZACION=4;
|
||||||
|
public static final int ERROR_BORRADO=5;
|
||||||
|
|
||||||
|
public AgenciaEsaException(Throwable error, Class<?> claseOrigen, int codError) {
|
||||||
|
super(error);
|
||||||
|
this.claseOrigen = claseOrigen;
|
||||||
|
this.codigoError=codError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCodigoError() {
|
||||||
|
return codigoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodigoError(int codigoError) {
|
||||||
|
this.codigoError = codigoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<?> getClaseOrigen() {
|
||||||
|
return claseOrigen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClaseOrigen(Class<?> claseOrigen) {
|
||||||
|
this.claseOrigen = claseOrigen;
|
||||||
|
}
|
||||||
|
}
|
||||||
32
src/main/java/eu/esa/gemis/gestor/GestorConexionJDBC.java
Normal file
32
src/main/java/eu/esa/gemis/gestor/GestorConexionJDBC.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* GestorConexionJDBC: clase utilitaria para obtener conexiones JDBC a la base de datos MySQL.
|
||||||
|
* Utiliza la configuración leída por {@link GestorFicheroConfiguracion}.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.gestor;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class GestorConexionJDBC {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtiene una nueva conexión JDBC a la base de datos configurada.
|
||||||
|
*
|
||||||
|
* @return {@link Connection} activa
|
||||||
|
* @throws SQLException si ocurre un error al conectar
|
||||||
|
*/
|
||||||
|
public static Connection obtenerConexion() throws SQLException {
|
||||||
|
String url = GestorFicheroConfiguracion.obtenerValor("jdbc.url");
|
||||||
|
String usuario = GestorFicheroConfiguracion.obtenerValor("jdbc.usuario");
|
||||||
|
String password = GestorFicheroConfiguracion.obtenerValor("jdbc.password");
|
||||||
|
|
||||||
|
if (url == null || usuario == null) {
|
||||||
|
throw new IllegalStateException("Propiedades JDBC no configuradas correctamente en application.properties");
|
||||||
|
}
|
||||||
|
return DriverManager.getConnection(url, usuario, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* GestorFicheroConfiguracion: clase utilitaria para leer propiedades del archivo application.properties.
|
||||||
|
* Provee un método estático que devuelve el valor asociado a una clave.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.gestor;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class GestorFicheroConfiguracion {
|
||||||
|
private static final String RUTA_FICHERO_CONFIGURACION = "configuracion/aplicacion.properties";
|
||||||
|
private static final Properties PROPIEDADES;
|
||||||
|
|
||||||
|
static {
|
||||||
|
PROPIEDADES = new Properties();
|
||||||
|
try (FileInputStream is = new FileInputStream(RUTA_FICHERO_CONFIGURACION);
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (is != null) {
|
||||||
|
PROPIEDADES.load(is);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IllegalStateException("Error al cargar application.properties", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtiene el valor asociado a la clave especificada.
|
||||||
|
*
|
||||||
|
* @param clave la clave a buscar
|
||||||
|
* @return el valor o {@code null} si no existe
|
||||||
|
*/
|
||||||
|
public static String obtenerValor(String clave) {
|
||||||
|
return PROPIEDADES.getProperty(clave);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package eu.esa.gemis.procesos;
|
||||||
|
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.ITripulanteDAO;
|
||||||
|
import eu.esa.gemis.dao.impl.TripulanteDaoJDBC;
|
||||||
|
import eu.esa.gemis.excepcion.AgenciaEsaException;
|
||||||
|
import eu.esa.gemis.gestor.GestorFicheroConfiguracion;
|
||||||
|
import eu.esa.gemis.vo.Tripulante;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ProcesadorTripulantesCSV: Clase que realiza el tratamiuento de tripulantes
|
||||||
|
* para almacenarlos en ficheros CSV.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 27 nov 2025
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ProcesadorTripulantesCSV {
|
||||||
|
private static final String SEPARADOR_CSV = GestorFicheroConfiguracion.obtenerValor("csv.separador");
|
||||||
|
private static final String CABECERA_CSV = GestorFicheroConfiguracion.obtenerValor("csv.cabecera");
|
||||||
|
private String rutaFicheroCSV = GestorFicheroConfiguracion.obtenerValor("ruta.fichero.csv");
|
||||||
|
|
||||||
|
public void almacenarTripulantesSinMisionEnFicheroCSV() throws AgenciaEsaException {
|
||||||
|
File ficheroCSV = new File(rutaFicheroCSV);
|
||||||
|
|
||||||
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter(ficheroCSV));) {
|
||||||
|
|
||||||
|
// Escribimos la cabecera
|
||||||
|
writer.write(CABECERA_CSV);
|
||||||
|
writer.newLine();
|
||||||
|
|
||||||
|
ITripulanteDAO iTripulanteDAO = new TripulanteDaoJDBC();
|
||||||
|
List<Tripulante> listaTripulantesSinMision = iTripulanteDAO.obtenerTripulantesSinMision();
|
||||||
|
|
||||||
|
// Recorremos la lista de tripulantes y los escribimos en el fichero
|
||||||
|
for (Tripulante tripulante : listaTripulantesSinMision) {
|
||||||
|
writer.write(tripulante.getNumeroTripulante() + SEPARADOR_CSV + tripulante.getNombre() + SEPARADOR_CSV
|
||||||
|
+ tripulante.getApellidos() + SEPARADOR_CSV + tripulante.getIdentificadorEsa() + SEPARADOR_CSV
|
||||||
|
+ tripulante.getEspecialidad() + SEPARADOR_CSV + tripulante.getFechaIngresoEsa());
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("Error E/S: " + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
124
src/main/java/eu/esa/gemis/procesos/ProcesadorXMLMision.java
Normal file
124
src/main/java/eu/esa/gemis/procesos/ProcesadorXMLMision.java
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
package eu.esa.gemis.procesos;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import eu.esa.gemis.dao.IMisionDAO;
|
||||||
|
import eu.esa.gemis.dao.ITripulanteDAO;
|
||||||
|
import eu.esa.gemis.dao.impl.MisionDaoJDBC;
|
||||||
|
import eu.esa.gemis.dao.impl.TripulanteDaoJDBC;
|
||||||
|
import eu.esa.gemis.excepcion.AgenciaEsaException;
|
||||||
|
import eu.esa.gemis.gestor.GestorFicheroConfiguracion;
|
||||||
|
import eu.esa.gemis.vo.CuerpoCeleste;
|
||||||
|
import eu.esa.gemis.vo.Mision;
|
||||||
|
import eu.esa.gemis.vo.Nave;
|
||||||
|
import eu.esa.gemis.vo.Tripulante;
|
||||||
|
import tools.jackson.databind.JsonNode;
|
||||||
|
import tools.jackson.databind.ObjectMapper;
|
||||||
|
import tools.jackson.dataformat.xml.XmlMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ProcesadorXMLMision: Clase que realiza el procesamiento de ficheros XML de
|
||||||
|
* misiones.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 nov 2025
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ProcesadorXMLMision {
|
||||||
|
private String rutaFicheroXML = GestorFicheroConfiguracion.obtenerValor("ruta.fichero.xml");
|
||||||
|
|
||||||
|
public void procesarFicheroXMLMisiones() throws AgenciaEsaException {
|
||||||
|
File ficheroXML = new File(rutaFicheroXML);
|
||||||
|
ObjectMapper mapeadorXML = new XmlMapper();
|
||||||
|
JsonNode nodoOperaciones = mapeadorXML.readTree(ficheroXML);
|
||||||
|
JsonNode listaMisiones = nodoOperaciones.get("misiones").get("mision");
|
||||||
|
|
||||||
|
// Tratamiento de nodos Misión
|
||||||
|
for (JsonNode nodoMision : listaMisiones) {
|
||||||
|
// System.out.println("----- Misión -----");
|
||||||
|
realizarTratamientoNodoMision(nodoMision);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tratamiento de nodos Tripulante
|
||||||
|
for (JsonNode nodoMision : listaMisiones) {
|
||||||
|
|
||||||
|
JsonNode nodoTripulacion = nodoMision.get("tripulacion");
|
||||||
|
JsonNode listaTripulantes = nodoTripulacion.get("tripulante");
|
||||||
|
// Recorrer los distintos nodos Tripulante
|
||||||
|
for (JsonNode nodoTripulante : listaTripulantes) {
|
||||||
|
// System.out.println("----- tripulante -----");
|
||||||
|
realizarTratamientoNodoTripulante(nodoTripulante);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void realizarTratamientoNodoMision(JsonNode nodoMision) throws AgenciaEsaException {
|
||||||
|
Mision mision = new Mision();
|
||||||
|
mision.setNombre(nodoMision.get("nombre").asString());
|
||||||
|
String fechaInicio = nodoMision.get("fecha_inicio").asString();
|
||||||
|
mision.setFechaInicio(LocalDate.parse(fechaInicio));
|
||||||
|
String fechaFinEstimado = nodoMision.get("fecha_fin_estimada").asString();
|
||||||
|
mision.setFechaFinEstimado(LocalDate.parse(fechaFinEstimado));
|
||||||
|
String objetivo = nodoMision.get("objetivo").asString();
|
||||||
|
mision.setObjetivoPrincipal(objetivo);
|
||||||
|
String presupuesto = nodoMision.get("presupuesto").asString();
|
||||||
|
mision.setPresupuestoAsignado(Integer.parseInt(presupuesto));
|
||||||
|
mision.setEstado(nodoMision.get("estado").asString());
|
||||||
|
|
||||||
|
CuerpoCeleste cuerpoCeleste = new CuerpoCeleste();
|
||||||
|
cuerpoCeleste.setNombre(nodoMision.get("cuerpo_celeste").asString());
|
||||||
|
mision.setCuerpoCeleste(cuerpoCeleste);
|
||||||
|
|
||||||
|
Nave nave = new Nave();
|
||||||
|
nave.setCodigo(nodoMision.get("cod_nave").asString());
|
||||||
|
mision.setNave(nave);
|
||||||
|
|
||||||
|
IMisionDAO iMisionDAO = new MisionDaoJDBC();
|
||||||
|
iMisionDAO.actualizarMisionPorNaveCuerpoFecha(mision);
|
||||||
|
// System.out.println(mision);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void realizarTratamientoNodoTripulante(JsonNode nodoTripulante) throws AgenciaEsaException {
|
||||||
|
|
||||||
|
int identificadorESA = nodoTripulante.get("ident_esa").asInt();
|
||||||
|
JsonNode nodoNuevoTripulante = nodoTripulante.get("nuevo_tripulante");
|
||||||
|
// Si el nodo nuevo_tripulante es nulo, no se trata el tripulante
|
||||||
|
if (nodoNuevoTripulante != null) {
|
||||||
|
Tripulante tripulante = new Tripulante();
|
||||||
|
tripulante.setNombre(nodoNuevoTripulante.get("nombre").asString());
|
||||||
|
tripulante.setApellidos(nodoNuevoTripulante.get("apellidos").asString());
|
||||||
|
tripulante.setIdentificadorEsa(identificadorESA);
|
||||||
|
tripulante.setNivelExperiencia(nodoNuevoTripulante.get("nivel_experiencia").asInt());
|
||||||
|
tripulante.setEspecialidad(nodoNuevoTripulante.get("especialidad").asString());
|
||||||
|
|
||||||
|
|
||||||
|
ITripulanteDAO iTripulanteDAO = new TripulanteDaoJDBC();
|
||||||
|
Tripulante tripulanteBBDD = iTripulanteDAO.obtenerTripulantePorIdESA(identificadorESA);
|
||||||
|
// System.out.println(tripulanteBBDD);
|
||||||
|
|
||||||
|
// Si el tripulante ya existe en la BBDD, se actualiza, si no, se inserta
|
||||||
|
if (tripulanteBBDD != null) {
|
||||||
|
tripulante.setIdentificadorEsa(tripulanteBBDD.getIdentificadorEsa());
|
||||||
|
tripulante.setNombre(tripulanteBBDD.getNombre());
|
||||||
|
tripulante.setApellidos(tripulanteBBDD.getApellidos());
|
||||||
|
tripulante.setFechaIngresoEsa(tripulanteBBDD.getFechaIngresoEsa());
|
||||||
|
tripulante.setNivelExperiencia(tripulanteBBDD.getNivelExperiencia());
|
||||||
|
tripulante.setEspecialidad(tripulanteBBDD.getEspecialidad());
|
||||||
|
|
||||||
|
iTripulanteDAO.actualizarTripulantePorIdESA(tripulante);
|
||||||
|
} else {
|
||||||
|
// Asignar la fecha de ingreso a la ESA como la fecha actual
|
||||||
|
LocalDate fechaIngresoEsa = LocalDate.now();
|
||||||
|
tripulante.setFechaIngresoEsa(fechaIngresoEsa);
|
||||||
|
|
||||||
|
iTripulanteDAO.insertarTripulante(tripulante);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package eu.esa.gemis.util;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ConversorTiposDatos: Clase que realiza conversiones entre tipos de datos y formatos.
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 14 nov 2025
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ConversorTiposDatosYFormatos {
|
||||||
|
public static String convertirAFechaConFormato(LocalDate fecha, String formato) {
|
||||||
|
String fechaFormateada = null;
|
||||||
|
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(formato);
|
||||||
|
fechaFormateada = fecha.format(formatter);
|
||||||
|
|
||||||
|
|
||||||
|
return fechaFormateada;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
74
src/main/java/eu/esa/gemis/vo/Base.java
Normal file
74
src/main/java/eu/esa/gemis/vo/Base.java
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/**
|
||||||
|
* Base: VO que representa una base espacial.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class Base {
|
||||||
|
private int identificador;
|
||||||
|
private String nombre;
|
||||||
|
private String funcionPrincipal;
|
||||||
|
private LocalDate fechaEstablecimiento;
|
||||||
|
private String estado;
|
||||||
|
private CuerpoCeleste cuerpoCeleste;
|
||||||
|
|
||||||
|
public int getIdentificador() {
|
||||||
|
return identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificador(int identificador) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFuncionPrincipal() {
|
||||||
|
return funcionPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFuncionPrincipal(String funcionPrincipal) {
|
||||||
|
this.funcionPrincipal = funcionPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaEstablecimiento() {
|
||||||
|
return fechaEstablecimiento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaEstablecimiento(LocalDate fechaEstablecimiento) {
|
||||||
|
this.fechaEstablecimiento = fechaEstablecimiento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEstado() {
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(String estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuerpoCeleste getCuerpoCeleste() {
|
||||||
|
return cuerpoCeleste;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCuerpoCeleste(CuerpoCeleste cuerpoCeleste) {
|
||||||
|
this.cuerpoCeleste = cuerpoCeleste;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Base [identificador=" + identificador + ", nombre=" + nombre + ", funcionPrincipal=" + funcionPrincipal
|
||||||
|
+ ", fechaEstablecimiento=" + fechaEstablecimiento + ", estado=" + estado + ", cuerpoCeleste="
|
||||||
|
+ cuerpoCeleste + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
53
src/main/java/eu/esa/gemis/vo/CuerpoCeleste.java
Normal file
53
src/main/java/eu/esa/gemis/vo/CuerpoCeleste.java
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* CuerpoCeleste: VO que representa un cuerpo celeste (planeta, satélite, etc.).
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
public class CuerpoCeleste {
|
||||||
|
private int identificador;
|
||||||
|
private String nombre;
|
||||||
|
private String tipo;
|
||||||
|
private double gravedadSuperficieMs2;
|
||||||
|
|
||||||
|
public int getIdentificador() {
|
||||||
|
return identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificador(int identificador) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipo() {
|
||||||
|
return tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipo(String tipo) {
|
||||||
|
this.tipo = tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getGravedadSuperficieMs2() {
|
||||||
|
return gravedadSuperficieMs2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGravedadSuperficieMs2(double gravedadSuperficieMs2) {
|
||||||
|
this.gravedadSuperficieMs2 = gravedadSuperficieMs2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "CuerpoCeleste [identificador=" + identificador + ", nombre=" + nombre + ", tipo=" + tipo
|
||||||
|
+ ", gravedadSuperficieMs2=" + gravedadSuperficieMs2 + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
62
src/main/java/eu/esa/gemis/vo/GeneradorPrincipal.java
Normal file
62
src/main/java/eu/esa/gemis/vo/GeneradorPrincipal.java
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* GeneradorPrincipal: VO que representa un generador de energía principal.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
public class GeneradorPrincipal {
|
||||||
|
private int identificador;
|
||||||
|
private String nombre;
|
||||||
|
private String tipo;
|
||||||
|
private double potenciaMw;
|
||||||
|
private Base base;
|
||||||
|
|
||||||
|
public int getIdentificador() {
|
||||||
|
return identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificador(int identificador) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipo() {
|
||||||
|
return tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipo(String tipo) {
|
||||||
|
this.tipo = tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPotenciaMw() {
|
||||||
|
return potenciaMw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPotenciaMw(double potenciaMw) {
|
||||||
|
this.potenciaMw = potenciaMw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base getBase() {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBase(Base base) {
|
||||||
|
this.base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GeneradorPrincipal [identificador=" + identificador + ", nombre=" + nombre + ", tipo=" + tipo
|
||||||
|
+ ", potenciaMw=" + potenciaMw + ", base=" + base + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
111
src/main/java/eu/esa/gemis/vo/Mision.java
Normal file
111
src/main/java/eu/esa/gemis/vo/Mision.java
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
/**
|
||||||
|
* Mision: VO que representa una misión espacial.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class Mision {
|
||||||
|
private int identificador;
|
||||||
|
private String nombre;
|
||||||
|
private Nave nave;
|
||||||
|
private CuerpoCeleste cuerpoCeleste;
|
||||||
|
private LocalDate fechaInicio;
|
||||||
|
private LocalDate fechaFinEstimado;
|
||||||
|
private LocalDate fechaFin;
|
||||||
|
private String estado;
|
||||||
|
private String objetivoPrincipal;
|
||||||
|
private int presupuestoAsignado;
|
||||||
|
|
||||||
|
public Nave getNave() {
|
||||||
|
return nave;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNave(Nave nave) {
|
||||||
|
this.nave = nave;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIdentificador() {
|
||||||
|
return identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificador(int identificador) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuerpoCeleste getCuerpoCeleste() {
|
||||||
|
return cuerpoCeleste;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCuerpoCeleste(CuerpoCeleste cuerpoCeleste) {
|
||||||
|
this.cuerpoCeleste = cuerpoCeleste;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaInicio() {
|
||||||
|
return fechaInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaInicio(LocalDate fechaInicio) {
|
||||||
|
this.fechaInicio = fechaInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaFinEstimado() {
|
||||||
|
return fechaFinEstimado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaFinEstimado(LocalDate fechaFinEstimado) {
|
||||||
|
this.fechaFinEstimado = fechaFinEstimado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaFin() {
|
||||||
|
return fechaFin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaFin(LocalDate fechaFin) {
|
||||||
|
this.fechaFin = fechaFin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEstado() {
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(String estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObjetivoPrincipal() {
|
||||||
|
return objetivoPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjetivoPrincipal(String objetivoPrincipal) {
|
||||||
|
this.objetivoPrincipal = objetivoPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPresupuestoAsignado() {
|
||||||
|
return presupuestoAsignado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPresupuestoAsignado(int presupuestoAsignado) {
|
||||||
|
this.presupuestoAsignado = presupuestoAsignado;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Mision [identificador=" + identificador + ", nombre=" + nombre + ", nave=" + nave + ", cuerpoCeleste="
|
||||||
|
+ cuerpoCeleste + ", fechaInicio=" + fechaInicio + ", fechaFinEstimado=" + fechaFinEstimado
|
||||||
|
+ ", fechaFin=" + fechaFin + ", estado=" + estado + ", objetivoPrincipal=" + objetivoPrincipal
|
||||||
|
+ ", presupuestoAsignado=" + presupuestoAsignado + "]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
62
src/main/java/eu/esa/gemis/vo/Nave.java
Normal file
62
src/main/java/eu/esa/gemis/vo/Nave.java
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* Nave: VO que representa una nave espacial.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
public class Nave {
|
||||||
|
private String codigo;
|
||||||
|
private String nombre;
|
||||||
|
private String tipo;
|
||||||
|
private int capacidadTripulacion;
|
||||||
|
private short autonomiaDias;
|
||||||
|
|
||||||
|
public String getCodigo() {
|
||||||
|
return codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodigo(String codigo) {
|
||||||
|
this.codigo = codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipo() {
|
||||||
|
return tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipo(String tipo) {
|
||||||
|
this.tipo = tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCapacidadTripulacion() {
|
||||||
|
return capacidadTripulacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCapacidadTripulacion(int capacidadTripulacion) {
|
||||||
|
this.capacidadTripulacion = capacidadTripulacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getAutonomiaDias() {
|
||||||
|
return autonomiaDias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutonomiaDias(short autonomiaDias) {
|
||||||
|
this.autonomiaDias = autonomiaDias;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Nave [codigo=" + codigo + ", nombre=" + nombre + ", tipo=" + tipo + ", capacidadTripulacion="
|
||||||
|
+ capacidadTripulacion + ", autonomiaDias=" + autonomiaDias + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
83
src/main/java/eu/esa/gemis/vo/Tripulante.java
Normal file
83
src/main/java/eu/esa/gemis/vo/Tripulante.java
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/**
|
||||||
|
* Tripulante: VO que representa a un miembro del personal de la ESA.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class Tripulante {
|
||||||
|
private int numeroTripulante;
|
||||||
|
private String nombre;
|
||||||
|
private String apellidos;
|
||||||
|
private int identificadorEsa;
|
||||||
|
private int nivelExperiencia;
|
||||||
|
private String especialidad;
|
||||||
|
private LocalDate fechaIngresoEsa;
|
||||||
|
|
||||||
|
public int getNumeroTripulante() {
|
||||||
|
return numeroTripulante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumeroTripulante(int numeroTripulante) {
|
||||||
|
this.numeroTripulante = numeroTripulante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApellidos() {
|
||||||
|
return apellidos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApellidos(String apellidos) {
|
||||||
|
this.apellidos = apellidos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIdentificadorEsa() {
|
||||||
|
return identificadorEsa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificadorEsa(int identificadorEsa) {
|
||||||
|
this.identificadorEsa = identificadorEsa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNivelExperiencia() {
|
||||||
|
return nivelExperiencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNivelExperiencia(int nivelExperiencia) {
|
||||||
|
this.nivelExperiencia = nivelExperiencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEspecialidad() {
|
||||||
|
return especialidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEspecialidad(String especialidad) {
|
||||||
|
this.especialidad = especialidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaIngresoEsa() {
|
||||||
|
return fechaIngresoEsa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaIngresoEsa(LocalDate fechaIngresoEsa) {
|
||||||
|
this.fechaIngresoEsa = fechaIngresoEsa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Tripulante [numeroTripulante=" + numeroTripulante + ", nombre=" + nombre + ", apellidos=" + apellidos
|
||||||
|
+ ", identificadorEsa=" + identificadorEsa + ", nivelExperiencia=" + nivelExperiencia
|
||||||
|
+ ", especialidad=" + especialidad + ", fechaIngresoEsa=" + fechaIngresoEsa + "]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
46
src/main/java/eu/esa/gemis/vo/TripulanteMision.java
Normal file
46
src/main/java/eu/esa/gemis/vo/TripulanteMision.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* TripulanteMision: VO que representa la asignación de un tripulante a una misión.
|
||||||
|
*
|
||||||
|
* Se modelan las claves foráneas como referencias a los objetos
|
||||||
|
* {@link Mision} y {@link Tripulante} en lugar de simples identificadores.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
public class TripulanteMision {
|
||||||
|
private Mision mision;
|
||||||
|
private Tripulante tripulante;
|
||||||
|
private String rol;
|
||||||
|
|
||||||
|
public Mision getMision() {
|
||||||
|
return mision;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMision(Mision mision) {
|
||||||
|
this.mision = mision;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tripulante getTripulante() {
|
||||||
|
return tripulante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTripulante(Tripulante tripulante) {
|
||||||
|
this.tripulante = tripulante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRol() {
|
||||||
|
return rol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRol(String rol) {
|
||||||
|
this.rol = rol;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TripulanteMision [mision=" + mision + ", tripulante=" + tripulante + ", rol=" + rol + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
src/main/main/java/eu/esa/gemis/dao/IBaseDAO.java
Normal file
23
src/main/main/java/eu/esa/gemis/dao/IBaseDAO.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* IBaseDAO: Interfaz DAO para la entidad Base.
|
||||||
|
* Define operaciones CRUD básicas.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
import eu.esa.gemis.vo.Base;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IBaseDAO {
|
||||||
|
void crear(Base base) throws Exception;
|
||||||
|
|
||||||
|
Base obtenerPorId(int identificador) throws Exception;
|
||||||
|
|
||||||
|
List<Base> obtenerTodas() throws Exception;
|
||||||
|
|
||||||
|
void actualizar(Base base) throws Exception;
|
||||||
|
|
||||||
|
void eliminar(int identificador) throws Exception;
|
||||||
|
}
|
||||||
23
src/main/main/java/eu/esa/gemis/dao/ICuerpoCelesteDAO.java
Normal file
23
src/main/main/java/eu/esa/gemis/dao/ICuerpoCelesteDAO.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* ICuerpoCelesteDAO: Interfaz DAO para la entidad CuerpoCeleste.
|
||||||
|
* Define operaciones CRUD básicas.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
import eu.esa.gemis.vo.CuerpoCeleste;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ICuerpoCelesteDAO {
|
||||||
|
void crear(CuerpoCeleste cuerpoCeleste) throws Exception;
|
||||||
|
|
||||||
|
CuerpoCeleste obtenerPorId(int identificador) throws Exception;
|
||||||
|
|
||||||
|
List<CuerpoCeleste> obtenerTodas() throws Exception;
|
||||||
|
|
||||||
|
void actualizar(CuerpoCeleste cuerpoCeleste) throws Exception;
|
||||||
|
|
||||||
|
void eliminar(int identificador) throws Exception;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* IGeneradorPrincipalDAO: Interfaz DAO para la entidad GeneradorPrincipal.
|
||||||
|
* Define operaciones CRUD básicas.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
import eu.esa.gemis.vo.GeneradorPrincipal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IGeneradorPrincipalDAO {
|
||||||
|
void crear(GeneradorPrincipal generador) throws Exception;
|
||||||
|
|
||||||
|
GeneradorPrincipal obtenerPorId(int identificador) throws Exception;
|
||||||
|
|
||||||
|
List<GeneradorPrincipal> obtenerTodas() throws Exception;
|
||||||
|
|
||||||
|
void actualizar(GeneradorPrincipal generador) throws Exception;
|
||||||
|
|
||||||
|
void eliminar(int identificador) throws Exception;
|
||||||
|
}
|
||||||
23
src/main/main/java/eu/esa/gemis/dao/INaveDAO.java
Normal file
23
src/main/main/java/eu/esa/gemis/dao/INaveDAO.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* INaveDAO: Interfaz DAO para la entidad Nave.
|
||||||
|
* Define operaciones CRUD básicas.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
import eu.esa.gemis.vo.Nave;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface INaveDAO {
|
||||||
|
void crear(Nave nave) throws Exception;
|
||||||
|
|
||||||
|
Nave obtenerPorCodigo(String codigo) throws Exception;
|
||||||
|
|
||||||
|
List<Nave> obtenerTodas() throws Exception;
|
||||||
|
|
||||||
|
void actualizar(Nave nave) throws Exception;
|
||||||
|
|
||||||
|
void eliminar(String codigo) throws Exception;
|
||||||
|
}
|
||||||
23
src/main/main/java/eu/esa/gemis/dao/ITripulanteDAO.java
Normal file
23
src/main/main/java/eu/esa/gemis/dao/ITripulanteDAO.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* ITripulanteDAO: Interfaz DAO para la entidad Tripulante.
|
||||||
|
* Define operaciones CRUD básicas.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.dao;
|
||||||
|
|
||||||
|
import eu.esa.gemis.vo.Tripulante;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ITripulanteDAO {
|
||||||
|
void crear(Tripulante tripulante) throws Exception;
|
||||||
|
|
||||||
|
Tripulante obtenerPorId(int numeroTripulante) throws Exception;
|
||||||
|
|
||||||
|
List<Tripulante> obtenerTodas() throws Exception;
|
||||||
|
|
||||||
|
void actualizar(Tripulante tripulante) throws Exception;
|
||||||
|
|
||||||
|
void eliminar(int numeroTripulante) throws Exception;
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* AgenciaEsaException: excepción personalizada para la aplicación AgenciaESA.
|
||||||
|
* Incluye información del origen (clase que lanzó la excepción) y una constante
|
||||||
|
* que indica la operación que se estaba realizando.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.exception;
|
||||||
|
|
||||||
|
public class AgenciaEsaException extends Exception {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** Operación genérica para identificar el contexto donde ocurre la excepción */
|
||||||
|
public static final String OPERACION_DAO = "DAO_OPERATION";
|
||||||
|
|
||||||
|
private final String claseOrigen;
|
||||||
|
|
||||||
|
public AgenciaEsaException(Throwable cause, String claseOrigen) {
|
||||||
|
super(cause);
|
||||||
|
this.claseOrigen = claseOrigen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClaseOrigen() {
|
||||||
|
return claseOrigen;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "Error en " + claseOrigen + ": " + super.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
31
src/main/main/java/eu/esa/gemis/util/GestorConexionJDBC.java
Normal file
31
src/main/main/java/eu/esa/gemis/util/GestorConexionJDBC.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* GestorConexionJDBC: clase utilitaria para obtener conexiones JDBC a la base de datos MySQL.
|
||||||
|
* Utiliza la configuración leída por {@link GestorFicheroConfiguracion}.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.util;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class GestorConexionJDBC {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtiene una nueva conexión JDBC a la base de datos configurada.
|
||||||
|
*
|
||||||
|
* @return {@link Connection} activa
|
||||||
|
* @throws SQLException si ocurre un error al conectar
|
||||||
|
*/
|
||||||
|
public static Connection obtenerConexion() throws SQLException {
|
||||||
|
String url = GestorFicheroConfiguracion.obtenerValor("jdbc.url");
|
||||||
|
String usuario = GestorFicheroConfiguracion.obtenerValor("jdbc.usuario");
|
||||||
|
String password = GestorFicheroConfiguracion.obtenerValor("jdbc.password");
|
||||||
|
if (url == null || usuario == null) {
|
||||||
|
throw new IllegalStateException("Propiedades JDBC no configuradas correctamente en application.properties");
|
||||||
|
}
|
||||||
|
return DriverManager.getConnection(url, usuario, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* GestorFicheroConfiguracion: clase utilitaria para leer propiedades del archivo application.properties.
|
||||||
|
* Provee un método estático que devuelve el valor asociado a una clave.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.util;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class GestorFicheroConfiguracion {
|
||||||
|
private static final Properties PROPIEDADES = new Properties();
|
||||||
|
|
||||||
|
static {
|
||||||
|
try (InputStream is = GestorFicheroConfiguracion.class.getClassLoader()
|
||||||
|
.getResourceAsStream("application.properties")) {
|
||||||
|
if (is != null) {
|
||||||
|
PROPIEDADES.load(is);
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("No se encontró application.properties en el classpath");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IllegalStateException("Error al cargar application.properties", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtiene el valor asociado a la clave especificada.
|
||||||
|
*
|
||||||
|
* @param clave la clave a buscar
|
||||||
|
* @return el valor o {@code null} si no existe
|
||||||
|
*/
|
||||||
|
public static String obtenerValor(String clave) {
|
||||||
|
return PROPIEDADES.getProperty(clave);
|
||||||
|
}
|
||||||
|
}
|
||||||
91
src/main/main/java/eu/esa/gemis/vo/Base.java
Normal file
91
src/main/main/java/eu/esa/gemis/vo/Base.java
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/**
|
||||||
|
* Base: VO que representa una base espacial.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class Base {
|
||||||
|
private int identificador; // AUTO_INCREMENT
|
||||||
|
private String nombre;
|
||||||
|
private String funcionPrincipal; // Investigación, Logística, Control
|
||||||
|
private LocalDate fechaEstablecimiento;
|
||||||
|
private String estado; // Operativa, Mantenimiento, Expandible
|
||||||
|
private CuerpoCeleste cuerpoCeleste; // FK a CuerpoCeleste
|
||||||
|
|
||||||
|
public Base() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base(int identificador, String nombre, String funcionPrincipal,
|
||||||
|
LocalDate fechaEstablecimiento, String estado, CuerpoCeleste cuerpoCeleste) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
this.nombre = nombre;
|
||||||
|
this.funcionPrincipal = funcionPrincipal;
|
||||||
|
this.fechaEstablecimiento = fechaEstablecimiento;
|
||||||
|
this.estado = estado;
|
||||||
|
this.cuerpoCeleste = cuerpoCeleste;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIdentificador() {
|
||||||
|
return identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificador(int identificador) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFuncionPrincipal() {
|
||||||
|
return funcionPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFuncionPrincipal(String funcionPrincipal) {
|
||||||
|
this.funcionPrincipal = funcionPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaEstablecimiento() {
|
||||||
|
return fechaEstablecimiento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaEstablecimiento(LocalDate fechaEstablecimiento) {
|
||||||
|
this.fechaEstablecimiento = fechaEstablecimiento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEstado() {
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(String estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuerpoCeleste getCuerpoCeleste() {
|
||||||
|
return cuerpoCeleste;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCuerpoCeleste(CuerpoCeleste cuerpoCeleste) {
|
||||||
|
this.cuerpoCeleste = cuerpoCeleste;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Base{" +
|
||||||
|
"identificador=" + identificador +
|
||||||
|
", nombre='" + nombre + '\'' +
|
||||||
|
", funcionPrincipal='" + funcionPrincipal + '\'' +
|
||||||
|
", fechaEstablecimiento=" + fechaEstablecimiento +
|
||||||
|
", estado='" + estado + '\'' +
|
||||||
|
", cuerpoCeleste=" + cuerpoCeleste +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/main/main/java/eu/esa/gemis/vo/CuerpoCeleste.java
Normal file
66
src/main/main/java/eu/esa/gemis/vo/CuerpoCeleste.java
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* CuerpoCeleste: VO que representa un cuerpo celeste (planeta, satélite, etc.).
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
public class CuerpoCeleste {
|
||||||
|
private int identificador; // AUTO_INCREMENT
|
||||||
|
private String nombre;
|
||||||
|
private String tipo; // Planeta, Satélite, Asteroide, Planetoide
|
||||||
|
private double gravedadSuperficieMs2;
|
||||||
|
|
||||||
|
public CuerpoCeleste() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuerpoCeleste(int identificador, String nombre, String tipo, double gravedadSuperficieMs2) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
this.nombre = nombre;
|
||||||
|
this.tipo = tipo;
|
||||||
|
this.gravedadSuperficieMs2 = gravedadSuperficieMs2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIdentificador() {
|
||||||
|
return identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificador(int identificador) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipo() {
|
||||||
|
return tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipo(String tipo) {
|
||||||
|
this.tipo = tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getGravedadSuperficieMs2() {
|
||||||
|
return gravedadSuperficieMs2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGravedadSuperficieMs2(double gravedadSuperficieMs2) {
|
||||||
|
this.gravedadSuperficieMs2 = gravedadSuperficieMs2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "CuerpoCeleste{" +
|
||||||
|
"identificador=" + identificador +
|
||||||
|
", nombre='" + nombre + '\'' +
|
||||||
|
", tipo='" + tipo + '\'' +
|
||||||
|
", gravedadSuperficieMs2=" + gravedadSuperficieMs2 +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
77
src/main/main/java/eu/esa/gemis/vo/GeneradorPrincipal.java
Normal file
77
src/main/main/java/eu/esa/gemis/vo/GeneradorPrincipal.java
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* GeneradorPrincipal: VO que representa un generador de energía principal.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
public class GeneradorPrincipal {
|
||||||
|
private int identificador; // AUTO_INCREMENT
|
||||||
|
private String nombre;
|
||||||
|
private String tipo; // Nuclear, Solar, Geotérmica
|
||||||
|
private double potenciaMw;
|
||||||
|
private Base base; // FK opcional a Base (puede ser null)
|
||||||
|
|
||||||
|
public GeneradorPrincipal() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeneradorPrincipal(int identificador, String nombre, String tipo, double potenciaMw, Base base) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
this.nombre = nombre;
|
||||||
|
this.tipo = tipo;
|
||||||
|
this.potenciaMw = potenciaMw;
|
||||||
|
this.base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIdentificador() {
|
||||||
|
return identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificador(int identificador) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipo() {
|
||||||
|
return tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipo(String tipo) {
|
||||||
|
this.tipo = tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPotenciaMw() {
|
||||||
|
return potenciaMw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPotenciaMw(double potenciaMw) {
|
||||||
|
this.potenciaMw = potenciaMw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base getBase() {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBase(Base base) {
|
||||||
|
this.base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GeneradorPrincipal{" +
|
||||||
|
"identificador=" + identificador +
|
||||||
|
", nombre='" + nombre + '\'' +
|
||||||
|
", tipo='" + tipo + '\'' +
|
||||||
|
", potenciaMw=" + potenciaMw +
|
||||||
|
", base=" + base +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
125
src/main/main/java/eu/esa/gemis/vo/Mision.java
Normal file
125
src/main/main/java/eu/esa/gemis/vo/Mision.java
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/**
|
||||||
|
* Mision: VO que representa una misión espacial.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class Mision {
|
||||||
|
private int identificador; // AUTO_INCREMENT
|
||||||
|
private String codNave; // FK a Nave (codigo)
|
||||||
|
private CuerpoCeleste cuerpoCeleste; // FK a CuerpoCeleste (identificador)
|
||||||
|
private LocalDate fechaInicio;
|
||||||
|
private LocalDate fechaFinEstimado;
|
||||||
|
private LocalDate fechaFin; // nullable
|
||||||
|
private String estado; // Planificada, En curso, Completada, Cancelada
|
||||||
|
private String objetivoPrincipal;
|
||||||
|
private double presupuestoAsignado;
|
||||||
|
|
||||||
|
public Mision() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mision(int identificador, String codNave, CuerpoCeleste cuerpoCeleste,
|
||||||
|
LocalDate fechaInicio, LocalDate fechaFinEstimado, LocalDate fechaFin,
|
||||||
|
String estado, String objetivoPrincipal, double presupuestoAsignado) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
this.codNave = codNave;
|
||||||
|
this.cuerpoCeleste = cuerpoCeleste;
|
||||||
|
this.fechaInicio = fechaInicio;
|
||||||
|
this.fechaFinEstimado = fechaFinEstimado;
|
||||||
|
this.fechaFin = fechaFin;
|
||||||
|
this.estado = estado;
|
||||||
|
this.objetivoPrincipal = objetivoPrincipal;
|
||||||
|
this.presupuestoAsignado = presupuestoAsignado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIdentificador() {
|
||||||
|
return identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificador(int identificador) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodNave() {
|
||||||
|
return codNave;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodNave(String codNave) {
|
||||||
|
this.codNave = codNave;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuerpoCeleste getCuerpoCeleste() {
|
||||||
|
return cuerpoCeleste;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCuerpoCeleste(CuerpoCeleste cuerpoCeleste) {
|
||||||
|
this.cuerpoCeleste = cuerpoCeleste;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaInicio() {
|
||||||
|
return fechaInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaInicio(LocalDate fechaInicio) {
|
||||||
|
this.fechaInicio = fechaInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaFinEstimado() {
|
||||||
|
return fechaFinEstimado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaFinEstimado(LocalDate fechaFinEstimado) {
|
||||||
|
this.fechaFinEstimado = fechaFinEstimado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaFin() {
|
||||||
|
return fechaFin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaFin(LocalDate fechaFin) {
|
||||||
|
this.fechaFin = fechaFin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEstado() {
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(String estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObjetivoPrincipal() {
|
||||||
|
return objetivoPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjetivoPrincipal(String objetivoPrincipal) {
|
||||||
|
this.objetivoPrincipal = objetivoPrincipal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPresupuestoAsignado() {
|
||||||
|
return presupuestoAsignado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPresupuestoAsignado(double presupuestoAsignado) {
|
||||||
|
this.presupuestoAsignado = presupuestoAsignado;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Mision{" +
|
||||||
|
"identificador=" + identificador +
|
||||||
|
", codNave='" + codNave + '\'' +
|
||||||
|
", cuerpoCeleste=" + cuerpoCeleste +
|
||||||
|
", fechaInicio=" + fechaInicio +
|
||||||
|
", fechaFinEstimado=" + fechaFinEstimado +
|
||||||
|
", fechaFin=" + fechaFin +
|
||||||
|
", estado='" + estado + '\'' +
|
||||||
|
", objetivoPrincipal='" + objetivoPrincipal + '\'' +
|
||||||
|
", presupuestoAsignado=" + presupuestoAsignado +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
91
src/main/main/java/eu/esa/gemis/vo/Modulo.java
Normal file
91
src/main/main/java/eu/esa/gemis/vo/Modulo.java
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/**
|
||||||
|
* Modulo: VO que representa un módulo instalado en una base espacial.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class Modulo {
|
||||||
|
private int identificador; // AUTO_INCREMENT
|
||||||
|
private String nombre;
|
||||||
|
private String tipo; // Laboratorio, Alojamiento, Comunicaciones, Perforación, Sísmico
|
||||||
|
private LocalDate fechaInstalacion;
|
||||||
|
private double consumoEnergia;
|
||||||
|
private Base base; // FK a Base (identificador)
|
||||||
|
|
||||||
|
public Modulo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Modulo(int identificador, String nombre, String tipo, LocalDate fechaInstalacion,
|
||||||
|
double consumoEnergia, Base base) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
this.nombre = nombre;
|
||||||
|
this.tipo = tipo;
|
||||||
|
this.fechaInstalacion = fechaInstalacion;
|
||||||
|
this.consumoEnergia = consumoEnergia;
|
||||||
|
this.base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIdentificador() {
|
||||||
|
return identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificador(int identificador) {
|
||||||
|
this.identificador = identificador;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipo() {
|
||||||
|
return tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipo(String tipo) {
|
||||||
|
this.tipo = tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaInstalacion() {
|
||||||
|
return fechaInstalacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaInstalacion(LocalDate fechaInstalacion) {
|
||||||
|
this.fechaInstalacion = fechaInstalacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getConsumoEnergia() {
|
||||||
|
return consumoEnergia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConsumoEnergia(double consumoEnergia) {
|
||||||
|
this.consumoEnergia = consumoEnergia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base getBase() {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBase(Base base) {
|
||||||
|
this.base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Modulo{" +
|
||||||
|
"identificador=" + identificador +
|
||||||
|
", nombre='" + nombre + '\'' +
|
||||||
|
", tipo='" + tipo + '\'' +
|
||||||
|
", fechaInstalacion=" + fechaInstalacion +
|
||||||
|
", consumoEnergia=" + consumoEnergia +
|
||||||
|
", base=" + base +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
77
src/main/main/java/eu/esa/gemis/vo/Nave.java
Normal file
77
src/main/main/java/eu/esa/gemis/vo/Nave.java
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* Nave: VO que representa una nave espacial.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
public class Nave {
|
||||||
|
private String codigo;
|
||||||
|
private String nombre;
|
||||||
|
private String tipo; // Transporte, Reconocimiento, Científica, Mantenimiento
|
||||||
|
private int capacidadTripulacion;
|
||||||
|
private short autonomiaDias;
|
||||||
|
|
||||||
|
public Nave() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Nave(String codigo, String nombre, String tipo, int capacidadTripulacion, short autonomiaDias) {
|
||||||
|
this.codigo = codigo;
|
||||||
|
this.nombre = nombre;
|
||||||
|
this.tipo = tipo;
|
||||||
|
this.capacidadTripulacion = capacidadTripulacion;
|
||||||
|
this.autonomiaDias = autonomiaDias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodigo() {
|
||||||
|
return codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodigo(String codigo) {
|
||||||
|
this.codigo = codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipo() {
|
||||||
|
return tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipo(String tipo) {
|
||||||
|
this.tipo = tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCapacidadTripulacion() {
|
||||||
|
return capacidadTripulacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCapacidadTripulacion(int capacidadTripulacion) {
|
||||||
|
this.capacidadTripulacion = capacidadTripulacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getAutonomiaDias() {
|
||||||
|
return autonomiaDias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutonomiaDias(short autonomiaDias) {
|
||||||
|
this.autonomiaDias = autonomiaDias;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Nave{" +
|
||||||
|
"codigo='" + codigo + '\'' +
|
||||||
|
", nombre='" + nombre + '\'' +
|
||||||
|
", tipo='" + tipo + '\'' +
|
||||||
|
", capacidadTripulacion=" + capacidadTripulacion +
|
||||||
|
", autonomiaDias=" + autonomiaDias +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
102
src/main/main/java/eu/esa/gemis/vo/Tripulante.java
Normal file
102
src/main/main/java/eu/esa/gemis/vo/Tripulante.java
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/**
|
||||||
|
* Tripulante: VO que representa a un miembro del personal de la ESA.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class Tripulante {
|
||||||
|
private int numeroTripulante; // AUTO_INCREMENT
|
||||||
|
private String nombre;
|
||||||
|
private String apellidos;
|
||||||
|
private int identificadorEsa; // único
|
||||||
|
private int nivelExperiencia; // 1-5
|
||||||
|
private String especialidad; // Pilotaje, Ingeniería, Medicina, Geología, Comunicaciones
|
||||||
|
private LocalDate fechaIngresoEsa;
|
||||||
|
|
||||||
|
public Tripulante() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tripulante(int numeroTripulante, String nombre, String apellidos, int identificadorEsa,
|
||||||
|
int nivelExperiencia, String especialidad, LocalDate fechaIngresoEsa) {
|
||||||
|
this.numeroTripulante = numeroTripulante;
|
||||||
|
this.nombre = nombre;
|
||||||
|
this.apellidos = apellidos;
|
||||||
|
this.identificadorEsa = identificadorEsa;
|
||||||
|
this.nivelExperiencia = nivelExperiencia;
|
||||||
|
this.especialidad = especialidad;
|
||||||
|
this.fechaIngresoEsa = fechaIngresoEsa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumeroTripulante() {
|
||||||
|
return numeroTripulante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumeroTripulante(int numeroTripulante) {
|
||||||
|
this.numeroTripulante = numeroTripulante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApellidos() {
|
||||||
|
return apellidos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApellidos(String apellidos) {
|
||||||
|
this.apellidos = apellidos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIdentificadorEsa() {
|
||||||
|
return identificadorEsa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentificadorEsa(int identificadorEsa) {
|
||||||
|
this.identificadorEsa = identificadorEsa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNivelExperiencia() {
|
||||||
|
return nivelExperiencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNivelExperiencia(int nivelExperiencia) {
|
||||||
|
this.nivelExperiencia = nivelExperiencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEspecialidad() {
|
||||||
|
return especialidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEspecialidad(String especialidad) {
|
||||||
|
this.especialidad = especialidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFechaIngresoEsa() {
|
||||||
|
return fechaIngresoEsa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechaIngresoEsa(LocalDate fechaIngresoEsa) {
|
||||||
|
this.fechaIngresoEsa = fechaIngresoEsa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Tripulante{" +
|
||||||
|
"numeroTripulante=" + numeroTripulante +
|
||||||
|
", nombre='" + nombre + '\'' +
|
||||||
|
", apellidos='" + apellidos + '\'' +
|
||||||
|
", identificadorEsa=" + identificadorEsa +
|
||||||
|
", nivelExperiencia=" + nivelExperiencia +
|
||||||
|
", especialidad='" + especialidad + '\'' +
|
||||||
|
", fechaIngresoEsa=" + fechaIngresoEsa +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
89
src/main/main/java/eu/esa/gemis/vo/TripulanteMision.java
Normal file
89
src/main/main/java/eu/esa/gemis/vo/TripulanteMision.java
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* TripulanteMision: VO que representa la asignación de un tripulante a una misión.
|
||||||
|
*
|
||||||
|
* Se modelan las claves foráneas como referencias a los objetos
|
||||||
|
* {@link Mision} y {@link Tripulante} en lugar de simples identificadores.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 nov 2025
|
||||||
|
*/
|
||||||
|
package eu.esa.gemis.vo;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class TripulanteMision {
|
||||||
|
private Mision mision; // FK a Mision
|
||||||
|
private Tripulante tripulante; // FK a Tripulante
|
||||||
|
private String rol; // descripción del rol en la misión
|
||||||
|
private int nivelEstres; // 1-5
|
||||||
|
|
||||||
|
public TripulanteMision() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripulanteMision(Mision mision, Tripulante tripulante, String rol, int nivelEstres) {
|
||||||
|
this.mision = mision;
|
||||||
|
this.tripulante = tripulante;
|
||||||
|
this.rol = rol;
|
||||||
|
this.nivelEstres = nivelEstres;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mision getMision() {
|
||||||
|
return mision;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMision(Mision mision) {
|
||||||
|
this.mision = mision;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tripulante getTripulante() {
|
||||||
|
return tripulante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTripulante(Tripulante tripulante) {
|
||||||
|
this.tripulante = tripulante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRol() {
|
||||||
|
return rol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRol(String rol) {
|
||||||
|
this.rol = rol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNivelEstres() {
|
||||||
|
return nivelEstres;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNivelEstres(int nivelEstres) {
|
||||||
|
this.nivelEstres = nivelEstres;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TripulanteMision{" +
|
||||||
|
"mision=" + (mision != null ? mision.getIdentificador() : "null") +
|
||||||
|
", tripulante=" + (tripulante != null ? tripulante.getNumeroTripulante() : "null") +
|
||||||
|
", rol='" + rol + '\'' +
|
||||||
|
", nivelEstres=" + nivelEstres +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
TripulanteMision that = (TripulanteMision) o;
|
||||||
|
return nivelEstres == that.nivelEstres &&
|
||||||
|
Objects.equals(mision, that.mision) &&
|
||||||
|
Objects.equals(tripulante, that.tripulante) &&
|
||||||
|
Objects.equals(rol, that.rol);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(mision, tripulante, rol, nivelEstres);
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/main/main/resources/application.properties
Normal file
5
src/main/main/resources/application.properties
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Configuración de la aplicación AgenciaESA
|
||||||
|
# JDBC MySQL
|
||||||
|
jdbc.url=jdbc:mysql://localhost:3306/agenciaesa?useSSL=false&serverTimezone=UTC
|
||||||
|
jdbc.usuario=usuario
|
||||||
|
jdbc.password=clave
|
||||||
Loading…
Reference in New Issue
Block a user