Incluir Enumerado
This commit is contained in:
parent
00a7255659
commit
0e9c375ff8
@ -1,12 +1,12 @@
|
|||||||
a_tratar,id_formacion, id_instituto, anyo
|
a_tratar,cod_formacion, id_instituto, anyo
|
||||||
S, 1, 1, 2021
|
S, IFCS02, 1, 2021
|
||||||
S, 1, 2, 2022
|
S, IFCS02, 2, 2022
|
||||||
S, 2, 1, 2022
|
S, IFCM01, 1, 2022
|
||||||
N, 3, 2, 2022
|
N, ADGM01, 2, 2022
|
||||||
S, 8, 5, 2020
|
S, IFCS03, 5, 2020
|
||||||
S, 2, 2, 2021
|
S, IFCM01, 2, 2021
|
||||||
N, 2, 3, 2023
|
N, IFCM01, 3, 2023
|
||||||
S, 3, 1, 2024
|
S, ADGM01, 1, 2024
|
||||||
S, 5, 9, 2020
|
S, INFP01, 9, 2020
|
||||||
S, 3, 3, 2024
|
S, ADGM01, 3, 2024
|
||||||
S, 4, 3, 2020
|
S, COMM01, 3, 2020
|
||||||
|
@ -5,14 +5,14 @@ package org.comunidadmadrid.fp.dam2;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.comunidadmadrid.fp.dam2.dao.ICicloFormativoDAO;
|
|
||||||
import org.comunidadmadrid.fp.dam2.dao.IFormacionDAO;
|
import org.comunidadmadrid.fp.dam2.dao.IFormacionDAO;
|
||||||
import org.comunidadmadrid.fp.dam2.dao.IInstitutoDAO;
|
import org.comunidadmadrid.fp.dam2.dao.IInstitutoDAO;
|
||||||
import org.comunidadmadrid.fp.dam2.dao.IInstitutoFormacionDAO;
|
import org.comunidadmadrid.fp.dam2.dao.IInstitutoFormacionDAO;
|
||||||
import org.comunidadmadrid.fp.dam2.dao.hibernate.CicloFormativoDaoHibernate;
|
import org.comunidadmadrid.fp.dam2.dao.INivelFormativoDAO;
|
||||||
import org.comunidadmadrid.fp.dam2.dao.hibernate.FormacionDaoHibernate;
|
import org.comunidadmadrid.fp.dam2.dao.hibernate.FormacionDaoHibernate;
|
||||||
import org.comunidadmadrid.fp.dam2.dao.hibernate.InstitutoFormacionDaoHibernate;
|
import org.comunidadmadrid.fp.dam2.dao.hibernate.InstitutoFormacionDaoHibernate;
|
||||||
import org.comunidadmadrid.fp.dam2.dao.jdbc.CicloFormativoDaoJDBC;
|
import org.comunidadmadrid.fp.dam2.dao.hibernate.NivelFormativoDaoHibernate;
|
||||||
|
import org.comunidadmadrid.fp.dam2.dao.jdbc.NivelFormativoDaoJDBC;
|
||||||
import org.comunidadmadrid.fp.dam2.dao.jpa.InstitutoDaoJPA;
|
import org.comunidadmadrid.fp.dam2.dao.jpa.InstitutoDaoJPA;
|
||||||
import org.comunidadmadrid.fp.dam2.dao.mongodb.InstitutoDaoMongoDB;
|
import org.comunidadmadrid.fp.dam2.dao.mongodb.InstitutoDaoMongoDB;
|
||||||
import org.comunidadmadrid.fp.dam2.excepcion.FormacionException;
|
import org.comunidadmadrid.fp.dam2.excepcion.FormacionException;
|
||||||
@ -20,10 +20,11 @@ import org.comunidadmadrid.fp.dam2.gestores.GestorSesionHibernate;
|
|||||||
import org.comunidadmadrid.fp.dam2.procesamiento.ProcesadorFormacionInstitutoCSV;
|
import org.comunidadmadrid.fp.dam2.procesamiento.ProcesadorFormacionInstitutoCSV;
|
||||||
import org.comunidadmadrid.fp.dam2.procesamiento.ProcesadorFormacionesURL;
|
import org.comunidadmadrid.fp.dam2.procesamiento.ProcesadorFormacionesURL;
|
||||||
import org.comunidadmadrid.fp.dam2.utilidades.GestorURLs;
|
import org.comunidadmadrid.fp.dam2.utilidades.GestorURLs;
|
||||||
import org.comunidadmadrid.fp.dam2.vo.CicloFormativo;
|
import org.comunidadmadrid.fp.dam2.vo.EIndicadorSTEM;
|
||||||
import org.comunidadmadrid.fp.dam2.vo.Formacion;
|
import org.comunidadmadrid.fp.dam2.vo.Formacion;
|
||||||
import org.comunidadmadrid.fp.dam2.vo.Instituto;
|
import org.comunidadmadrid.fp.dam2.vo.Instituto;
|
||||||
import org.comunidadmadrid.fp.dam2.vo.InstitutoFormacion;
|
import org.comunidadmadrid.fp.dam2.vo.InstitutoFormacion;
|
||||||
|
import org.comunidadmadrid.fp.dam2.vo.NivelFormativo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Organización: Virgen de la Paloma Programador: Isidoro Nevares Martín Fecha:
|
* Organización: Virgen de la Paloma Programador: Isidoro Nevares Martín Fecha:
|
||||||
@ -85,15 +86,15 @@ public class ClasePrincipal {
|
|||||||
private void tratarCiclosFormativos() throws FormacionException {
|
private void tratarCiclosFormativos() throws FormacionException {
|
||||||
|
|
||||||
// Se obtiene la lista de Ciclos formativos de PostgreSQL
|
// Se obtiene la lista de Ciclos formativos de PostgreSQL
|
||||||
ICicloFormativoDAO iCicloFormativoDAO = new CicloFormativoDaoJDBC();
|
INivelFormativoDAO iCicloFormativoDAO = new NivelFormativoDaoJDBC();
|
||||||
List<CicloFormativo> listaCiclos = iCicloFormativoDAO.obtenerListCiclosFormativosActivos();
|
List<NivelFormativo> listaCiclos = iCicloFormativoDAO.obtenerListCiclosFormativosActivos();
|
||||||
|
|
||||||
if (listaCiclos != null && listaCiclos.size() > 0) {
|
if (listaCiclos != null && listaCiclos.size() > 0) {
|
||||||
|
|
||||||
// Se prepara el AADD de Ciclo formativo para que se realice mediante Hibernate
|
// Se prepara el AADD de Ciclo formativo para que se realice mediante Hibernate
|
||||||
iCicloFormativoDAO = new CicloFormativoDaoHibernate();
|
iCicloFormativoDAO = new NivelFormativoDaoHibernate();
|
||||||
|
|
||||||
for (CicloFormativo cicloFormativo : listaCiclos) {
|
for (NivelFormativo cicloFormativo : listaCiclos) {
|
||||||
|
|
||||||
System.out.println(cicloFormativo);
|
System.out.println(cicloFormativo);
|
||||||
|
|
||||||
@ -124,7 +125,7 @@ public class ClasePrincipal {
|
|||||||
for (Formacion formacion : listaFormaciones) {
|
for (Formacion formacion : listaFormaciones) {
|
||||||
|
|
||||||
// Se obiene la formación en la BBDD
|
// Se obiene la formación en la BBDD
|
||||||
Formacion formacionBBDD = iFormacionDAO.obtenerFormacionPorID(formacion.getIdentificador());
|
Formacion formacionBBDD = iFormacionDAO.obtenerFormacionPorID(formacion.getCodigo());
|
||||||
|
|
||||||
// Si no existen en la BBDD se inserta, en caso contrario se actualiza.
|
// Si no existen en la BBDD se inserta, en caso contrario se actualiza.
|
||||||
if (formacionBBDD == null) {
|
if (formacionBBDD == null) {
|
||||||
@ -198,8 +199,9 @@ public class ClasePrincipal {
|
|||||||
Instituto instituto = iInstitutoDAO
|
Instituto instituto = iInstitutoDAO
|
||||||
.obtenerInstitutoPorID(institutoFormacion.getInstituto().getIdentificador());
|
.obtenerInstitutoPorID(institutoFormacion.getInstituto().getIdentificador());
|
||||||
Formacion formacion = iFormacionDAO
|
Formacion formacion = iFormacionDAO
|
||||||
.obtenerFormacionPorID(institutoFormacion.getFormacion().getIdentificador());
|
.obtenerFormacionPorID(institutoFormacion.getFormacion().getCodigo());
|
||||||
if (instituto != null && formacion != null) {
|
// Se insertará el InstitutoFormacion sólo si la formación es STEM
|
||||||
|
if (instituto != null && formacion != null && formacion.getIndicadorSTEM() == EIndicadorSTEM.sí) {
|
||||||
institutoFormacion.setInstituto(instituto);
|
institutoFormacion.setInstituto(instituto);
|
||||||
institutoFormacion.setFormacion(formacion);
|
institutoFormacion.setFormacion(formacion);
|
||||||
institutoFormacionDAO.insertarInstitutoFormacion(institutoFormacion);
|
institutoFormacionDAO.insertarInstitutoFormacion(institutoFormacion);
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public interface IFormacionDAO {
|
|||||||
* @return
|
* @return
|
||||||
* @throws FormacionException
|
* @throws FormacionException
|
||||||
*/
|
*/
|
||||||
Formacion obtenerFormacionPorID(int identificador) throws FormacionException;
|
Formacion obtenerFormacionPorID(String codigo) throws FormacionException;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param formacion
|
* @param formacion
|
||||||
|
|||||||
@ -6,25 +6,25 @@ package org.comunidadmadrid.fp.dam2.dao;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.comunidadmadrid.fp.dam2.excepcion.FormacionException;
|
import org.comunidadmadrid.fp.dam2.excepcion.FormacionException;
|
||||||
import org.comunidadmadrid.fp.dam2.vo.CicloFormativo;
|
import org.comunidadmadrid.fp.dam2.vo.NivelFormativo;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Organización: Virgen de la Paloma
|
Organización: Virgen de la Paloma
|
||||||
Programador: Isidoro Nevares Martín
|
Programador: Isidoro Nevares Martín
|
||||||
Fecha: 1 mar 2025
|
Fecha: 1 mar 2025
|
||||||
*/
|
*/
|
||||||
public interface ICicloFormativoDAO {
|
public interface INivelFormativoDAO {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws FormacionException
|
* @throws FormacionException
|
||||||
*/
|
*/
|
||||||
List<CicloFormativo> obtenerListCiclosFormativosActivos() throws FormacionException;
|
List<NivelFormativo> obtenerListCiclosFormativosActivos() throws FormacionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param ciclo
|
* @param ciclo
|
||||||
* @throws FormacionException
|
* @throws FormacionException
|
||||||
*/
|
*/
|
||||||
void insertarCicloFormativo(CicloFormativo ciclo) throws FormacionException;
|
void insertarCicloFormativo(NivelFormativo ciclo) throws FormacionException;
|
||||||
}
|
}
|
||||||
@ -45,11 +45,11 @@ public class FormacionDaoHibernate implements IFormacionDAO{
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Formacion obtenerFormacionPorID(int identificador) throws FormacionException {
|
public Formacion obtenerFormacionPorID(String codigo) throws FormacionException {
|
||||||
Formacion formacion = null;
|
Formacion formacion = null;
|
||||||
// try con recursos "cerrables": Session
|
// try con recursos "cerrables": Session
|
||||||
try (Session sesion = GestorSesionHibernate.getSession();) {
|
try (Session sesion = GestorSesionHibernate.getSession();) {
|
||||||
formacion = sesion.find(Formacion.class, identificador);
|
formacion = sesion.find(Formacion.class, codigo);
|
||||||
} catch (HibernateException e) {
|
} catch (HibernateException e) {
|
||||||
throw new FormacionException(e, FormacionException.ERROR_CONSULTA, getClass());
|
throw new FormacionException(e, FormacionException.ERROR_CONSULTA, getClass());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,10 +5,10 @@ package org.comunidadmadrid.fp.dam2.dao.hibernate;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.comunidadmadrid.fp.dam2.dao.ICicloFormativoDAO;
|
import org.comunidadmadrid.fp.dam2.dao.INivelFormativoDAO;
|
||||||
import org.comunidadmadrid.fp.dam2.excepcion.FormacionException;
|
import org.comunidadmadrid.fp.dam2.excepcion.FormacionException;
|
||||||
import org.comunidadmadrid.fp.dam2.gestores.GestorSesionHibernate;
|
import org.comunidadmadrid.fp.dam2.gestores.GestorSesionHibernate;
|
||||||
import org.comunidadmadrid.fp.dam2.vo.CicloFormativo;
|
import org.comunidadmadrid.fp.dam2.vo.NivelFormativo;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
|
|
||||||
@ -17,17 +17,17 @@ import org.hibernate.Transaction;
|
|||||||
* Programador: Isidoro Nevares Martín
|
* Programador: Isidoro Nevares Martín
|
||||||
* Fecha: 26 marzo 2026
|
* Fecha: 26 marzo 2026
|
||||||
*/
|
*/
|
||||||
public class CicloFormativoDaoHibernate implements ICicloFormativoDAO {
|
public class NivelFormativoDaoHibernate implements INivelFormativoDAO {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CicloFormativo> obtenerListCiclosFormativosActivos() throws FormacionException {
|
public List<NivelFormativo> obtenerListCiclosFormativosActivos() throws FormacionException {
|
||||||
List<CicloFormativo> listaCiclosFormativos = null;
|
List<NivelFormativo> listaCiclosFormativos = null;
|
||||||
|
|
||||||
return listaCiclosFormativos;
|
return listaCiclosFormativos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertarCicloFormativo(CicloFormativo ciclo) throws FormacionException {
|
public void insertarCicloFormativo(NivelFormativo ciclo) throws FormacionException {
|
||||||
Transaction transaccion = null;
|
Transaction transaccion = null;
|
||||||
|
|
||||||
Session sesion = null;
|
Session sesion = null;
|
||||||
@ -10,45 +10,46 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.comunidadmadrid.fp.dam2.dao.ICicloFormativoDAO;
|
import org.comunidadmadrid.fp.dam2.dao.INivelFormativoDAO;
|
||||||
import org.comunidadmadrid.fp.dam2.excepcion.FormacionException;
|
import org.comunidadmadrid.fp.dam2.excepcion.FormacionException;
|
||||||
import org.comunidadmadrid.fp.dam2.gestores.GestorConexionJDBC;
|
import org.comunidadmadrid.fp.dam2.gestores.GestorConexionJDBC;
|
||||||
import org.comunidadmadrid.fp.dam2.vo.CicloFormativo;
|
import org.comunidadmadrid.fp.dam2.vo.NivelFormativo;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Organización: Virgen de la Paloma
|
Organización: Virgen de la Paloma
|
||||||
Programador: Isidoro Nevares Martín
|
Programador: Isidoro Nevares Martín
|
||||||
Fecha: 1 mar 2025
|
Fecha: 1 mar 2025
|
||||||
*/
|
*/
|
||||||
public class CicloFormativoDaoJDBC implements ICicloFormativoDAO{
|
public class NivelFormativoDaoJDBC implements INivelFormativoDAO{
|
||||||
private Connection conexion=null;
|
private Connection conexion=null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CicloFormativo> obtenerListCiclosFormativosActivos() throws FormacionException {
|
public List<NivelFormativo> obtenerListCiclosFormativosActivos() throws FormacionException {
|
||||||
List<CicloFormativo> listaCiclosFormativos=null;
|
List<NivelFormativo> listaCiclosFormativos=null;
|
||||||
|
|
||||||
String sentenciaSQL= """
|
String sentenciaSQL= """
|
||||||
SELECT * FROM T_CICLO_FORMATIVO cf
|
SELECT * FROM T_NIVEL_FORMACION nf
|
||||||
WHERE cf.activo='S'
|
WHERE nf.activo='S'
|
||||||
""";
|
""";
|
||||||
|
|
||||||
ResultSet resultadoSentencia=null;
|
|
||||||
// try con recursos "cerrables": Connection, Statement
|
// try con recursos "cerrables": Connection, Statement
|
||||||
try (Connection conexion = GestorConexionJDBC.getConexionSGDB();
|
try (Connection conexion = GestorConexionJDBC.getConexionSGDB();
|
||||||
PreparedStatement sentenciaJDBCPreparada = conexion.prepareStatement(sentenciaSQL);) {
|
PreparedStatement sentenciaJDBCPreparada = conexion.prepareStatement(sentenciaSQL);) {
|
||||||
System.out.println(sentenciaJDBCPreparada);
|
System.out.println(sentenciaJDBCPreparada);
|
||||||
|
|
||||||
resultadoSentencia = sentenciaJDBCPreparada.executeQuery();
|
ResultSet resultadoSentencia = sentenciaJDBCPreparada.executeQuery();
|
||||||
if (resultadoSentencia!= null)
|
if (resultadoSentencia!= null)
|
||||||
listaCiclosFormativos= new ArrayList<CicloFormativo>();
|
listaCiclosFormativos= new ArrayList<NivelFormativo>();
|
||||||
|
|
||||||
while (resultadoSentencia.next()) {
|
while (resultadoSentencia.next()) {
|
||||||
|
String codigo = resultadoSentencia.getString("codigo");
|
||||||
|
String descripcion = resultadoSentencia.getString("desc_ciclo");
|
||||||
|
String urlLogo = resultadoSentencia.getString("url_img_logo");
|
||||||
|
|
||||||
CicloFormativo cicloFormativo= new CicloFormativo();
|
NivelFormativo cicloFormativo= new NivelFormativo();
|
||||||
cicloFormativo.setIdentificador(resultadoSentencia.getInt("identificador"));
|
cicloFormativo.setCodigo(codigo);
|
||||||
cicloFormativo.setDescripcion(resultadoSentencia.getString("desc_ciclo") );
|
cicloFormativo.setDescripcion(descripcion);
|
||||||
cicloFormativo.setNombre(resultadoSentencia.getString("nom_corto"));
|
cicloFormativo.setUrlLogo(urlLogo);
|
||||||
cicloFormativo.setUrlLogo(resultadoSentencia.getString("url_img_logo"));
|
|
||||||
|
|
||||||
listaCiclosFormativos.add(cicloFormativo);
|
listaCiclosFormativos.add(cicloFormativo);
|
||||||
}
|
}
|
||||||
@ -69,7 +70,7 @@ public class CicloFormativoDaoJDBC implements ICicloFormativoDAO{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertarCicloFormativo(CicloFormativo ciclo) throws FormacionException {
|
public void insertarCicloFormativo(NivelFormativo ciclo) throws FormacionException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -44,19 +44,19 @@ public class ProcesadorFormacionInstitutoCSV {
|
|||||||
|
|
||||||
String[] partes = linea.split(",");
|
String[] partes = linea.split(",");
|
||||||
String registroATratar = partes[0];
|
String registroATratar = partes[0];
|
||||||
int idFormacion = Integer.parseInt(partes[1].trim());
|
String codFormacion = partes[1].trim();
|
||||||
int idInstituto = Integer.parseInt(partes[2].trim());
|
int idInstituto = Integer.parseInt(partes[2].trim());
|
||||||
int anyo = Integer.parseInt(partes[3].trim());
|
int anyo = Integer.parseInt(partes[3].trim());
|
||||||
|
|
||||||
// Si el registro es de tipo "S" se tratará para insertarse en la Base de datos.
|
// Si el registro es de tipo "S" se tratará para insertarse en la Base de datos.
|
||||||
if (registroATratar.equals("S")) {
|
if (registroATratar.equals("S")) {
|
||||||
InstitutoFormacion institutoFormacion = new InstitutoFormacion();
|
InstitutoFormacion institutoFormacion = new InstitutoFormacion();
|
||||||
InstitutoFormacionID institutoFormacionID = new InstitutoFormacionID(idInstituto, idFormacion);
|
InstitutoFormacionID institutoFormacionID = new InstitutoFormacionID(idInstituto, codFormacion);
|
||||||
|
|
||||||
Instituto instituto = new Instituto();
|
Instituto instituto = new Instituto();
|
||||||
instituto.setIdentificador(idInstituto);
|
instituto.setIdentificador(idInstituto);
|
||||||
Formacion formacion = new Formacion();
|
Formacion formacion = new Formacion();
|
||||||
formacion.setIdentificador(idFormacion);
|
formacion.setCodigo(codFormacion);
|
||||||
|
|
||||||
institutoFormacion.setIdInstitutoFormacion(institutoFormacionID);
|
institutoFormacion.setIdInstitutoFormacion(institutoFormacionID);
|
||||||
institutoFormacion.setInstituto(instituto);
|
institutoFormacion.setInstituto(instituto);
|
||||||
|
|||||||
@ -8,8 +8,9 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.comunidadmadrid.fp.dam2.gestores.GestorFicheroConfiguracion;
|
import org.comunidadmadrid.fp.dam2.gestores.GestorFicheroConfiguracion;
|
||||||
import org.comunidadmadrid.fp.dam2.utilidades.GestorURLs;
|
import org.comunidadmadrid.fp.dam2.utilidades.GestorURLs;
|
||||||
import org.comunidadmadrid.fp.dam2.vo.CicloFormativo;
|
import org.comunidadmadrid.fp.dam2.vo.EIndicadorSTEM;
|
||||||
import org.comunidadmadrid.fp.dam2.vo.Formacion;
|
import org.comunidadmadrid.fp.dam2.vo.Formacion;
|
||||||
|
import org.comunidadmadrid.fp.dam2.vo.NivelFormativo;
|
||||||
|
|
||||||
import tools.jackson.databind.JsonNode;
|
import tools.jackson.databind.JsonNode;
|
||||||
import tools.jackson.databind.ObjectMapper;
|
import tools.jackson.databind.ObjectMapper;
|
||||||
@ -54,7 +55,6 @@ public class ProcesadorFormacionesURL {
|
|||||||
return listaFormaciones;
|
return listaFormaciones;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convierte un JsonNode que representa una formación en el objeto Formacion
|
* Convierte un JsonNode que representa una formación en el objeto Formacion
|
||||||
* correspondiente.
|
* correspondiente.
|
||||||
@ -68,25 +68,33 @@ public class ProcesadorFormacionesURL {
|
|||||||
formacion = new Formacion();
|
formacion = new Formacion();
|
||||||
|
|
||||||
// Atributos mapeados como nodos en Jackson
|
// Atributos mapeados como nodos en Jackson
|
||||||
if (nodoJson.has("id_formacion")) {
|
if (nodoJson.has("cod_formacion")) {
|
||||||
formacion.setIdentificador(nodoJson.get("id_formacion").asInt());
|
formacion.setCodigo(nodoJson.get("cod_formacion").asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
int formacionSTEM = 0;
|
int formacionSTEM = 0;
|
||||||
if (nodoJson.has("es_formacion_stem")) {
|
if (nodoJson.has("es_formacion_stem")) {
|
||||||
formacionSTEM = nodoJson.get("es_formacion_stem").asInt();
|
formacionSTEM = nodoJson.get("es_formacion_stem").asInt();
|
||||||
|
|
||||||
|
formacion.setIndicadorSTEM(EIndicadorSTEM.sí);
|
||||||
|
if (formacionSTEM == 0) {
|
||||||
|
formacion.setIndicadorSTEM(EIndicadorSTEM.no);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
formacion.setIndicadorSTEM(formacionSTEM == 1);
|
|
||||||
|
|
||||||
if (nodoJson.has("nombre_corto")) {
|
if (nodoJson.has("nombre_corto")) {
|
||||||
formacion.setNombreCorto(nodoJson.get("nombre_corto").asString());
|
formacion.setNombreCorto(nodoJson.get("nombre_corto").asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
CicloFormativo ciclo = new CicloFormativo();
|
if (nodoJson.has("num_cursos")) {
|
||||||
if (nodoJson.has("cod_ciclo_formativo")) {
|
formacion.setNumeroCursos(nodoJson.get("num_cursos").asInt());
|
||||||
ciclo.setIdentificador(nodoJson.get("cod_ciclo_formativo").asInt());
|
|
||||||
}
|
}
|
||||||
formacion.setCicloFormativo(ciclo);
|
|
||||||
|
NivelFormativo nivelFornativo = new NivelFormativo();
|
||||||
|
if (nodoJson.has("cod_ciclo_formativo")) {
|
||||||
|
nivelFornativo.setCodigo(nodoJson.get("cod_ciclo_formativo").asString());
|
||||||
|
}
|
||||||
|
formacion.setNivelFormativo(nivelFornativo);;
|
||||||
}
|
}
|
||||||
return formacion;
|
return formacion;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.comunidadmadrid.fp.dam2.vo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ENumeroCursos: Clase que realiza ....
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 25 feb 2026
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum EIndicadorSTEM {
|
||||||
|
sí, no;
|
||||||
|
}
|
||||||
|
|
||||||
@ -5,39 +5,37 @@ package org.comunidadmadrid.fp.dam2.vo;
|
|||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Organización: Virgen de la Paloma
|
* Organización: Virgen de la Paloma Programador: Isidoro Nevares Martín Fecha:
|
||||||
* Programador: Isidoro Nevares Martín
|
* 26 marzo 2026
|
||||||
* Fecha: 26 marzo 2026
|
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "T_FORMACION")
|
@Table(name = "T_FORMACION")
|
||||||
public class Formacion {
|
public class Formacion {
|
||||||
@Id
|
@Id
|
||||||
private int identificador;
|
private String codigo;
|
||||||
|
|
||||||
@Column(name = "nombre_corto")
|
@Column(name = "nombre_corto")
|
||||||
private String nombreCorto;
|
private String nombreCorto;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING) // Se almacena el valor de un enumerado
|
||||||
@Column(name = "indicador_stem")
|
@Column(name = "indicador_stem")
|
||||||
private boolean indicadorSTEM;
|
private EIndicadorSTEM indicadorSTEM;
|
||||||
|
|
||||||
|
@Column(name = "numero_cursos")
|
||||||
|
private int numeroCursos;
|
||||||
|
|
||||||
@ManyToOne()
|
@ManyToOne()
|
||||||
@JoinColumn(name="id_ciclo", nullable = false )
|
@JoinColumn(name = "cod_nivel", nullable = false)
|
||||||
private CicloFormativo cicloFormativo;
|
private NivelFormativo nivelFormativo;
|
||||||
|
|
||||||
public int getIdentificador() {
|
|
||||||
return identificador;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIdentificador(int identificador) {
|
|
||||||
this.identificador = identificador;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNombreCorto() {
|
public String getNombreCorto() {
|
||||||
return nombreCorto;
|
return nombreCorto;
|
||||||
@ -47,26 +45,42 @@ public class Formacion {
|
|||||||
this.nombreCorto = nombreCorto;
|
this.nombreCorto = nombreCorto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIndicadorSTEM() {
|
public EIndicadorSTEM getIndicadorSTEM() {
|
||||||
return indicadorSTEM;
|
return indicadorSTEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIndicadorSTEM(boolean indicadorSTEM) {
|
public void setIndicadorSTEM(EIndicadorSTEM indicadorSTEM) {
|
||||||
this.indicadorSTEM = indicadorSTEM;
|
this.indicadorSTEM = indicadorSTEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CicloFormativo getCicloFormativo() {
|
public int getNumeroCursos() {
|
||||||
return cicloFormativo;
|
return numeroCursos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCicloFormativo(CicloFormativo cicloFormativo) {
|
public void setNumeroCursos(int numeroCursos) {
|
||||||
this.cicloFormativo = cicloFormativo;
|
this.numeroCursos = numeroCursos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NivelFormativo getNivelFormativo() {
|
||||||
|
return nivelFormativo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNivelFormativo(NivelFormativo nivelFormativo) {
|
||||||
|
this.nivelFormativo = nivelFormativo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodigo() {
|
||||||
|
return codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodigo(String codigo) {
|
||||||
|
this.codigo = codigo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Formacion [identificador=" + identificador + ", nombreCorto=" + nombreCorto + ", indicadorSTEM="
|
return "Formacion [codigo=" + codigo + ", nombreCorto=" + nombreCorto + ", indicadorSTEM=" + indicadorSTEM
|
||||||
+ indicadorSTEM + ", cicloFormativo=" + cicloFormativo + "]\n";
|
+ ", numeroCursos=" + numeroCursos + ", nivelFormativo=" + nivelFormativo + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.comunidadmadrid.fp.dam2.vo;
|
package org.comunidadmadrid.fp.dam2.vo;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
||||||
import jakarta.persistence.EmbeddedId;
|
import jakarta.persistence.EmbeddedId;
|
||||||
@ -27,7 +29,7 @@ public class InstitutoFormacion {
|
|||||||
private Instituto instituto;
|
private Instituto instituto;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name="id_formacion", insertable=false, updatable=false)
|
@JoinColumn(name="cod_formacion", insertable=false, updatable=false)
|
||||||
private Formacion formacion;
|
private Formacion formacion;
|
||||||
|
|
||||||
@Column(name="anyo_academico")
|
@Column(name="anyo_academico")
|
||||||
@ -38,32 +40,37 @@ public class InstitutoFormacion {
|
|||||||
public InstitutoFormacionID() {
|
public InstitutoFormacionID() {
|
||||||
|
|
||||||
}
|
}
|
||||||
public InstitutoFormacionID(Integer idInstituto, Integer idFormacion) {
|
public InstitutoFormacionID(Integer idInstituto, String codFormacion) {
|
||||||
this.idFormacion=idFormacion;
|
this.codFormacion=codFormacion;
|
||||||
this.idIntituto=idInstituto;
|
this.idIntituto=idInstituto;
|
||||||
|
|
||||||
}
|
}
|
||||||
@Column(name="id_instituto")
|
@Column(name="id_instituto")
|
||||||
private Integer idIntituto;
|
private Integer idIntituto;
|
||||||
|
|
||||||
@Column(name="id_formacion")
|
@Column(name="cod_formacion")
|
||||||
private Integer idFormacion;
|
private String codFormacion;
|
||||||
|
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
@Override
|
||||||
boolean resultado=false;
|
|
||||||
if (o != null && o instanceof InstitutoFormacionID) {
|
|
||||||
InstitutoFormacionID that = (InstitutoFormacionID) o;
|
|
||||||
resultado= (this.idFormacion==that.idFormacion) && (this.idIntituto == that.idIntituto);
|
|
||||||
}
|
|
||||||
return resultado;
|
|
||||||
}
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Long.hashCode(idIntituto)+ Long.hashCode(idFormacion);
|
return Objects.hash(codFormacion, idIntituto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
InstitutoFormacionID other = (InstitutoFormacionID) obj;
|
||||||
|
return Objects.equals(codFormacion, other.codFormacion) && Objects.equals(idIntituto, other.idIntituto);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "InstitutoFormacionID [idIntituto=" + idIntituto + ", idFormacion=" + idFormacion + "]";
|
return "InstitutoFormacionID [idIntituto=" + idIntituto + ", idFormacion=" + codFormacion + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,13 +18,11 @@ import jakarta.persistence.Table;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="T_CICLO_FORMATIVO")
|
@Table(name="T_NIVEL_FORMATIVO")
|
||||||
public class CicloFormativo {
|
public class NivelFormativo {
|
||||||
@Id
|
@Id
|
||||||
private int identificador;
|
@Column(name="codigo")
|
||||||
|
private String codigo;
|
||||||
@Column(name="nombre")
|
|
||||||
private String nombre;
|
|
||||||
|
|
||||||
@Column(name="descripcion")
|
@Column(name="descripcion")
|
||||||
private String descripcion;
|
private String descripcion;
|
||||||
@ -36,20 +34,14 @@ public class CicloFormativo {
|
|||||||
@Lob
|
@Lob
|
||||||
private byte[] imagenCiclo;
|
private byte[] imagenCiclo;
|
||||||
|
|
||||||
public int getIdentificador() {
|
|
||||||
return identificador;
|
|
||||||
|
public String getCodigo() {
|
||||||
|
return codigo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdentificador(int identificador) {
|
public void setCodigo(String codigo) {
|
||||||
this.identificador = identificador;
|
this.codigo = codigo;
|
||||||
}
|
|
||||||
|
|
||||||
public String getNombre() {
|
|
||||||
return nombre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNombre(String nombre) {
|
|
||||||
this.nombre = nombre;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescripcion() {
|
public String getDescripcion() {
|
||||||
@ -78,10 +70,8 @@ public class CicloFormativo {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CicloFormativo [identificador=" + identificador + ", nombre=" + nombre + ", descripcion=" + descripcion
|
return "NivelFormativo [codigo=" + codigo + ", descripcion=" + descripcion + ", urlLogo=" + urlLogo
|
||||||
+ ", urlLogo=" + urlLogo + ", imagenCiclo=" + Arrays.toString(imagenCiclo) + "]\n";
|
+ ", imagenCiclo=" + Arrays.toString(imagenCiclo) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
# Información sobre la Base de datos PostgreSQL
|
# Información sobre la Base de datos PostgreSQL
|
||||||
jdbc.driver=org.postgresql.Driver
|
jdbc.driver=org.postgresql.Driver
|
||||||
jdbc.url=jdbc:postgresql://192.168.1.36:5432/formacionfp_postgresql
|
jdbc.url=jdbc:postgresql://192.168.1.36:5432/formacionfp_origen
|
||||||
jdbc.usuario=vdlp
|
jdbc.usuario=vdlp
|
||||||
jdbc.password=postgresql_123
|
jdbc.password=postgresql_123
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
<property name="hibernate.format_sql">true</property> <!-- Da formato a las consultas SQL -->
|
<property name="hibernate.format_sql">true</property> <!-- Da formato a las consultas SQL -->
|
||||||
<property name="hibernate.use_sql_comments">false</property> <!-- Añade comentarios en las consultas SQL -->
|
<property name="hibernate.use_sql_comments">false</property> <!-- Añade comentarios en las consultas SQL -->
|
||||||
|
|
||||||
<mapping class="org.comunidadmadrid.fp.dam2.vo.CicloFormativo"></mapping>
|
<mapping class="org.comunidadmadrid.fp.dam2.vo.NivelFormativo"></mapping>
|
||||||
<mapping class="org.comunidadmadrid.fp.dam2.vo.Instituto"></mapping>
|
<mapping class="org.comunidadmadrid.fp.dam2.vo.Instituto"></mapping>
|
||||||
<mapping class="org.comunidadmadrid.fp.dam2.vo.Formacion"></mapping>
|
<mapping class="org.comunidadmadrid.fp.dam2.vo.Formacion"></mapping>
|
||||||
<mapping class="org.comunidadmadrid.fp.dam2.vo.InstitutoFormacion"></mapping>
|
<mapping class="org.comunidadmadrid.fp.dam2.vo.InstitutoFormacion"></mapping>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user