Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
th-app-java
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oscar Enrique Gonzalez Escurra
th-app-java
Commits
255ffe9f
Commit
255ffe9f
authored
Nov 04, 2021
by
Cesar Giulano Gonzalez Maqueda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creacion de estudio con modelo nuevo
parent
83013cc5
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
150 additions
and
77 deletions
+150
-77
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
+20
-9
curriculumsearch/src/main/java/com/roshka/modelo/EstadoEstudio.java
+18
-0
curriculumsearch/src/main/java/com/roshka/modelo/Estudio.java
+8
-9
curriculumsearch/src/main/java/com/roshka/modelo/Experiencia.java
+2
-2
curriculumsearch/src/main/java/com/roshka/modelo/ExperienciaReconocimiento.java
+1
-1
curriculumsearch/src/main/java/com/roshka/modelo/Institucion.java
+33
-0
curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java
+3
-3
curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java
+1
-1
curriculumsearch/src/main/java/com/roshka/modelo/TipoDeEstudio.java
+13
-17
curriculumsearch/src/main/java/com/roshka/repositorio/InstitucionRepository.java
+8
-0
curriculumsearch/src/main/resources/static/main.js
+9
-3
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
+34
-32
No files found.
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
View file @
255ffe9f
...
...
@@ -5,10 +5,9 @@ import java.util.List;
import
javax.validation.ConstraintViolationException
;
import
com.roshka.modelo.Disponibilidad
;
import
com.roshka.modelo.Modalidad
;
import
com.roshka.modelo.Postulante
;
import
com.roshka.modelo.*
;
import
com.roshka.repositorio.ExperienciaRepository
;
import
com.roshka.repositorio.InstitucionRepository
;
import
com.roshka.repositorio.PostulanteRepository
;
import
com.roshka.repositorio.TecnologiaRepository
;
...
...
@@ -24,15 +23,18 @@ import org.springframework.web.bind.annotation.*;
@Controller
public
class
PostulanteController
{
@Autowired
PostulanteRepository
post
;
@Autowired
PostulanteRepository
post
;
TecnologiaRepository
tecRepo
;
@Autowired
ExperienciaRepository
expRepo
;
InstitucionRepository
institucionRepository
;
@Autowired
public
PostulanteController
(
PostulanteRepository
post
,
TecnologiaRepository
tecRepo
,
ExperienciaRepository
expRepo
,
InstitucionRepository
institucionRepository
)
{
this
.
post
=
post
;
this
.
tecRepo
=
tecRepo
;
this
.
expRepo
=
expRepo
;
this
.
institucionRepository
=
institucionRepository
;
}
@RequestMapping
(
"/"
)
public
String
index
()
{
...
...
@@ -53,11 +55,20 @@ public class PostulanteController {
model
.
addAttribute
(
"tecnologias"
,
tecRepo
.
findAll
());
model
.
addAttribute
(
"modalidades"
,
Modalidad
.
values
());
model
.
addAttribute
(
"disponibilidades"
,
Disponibilidad
.
values
());
model
.
addAttribute
(
"tiposDeEstudio"
,
TipoDeEstudio
.
values
());
model
.
addAttribute
(
"estadosEstudio"
,
EstadoEstudio
.
values
());
return
"postulante-form"
;
}
@PostMapping
(
value
=
"/postulante"
,
consumes
=
"application/json"
)
public
String
guardarPostulante
(
@RequestBody
Postulante
postulante
){
System
.
out
.
println
(
"hola"
);
for
(
Estudio
estudio:
postulante
.
getEstudios
()){
if
(
institucionRepository
.
findByNombre
(
estudio
.
getInstitucion
().
getNombre
())==
null
){
institucionRepository
.
save
(
estudio
.
getInstitucion
());
}
}
System
.
out
.
println
(
"hola"
);
post
.
save
(
postulante
);
return
"redirect:/"
;
}
...
...
curriculumsearch/src/main/java/com/roshka/modelo/EstadoEstudio.java
0 → 100644
View file @
255ffe9f
package
com
.
roshka
.
modelo
;
public
enum
EstadoEstudio
{
CURSANDO
(
"Cursando"
),
FINALIZADO
(
"Finalizado"
),
SUSPENDIDO
(
"Suspendido"
),
TESIS
(
"En Proceso de Tesis"
);
private
final
String
name
;
EstadoEstudio
(
String
name
){
this
.
name
=
name
;
}
public
String
getName
(){
return
this
.
name
;
}
}
curriculumsearch/src/main/java/com/roshka/modelo/Estudio.java
View file @
255ffe9f
...
...
@@ -19,9 +19,8 @@ public class Estudio {
@Column
(
name
=
"id"
)
private
long
id
;
@
ManyToOne
(
fetch
=
FetchType
.
EAGER
)
@
Column
(
name
=
"tipo_de_estudio"
)
@NotNull
(
message
=
"Este campo no puede ser null"
)
@JsonBackReference
private
TipoDeEstudio
tipoDeEstudio
;
@NotNull
(
message
=
"Este campo no puede estar vacio"
)
...
...
@@ -29,15 +28,15 @@ public class Estudio {
@JsonBackReference
private
Institucion
institucion
;
@Column
(
name
=
"estado"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
estado
;
//Carrera, Bachiller
@Column
(
name
=
"tema_de_estudio"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
temaDeEstudio
;
@Column
(
name
=
"estado"
)
@NotNull
(
message
=
"Este campo no puede estar vacio"
)
private
EstadoEstudio
estado
;
@Column
(
name
=
"fecha_desde"
)
@NotNull
(
message
=
"Este campo no puede estar vacio"
)
@Past
(
message
=
"Este campo no puede estar en el futuro"
)
...
...
@@ -49,7 +48,7 @@ public class Estudio {
@ManyToOne
@JoinColumn
@JsonBackReference
@JsonBackReference
(
value
=
"estudio-postulante"
)
private
Postulante
postulante
;
public
Postulante
getPostulante
()
{
...
...
@@ -79,7 +78,7 @@ public class Estudio {
this
.
institucion
=
institucion
;
}
public
void
setEstado
(
String
estado
)
{
public
void
setEstado
(
EstadoEstudio
estado
)
{
this
.
estado
=
estado
;
}
...
...
@@ -99,7 +98,7 @@ public class Estudio {
return
institucion
;
}
public
String
getEstado
()
{
public
EstadoEstudio
getEstado
()
{
return
estado
;
}
...
...
curriculumsearch/src/main/java/com/roshka/modelo/Experiencia.java
View file @
255ffe9f
...
...
@@ -48,12 +48,12 @@ public class Experiencia {
@Column
(
name
=
"descripcion"
)
private
String
descripcion
;
@JsonBackReference
@JsonBackReference
(
value
=
"experiencia-postulante"
)
@ManyToOne
(
optional
=
false
)
@JoinColumn
private
Postulante
postulante
;
@JsonManagedReference
@JsonManagedReference
(
value
=
"experienciareconocimiento-experiencia"
)
@OneToMany
(
mappedBy
=
"experiencia"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
ExperienciaReconocimiento
>
reconocimientos
;
...
...
curriculumsearch/src/main/java/com/roshka/modelo/ExperienciaReconocimiento.java
View file @
255ffe9f
...
...
@@ -14,7 +14,7 @@ public class ExperienciaReconocimiento {
@ManyToOne
(
optional
=
false
)
@JoinColumn
@JsonBackReference
@JsonBackReference
(
value
=
"experienciareconocimiento-experiencia"
)
private
Experiencia
experiencia
;
@Column
(
name
=
"nombre"
)
...
...
curriculumsearch/src/main/java/com/roshka/modelo/Institucion.java
View file @
255ffe9f
...
...
@@ -10,6 +10,7 @@ import java.util.List;
@Table
(
name
=
"institucion"
)
public
class
Institucion
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@Column
(
name
=
"id"
)
private
long
id
;
...
...
@@ -24,4 +25,36 @@ public class Institucion {
@OneToMany
(
cascade
=
CascadeType
.
PERSIST
,
mappedBy
=
"institucion"
,
fetch
=
FetchType
.
LAZY
)
@JsonManagedReference
private
List
<
Estudio
>
estudioList
;
public
long
getId
()
{
return
id
;
}
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
}
public
String
getNombre
()
{
return
nombre
;
}
public
void
setNombre
(
String
nombre
)
{
this
.
nombre
=
nombre
;
}
public
String
getSubNombre
()
{
return
subNombre
;
}
public
void
setSubNombre
(
String
subNombre
)
{
this
.
subNombre
=
subNombre
;
}
public
List
<
Estudio
>
getEstudioList
()
{
return
estudioList
;
}
public
void
setEstudioList
(
List
<
Estudio
>
estudioList
)
{
this
.
estudioList
=
estudioList
;
}
}
curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java
View file @
255ffe9f
...
...
@@ -71,15 +71,15 @@ public class Postulante {
@Column
(
name
=
"disponibilidad"
,
length
=
2
)
private
Disponibilidad
disponibilidad
;
@JsonManagedReference
@JsonManagedReference
(
value
=
"postulantetecnologia-postulante"
)
@OneToMany
(
mappedBy
=
"postulante"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
PostulanteTecnologia
>
tecnologias
;
@JsonManagedReference
@JsonManagedReference
(
value
=
"experiencia-postulante"
)
@OneToMany
(
mappedBy
=
"postulante"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
Experiencia
>
experiencias
=
new
ArrayList
<>();
@JsonManagedReference
@JsonManagedReference
(
value
=
"estudio-postulante"
)
@OneToMany
(
mappedBy
=
"postulante"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
Estudio
>
estudios
;
...
...
curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java
View file @
255ffe9f
...
...
@@ -35,7 +35,7 @@ public class PostulanteTecnologia {
@ManyToOne
()
@JoinColumn
@JsonBackReference
@JsonBackReference
(
value
=
"postulantetecnologia-postulante"
)
private
Postulante
postulante
;
public
long
getId
()
{
return
id
;
...
...
curriculumsearch/src/main/java/com/roshka/modelo/TipoDeEstudio.java
View file @
255ffe9f
package
com
.
roshka
.
modelo
;
import
com.fasterxml.jackson.annotation.JsonManagedReference
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
java.util.List
;
@Entity
@Table
(
name
=
"tipo_de_estudio"
)
public
class
TipoDeEstudio
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@Column
(
name
=
"id"
)
private
long
id
;
public
enum
TipoDeEstudio
{
TERCIARIO
(
"Terciario"
),
SECUNDARIO
(
"Secundario"
),
CURSO
(
"Curso"
),
OTRO
(
"Otro"
);
@Column
(
name
=
"nombre"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
nombre
;
private
final
String
name
;
@OneToMany
(
cascade
=
CascadeType
.
PERSIST
,
mappedBy
=
"tipoDeEstudio"
,
fetch
=
FetchType
.
LAZY
)
@JsonManagedReference
private
List
<
Estudio
>
estudioList
;
TipoDeEstudio
(
String
name
){
this
.
name
=
name
;
}
public
String
getName
(){
return
this
.
name
;
}
}
curriculumsearch/src/main/java/com/roshka/repositorio/InstitucionRepository.java
0 → 100644
View file @
255ffe9f
package
com
.
roshka
.
repositorio
;
import
com.roshka.modelo.Institucion
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
InstitucionRepository
extends
JpaRepository
<
Institucion
,
Long
>
{
public
Institucion
findByNombre
(
String
nombre
);
}
curriculumsearch/src/main/resources/static/main.js
View file @
255ffe9f
...
...
@@ -202,8 +202,8 @@ document.querySelector("#btn-new-tech").addEventListener('click',()=>{document.q
function
agregarFieldEstudio
(){
//recoger del form
cons
t
pairs
=
{};
const
formest
=
document
.
querySelector
(
"[name=estudio-form"
);
le
t
pairs
=
{};
const
formest
=
document
.
querySelector
(
"[name=estudio-form
]
"
);
const
formData
=
new
FormData
(
formest
);
const
estudioReconocimiento
=
[{},{},{}];
let
pos_rec
;
...
...
@@ -217,6 +217,12 @@ function agregarFieldEstudio(){
}
}
let
nombre
=
pairs
[
"institucion"
]
delete
pairs
[
"institucion"
]
console
.
log
(
pairs
)
pairs
[
"institucion"
]
=
{
}
pairs
[
"institucion"
].
nombre
=
nombre
pairs
[
"institucion"
].
subNombre
=
""
pairs
[
"estudioReconocimiento"
]
=
estudioReconocimiento
.
filter
(
rec
=>
rec
.
nombre
);
estudios
[
cont_estudios
]
=
pairs
;
formest
.
reset
();
...
...
@@ -230,7 +236,7 @@ function agregarFieldEstudio(){
if
(
est
==
null
)
continue
;
content
+=
`
<li id="est-
${
index
}
">
${
est
.
institucion
}
${
est
.
institucion
.
nombre
}
<button type="button" onclick="eliminarEstudio(event)">Eliminar</button>
</li>
...
...
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
View file @
255ffe9f
...
...
@@ -406,41 +406,43 @@
</div>
<div
class=
"modal-body"
>
<form
name=
"estudio-form"
>
<label
for=
"tipoDeEstudio"
class=
"form-label"
>
Tipo De Estudio
</label>
<input
type=
"text"
class=
"form-control "
name=
"tipoDeEstudio"
id=
"tipoDeEstudio"
>
<label
for=
"institucion"
class=
"form-label"
>
Institucion
</label>
<input
type=
"text"
class=
"form-control "
name=
"institucion"
id=
"institucion"
>
<label
for=
"fechaDesde"
class=
"form-label"
>
Fecha Desde
</label>
<input
type=
"date"
class=
"form-control "
name=
"fechaDesde"
id=
"fechaDesde"
>
<label
for=
"fechaHasta"
class=
"form-label"
>
Fecha Hasta
</label>
<input
type=
"date"
class=
"form-control "
name=
"fechaHasta"
id=
"fechaHasta"
>
<label
for=
"titulo"
class=
"form-label"
>
Titulo
</label>
<input
type=
"text"
class=
"form-control "
name=
"titulo"
id=
"titulo"
>
<label
class=
"form-label"
>
Reconocimientos
</label>
<div
class=
"row mb-3"
>
<div
class=
"col"
>
<input
type=
"text"
class=
"form-control"
name=
"rec-nombre-0"
placeholder=
"Titulo del reconocimiento"
aria-label=
"First name"
>
</div>
<div
class=
"col"
>
<input
type=
"text"
class=
"form-control"
name=
"rec-certificado-0"
placeholder=
"Adjuntar archivo"
aria-label=
"Last name"
>
</div>
<div
class=
"form-group"
>
<label
for=
"tipoDeEstudio"
>
Tipo de Estudio
</label>
<select
name=
"tipoDeEstudio"
id=
"tipoDeEstudio"
>
<option
value=
"-1"
selected
disabled
hidden
>
Seleccionar
</option>
<c:forEach
items=
"${tiposDeEstudio}"
var=
"tipo"
>
<option
value=
"${tipo}"
>
${tipo.name}
</option>
</c:forEach>
</select>
</div>
<div
class=
"row mb-3"
>
<div
class=
"col"
>
<input
type=
"text"
class=
"form-control"
name=
"rec-nombre-1"
placeholder=
"Titulo del reconocimiento"
aria-label=
"First name"
>
</div>
<div
class=
"col"
>
<input
type=
"text"
class=
"form-control"
name=
"rec-certificado-1"
placeholder=
"Adjuntar archivo"
aria-label=
"Last name"
>
</div>
<
%
--
<
label
for=
"tipoDeEstudio"
class=
"form-label"
>
Tipo De Estudio
</label>
--%>
<
%
--
<
input
type=
"text"
class=
"form-control "
name=
"tipoDeEstudio"
id=
"tipoDeEstudio"
>
--%>
<div
class=
"form-group"
>
<label
for=
"institucion"
class=
"form-label"
>
Institucion
</label>
<input
type=
"text"
class=
"form-control"
name=
"institucion"
id=
"institucion"
>
</div>
<div
class=
"row mb-3"
>
<div
class=
"col"
>
<input
type=
"text"
class=
"form-control"
name=
"rec-nombre-2"
placeholder=
"Titulo del reconocimiento"
aria-label=
"First name"
>
</div>
<div
class=
"col"
>
<input
type=
"text"
class=
"form-control"
name=
"rec-certificado-2"
placeholder=
"Adjuntar archivo"
aria-label=
"Last name"
>
<div
class=
"form-group"
>
<label
for=
"temaDeEstudio"
class=
"form-label"
>
Carrera/Bachiller/Tema de Curso
</label>
<input
type=
"text"
class=
"form-control"
name=
"temaDeEstudio"
id=
"temaDeEstudio"
>
</div>
<div
class=
"form-group"
>
<label
for=
"estado"
>
Estado
</label>
<select
name=
"estado"
id=
"estado"
>
<option
value=
"-1"
selected
disabled
hidden
>
Seleccionar
</option>
<c:forEach
items=
"${estadosEstudio}"
var=
"estado"
>
<option
value=
"${estado}"
>
${estado.name}
</option>
</c:forEach>
</select>
</div>
<div
class=
"form-group"
>
<label
for=
"fechaDesde"
class=
"form-label"
>
Fecha Desde
</label>
<input
type=
"date"
class=
"form-control "
name=
"fechaDesde"
id=
"fechaDesde"
>
</div>
<div
class=
"form-group"
>
<label
for=
"fechaHasta"
class=
"form-label"
>
Fecha Hasta
</label>
<input
type=
"date"
class=
"form-control "
name=
"fechaHasta"
id=
"fechaHasta"
>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment