Commit inicial
This commit is contained in:
commit
3ecb6099dc
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-23">
|
||||||
|
<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/
|
||||||
34
.project
Normal file
34
.project
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>aaee_ra3_proy4</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>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1772465433562</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
||||||
2
.settings/org.eclipse.jdt.apt.core.prefs
Normal file
2
.settings/org.eclipse.jdt.apt.core.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.apt.aptEnabled=false
|
||||||
14
.settings/org.eclipse.jdt.core.prefs
Normal file
14
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=17
|
||||||
|
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.processAnnotations=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=17
|
||||||
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
|
||||||
50
pom.xml
Normal file
50
pom.xml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<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>org.lapaloma.mapamundi</groupId>
|
||||||
|
<artifactId>aaee_mapamundi</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
|
||||||
|
<name>Prueba de Springboot</name>
|
||||||
|
<description>Proyecto para poder probar el funcionamiento de SpringBoot</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>4.0.1</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>23</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
14
src/main/java/org/lapaloma/mapamundi/AppMapaMundiSB.java
Normal file
14
src/main/java/org/lapaloma/mapamundi/AppMapaMundiSB.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package org.lapaloma.mapamundi;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class AppMapaMundiSB {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(AppMapaMundiSB.class, args);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.lapaloma.mapamundi.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lapaloma.mapamundi.service.ContinenteService;
|
||||||
|
import org.lapaloma.mapamundi.vo.Continente;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Isidoro Nevares Martín - Virgen de la Paloma Fecha creación: 13 mar 2026
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/continentes")
|
||||||
|
public class ContinenteController {
|
||||||
|
|
||||||
|
private final ContinenteService continenteService = new ContinenteService();
|
||||||
|
|
||||||
|
// GET /api/continentes - listar todos los continentes
|
||||||
|
@GetMapping
|
||||||
|
public List<Continente> getAll() {
|
||||||
|
List<Continente> listaContinentes = continenteService.obtenerListaContinentes();
|
||||||
|
return listaContinentes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET /api/continentes/codigo/{codigo} - Obtener un Continente por su código
|
||||||
|
@GetMapping("/codigo/{codigo}")
|
||||||
|
public ResponseEntity<Continente> getByCodigo(@PathVariable("codigo") String codigo) {
|
||||||
|
Continente continente = continenteService.obtenerContinentePorClave(codigo);
|
||||||
|
|
||||||
|
return continente != null ? ResponseEntity.ok(continente) : ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET /api/continentes/nombre/{nombre} - Obtener un Continente por su nombre
|
||||||
|
@GetMapping("/nombre/{nombre}")
|
||||||
|
public List<Continente> getByNombre(@PathVariable("nombre") String nombre) {
|
||||||
|
List<Continente> listaContinentes = continenteService.obtenerContinentePorNombre(nombre);
|
||||||
|
|
||||||
|
return listaContinentes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
14
src/main/java/org/lapaloma/mapamundi/dao/IContinenteDAO.java
Normal file
14
src/main/java/org/lapaloma/mapamundi/dao/IContinenteDAO.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package org.lapaloma.mapamundi.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lapaloma.mapamundi.vo.Continente;
|
||||||
|
|
||||||
|
public interface IContinenteDAO {
|
||||||
|
public Continente obtenerContinentePorClave(String codigo) ;
|
||||||
|
public Continente actualizarContinente(Continente coche) ;
|
||||||
|
public Continente crearContinente(Continente coche);
|
||||||
|
public void borrarContinente(Continente coche);
|
||||||
|
public List<Continente> obtenerListaContinentes();
|
||||||
|
public List<Continente> obtenerContinentePorNombre(String nombre);
|
||||||
|
}
|
||||||
@ -0,0 +1,181 @@
|
|||||||
|
package org.lapaloma.mapamundi.dao.impl;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lapaloma.mapamundi.dao.IContinenteDAO;
|
||||||
|
import org.lapaloma.mapamundi.gestores.GestorConexionJDBC;
|
||||||
|
import org.lapaloma.mapamundi.vo.Continente;
|
||||||
|
|
||||||
|
public class ContinenteDaoJDBC implements IContinenteDAO {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Continente obtenerContinentePorClave(String codigo) {
|
||||||
|
Continente continente = null;
|
||||||
|
|
||||||
|
String sentenciaSQL = """
|
||||||
|
SELECT * FROM T_CONTINENTE
|
||||||
|
WHERE codigo=?
|
||||||
|
""";
|
||||||
|
|
||||||
|
try (Connection conexion = GestorConexionJDBC.getConexionSGDB();
|
||||||
|
PreparedStatement sentenciaJDBCPreparada = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
sentenciaJDBCPreparada.setString(1, codigo);
|
||||||
|
System.out.println(sentenciaJDBCPreparada);
|
||||||
|
|
||||||
|
ResultSet resultadoSentencia = sentenciaJDBCPreparada.executeQuery();
|
||||||
|
|
||||||
|
if (resultadoSentencia.next()) {
|
||||||
|
continente = getLineaFromResultSet(resultadoSentencia);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return continente;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Continente actualizarContinente(Continente continente) {
|
||||||
|
|
||||||
|
String sentenciaSQL = """
|
||||||
|
UPDATE T_CONTINENTE
|
||||||
|
SET nombre_continente=?
|
||||||
|
WHERE codigo=?
|
||||||
|
""";
|
||||||
|
|
||||||
|
try (Connection conexion = GestorConexionJDBC.getConexionSGDB();
|
||||||
|
PreparedStatement sentenciaJDBCPreparada = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
sentenciaJDBCPreparada.setString(1, continente.getNombre());
|
||||||
|
sentenciaJDBCPreparada.setString(2, continente.getCodigo());
|
||||||
|
|
||||||
|
System.out.println(sentenciaJDBCPreparada);
|
||||||
|
|
||||||
|
sentenciaJDBCPreparada.executeUpdate();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return continente;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Continente crearContinente(Continente continente) {
|
||||||
|
|
||||||
|
String sentenciaSQL = """
|
||||||
|
INSERT INTO T_CONTINENTE (codigo, nombre_continente)
|
||||||
|
VALUES (?, ?)
|
||||||
|
""";
|
||||||
|
|
||||||
|
try (Connection conexion = GestorConexionJDBC.getConexionSGDB();
|
||||||
|
PreparedStatement sentenciaJDBCPreparada = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
sentenciaJDBCPreparada.setString(1, continente.getCodigo());
|
||||||
|
sentenciaJDBCPreparada.setString(2, continente.getNombre());
|
||||||
|
|
||||||
|
System.out.println(sentenciaJDBCPreparada);
|
||||||
|
|
||||||
|
sentenciaJDBCPreparada.executeUpdate();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return continente;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void borrarContinente(Continente continente) {
|
||||||
|
|
||||||
|
String sentenciaSQL = """
|
||||||
|
DELETE FROM T_CONTINENTE
|
||||||
|
WHERE codigo=?
|
||||||
|
""";
|
||||||
|
|
||||||
|
try (Connection conexion = GestorConexionJDBC.getConexionSGDB();
|
||||||
|
PreparedStatement sentenciaJDBCPreparada = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
sentenciaJDBCPreparada.setString(1, continente.getCodigo());
|
||||||
|
|
||||||
|
sentenciaJDBCPreparada.executeUpdate();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Continente> obtenerListaContinentes() {
|
||||||
|
|
||||||
|
List<Continente> lista = new ArrayList<>();
|
||||||
|
|
||||||
|
String sentenciaSQL = """
|
||||||
|
SELECT * FROM T_CONTINENTE
|
||||||
|
""";
|
||||||
|
|
||||||
|
try (Connection conexion = GestorConexionJDBC.getConexionSGDB();
|
||||||
|
PreparedStatement sentenciaJDBCPreparada = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
System.out.println(sentenciaJDBCPreparada);
|
||||||
|
|
||||||
|
ResultSet resultadoSentencia = sentenciaJDBCPreparada.executeQuery();
|
||||||
|
|
||||||
|
while (resultadoSentencia.next()) {
|
||||||
|
lista.add(getLineaFromResultSet(resultadoSentencia));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return lista;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Continente> obtenerContinentePorNombre(String nombre) {
|
||||||
|
|
||||||
|
List<Continente> lista = new ArrayList<>();
|
||||||
|
|
||||||
|
String sentenciaSQL = """
|
||||||
|
SELECT * FROM T_CONTINENTE
|
||||||
|
WHERE nombre_continente LIKE ?
|
||||||
|
""";
|
||||||
|
|
||||||
|
try (Connection conexion = GestorConexionJDBC.getConexionSGDB();
|
||||||
|
PreparedStatement sentenciaJDBCPreparada = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
|
|
||||||
|
sentenciaJDBCPreparada.setString(1, "%" + nombre + "%");
|
||||||
|
|
||||||
|
System.out.println(sentenciaJDBCPreparada);
|
||||||
|
|
||||||
|
ResultSet resultadoSentencia = sentenciaJDBCPreparada.executeQuery();
|
||||||
|
|
||||||
|
while (resultadoSentencia.next()) {
|
||||||
|
lista.add(getLineaFromResultSet(resultadoSentencia));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return lista;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Continente getLineaFromResultSet(ResultSet resultadoSentencia) throws SQLException {
|
||||||
|
|
||||||
|
Continente continente = new Continente();
|
||||||
|
|
||||||
|
continente.setCodigo(resultadoSentencia.getString("codigo"));
|
||||||
|
continente.setNombre(resultadoSentencia.getString("nombre_continente"));
|
||||||
|
|
||||||
|
return continente;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package org.lapaloma.mapamundi.gestores;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
|
||||||
|
public class GestorConexionJDBC {
|
||||||
|
|
||||||
|
// Evita que pueda construirse un objeto de la clase.
|
||||||
|
private GestorConexionJDBC() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Connection getConexionSGDB() throws Exception {
|
||||||
|
Connection conexionSGDB = null;
|
||||||
|
|
||||||
|
// Datos URL
|
||||||
|
String urlBBDD = GestorFicheroConfiguracion.obtenerValor("jdbc.url");
|
||||||
|
|
||||||
|
String usuario = GestorFicheroConfiguracion.obtenerValor("jdbc.usuario");
|
||||||
|
String contrasenya = GestorFicheroConfiguracion.obtenerValor("jdbc.password");
|
||||||
|
|
||||||
|
String claseDriver = GestorFicheroConfiguracion.obtenerValor("jdbc.driver");
|
||||||
|
Class.forName(claseDriver);
|
||||||
|
|
||||||
|
conexionSGDB = DriverManager.getConnection(urlBBDD, usuario, contrasenya);
|
||||||
|
|
||||||
|
return conexionSGDB;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.lapaloma.mapamundi.gestores;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 20 feb 2026
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GestorFicheroConfiguracion {
|
||||||
|
private static final Properties PROPIEDADES = new Properties();
|
||||||
|
|
||||||
|
static {
|
||||||
|
try (InputStream is = GestorFicheroConfiguracion.class.getClassLoader()
|
||||||
|
.getResourceAsStream("config.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.lapaloma.mapamundi.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lapaloma.mapamundi.dao.IContinenteDAO;
|
||||||
|
import org.lapaloma.mapamundi.dao.impl.ContinenteDaoJDBC;
|
||||||
|
import org.lapaloma.mapamundi.vo.Continente;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Isidoro Nevares Martín - Virgen de la Paloma Fecha creación: 13 mar 2026
|
||||||
|
*/
|
||||||
|
public class ContinenteService {
|
||||||
|
IContinenteDAO continenteDAO = new ContinenteDaoJDBC();
|
||||||
|
|
||||||
|
public Continente obtenerContinentePorClave(String codigo) {
|
||||||
|
Continente continente = null;
|
||||||
|
|
||||||
|
continente = continenteDAO.obtenerContinentePorClave(codigo);
|
||||||
|
|
||||||
|
return continente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Continente> obtenerListaContinentes() {
|
||||||
|
List<Continente> listaContinentes = null;
|
||||||
|
|
||||||
|
listaContinentes = continenteDAO.obtenerListaContinentes();
|
||||||
|
|
||||||
|
return listaContinentes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Continente> obtenerContinentePorNombre(String nombre) {
|
||||||
|
List<Continente> listaContinentes = null;
|
||||||
|
|
||||||
|
listaContinentes = continenteDAO.obtenerContinentePorNombre(nombre);
|
||||||
|
|
||||||
|
return listaContinentes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
44
src/main/java/org/lapaloma/mapamundi/vo/Continente.java
Normal file
44
src/main/java/org/lapaloma/mapamundi/vo/Continente.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package org.lapaloma.mapamundi.vo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Coche: Clase de persistencia que representa un coche de un concesionario.
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 03 marzo 2026
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Continente {
|
||||||
|
private String codigo;
|
||||||
|
private String nombre;
|
||||||
|
|
||||||
|
public Continente(String codigo, String nombre) {
|
||||||
|
super();
|
||||||
|
this.codigo = codigo;
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Continente() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Coche [codigo=" + codigo + ", nombre=" + nombre + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
src/main/resources/config.properties
Normal file
6
src/main/resources/config.properties
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Parámetros de conexión a la base de datos MapaMundi en SGDB MySQL
|
||||||
|
jdbc.driver = com.mysql.cj.jdbc.Driver
|
||||||
|
jdbc.url = jdbc:mysql://23.21.171.246:3306/mapa_mundi
|
||||||
|
jdbc.usuario = isidoronm
|
||||||
|
jdbc.password = 1234
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user