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
0
Merge Requests
0
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
Amparo Oliver
th-app-java
Commits
56937330
Commit
56937330
authored
Nov 03, 2021
by
Joel Florentin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enum para modalidad y disponibilidad.
parent
c492342c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
12 deletions
+113
-12
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
+4
-1
curriculumsearch/src/main/java/com/roshka/modelo/Disponibilidad.java
+18
-0
curriculumsearch/src/main/java/com/roshka/modelo/DisponibilidadConverter.java
+30
-0
curriculumsearch/src/main/java/com/roshka/modelo/Modalidad.java
+18
-0
curriculumsearch/src/main/java/com/roshka/modelo/ModalidadConverter.java
+30
-0
curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java
+8
-10
curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java
+5
-1
No files found.
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
View file @
56937330
...
...
@@ -3,7 +3,8 @@ package com.roshka.controller;
import
javax.validation.ConstraintViolationException
;
import
com.roshka.modelo.Disponibilidad
;
import
com.roshka.modelo.Modalidad
;
import
com.roshka.modelo.Postulante
;
import
com.roshka.repositorio.PostulanteRepository
;
import
com.roshka.repositorio.TecnologiaRepository
;
...
...
@@ -33,6 +34,8 @@ public class PostulanteController {
@RequestMapping
(
"/postulante"
)
public
String
getFormPostulante
(
Model
model
){
model
.
addAttribute
(
"tecnologias"
,
tecRepo
.
findAll
());
model
.
addAttribute
(
"modalidades"
,
Modalidad
.
values
());
model
.
addAttribute
(
"disponibilidades"
,
Disponibilidad
.
values
());
return
"postulante-form"
;
}
...
...
curriculumsearch/src/main/java/com/roshka/modelo/Disponibilidad.java
0 → 100644
View file @
56937330
package
com
.
roshka
.
modelo
;
import
com.fasterxml.jackson.annotation.JsonValue
;
public
enum
Disponibilidad
{
TIEMPO_COMPLETO
(
"C"
),
PARCIAL
(
"P"
);
private
String
code
;
private
Disponibilidad
(
String
code
)
{
this
.
code
=
code
;
}
@JsonValue
public
String
getCode
()
{
return
code
;
}
}
curriculumsearch/src/main/java/com/roshka/modelo/DisponibilidadConverter.java
0 → 100644
View file @
56937330
package
com
.
roshka
.
modelo
;
import
java.util.Arrays
;
import
javax.persistence.AttributeConverter
;
import
javax.persistence.Converter
;
@Converter
(
autoApply
=
true
)
public
class
DisponibilidadConverter
implements
AttributeConverter
<
Disponibilidad
,
String
>
{
@Override
public
String
convertToDatabaseColumn
(
Disponibilidad
modalidad
)
{
if
(
modalidad
==
null
)
{
return
null
;
}
return
modalidad
.
getCode
();
}
@Override
public
Disponibilidad
convertToEntityAttribute
(
String
code
)
{
if
(
code
==
null
)
{
return
null
;
}
return
Arrays
.
stream
(
Disponibilidad
.
values
())
.
filter
(
c
->
c
.
getCode
().
equals
(
code
))
.
findFirst
()
.
orElseThrow
(
IllegalArgumentException:
:
new
);
}
}
curriculumsearch/src/main/java/com/roshka/modelo/Modalidad.java
0 → 100644
View file @
56937330
package
com
.
roshka
.
modelo
;
import
com.fasterxml.jackson.annotation.JsonValue
;
public
enum
Modalidad
{
PRESENCIAL
(
"P"
),
SEMIPRESENCIAL
(
"S"
),
REMOTO
(
"R"
);
private
String
code
;
private
Modalidad
(
String
code
)
{
this
.
code
=
code
;
}
@JsonValue
public
String
getCode
()
{
return
code
;
}
}
curriculumsearch/src/main/java/com/roshka/modelo/ModalidadConverter.java
0 → 100644
View file @
56937330
package
com
.
roshka
.
modelo
;
import
java.util.Arrays
;
import
javax.persistence.AttributeConverter
;
import
javax.persistence.Converter
;
@Converter
(
autoApply
=
true
)
public
class
ModalidadConverter
implements
AttributeConverter
<
Modalidad
,
String
>
{
@Override
public
String
convertToDatabaseColumn
(
Modalidad
modalidad
)
{
if
(
modalidad
==
null
)
{
return
null
;
}
return
modalidad
.
getCode
();
}
@Override
public
Modalidad
convertToEntityAttribute
(
String
code
)
{
if
(
code
==
null
)
{
return
null
;
}
return
Arrays
.
stream
(
Modalidad
.
values
())
.
filter
(
c
->
c
.
getCode
().
equals
(
code
))
.
findFirst
()
.
orElseThrow
(
IllegalArgumentException:
:
new
);
}
}
curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java
View file @
56937330
...
...
@@ -6,8 +6,6 @@ import javax.validation.constraints.*;
import
com.fasterxml.jackson.annotation.JsonManagedReference
;
import
com.roshka.utils.Helper
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -66,12 +64,12 @@ public class Postulante {
@Column
(
name
=
"curriculum"
)
private
String
curriculum
;
@Column
(
name
=
"modalidad"
)
@Column
(
name
=
"modalidad"
,
length
=
2
)
@NotNull
private
String
modalidad
;
private
Modalidad
modalidad
;
@Column
(
name
=
"disponibilidad"
)
private
String
disponibilidad
;
@Column
(
name
=
"disponibilidad"
,
length
=
2
)
private
Disponibilidad
disponibilidad
;
@JsonManagedReference
@OneToMany
(
mappedBy
=
"postulante"
,
cascade
=
CascadeType
.
ALL
)
...
...
@@ -178,19 +176,19 @@ public class Postulante {
this
.
curriculum
=
curriculum
;
}
public
String
getModalidad
()
{
public
Modalidad
getModalidad
()
{
return
modalidad
;
}
public
void
setModalidad
(
String
modalidad
)
{
public
void
setModalidad
(
Modalidad
modalidad
)
{
this
.
modalidad
=
modalidad
;
}
public
String
getDisponibilidad
()
{
public
Disponibilidad
getDisponibilidad
()
{
return
disponibilidad
;
}
public
void
setDisponibilidad
(
String
disponibilidad
)
{
public
void
setDisponibilidad
(
Disponibilidad
disponibilidad
)
{
this
.
disponibilidad
=
disponibilidad
;
}
...
...
curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java
View file @
56937330
package
com
.
roshka
.
repositorio
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
java.util.List
;
import
com.roshka.modelo.Postulante
;
public
interface
PostulanteRepository
extends
JpaRepository
<
Postulante
,
Long
>
{
@Query
(
"select p from Postulante p join p.estudios e on e.institucion LIKE %?1%"
)
public
List
<
Postulante
>
findByInstitucionEstudio
(
String
institucion
);
}
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