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
d6b0b79d
Commit
d6b0b79d
authored
Nov 25, 2021
by
Joel Florentin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
se unificaron los path de todos los controllers
parent
a355ef3d
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
38 deletions
+18
-38
curriculumsearch/src/main/java/com/roshka/configuration/WebSecurityConfig.java
+2
-3
curriculumsearch/src/main/java/com/roshka/controller/CargoController.java
+4
-3
curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java
+7
-27
curriculumsearch/src/main/webapp/jsp/cargo-form.jsp
+1
-1
curriculumsearch/src/main/webapp/jsp/cargos.jsp
+2
-2
curriculumsearch/src/main/webapp/jsp/convocatorias.jsp
+1
-1
curriculumsearch/src/main/webapp/jsp/layouts/base.jsp
+1
-1
No files found.
curriculumsearch/src/main/java/com/roshka/configuration/WebSecurityConfig.java
View file @
d6b0b79d
...
@@ -48,9 +48,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -48,9 +48,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.
authorizeRequests
()
.
authorizeRequests
()
.
mvcMatchers
(
"/"
).
authenticated
()
.
mvcMatchers
(
"/"
).
authenticated
()
.
mvcMatchers
(
"/home"
).
authenticated
()
.
mvcMatchers
(
"/home"
).
authenticated
()
.
mvcMatchers
(
"/cargo*"
).
authenticated
()
.
mvcMatchers
(
"/cargos"
,
"/cargos/**"
).
authenticated
()
.
mvcMatchers
(
"/convocatoria*"
).
authenticated
()
.
mvcMatchers
(
"/convocatorias"
,
"/convocatorias/**"
).
authenticated
()
.
mvcMatchers
(
"/convocatoria/crear/*"
).
authenticated
()
.
mvcMatchers
(
"/tecnologias"
,
"/tecnologias/**"
).
authenticated
()
.
mvcMatchers
(
"/tecnologias"
,
"/tecnologias/**"
).
authenticated
()
.
mvcMatchers
(
"/postulantes"
,
"/postulantes/**"
).
authenticated
()
.
mvcMatchers
(
"/postulantes"
,
"/postulantes/**"
).
authenticated
()
.
mvcMatchers
(
"/edit-user-data"
).
authenticated
()
.
mvcMatchers
(
"/edit-user-data"
).
authenticated
()
...
...
curriculumsearch/src/main/java/com/roshka/controller/CargoController.java
View file @
d6b0b79d
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
@Controller
@Controller
@RequestMapping
(
"/cargos"
)
public
class
CargoController
{
public
class
CargoController
{
CargoRepository
cargoRepo
;
CargoRepository
cargoRepo
;
...
@@ -25,7 +26,7 @@ public class CargoController {
...
@@ -25,7 +26,7 @@ public class CargoController {
this
.
cargoRepo
=
cargoRepo
;
this
.
cargoRepo
=
cargoRepo
;
}
}
@RequestMapping
(
"/cargos"
)
@RequestMapping
()
public
String
menuCargos
(
Model
model
,
@RequestParam
(
required
=
false
)
String
nombre
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
nroPagina
)
{
public
String
menuCargos
(
Model
model
,
@RequestParam
(
required
=
false
)
String
nombre
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
nroPagina
)
{
final
Integer
CANTIDAD_POR_PAGINA
=
10
;
final
Integer
CANTIDAD_POR_PAGINA
=
10
;
Pageable
page
=
PageRequest
.
of
(
nroPagina
,
CANTIDAD_POR_PAGINA
,
Sort
.
by
(
"id"
));
Pageable
page
=
PageRequest
.
of
(
nroPagina
,
CANTIDAD_POR_PAGINA
,
Sort
.
by
(
"id"
));
...
@@ -42,7 +43,7 @@ public class CargoController {
...
@@ -42,7 +43,7 @@ public class CargoController {
return
"cargos"
;
return
"cargos"
;
}
}
@RequestMapping
(
path
=
{
"/
cargo"
,
"/cargo
/{id}"
},
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
{
"/
agregar"
,
"/modificar
/{id}"
},
method
=
RequestMethod
.
GET
)
public
String
formCargo
(
Model
model
,
@PathVariable
(
required
=
false
)
Long
id
)
{
public
String
formCargo
(
Model
model
,
@PathVariable
(
required
=
false
)
Long
id
)
{
if
(
id
==
null
)
model
.
addAttribute
(
"cargo"
,
new
Cargo
());
if
(
id
==
null
)
model
.
addAttribute
(
"cargo"
,
new
Cargo
());
...
@@ -50,7 +51,7 @@ public class CargoController {
...
@@ -50,7 +51,7 @@ public class CargoController {
return
"cargo-form"
;
return
"cargo-form"
;
}
}
@PostMapping
(
path
=
{
"/
cargo"
,
"/cargo
/{id}"
})
@PostMapping
(
path
=
{
"/
agregar"
,
"/modificar
/{id}"
})
public
String
guardarCargo
(
@Valid
@ModelAttribute
Cargo
cargo
,
BindingResult
result
,
@PathVariable
(
required
=
false
)
Long
id
,
Model
model
)
{
public
String
guardarCargo
(
@Valid
@ModelAttribute
Cargo
cargo
,
BindingResult
result
,
@PathVariable
(
required
=
false
)
Long
id
,
Model
model
)
{
if
(
result
.
hasErrors
()
||
(
id
==
null
&&
cargoRepo
.
existsByNombreIgnoreCase
(
cargo
.
getNombre
())
)){
if
(
result
.
hasErrors
()
||
(
id
==
null
&&
cargoRepo
.
existsByNombreIgnoreCase
(
cargo
.
getNombre
())
)){
model
.
addAttribute
(
"mismoNombre"
,
true
);
model
.
addAttribute
(
"mismoNombre"
,
true
);
...
...
curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java
View file @
d6b0b79d
...
@@ -11,12 +11,12 @@ import org.springframework.data.domain.Pageable;
...
@@ -11,12 +11,12 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.ui.Model
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
java.util.Date
;
import
java.util.Date
;
@RequestMapping
(
"/convocatorias"
)
@Controller
@Controller
public
class
ConvocatoriaController
{
public
class
ConvocatoriaController
{
...
@@ -29,7 +29,7 @@ public class ConvocatoriaController {
...
@@ -29,7 +29,7 @@ public class ConvocatoriaController {
this
.
convoRepo
=
convoRepo
;
this
.
convoRepo
=
convoRepo
;
}
}
@RequestMapping
(
"/convocatorias"
)
@RequestMapping
()
public
String
menuConvocatorias
(
Model
model
,
RedirectAttributes
redirectAttrs
,
public
String
menuConvocatorias
(
Model
model
,
RedirectAttributes
redirectAttrs
,
@RequestParam
(
required
=
false
)
Long
cargoId
,
@RequestParam
(
required
=
false
)
Long
cargoId
,
@RequestParam
(
required
=
false
)
EstadoConvocatoria
estado
,
//1: true, 0: false
@RequestParam
(
required
=
false
)
EstadoConvocatoria
estado
,
//1: true, 0: false
...
@@ -48,7 +48,7 @@ public class ConvocatoriaController {
...
@@ -48,7 +48,7 @@ public class ConvocatoriaController {
return
"convocatorias"
;
return
"convocatorias"
;
}
}
@RequestMapping
(
"/c
onvocatoria/c
rear/{id}"
)
@RequestMapping
(
"/crear/{id}"
)
public
String
guardarConvocatoriaa
(
@PathVariable
(
required
=
false
)
Long
id
,
RedirectAttributes
redirectAttributes
)
{
public
String
guardarConvocatoriaa
(
@PathVariable
(
required
=
false
)
Long
id
,
RedirectAttributes
redirectAttributes
)
{
for
(
ConvocatoriaCargo
conv:
convoRepo
.
findByCargoId
(
id
))
{
for
(
ConvocatoriaCargo
conv:
convoRepo
.
findByCargoId
(
id
))
{
if
(
conv
.
getEstado
()==
EstadoConvocatoria
.
abierto
){
if
(
conv
.
getEstado
()==
EstadoConvocatoria
.
abierto
){
...
@@ -68,36 +68,16 @@ public class ConvocatoriaController {
...
@@ -68,36 +68,16 @@ public class ConvocatoriaController {
return
"redirect:/convocatorias"
;
return
"redirect:/convocatorias"
;
}
}
/* @RequestMapping("/convocatoria/{id}")
public String formConvocatoria(Model model,@PathVariable(required = false) Long id) {
model.addAttribute("cargos", cargoRepo.findAll());
if(id == null){
model.addAttribute("convocatoria", new ConvocatoriaCargo());
model.addAttribute("listaConvocatoria", convoRepo.findAll());
}
else {
ConvocatoriaCargo cc = convoRepo.getById(id);
cc.setFechaFinS(new SimpleDateFormat("yyyy-MM-dd").format((cc.getFechaFin())));
cc.setFechaInicioS(new SimpleDateFormat("yyyy-MM-dd").format((cc.getFechaInicio())));
model.addAttribute("convocatoria", cc);
model.addAttribute("listaConvocatoria", convoRepo.findAll());
}
return "convocatoria-form";
@RequestMapping
(
"/cerrar/{id}"
)
}*/
public
String
cerrarConvocatoria
(
@PathVariable
(
required
=
false
)
Long
id
)
{
@RequestMapping
(
"/convocatoria/{id}"
)
ConvocatoriaCargo
convocatoria
=
convoRepo
.
getById
(
id
);
public
String
guardarConvocatoria
(
@ModelAttribute
ConvocatoriaCargo
convocatoria
,
BindingResult
result
,
@PathVariable
(
required
=
false
)
Long
id
,
Model
model
)
{
if
(
convocatoria
==
null
||
convocatoria
.
getEstado
()
==
EstadoConvocatoria
.
cerrado
)
return
"error"
;
if
(
id
!=
null
)
convocatoria
.
setId
(
id
);
convocatoria
=
convoRepo
.
findByIdConvocatoriaCargo
(
id
);
convocatoria
.
setEstado
(
EstadoConvocatoria
.
cerrado
);
convocatoria
.
setEstado
(
EstadoConvocatoria
.
cerrado
);
convocatoria
.
setFechaFin
(
new
Date
());
convocatoria
.
setFechaFin
(
new
Date
());
convocatoria
.
getCargo
().
setExisteConvocatoria
(
false
);
convocatoria
.
getCargo
().
setExisteConvocatoria
(
false
);
convoRepo
.
save
(
convocatoria
);
convoRepo
.
save
(
convocatoria
);
return
"redirect:/convocatorias"
;
return
"redirect:/convocatorias"
;
}
}
}
}
curriculumsearch/src/main/webapp/jsp/cargo-form.jsp
View file @
d6b0b79d
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<h5>Cargo</h5>
<h5>Cargo</h5>
</div>
</div>
<form:form
<form:form
action="/cargo
/${cargo.id == null ? '' : cargo.id
}"
action="/cargo
s/${cargo.id == null ? 'agregar' : 'modificar/'.concat(cargo.id)
}"
method="post"
method="post"
modelAttribute="cargo"
modelAttribute="cargo"
class="d-flex flex-column"
class="d-flex flex-column"
...
...
curriculumsearch/src/main/webapp/jsp/cargos.jsp
View file @
d6b0b79d
...
@@ -50,10 +50,10 @@ contentType="text/html;charset=UTF-8" language="java" %>
...
@@ -50,10 +50,10 @@ contentType="text/html;charset=UTF-8" language="java" %>
>Ver Convocatorias</a
>Ver Convocatorias</a
>
>
</td>
</td>
<td><a href="/cargo/${cargo.id}">Editar cargo</a></td>
<td><a href="/cargo
s/modificar
/${cargo.id}">Editar cargo</a></td>
<td>
<td>
<c:if test="${!cargo.isExisteConvocatoria()}">
<c:if test="${!cargo.isExisteConvocatoria()}">
<a class="btn btn-secondary" href="/convocatoria/crear/${cargo.id}">Abrir Convocatoria</a>
<a class="btn btn-secondary" href="/convocatoria
s
/crear/${cargo.id}">Abrir Convocatoria</a>
</c:if>
</c:if>
</td>
</td>
</tr>
</tr>
...
...
curriculumsearch/src/main/webapp/jsp/convocatorias.jsp
View file @
d6b0b79d
...
@@ -92,7 +92,7 @@
...
@@ -92,7 +92,7 @@
<td><a href="/postulantes?convId=${convocatoria.id}">Ver postulantes</a></td>
<td><a href="/postulantes?convId=${convocatoria.id}">Ver postulantes</a></td>
<td>
<td>
<c:if test="${convocatoria.getEstado() != 'cerrado'}">
<c:if test="${convocatoria.getEstado() != 'cerrado'}">
<a class="btn btn-secondary" href="/convocatoria/${convocatoria.id}">Cerrar convocatoria</a>
<a class="btn btn-secondary" href="/convocatoria
s/cerrar
/${convocatoria.id}">Cerrar convocatoria</a>
</c:if>
</c:if>
</td>
</td>
</tr>
</tr>
...
...
curriculumsearch/src/main/webapp/jsp/layouts/base.jsp
View file @
d6b0b79d
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
Cargos
Cargos
</a>
</a>
<ul
class=
"dropdown-menu"
aria-labelledby=
"navbarDropdownMenuLink"
>
<ul
class=
"dropdown-menu"
aria-labelledby=
"navbarDropdownMenuLink"
>
<li><a
class=
"dropdown-item"
href=
"/cargo"
>
Agregar Cargo
</a></li>
<li><a
class=
"dropdown-item"
href=
"/cargo
s/agregar
"
>
Agregar Cargo
</a></li>
<li><a
class=
"dropdown-item"
href=
"/cargos"
>
Listar cargos
</a></li>
<li><a
class=
"dropdown-item"
href=
"/cargos"
>
Listar cargos
</a></li>
<li><a
class=
"dropdown-item"
href=
"/convocatorias"
>
Listar convocatorias
</a></li>
<li><a
class=
"dropdown-item"
href=
"/convocatorias"
>
Listar convocatorias
</a></li>
</ul>
</ul>
...
...
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