Commit 724048937a38fdf653db4fd205e67f02ffbca1fa

Authored by vitor.pacheco
1 parent dd7cb2b8
Exists in master

Codificação #2969: ERRO na manutenção do Tipo de Teste

git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/e-selo@9765 c2178572-b5ca-4887-91d2-9e3a90c7d55b
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/grupos/lista.jsp
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 5
6 <tiles:insertTemplate template="/WEB-INF/jsp/template/template.jsp"> 6 <tiles:insertTemplate template="/WEB-INF/jsp/template/template.jsp">
7 <tiles:putAttribute name="body"> 7 <tiles:putAttribute name="body">
8 - <a href="<c:url value="/grupos" />"><strong><span class="glyphicon glyphicon-check"></span> Grupodds</strong></a> 8 + <a href="<c:url value="/grupos" />"><strong><span class="glyphicon glyphicon-check"></span> Grupos</strong></a>
9 9
10 <a href="<c:url value="/grupos/form" />" class="btn btn-default pull-right"><span class="glyphicon glyphicon-plus"></span> Incluir</a> 10 <a href="<c:url value="/grupos/form" />" class="btn btn-default pull-right"><span class="glyphicon glyphicon-plus"></span> Incluir</a>
11 11
@@ -39,6 +39,8 @@ @@ -39,6 +39,8 @@
39 </div> 39 </div>
40 </div> 40 </div>
41 41
  42 + <br />
  43 +
42 <div class="row"> 44 <div class="row">
43 <div class="col-md-12"> 45 <div class="col-md-12">
44 <div class="table-responsive"> 46 <div class="table-responsive">
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/tiposTeste/form.jsp
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 <div class="form-group"> 32 <div class="form-group">
33 <label for="inputTipo" class="col-lg-2 control-label">Tipo</label> 33 <label for="inputTipo" class="col-lg-2 control-label">Tipo</label>
34 <div class="col-lg-10"> 34 <div class="col-lg-10">
35 - <input id="inputTipo" name="tipoTeste.tipo" type="text" class="form-control required" placeholder="Tipo" maxlength="100" value="${tipoTeste.tipo}" /> 35 + <input id="inputTipo" name="tipoTeste.tipo" type="text" class="form-control required" ${tipoTeste.id != null ? "readonly" : ""} placeholder="Tipo" maxlength="100" value="${tipoTeste.tipo}" />
36 </div> 36 </div>
37 </div> 37 </div>
38 <div class="form-group"> 38 <div class="form-group">
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <div class="form-group"> 45 <div class="form-group">
46 <label for="inputValMaximoConformidade" class="col-lg-2 control-label">Valor Máximo</label> 46 <label for="inputValMaximoConformidade" class="col-lg-2 control-label">Valor Máximo</label>
47 <div class="col-xs-3"> 47 <div class="col-xs-3">
48 - <input id="inputValMaximoConformidade" name="tipoTeste.maximoTeste" min="1" type="number" class="form-control number numeric required" placeholder="Valor Máximo" value="${tipoTeste.maximoTeste}" /> 48 + <input id="inputValMaximoConformidade" name="tipoTeste.maximoTeste" min="1" type="number" class="form-control number numeric required" ${tipoTeste.id != null ? "readonly" : ""} placeholder="Valor Máximo" value="${tipoTeste.maximoTeste}" />
49 </div> 49 </div>
50 </div> 50 </div>
51 51
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/RecomendacaoController.java
@@ -68,7 +68,7 @@ public class RecomendacaoController { @@ -68,7 +68,7 @@ public class RecomendacaoController {
68 68
69 if (recomendacao.getNumeroRecomendacao() == null) { 69 if (recomendacao.getNumeroRecomendacao() == null) {
70 validator.add(new ValidationMessage( 70 validator.add(new ValidationMessage(
71 - "É obrigatório informar o número da recomendação.", 71 + "É obrigatório informar o número da recomendação.",
72 "recomendacao.numeroRecomendacao")); 72 "recomendacao.numeroRecomendacao"));
73 } else if (hasNumeroRecomendacaoNoParametroAtual(recomendacao)) { 73 } else if (hasNumeroRecomendacaoNoParametroAtual(recomendacao)) {
74 validator 74 validator
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/TiposTesteController.java
@@ -93,11 +93,14 @@ public class TiposTesteController { @@ -93,11 +93,14 @@ public class TiposTesteController {
93 @Path("/tiposTeste/delete/{id}") 93 @Path("/tiposTeste/delete/{id}")
94 @Restrito(descricao = "TIPOS_TESTE_EXCLUIR") 94 @Restrito(descricao = "TIPOS_TESTE_EXCLUIR")
95 public void excluir(Long id) { 95 public void excluir(Long id) {
96 -  
97 - /*  
98 -  
99 TipoTeste tipoTeste = dao.load(id); 96 TipoTeste tipoTeste = dao.load(id);
  97 +
  98 + if (tipoTeste.getCriterios().isEmpty()) {
  99 + validator.add(new ValidationMessage("O Tipo de Teste está sendo referenciado e não pode ser excluído.",
  100 + "tipoTeste.descricao"));
  101 + }
100 102
  103 + /*
101 if (!tipoTeste.getRecomendacoes().isEmpty()) { 104 if (!tipoTeste.getRecomendacoes().isEmpty()) {
102 validator.add(new ValidationMessage(Messages 105 validator.add(new ValidationMessage(Messages
103 .getString("tipo_recomendacao.validacao.remove"), 106 .getString("tipo_recomendacao.validacao.remove"),
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/model/TipoTeste.java
1 package br.com.eselo.model; 1 package br.com.eselo.model;
2 2
  3 +import java.util.List;
  4 +
  5 +import javax.persistence.CascadeType;
3 import javax.persistence.Column; 6 import javax.persistence.Column;
4 import javax.persistence.Entity; 7 import javax.persistence.Entity;
  8 +import javax.persistence.FetchType;
5 import javax.persistence.GeneratedValue; 9 import javax.persistence.GeneratedValue;
6 import javax.persistence.GenerationType; 10 import javax.persistence.GenerationType;
7 import javax.persistence.Id; 11 import javax.persistence.Id;
  12 +import javax.persistence.OneToMany;
8 import javax.persistence.SequenceGenerator; 13 import javax.persistence.SequenceGenerator;
9 import javax.persistence.Table; 14 import javax.persistence.Table;
10 15
@@ -26,6 +31,9 @@ public class TipoTeste{ @@ -26,6 +31,9 @@ public class TipoTeste{
26 31
27 @Column(name = "nu_maximo_teste", nullable = false) 32 @Column(name = "nu_maximo_teste", nullable = false)
28 private Long maximoTeste; 33 private Long maximoTeste;
  34 +
  35 + @OneToMany(mappedBy = "tipoTeste", targetEntity = br.com.eselo.model.Criterio.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)
  36 + private List<Criterio> criterios;
29 37
30 public Long getId() { 38 public Long getId() {
31 return id; 39 return id;
@@ -59,4 +67,12 @@ public class TipoTeste{ @@ -59,4 +67,12 @@ public class TipoTeste{
59 this.maximoTeste = maximoTeste; 67 this.maximoTeste = maximoTeste;
60 } 68 }
61 69
  70 + public List<Criterio> getCriterios() {
  71 + return criterios;
  72 + }
  73 +
  74 + public void setCriterios(List<Criterio> criterios) {
  75 + this.criterios = criterios;
  76 + }
  77 +
62 } 78 }