Incluir Enumerado
This commit is contained in:
parent
00a7255659
commit
0e9c375ff8
@ -1,12 +1,12 @@
|
||||
a_tratar,id_formacion, id_instituto, anyo
|
||||
S, 1, 1, 2021
|
||||
S, 1, 2, 2022
|
||||
S, 2, 1, 2022
|
||||
N, 3, 2, 2022
|
||||
S, 8, 5, 2020
|
||||
S, 2, 2, 2021
|
||||
N, 2, 3, 2023
|
||||
S, 3, 1, 2024
|
||||
S, 5, 9, 2020
|
||||
S, 3, 3, 2024
|
||||
S, 4, 3, 2020
|
||||
a_tratar,cod_formacion, id_instituto, anyo
|
||||
S, IFCS02, 1, 2021
|
||||
S, IFCS02, 2, 2022
|
||||
S, IFCM01, 1, 2022
|
||||
N, ADGM01, 2, 2022
|
||||
S, IFCS03, 5, 2020
|
||||
S, IFCM01, 2, 2021
|
||||
N, IFCM01, 3, 2023
|
||||
S, ADGM01, 1, 2024
|
||||
S, INFP01, 9, 2020
|
||||
S, ADGM01, 3, 2024
|
||||
S, COMM01, 3, 2020
|
||||
|
@ -5,14 +5,14 @@ package org.comunidadmadrid.fp.dam2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.comunidadmadrid.fp.dam2.dao.ICicloFormativoDAO;
|
||||
import org.comunidadmadrid.fp.dam2.dao.IFormacionDAO;
|
||||
import org.comunidadmadrid.fp.dam2.dao.IInstitutoDAO;
|
||||
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.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.mongodb.InstitutoDaoMongoDB;
|
||||
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.ProcesadorFormacionesURL;
|
||||
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.Instituto;
|
||||
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:
|
||||
@ -85,15 +86,15 @@ public class ClasePrincipal {
|
||||
private void tratarCiclosFormativos() throws FormacionException {
|
||||
|
||||
// Se obtiene la lista de Ciclos formativos de PostgreSQL
|
||||
ICicloFormativoDAO iCicloFormativoDAO = new CicloFormativoDaoJDBC();
|
||||
List<CicloFormativo> listaCiclos = iCicloFormativoDAO.obtenerListCiclosFormativosActivos();
|
||||
INivelFormativoDAO iCicloFormativoDAO = new NivelFormativoDaoJDBC();
|
||||
List<NivelFormativo> listaCiclos = iCicloFormativoDAO.obtenerListCiclosFormativosActivos();
|
||||
|
||||
if (listaCiclos != null && listaCiclos.size() > 0) {
|
||||
|
||||
// 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);
|
||||
|
||||
@ -124,7 +125,7 @@ public class ClasePrincipal {
|
||||
for (Formacion formacion : listaFormaciones) {
|
||||
|
||||
// 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.
|
||||
if (formacionBBDD == null) {
|
||||
@ -198,8 +199,9 @@ public class ClasePrincipal {
|
||||
Instituto instituto = iInstitutoDAO
|
||||
.obtenerInstitutoPorID(institutoFormacion.getInstituto().getIdentificador());
|
||||
Formacion formacion = iFormacionDAO
|
||||
.obtenerFormacionPorID(institutoFormacion.getFormacion().getIdentificador());
|
||||
if (instituto != null && formacion != null) {
|
||||
.obtenerFormacionPorID(institutoFormacion.getFormacion().getCodigo());
|
||||
// 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.setFormacion(formacion);
|
||||
institutoFormacionDAO.insertarInstitutoFormacion(institutoFormacion);
|
||||
|
||||
@ -18,7 +18,7 @@ public interface IFormacionDAO {
|
||||
* @return
|
||||
* @throws FormacionException
|
||||
*/
|
||||
Formacion obtenerFormacionPorID(int identificador) throws FormacionException;
|
||||
Formacion obtenerFormacionPorID(String codigo) throws FormacionException;
|
||||
/**
|
||||
*
|
||||
* @param formacion
|
||||
|
||||
@ -6,25 +6,25 @@ package org.comunidadmadrid.fp.dam2.dao;
|
||||
import java.util.List;
|
||||
|
||||
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
|
||||
Programador: Isidoro Nevares Martín
|
||||
Fecha: 1 mar 2025
|
||||
*/
|
||||
public interface ICicloFormativoDAO {
|
||||
public interface INivelFormativoDAO {
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws FormacionException
|
||||
*/
|
||||
List<CicloFormativo> obtenerListCiclosFormativosActivos() throws FormacionException;
|
||||
List<NivelFormativo> obtenerListCiclosFormativosActivos() throws FormacionException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ciclo
|
||||
* @throws FormacionException
|
||||
*/
|
||||
void insertarCicloFormativo(CicloFormativo ciclo) throws FormacionException;
|
||||
void insertarCicloFormativo(NivelFormativo ciclo) throws FormacionException;
|
||||
}
|
||||
@ -45,11 +45,11 @@ public class FormacionDaoHibernate implements IFormacionDAO{
|
||||
|
||||
|
||||
@Override
|
||||
public Formacion obtenerFormacionPorID(int identificador) throws FormacionException {
|
||||
public Formacion obtenerFormacionPorID(String codigo) throws FormacionException {
|
||||
Formacion formacion = null;
|
||||
// try con recursos "cerrables": Session
|
||||
try (Session sesion = GestorSesionHibernate.getSession();) {
|
||||
formacion = sesion.find(Formacion.class, identificador);
|
||||
formacion = sesion.find(Formacion.class, codigo);
|
||||
} catch (HibernateException e) {
|
||||
throw new FormacionException(e, FormacionException.ERROR_CONSULTA, getClass());
|
||||
}
|
||||
|
||||
@ -5,10 +5,10 @@ package org.comunidadmadrid.fp.dam2.dao.hibernate;
|
||||
|
||||
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.gestores.GestorSesionHibernate;
|
||||
import org.comunidadmadrid.fp.dam2.vo.CicloFormativo;
|
||||
import org.comunidadmadrid.fp.dam2.vo.NivelFormativo;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
@ -17,17 +17,17 @@ import org.hibernate.Transaction;
|
||||
* Programador: Isidoro Nevares Martín
|
||||
* Fecha: 26 marzo 2026
|
||||
*/
|
||||
public class CicloFormativoDaoHibernate implements ICicloFormativoDAO {
|
||||
public class NivelFormativoDaoHibernate implements INivelFormativoDAO {
|
||||
|
||||
@Override
|
||||
public List<CicloFormativo> obtenerListCiclosFormativosActivos() throws FormacionException {
|
||||
List<CicloFormativo> listaCiclosFormativos = null;
|
||||
public List<NivelFormativo> obtenerListCiclosFormativosActivos() throws FormacionException {
|
||||
List<NivelFormativo> listaCiclosFormativos = null;
|
||||
|
||||
return listaCiclosFormativos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertarCicloFormativo(CicloFormativo ciclo) throws FormacionException {
|
||||
public void insertarCicloFormativo(NivelFormativo ciclo) throws FormacionException {
|
||||
Transaction transaccion = null;
|
||||
|
||||
Session sesion = null;
|
||||
@ -10,45 +10,46 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
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.gestores.GestorConexionJDBC;
|
||||
import org.comunidadmadrid.fp.dam2.vo.CicloFormativo;
|
||||
import org.comunidadmadrid.fp.dam2.vo.NivelFormativo;
|
||||
|
||||
/*
|
||||
Organización: Virgen de la Paloma
|
||||
Programador: Isidoro Nevares Martín
|
||||
Fecha: 1 mar 2025
|
||||
*/
|
||||
public class CicloFormativoDaoJDBC implements ICicloFormativoDAO{
|
||||
public class NivelFormativoDaoJDBC implements INivelFormativoDAO{
|
||||
private Connection conexion=null;
|
||||
|
||||
@Override
|
||||
public List<CicloFormativo> obtenerListCiclosFormativosActivos() throws FormacionException {
|
||||
List<CicloFormativo> listaCiclosFormativos=null;
|
||||
public List<NivelFormativo> obtenerListCiclosFormativosActivos() throws FormacionException {
|
||||
List<NivelFormativo> listaCiclosFormativos=null;
|
||||
|
||||
String sentenciaSQL= """
|
||||
SELECT * FROM T_CICLO_FORMATIVO cf
|
||||
WHERE cf.activo='S'
|
||||
SELECT * FROM T_NIVEL_FORMACION nf
|
||||
WHERE nf.activo='S'
|
||||
""";
|
||||
|
||||
ResultSet resultadoSentencia=null;
|
||||
// try con recursos "cerrables": Connection, Statement
|
||||
try (Connection conexion = GestorConexionJDBC.getConexionSGDB();
|
||||
PreparedStatement sentenciaJDBCPreparada = conexion.prepareStatement(sentenciaSQL);) {
|
||||
System.out.println(sentenciaJDBCPreparada);
|
||||
|
||||
resultadoSentencia = sentenciaJDBCPreparada.executeQuery();
|
||||
ResultSet resultadoSentencia = sentenciaJDBCPreparada.executeQuery();
|
||||
if (resultadoSentencia!= null)
|
||||
listaCiclosFormativos= new ArrayList<CicloFormativo>();
|
||||
listaCiclosFormativos= new ArrayList<NivelFormativo>();
|
||||
|
||||
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();
|
||||
cicloFormativo.setIdentificador(resultadoSentencia.getInt("identificador"));
|
||||
cicloFormativo.setDescripcion(resultadoSentencia.getString("desc_ciclo") );
|
||||
cicloFormativo.setNombre(resultadoSentencia.getString("nom_corto"));
|
||||
cicloFormativo.setUrlLogo(resultadoSentencia.getString("url_img_logo"));
|
||||
NivelFormativo cicloFormativo= new NivelFormativo();
|
||||
cicloFormativo.setCodigo(codigo);
|
||||
cicloFormativo.setDescripcion(descripcion);
|
||||
cicloFormativo.setUrlLogo(urlLogo);
|
||||
|
||||
listaCiclosFormativos.add(cicloFormativo);
|
||||
}
|
||||
@ -69,7 +70,7 @@ public class CicloFormativoDaoJDBC implements ICicloFormativoDAO{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertarCicloFormativo(CicloFormativo ciclo) throws FormacionException {
|
||||
public void insertarCicloFormativo(NivelFormativo ciclo) throws FormacionException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@ -44,19 +44,19 @@ public class ProcesadorFormacionInstitutoCSV {
|
||||
|
||||
String[] partes = linea.split(",");
|
||||
String registroATratar = partes[0];
|
||||
int idFormacion = Integer.parseInt(partes[1].trim());
|
||||
String codFormacion = partes[1].trim();
|
||||
int idInstituto = Integer.parseInt(partes[2].trim());
|
||||
int anyo = Integer.parseInt(partes[3].trim());
|
||||
|
||||
// Si el registro es de tipo "S" se tratará para insertarse en la Base de datos.
|
||||
if (registroATratar.equals("S")) {
|
||||
InstitutoFormacion institutoFormacion = new InstitutoFormacion();
|
||||
InstitutoFormacionID institutoFormacionID = new InstitutoFormacionID(idInstituto, idFormacion);
|
||||
InstitutoFormacionID institutoFormacionID = new InstitutoFormacionID(idInstituto, codFormacion);
|
||||
|
||||
Instituto instituto = new Instituto();
|
||||
instituto.setIdentificador(idInstituto);
|
||||
Formacion formacion = new Formacion();
|
||||
formacion.setIdentificador(idFormacion);
|
||||
formacion.setCodigo(codFormacion);
|
||||
|
||||
institutoFormacion.setIdInstitutoFormacion(institutoFormacionID);
|
||||
institutoFormacion.setInstituto(instituto);
|
||||
|
||||
@ -8,8 +8,9 @@ import java.util.List;
|
||||
|
||||
import org.comunidadmadrid.fp.dam2.gestores.GestorFicheroConfiguracion;
|
||||
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.NivelFormativo;
|
||||
|
||||
import tools.jackson.databind.JsonNode;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
@ -24,9 +25,9 @@ Fecha: 1 mar 2025
|
||||
public class ProcesadorFormacionesURL {
|
||||
public List<Formacion> obtenerListaFormacionesDeURL() {
|
||||
List<Formacion> listaFormaciones = null;
|
||||
|
||||
|
||||
String urlFormaciones = GestorFicheroConfiguracion.obtenerValor("url.formaciones");
|
||||
|
||||
|
||||
String informacionFormacionesXML = GestorURLs.getTextoFromURL(urlFormaciones);
|
||||
ObjectMapper mapeadorXML = new XmlMapper();
|
||||
|
||||
@ -39,10 +40,10 @@ public class ProcesadorFormacionesURL {
|
||||
JsonNode nodosFormacion = nodoRaiz.has("formacion") ? nodoRaiz.get("formacion") : nodoRaiz;
|
||||
|
||||
JsonNode arrayNodosFormacion = convertirJsonNodeEnArrayNode(nodosFormacion);
|
||||
listaFormaciones= new ArrayList<Formacion>();
|
||||
listaFormaciones = new ArrayList<Formacion>();
|
||||
for (JsonNode nodoFormacion : arrayNodosFormacion) {
|
||||
Formacion formacion = obtenerFormacionDeJsonNode(nodoFormacion);
|
||||
|
||||
|
||||
listaFormaciones.add(formacion);
|
||||
}
|
||||
}
|
||||
@ -50,11 +51,10 @@ public class ProcesadorFormacionesURL {
|
||||
System.err.println("Error procesando XML con JsonNode: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return listaFormaciones;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convierte un JsonNode que representa una formación en el objeto Formacion
|
||||
* correspondiente.
|
||||
@ -68,25 +68,33 @@ public class ProcesadorFormacionesURL {
|
||||
formacion = new Formacion();
|
||||
|
||||
// Atributos mapeados como nodos en Jackson
|
||||
if (nodoJson.has("id_formacion")) {
|
||||
formacion.setIdentificador(nodoJson.get("id_formacion").asInt());
|
||||
if (nodoJson.has("cod_formacion")) {
|
||||
formacion.setCodigo(nodoJson.get("cod_formacion").asString());
|
||||
}
|
||||
|
||||
int formacionSTEM = 0;
|
||||
if (nodoJson.has("es_formacion_stem")) {
|
||||
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")) {
|
||||
formacion.setNombreCorto(nodoJson.get("nombre_corto").asString());
|
||||
}
|
||||
|
||||
CicloFormativo ciclo = new CicloFormativo();
|
||||
if (nodoJson.has("cod_ciclo_formativo")) {
|
||||
ciclo.setIdentificador(nodoJson.get("cod_ciclo_formativo").asInt());
|
||||
if (nodoJson.has("num_cursos")) {
|
||||
formacion.setNumeroCursos(nodoJson.get("num_cursos").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;
|
||||
}
|
||||
|
||||
@ -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.Entity;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
/**
|
||||
* Organización: Virgen de la Paloma
|
||||
* Programador: Isidoro Nevares Martín
|
||||
* Fecha: 26 marzo 2026
|
||||
*/
|
||||
* Organización: Virgen de la Paloma Programador: Isidoro Nevares Martín Fecha:
|
||||
* 26 marzo 2026
|
||||
*/
|
||||
@Entity
|
||||
@Table (name="T_FORMACION")
|
||||
@Table(name = "T_FORMACION")
|
||||
public class Formacion {
|
||||
@Id
|
||||
private int identificador;
|
||||
private String codigo;
|
||||
|
||||
@Column(name="nombre_corto")
|
||||
@Column(name = "nombre_corto")
|
||||
private String nombreCorto;
|
||||
|
||||
@Column(name="indicador_stem")
|
||||
private boolean indicadorSTEM;
|
||||
@Enumerated(EnumType.STRING) // Se almacena el valor de un enumerado
|
||||
@Column(name = "indicador_stem")
|
||||
private EIndicadorSTEM indicadorSTEM;
|
||||
|
||||
@Column(name = "numero_cursos")
|
||||
private int numeroCursos;
|
||||
|
||||
@ManyToOne()
|
||||
@JoinColumn(name="id_ciclo", nullable = false )
|
||||
private CicloFormativo cicloFormativo;
|
||||
@JoinColumn(name = "cod_nivel", nullable = false)
|
||||
private NivelFormativo nivelFormativo;
|
||||
|
||||
public int getIdentificador() {
|
||||
return identificador;
|
||||
}
|
||||
|
||||
public void setIdentificador(int identificador) {
|
||||
this.identificador = identificador;
|
||||
}
|
||||
|
||||
public String getNombreCorto() {
|
||||
return nombreCorto;
|
||||
@ -47,26 +45,42 @@ public class Formacion {
|
||||
this.nombreCorto = nombreCorto;
|
||||
}
|
||||
|
||||
public boolean isIndicadorSTEM() {
|
||||
public EIndicadorSTEM getIndicadorSTEM() {
|
||||
return indicadorSTEM;
|
||||
}
|
||||
|
||||
public void setIndicadorSTEM(boolean indicadorSTEM) {
|
||||
public void setIndicadorSTEM(EIndicadorSTEM indicadorSTEM) {
|
||||
this.indicadorSTEM = indicadorSTEM;
|
||||
}
|
||||
|
||||
public CicloFormativo getCicloFormativo() {
|
||||
return cicloFormativo;
|
||||
public int getNumeroCursos() {
|
||||
return numeroCursos;
|
||||
}
|
||||
|
||||
public void setCicloFormativo(CicloFormativo cicloFormativo) {
|
||||
this.cicloFormativo = cicloFormativo;
|
||||
public void setNumeroCursos(int numeroCursos) {
|
||||
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
|
||||
public String toString() {
|
||||
return "Formacion [identificador=" + identificador + ", nombreCorto=" + nombreCorto + ", indicadorSTEM="
|
||||
+ indicadorSTEM + ", cicloFormativo=" + cicloFormativo + "]\n";
|
||||
return "Formacion [codigo=" + codigo + ", nombreCorto=" + nombreCorto + ", indicadorSTEM=" + indicadorSTEM
|
||||
+ ", numeroCursos=" + numeroCursos + ", nivelFormativo=" + nivelFormativo + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
*/
|
||||
package org.comunidadmadrid.fp.dam2.vo;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import jakarta.persistence.EmbeddedId;
|
||||
@ -27,7 +29,7 @@ public class InstitutoFormacion {
|
||||
private Instituto instituto;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name="id_formacion", insertable=false, updatable=false)
|
||||
@JoinColumn(name="cod_formacion", insertable=false, updatable=false)
|
||||
private Formacion formacion;
|
||||
|
||||
@Column(name="anyo_academico")
|
||||
@ -38,32 +40,37 @@ public class InstitutoFormacion {
|
||||
public InstitutoFormacionID() {
|
||||
|
||||
}
|
||||
public InstitutoFormacionID(Integer idInstituto, Integer idFormacion) {
|
||||
this.idFormacion=idFormacion;
|
||||
public InstitutoFormacionID(Integer idInstituto, String codFormacion) {
|
||||
this.codFormacion=codFormacion;
|
||||
this.idIntituto=idInstituto;
|
||||
|
||||
}
|
||||
@Column(name="id_instituto")
|
||||
private Integer idIntituto;
|
||||
|
||||
@Column(name="id_formacion")
|
||||
private Integer idFormacion;
|
||||
@Column(name="cod_formacion")
|
||||
private String codFormacion;
|
||||
|
||||
|
||||
public boolean equals(Object o) {
|
||||
boolean resultado=false;
|
||||
if (o != null && o instanceof InstitutoFormacionID) {
|
||||
InstitutoFormacionID that = (InstitutoFormacionID) o;
|
||||
resultado= (this.idFormacion==that.idFormacion) && (this.idIntituto == that.idIntituto);
|
||||
}
|
||||
return resultado;
|
||||
}
|
||||
@Override
|
||||
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
|
||||
public String toString() {
|
||||
return "InstitutoFormacionID [idIntituto=" + idIntituto + ", idFormacion=" + idFormacion + "]";
|
||||
return "InstitutoFormacionID [idIntituto=" + idIntituto + ", idFormacion=" + codFormacion + "]";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,13 +18,11 @@ import jakarta.persistence.Table;
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="T_CICLO_FORMATIVO")
|
||||
public class CicloFormativo {
|
||||
@Table(name="T_NIVEL_FORMATIVO")
|
||||
public class NivelFormativo {
|
||||
@Id
|
||||
private int identificador;
|
||||
|
||||
@Column(name="nombre")
|
||||
private String nombre;
|
||||
@Column(name="codigo")
|
||||
private String codigo;
|
||||
|
||||
@Column(name="descripcion")
|
||||
private String descripcion;
|
||||
@ -35,21 +33,15 @@ public class CicloFormativo {
|
||||
@Column(name="imagen_ciclo", columnDefinition = "LONGBLOB")
|
||||
@Lob
|
||||
private byte[] imagenCiclo;
|
||||
|
||||
|
||||
|
||||
public int getIdentificador() {
|
||||
return identificador;
|
||||
public String getCodigo() {
|
||||
return codigo;
|
||||
}
|
||||
|
||||
public void setIdentificador(int identificador) {
|
||||
this.identificador = identificador;
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
public void setCodigo(String codigo) {
|
||||
this.codigo = codigo;
|
||||
}
|
||||
|
||||
public String getDescripcion() {
|
||||
@ -78,10 +70,8 @@ public class CicloFormativo {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CicloFormativo [identificador=" + identificador + ", nombre=" + nombre + ", descripcion=" + descripcion
|
||||
+ ", urlLogo=" + urlLogo + ", imagenCiclo=" + Arrays.toString(imagenCiclo) + "]\n";
|
||||
return "NivelFormativo [codigo=" + codigo + ", descripcion=" + descripcion + ", urlLogo=" + urlLogo
|
||||
+ ", imagenCiclo=" + Arrays.toString(imagenCiclo) + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
# Información sobre la Base de datos PostgreSQL
|
||||
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.password=postgresql_123
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<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 -->
|
||||
|
||||
<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.Formacion"></mapping>
|
||||
<mapping class="org.comunidadmadrid.fp.dam2.vo.InstitutoFormacion"></mapping>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user