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
6eec4fd0
Commit
6eec4fd0
authored
Nov 03, 2021
by
Nelson Ruiz
Browse files
Options
Browse Files
Download
Plain Diff
Se modifivo vista de formulario, sea gregaron modales de estudio y tecnologia
parents
77746912
c492342c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
363 additions
and
91 deletions
+363
-91
curriculumsearch/pom.xml
+16
-0
curriculumsearch/src/main/java/com/roshka/CurriculumsearchApplication.java
+1
-0
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
+36
-10
curriculumsearch/src/main/java/com/roshka/modelo/Estudio.java
+24
-12
curriculumsearch/src/main/java/com/roshka/modelo/EstudioReconocimiento.java
+6
-0
curriculumsearch/src/main/java/com/roshka/modelo/Experiencia.java
+31
-24
curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java
+19
-9
curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java
+38
-28
curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java
+2
-0
curriculumsearch/src/main/java/com/roshka/utils/Helper.java
+24
-0
curriculumsearch/src/main/resources/application.properties
+4
-1
curriculumsearch/src/main/resources/static/main.js
+162
-7
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
+0
-0
No files found.
curriculumsearch/pom.xml
View file @
6eec4fd0
...
@@ -47,6 +47,22 @@
...
@@ -47,6 +47,22 @@
<artifactId>
spring-boot-devtools
</artifactId>
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
<optional>
true
</optional>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-validation
</artifactId>
</dependency>
<dependency>
<groupId>
org.hibernate.validator
</groupId>
<artifactId>
hibernate-validator
</artifactId>
<version>
6.0.13.Final
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
jstl
</artifactId>
<version>
1.2
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
curriculumsearch/src/main/java/com/roshka/CurriculumsearchApplication.java
View file @
6eec4fd0
...
@@ -14,4 +14,5 @@ public class CurriculumsearchApplication {
...
@@ -14,4 +14,5 @@ public class CurriculumsearchApplication {
SpringApplication
.
run
(
CurriculumsearchApplication
.
class
,
args
);
SpringApplication
.
run
(
CurriculumsearchApplication
.
class
,
args
);
}
}
}
}
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
View file @
6eec4fd0
package
com
.
roshka
.
controller
;
package
com
.
roshka
.
controller
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.ConstraintViolationException
;
import
com.roshka.modelo.Experiencia
;
import
com.roshka.modelo.Postulante
;
import
com.roshka.modelo.Postulante
;
import
com.roshka.repositorio.PostulanteRepository
;
import
com.roshka.repositorio.PostulanteRepository
;
import
com.roshka.repositorio.TecnologiaRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.
web.bind.annotation.PostMapping
;
import
org.springframework.
ui.Model
;
import
org.springframework.web.bind.
annotation.RequestBody
;
import
org.springframework.web.bind.
MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.
RequestMapping
;
import
org.springframework.web.bind.annotation.
*
;
@Controller
@Controller
public
class
PostulanteController
{
public
class
PostulanteController
{
@Autowired
@Autowired
PostulanteRepository
post
;
PostulanteRepository
post
;
@Autowired
TecnologiaRepository
tecRepo
;
@RequestMapping
(
"/"
)
@RequestMapping
(
"/"
)
public
String
index
()
{
public
String
index
()
{
return
"index"
;
return
"index"
;
}
}
@RequestMapping
(
"/postulante"
)
@RequestMapping
(
"/postulante"
)
public
String
getFormPostulante
(){
public
String
getFormPostulante
(
Model
model
){
model
.
addAttribute
(
"tecnologias"
,
tecRepo
.
findAll
());
return
"postulante-form"
;
return
"postulante-form"
;
}
}
@PostMapping
(
value
=
"/postulante"
,
consumes
=
"application/json"
)
@PostMapping
(
value
=
"/postulante"
,
consumes
=
"application/json"
)
public
String
guardarPostulante
(
@RequestBody
Postulante
postulante
){
public
String
guardarPostulante
(
@RequestBody
Postulante
postulante
){
//se obtiene referencia de todas las tecnologias existentes
postulante
.
getTecnologias
().
stream
().
filter
(
tec
->
tec
.
getTecnologia
().
getId
()
!=
0
).
forEach
(
tec
->
tec
.
setTecnologia
(
tecRepo
.
getById
(
tec
.
getTecnologia
().
getId
()))
);
post
.
save
(
postulante
);
post
.
save
(
postulante
);
return
"redirect:/"
;
return
"redirect:/"
;
}
}
@ResponseStatus
(
HttpStatus
.
BAD_REQUEST
)
@ExceptionHandler
({
MethodArgumentNotValidException
.
class
})
public
ResponseEntity
<
String
>
handleValidationExceptions
(
MethodArgumentNotValidException
ex
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
BAD_REQUEST
)
.
body
(
ex
.
getMessage
());
}
@ResponseStatus
(
HttpStatus
.
BAD_REQUEST
)
@ExceptionHandler
({
ConstraintViolationException
.
class
})
public
ResponseEntity
<
String
>
handleValidationExceptions2
(
ConstraintViolationException
ex
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
BAD_REQUEST
)
.
body
(
ex
.
getMessage
());
}
}
}
curriculumsearch/src/main/java/com/roshka/modelo/Estudio.java
View file @
6eec4fd0
...
@@ -3,6 +3,7 @@ package com.roshka.modelo;
...
@@ -3,6 +3,7 @@ package com.roshka.modelo;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GeneratedValue
;
...
@@ -12,27 +13,39 @@ import javax.persistence.JoinColumn;
...
@@ -12,27 +13,39 @@ import javax.persistence.JoinColumn;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToMany
;
import
javax.persistence.OneToMany
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Past
;
import
com.fasterxml.jackson.annotation.JsonBackReference
;
import
com.fasterxml.jackson.annotation.JsonBackReference
;
import
com.fasterxml.jackson.annotation.JsonManagedReference
;
import
com.fasterxml.jackson.annotation.JsonManagedReference
;
import
com.roshka.utils.Helper
;
@Entity
@Entity
@Table
(
name
=
"estudio"
)
@Table
(
name
=
"estudio"
)
public
class
Estudio
{
public
class
Estudio
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@Column
(
name
=
"id"
)
@Column
(
name
=
"id"
)
private
long
id
;
private
long
id
;
@Column
(
name
=
"tipo_de_studio"
)
@Column
(
name
=
"tipo_de_studio"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
tipoDeEstudio
;
private
String
tipoDeEstudio
;
@Column
(
name
=
"institucion"
)
@Column
(
name
=
"institucion"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
institucion
;
private
String
institucion
;
@Column
(
name
=
"fecha_desde"
)
@Column
(
name
=
"fecha_desde"
)
@NotNull
(
message
=
"Este campo no puede estar vacio"
)
@Past
(
message
=
"Este campo no puede estar en el futuro"
)
private
Date
fechaDesde
;
private
Date
fechaDesde
;
@Column
(
name
=
"fecha_hasta"
)
@Column
(
name
=
"fecha_hasta"
)
private
Date
fechaHasta
;
private
Date
fechaHasta
;
@Column
(
name
=
"referencias"
)
private
String
referencias
;
@Column
(
name
=
"titulo"
)
@Column
(
name
=
"titulo"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
titulo
;
private
String
titulo
;
@ManyToOne
@ManyToOne
...
@@ -41,7 +54,7 @@ public class Estudio {
...
@@ -41,7 +54,7 @@ public class Estudio {
private
Postulante
postulante
;
private
Postulante
postulante
;
@JsonManagedReference
@JsonManagedReference
@OneToMany
(
mappedBy
=
"estudio"
)
@OneToMany
(
mappedBy
=
"estudio"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
EstudioReconocimiento
>
estudioReconocimiento
;
private
List
<
EstudioReconocimiento
>
estudioReconocimiento
;
...
@@ -62,6 +75,13 @@ public class Estudio {
...
@@ -62,6 +75,13 @@ public class Estudio {
this
.
postulante
=
postulante
;
this
.
postulante
=
postulante
;
}
}
public
void
setFechaDesde
(
String
fechaDesde
)
{
this
.
fechaDesde
=
Helper
.
convertirFecha
(
fechaDesde
);
}
public
void
setFechaHasta
(
String
fechaHasta
)
{
this
.
fechaHasta
=
Helper
.
convertirFecha
(
fechaHasta
);
}
public
long
getId
()
{
public
long
getId
()
{
...
@@ -105,14 +125,6 @@ public class Estudio {
...
@@ -105,14 +125,6 @@ public class Estudio {
this
.
fechaHasta
=
fechaHasta
;
this
.
fechaHasta
=
fechaHasta
;
}
}
public
String
getReferencias
()
{
return
this
.
referencias
;
}
public
void
setReferencias
(
String
referencias
)
{
this
.
referencias
=
referencias
;
}
public
String
getTitulo
()
{
public
String
getTitulo
()
{
return
this
.
titulo
;
return
this
.
titulo
;
}
}
...
...
curriculumsearch/src/main/java/com/roshka/modelo/EstudioReconocimiento.java
View file @
6eec4fd0
...
@@ -9,6 +9,7 @@ import javax.persistence.Id;
...
@@ -9,6 +9,7 @@ import javax.persistence.Id;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotBlank
;
import
com.fasterxml.jackson.annotation.JsonBackReference
;
import
com.fasterxml.jackson.annotation.JsonBackReference
;
...
@@ -19,10 +20,15 @@ public class EstudioReconocimiento {
...
@@ -19,10 +20,15 @@ public class EstudioReconocimiento {
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@Column
(
name
=
"id"
)
@Column
(
name
=
"id"
)
private
Long
id
;
private
Long
id
;
@Column
(
name
=
"nombre"
)
@Column
(
name
=
"nombre"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
nombre
;
private
String
nombre
;
@Column
(
name
=
"certificado"
)
@Column
(
name
=
"certificado"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
certificado
;
private
String
certificado
;
@JsonBackReference
@JsonBackReference
@ManyToOne
@ManyToOne
@JoinColumn
@JoinColumn
...
...
curriculumsearch/src/main/java/com/roshka/modelo/Experiencia.java
View file @
6eec4fd0
...
@@ -12,8 +12,12 @@ import javax.persistence.GenerationType;
...
@@ -12,8 +12,12 @@ import javax.persistence.GenerationType;
import
com.fasterxml.jackson.annotation.JsonBackReference
;
import
com.fasterxml.jackson.annotation.JsonBackReference
;
import
com.fasterxml.jackson.annotation.JsonManagedReference
;
import
com.fasterxml.jackson.annotation.JsonManagedReference
;
import
com.roshka.utils.Helper
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Past
;
@Entity
@Entity
@Table
(
name
=
"experiencia"
)
@Table
(
name
=
"experiencia"
)
...
@@ -21,18 +25,29 @@ public class Experiencia {
...
@@ -21,18 +25,29 @@ public class Experiencia {
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
private
long
id
;
private
long
id
;
@Column
(
name
=
"institucion"
)
@Column
(
name
=
"institucion"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
institucion
;
private
String
institucion
;
@Column
(
name
=
"fecha_desde"
)
@Column
(
name
=
"fecha_desde"
)
@Past
(
message
=
"Este campo no puede estar en el futuro"
)
@NotNull
(
message
=
"Este campo no puede estar vacio"
)
private
Date
fechaDesde
;
private
Date
fechaDesde
;
@Column
(
name
=
"fecha_hasta"
)
@Column
(
name
=
"fecha_hasta"
)
private
Date
fechaHasta
;
private
Date
fechaHasta
;
@Column
(
name
=
"referencias"
)
@Column
(
name
=
"nombre_referencia"
)
private
String
referencias
;
private
String
nombreReferencia
;
@Column
(
name
=
"telefono_referencia"
)
private
String
telefonoReferencia
;
@Column
(
name
=
"cargo"
)
@Column
(
name
=
"cargo"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
cargo
;
private
String
cargo
;
@Column
(
name
=
"descripcion"
)
@Column
(
name
=
"descripcion"
)
private
String
descripcion
;
private
String
descripcion
;
@JsonBackReference
@JsonBackReference
@ManyToOne
(
optional
=
false
)
@ManyToOne
(
optional
=
false
)
@JoinColumn
@JoinColumn
...
@@ -55,14 +70,7 @@ public class Experiencia {
...
@@ -55,14 +70,7 @@ public class Experiencia {
this
.
institucion
=
institucion
;
this
.
institucion
=
institucion
;
}
}
public
void
setFechaDesde
(
String
fechaDesde
)
{
public
void
setFechaDesde
(
String
fechaDesde
)
{
if
(
fechaDesde
==
null
||
fechaDesde
.
isEmpty
())
return
;
this
.
fechaDesde
=
Helper
.
convertirFecha
(
fechaDesde
);
try
{
this
.
fechaDesde
=
new
SimpleDateFormat
(
"yyyy-mm-dd"
).
parse
(
fechaDesde
);
}
catch
(
ParseException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
public
Date
getFechaHasta
()
{
public
Date
getFechaHasta
()
{
return
fechaHasta
;
return
fechaHasta
;
...
@@ -71,20 +79,19 @@ public class Experiencia {
...
@@ -71,20 +79,19 @@ public class Experiencia {
this
.
fechaHasta
=
fechaHasta
;
this
.
fechaHasta
=
fechaHasta
;
}
}
public
void
setFechaHasta
(
String
fechaHasta
)
{
public
void
setFechaHasta
(
String
fechaHasta
)
{
if
(
fechaHasta
==
null
||
fechaHasta
.
isEmpty
())
return
;
this
.
fechaHasta
=
Helper
.
convertirFecha
(
fechaHasta
);
}
try
{
public
String
getNombreReferencia
()
{
this
.
fechaHasta
=
new
SimpleDateFormat
(
"yyyy-mm-dd"
).
parse
(
fechaHasta
);
return
nombreReferencia
;
}
catch
(
ParseException
e
)
{
}
// TODO Auto-generated catch block
public
String
getTelefonoReferencia
()
{
e
.
printStackTrace
();
return
telefonoReferencia
;
}
}
}
public
void
setNombreReferencia
(
String
nombreReferencia
)
{
public
String
getReferencias
()
{
this
.
nombreReferencia
=
nombreReferencia
;
return
referencias
;
}
}
public
void
setTelefonoReferencia
(
String
telefonoReferencia
)
{
public
void
setReferencias
(
String
referencias
)
{
this
.
telefonoReferencia
=
telefonoReferencia
;
this
.
referencias
=
referencias
;
}
}
public
String
getCargo
()
{
public
String
getCargo
()
{
return
cargo
;
return
cargo
;
...
...
curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java
View file @
6eec4fd0
package
com
.
roshka
.
modelo
;
package
com
.
roshka
.
modelo
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.*
;
import
com.fasterxml.jackson.annotation.JsonManagedReference
;
import
com.fasterxml.jackson.annotation.JsonManagedReference
;
import
com.roshka.utils.Helper
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -20,36 +22,52 @@ public class Postulante {
...
@@ -20,36 +22,52 @@ public class Postulante {
private
long
id
;
private
long
id
;
@Column
(
name
=
"nombre"
)
@Column
(
name
=
"nombre"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
@Size
(
max
=
255
)
private
String
nombre
;
private
String
nombre
;
@Column
(
name
=
"apellido"
)
@Column
(
name
=
"apellido"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
@Size
(
max
=
255
)
private
String
apellido
;
private
String
apellido
;
@Column
(
name
=
"ci"
)
@Column
(
name
=
"ci"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
@Size
(
max
=
120
)
private
String
ci
;
private
String
ci
;
@Column
(
name
=
"correo"
)
@Column
(
name
=
"correo"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
@Email
(
message
=
"Formato incorrecto de correo"
)
private
String
correo
;
private
String
correo
;
@Column
(
name
=
"ciudad"
)
@Column
(
name
=
"ciudad"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
@Size
(
max
=
120
)
private
String
ciudad
;
private
String
ciudad
;
@Column
(
name
=
"telefono"
)
@Column
(
name
=
"telefono"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
telefono
;
private
String
telefono
;
@Column
(
name
=
"fecha_nacimiento"
)
@Column
(
name
=
"fecha_nacimiento"
)
@NotNull
(
message
=
"Este campo no puede estar vacio"
)
@Past
(
message
=
"Este campo no puede estar en el futuro"
)
private
Date
fechaNacimiento
;
private
Date
fechaNacimiento
;
@Column
(
name
=
"resumen"
)
@Column
(
name
=
"resumen"
)
private
String
resumen
;
private
String
resumen
;
@Column
(
name
=
"nivel_ingles"
)
@Column
(
name
=
"nivel_ingles"
)
@Min
(
value
=
1
)
@Max
(
value
=
5
)
private
long
nivelIngles
;
private
long
nivelIngles
;
@Column
(
name
=
"curriculum"
)
@Column
(
name
=
"curriculum"
)
private
String
curriculum
;
private
String
curriculum
;
@Column
(
name
=
"modalidad"
)
@Column
(
name
=
"modalidad"
)
@NotNull
private
String
modalidad
;
private
String
modalidad
;
@Column
(
name
=
"disponibilidad"
)
@Column
(
name
=
"disponibilidad"
)
...
@@ -133,15 +151,7 @@ public class Postulante {
...
@@ -133,15 +151,7 @@ public class Postulante {
}
}
public
void
setFechaNacimiento
(
String
fechaNacimiento
)
{
public
void
setFechaNacimiento
(
String
fechaNacimiento
)
{
if
(
fechaNacimiento
==
null
||
fechaNacimiento
.
isEmpty
())
return
;
this
.
fechaNacimiento
=
Helper
.
convertirFecha
(
fechaNacimiento
);
try
{
this
.
fechaNacimiento
=
new
SimpleDateFormat
(
"yyyy-mm-dd"
).
parse
(
fechaNacimiento
);
}
catch
(
ParseException
e
)
{
// TODO Auto-generated catch block
System
.
err
.
println
(
"Error al parsear"
);
e
.
printStackTrace
();
}
}
}
public
String
getResumen
()
{
public
String
getResumen
()
{
...
...
curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java
View file @
6eec4fd0
package
com
.
roshka
.
modelo
;
package
com
.
roshka
.
modelo
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GeneratedValue
;
...
@@ -8,49 +9,58 @@ import javax.persistence.Id;
...
@@ -8,49 +9,58 @@ import javax.persistence.Id;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotBlank
;
import
com.fasterxml.jackson.annotation.JsonBackReference
;
import
com.fasterxml.jackson.annotation.JsonBackReference
;
@Entity
@Entity
@Table
(
name
=
"postulante_tecnologia"
)
@Table
(
name
=
"postulante_tecnologia"
,
uniqueConstraints
=
@UniqueConstraint
(
columnNames
={
"postulante_id"
,
"tecnologia_id"
}))
public
class
PostulanteTecnologia
{
public
class
PostulanteTecnologia
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@Column
(
name
=
"id"
)
@Column
(
name
=
"id"
)
private
long
id
;
private
long
id
;
@Column
(
name
=
"nivel"
)
@Column
(
name
=
"nivel"
)
@Min
(
value
=
1
)
@Max
(
value
=
5
)
private
Long
nivel
;
private
Long
nivel
;
@ManyToOne
()
@ManyToOne
(
cascade
=
{
CascadeType
.
PERSIST
,
CascadeType
.
MERGE
},
optional
=
false
)
@JoinColumn
@JoinColumn
private
Tecnologia
tecnologia
;
private
Tecnologia
tecnologia
;
@ManyToOne
()
@ManyToOne
()
@JoinColumn
@JoinColumn
@JsonBackReference
@JsonBackReference
private
Postulante
postulante
;
private
Postulante
postulante
;
public
long
getId
()
{
public
long
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
long
id
)
{
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
Long
getNivel
()
{
public
Long
getNivel
()
{
return
nivel
;
return
nivel
;
}
}
public
void
setNivel
(
Long
nivel
)
{
public
void
setNivel
(
Long
nivel
)
{
this
.
nivel
=
nivel
;
this
.
nivel
=
nivel
;
}
}
public
Tecnologia
getTecnologia
()
{
public
Tecnologia
getTecnologia
()
{
return
tecnologia
;
return
tecnologia
;
}
}
public
void
setTecnologia
(
Tecnologia
tecnologia
)
{
public
void
setTecnologia
(
Tecnologia
tecnologia
)
{
this
.
tecnologia
=
tecnologia
;
this
.
tecnologia
=
tecnologia
;
}
}
public
Postulante
getPostulante
()
{
public
Postulante
getPostulante
()
{
return
postulante
;
return
postulante
;
}
}
public
void
setPostulante
(
Postulante
postulante
)
{
public
void
setPostulante
(
Postulante
postulante
)
{
this
.
postulante
=
postulante
;
this
.
postulante
=
postulante
;
}
}
...
...
curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java
View file @
6eec4fd0
...
@@ -6,6 +6,7 @@ import javax.persistence.GeneratedValue;
...
@@ -6,6 +6,7 @@ import javax.persistence.GeneratedValue;
import
javax.persistence.GenerationType
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotBlank
;
@Entity
@Entity
@Table
(
name
=
"tecnologia"
)
@Table
(
name
=
"tecnologia"
)
...
@@ -16,6 +17,7 @@ public class Tecnologia {
...
@@ -16,6 +17,7 @@ public class Tecnologia {
private
long
id
;
private
long
id
;
@Column
(
name
=
"nombre"
)
@Column
(
name
=
"nombre"
)
@NotBlank
(
message
=
"Este campo no puede estar vacio"
)
private
String
nombre
;
private
String
nombre
;
...
...
curriculumsearch/src/main/java/com/roshka/utils/Helper.java
0 → 100644
View file @
6eec4fd0
package
com
.
roshka
.
utils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
public
class
Helper
{
/**
* Se espera fecha en el formato yyyy-MM-dd
* @param fecha
* @return retorna fecha correcta o nulo si no es posible convertir
*/
public
static
Date
convertirFecha
(
String
fecha
)
{
try
{
return
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
parse
(
fecha
);
}
catch
(
ParseException
e
)
{
// TODO Auto-generated catch block
System
.
err
.
println
(
"Error al parsear"
);
e
.
printStackTrace
();
return
null
;
}
}
}
curriculumsearch/src/main/resources/application.properties
View file @
6eec4fd0
spring.jpa.hibernate.ddl-auto
=
create-drop
spring.jpa.hibernate.ddl-auto
=
create-drop
spring.jpa.database-platform
=
org.hibernate.dialect.PostgreSQLDialect
spring.jpa.database-platform
=
org.hibernate.dialect.PostgreSQLDialect
spring.jpa.show-sql
=
true
spring.jpa.properties.hibernate.format_sql
=
true
logging.level.org.hibernate.SQL
=
DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder
=
TRACE
spring.sql.init.mode
=
always
spring.sql.init.mode
=
always
spring.sql.init.platform
=
postgres
spring.sql.init.platform
=
postgres
...
...
curriculumsearch/src/main/resources/static/main.js
View file @
6eec4fd0
...
@@ -4,13 +4,51 @@ let cont_tecnologia = 0;
...
@@ -4,13 +4,51 @@ let cont_tecnologia = 0;
const
experiencias
=
[];
const
experiencias
=
[];
const
estudios
=
[];
const
estudios
=
[];
const
tecnologias
=
[];
const
tecnologias
=
[];
function
agregarFieldExpierncia
(){
const
formValidator
=
function
()
{
'use strict'
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var
forms
=
document
.
querySelectorAll
(
'.needs-validation'
)
var
expForm
=
document
.
querySelector
(
'#agregar-exp'
)
// Loop over them and prevent submission
Array
.
prototype
.
slice
.
call
(
forms
)
.
forEach
(
function
(
form
)
{
form
.
addEventListener
(
'submit'
,
function
(
event
)
{
if
(
!
form
.
checkValidity
())
{
event
.
preventDefault
()
event
.
stopPropagation
()
}
form
.
classList
.
add
(
'was-validated'
)
},
false
)
})
}
function
agregarFieldExpierncia
(
event
){
//recoger del form
//recoger del form
const
pairs
=
{};
const
pairs
=
{};
const
formexp
=
document
.
querySelector
(
"[name=experiencia-form]"
);
const
formexp
=
document
.
querySelector
(
"[name=experiencia-form]"
);
const
formData
=
new
FormData
(
formexp
);
const
formData
=
new
FormData
(
formexp
);
const
reconocimientos
=
[{},{},{}];
const
reconocimientos
=
[{},{},{}];
let
pos_rec
;
let
pos_rec
;
let
returnFlag
=
false
;
formData
.
forEach
((
value
,
key
)
=>
{
if
((
key
===
"institucion"
||
key
===
"cargo"
||
key
===
"fechaDesde"
)
&&
value
===
""
&&
returnFlag
==
false
){
console
.
log
(
key
,
value
)
returnFlag
=
true
;
}
});
if
(
returnFlag
===
true
){
alert
(
"Rellene Institucion, Fechas y Cargo como minimo"
);
return
;
}
for
(
const
[
name
,
value
]
of
formData
){
for
(
const
[
name
,
value
]
of
formData
){
pos_rec
=
name
.
split
(
"-"
);
//rec-nombre-index
pos_rec
=
name
.
split
(
"-"
);
//rec-nombre-index
if
(
pos_rec
.
length
>
1
)
{
if
(
pos_rec
.
length
>
1
)
{
...
@@ -28,7 +66,6 @@ function agregarFieldExpierncia(){
...
@@ -28,7 +66,6 @@ function agregarFieldExpierncia(){
const
div
=
document
.
querySelector
(
"#experiencias"
)
const
div
=
document
.
querySelector
(
"#experiencias"
)
const
div1
=
document
.
createElement
(
'div'
);
const
div1
=
document
.
createElement
(
'div'
);
let
content
=
'<ul>'
let
content
=
'<ul>'
for
(
let
index
=
0
;
index
<
experiencias
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
experiencias
.
length
;
index
++
)
{
const
exp
=
experiencias
[
index
];
const
exp
=
experiencias
[
index
];
if
(
exp
==
null
)
continue
;
if
(
exp
==
null
)
continue
;
...
@@ -45,15 +82,62 @@ function agregarFieldExpierncia(){
...
@@ -45,15 +82,62 @@ function agregarFieldExpierncia(){
div
.
innerHTML
=
''
;
div
.
innerHTML
=
''
;
div
.
appendChild
(
div1
);
div
.
appendChild
(
div1
);
cont_experiencia
++
;
cont_experiencia
++
;
}
/*--------------------------------------------------------------------*/
function
agregarFieldTecnologia
(){
//recoger del form
const
pairs
=
{};
const
formtecn
=
document
.
querySelector
(
"[name=tecnologia-form]"
);
const
formData
=
new
FormData
(
formtecn
);
for
(
const
[
name
,
value
]
of
formData
){
pairs
[
name
]
=
value
}
tecnologias
[
cont_tecnologia
]
=
{}
tecnologias
[
cont_tecnologia
][
"tecnologia"
]
=
pairs
[
"tecnologia-id"
]
==
"-1"
?{
nombre
:
pairs
[
"tecnologia-nombre"
]}:{
id
:
pairs
[
"tecnologia-id"
],
nombre
:
document
.
querySelector
(
'option[value="'
+
pairs
[
"tecnologia-id"
]
+
'"]'
).
innerHTML
}
tecnologias
[
cont_tecnologia
][
"nivel"
]
=
pairs
.
nivel
//tecnologias[cont_tecnologia] = pairs;
formtecn
.
reset
();
document
.
querySelector
(
"#tecnologia-nombre"
).
classList
.
add
(
'd-none'
)
//imprimir lista actualizada
const
div
=
document
.
querySelector
(
"#tecnologias"
)
const
div1
=
document
.
createElement
(
'div'
);
console
.
log
(
tecnologias
[
0
])
let
content1
=
'<ul>'
for
(
let
index
=
0
;
index
<
tecnologias
.
length
;
index
++
)
{
const
tecn
=
tecnologias
[
index
];
if
(
tecn
==
null
)
continue
;
content1
+=
`
<li id="tecn-
${
index
}
">
${
tecn
.
tecnologia
.
nombre
}
<button type="button" onclick="eliminarTecnologia(event)">Eliminar</button>
</li>
`
}
content1
+=
"</ul>"
div1
.
innerHTML
=
content1
div
.
innerHTML
=
''
;
div
.
appendChild
(
div1
);
cont_tecnologia
++
;
}
}
/*--------------------------------------------------------------------*/
function
eliminarExperiencia
(
event
)
{
function
eliminarExperiencia
(
event
)
{
//eliminar del array
//eliminar del array
experiencias
[
event
.
target
.
parentElement
.
id
.
split
(
"-"
)[
1
]]
=
null
experiencias
[
event
.
target
.
parentElement
.
id
.
split
(
"-"
)[
1
]]
=
null
//eliminar en html
//eliminar en html
event
.
target
.
parentElement
.
remove
()
event
.
target
.
parentElement
.
remove
()
}
}
/*----------------------------------------------------------------- */
function
eliminarTecnologia
(
event
)
{
//eliminar del array
tecnologias
[
event
.
target
.
parentElement
.
id
.
split
(
"-"
)[
1
]]
=
null
//eliminar en html
event
.
target
.
parentElement
.
remove
()
}
/*----------------------------------------------------------------- */
function
serializeJSON
(
form
)
{
function
serializeJSON
(
form
)
{
// Create a new FormData object
// Create a new FormData object
const
formData
=
new
FormData
(
form
);
const
formData
=
new
FormData
(
form
);
...
@@ -90,13 +174,85 @@ async function postData(url = '', data = {}) {
...
@@ -90,13 +174,85 @@ async function postData(url = '', data = {}) {
});
});
return
response
;
// parses JSON response into native JavaScript objects
return
response
;
// parses JSON response into native JavaScript objects
}
}
formValidator
()
form
=
document
.
querySelector
(
"form"
);
form
=
document
.
querySelector
(
"form"
);
form
.
addEventListener
(
"submit"
,(
evt
)
=>
{
form
.
addEventListener
(
"submit"
,(
evt
)
=>
{
// if (!form.checkValidity()) {
// evt.preventDefault()
// evt.stopPropagation()
// }
// form.classList.add('was-validated')
postData
(
'postulante'
,
serializeJSON
(
form
))
postData
(
'postulante'
,
serializeJSON
(
form
))
.
then
(
response
=>
{
.
then
(
response
=>
{
location
.
replace
(
response
.
url
);
if
(
response
.
status
==
200
||
response
.
status
==
302
){
location
.
replace
(
response
.
url
);
}
else
{
console
.
log
(
response
.
text
().
then
(
value
=>
console
.
log
(
value
)))
}
});
});
evt
.
preventDefault
();
evt
.
preventDefault
();
}
);
}
);
\ No newline at end of file
document
.
querySelector
(
"#btn-new-tech"
).
addEventListener
(
'click'
,()
=>
{
document
.
querySelector
(
"#tecnologia-nombre"
).
classList
.
remove
(
'd-none'
)})
//Metodos para Estudios
function
agregarFieldEstudio
(){
//recoger del form
const
pairs
=
{};
const
formest
=
document
.
querySelector
(
"[name=estudio-form"
);
const
formData
=
new
FormData
(
formest
);
const
estudioReconocimiento
=
[{},{},{}];
let
pos_rec
;
for
(
const
[
name
,
value
]
of
formData
){
pos_rec
=
name
.
split
(
"-"
);
//rec-nombre-index
if
(
pos_rec
.
length
>
1
)
{
estudioReconocimiento
[
pos_rec
[
2
]][
pos_rec
[
1
]]
=
value
}
else
{
pairs
[
name
]
=
value
}
}
pairs
[
"estudioReconocimiento"
]
=
estudioReconocimiento
.
filter
(
rec
=>
rec
.
nombre
);
estudios
[
cont_estudios
]
=
pairs
;
formest
.
reset
();
//imprimir lista actualizada
const
div
=
document
.
querySelector
(
"#estudios"
)
const
div1
=
document
.
createElement
(
'div'
);
let
content
=
'<ul>'
for
(
let
index
=
0
;
index
<
estudios
.
length
;
index
++
)
{
const
est
=
estudios
[
index
];
if
(
est
==
null
)
continue
;
content
+=
`
<li id="est-
${
index
}
">
${
est
.
institucion
}
<button type="button" onclick="eliminarEstudio(event)">Eliminar</button>
</li>
`
}
content
+=
"</ul>"
div1
.
innerHTML
=
content
div
.
innerHTML
=
''
;
div
.
appendChild
(
div1
);
cont_estudios
++
;
}
function
eliminarEstudio
(
event
)
{
//eliminar del array
estudios
[
event
.
target
.
parentElement
.
id
.
split
(
"-"
)[
1
]]
=
null
//eliminar en html
event
.
target
.
parentElement
.
remove
()
}
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
View file @
6eec4fd0
This diff is collapsed.
Click to expand it.
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