Commit 79cb0a814bea41ed1c053417f0fceb6f595678de
1 parent
ff75d7e2
Exists in
master
Ajustes no DER para guardar histórico das avaliações
git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/e-selo@9798 c2178572-b5ca-4887-91d2-9e3a90c7d55b
Showing
13 changed files
with
624 additions
and
5 deletions
Show diff stats
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/avaliacao/form.jsp
0 → 100644
@@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | ||
2 | + pageEncoding="UTF-8"%> | ||
3 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | ||
4 | +<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%> | ||
5 | + | ||
6 | +<tiles:insertTemplate template="/WEB-INF/jsp/template/template.jsp"> | ||
7 | + <tiles:putAttribute name="body"> | ||
8 | + <a href="<c:url value="/avaliacoes"/>"><strong><span class="glyphicon glyphicon-check"></span> Avaliações</strong></a> | ||
9 | + | ||
10 | + <hr /> | ||
11 | + | ||
12 | + <c:forEach var="error" items="${errors}"> | ||
13 | + <div class="alert alert-success alert-dismissable"> | ||
14 | + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | ||
15 | + ${error.message} | ||
16 | + </div> | ||
17 | + </c:forEach> | ||
18 | + | ||
19 | + <c:if test="${not empty mensagem}"> | ||
20 | + <div class="alert alert-success alert-dismissable"> | ||
21 | + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | ||
22 | + ${mensagem} | ||
23 | + </div> | ||
24 | + </c:if> | ||
25 | + | ||
26 | + <div class="row"> | ||
27 | + <div class="col-md-12"> | ||
28 | + <form name="url" class="form-horizontal" action="<c:url value="/url/adiciona "/>" method="post"> | ||
29 | + <fieldset> | ||
30 | + <div class="form-group"> | ||
31 | + <label for="inputNome" class="col-lg-2 control-label">Url</label> | ||
32 | + <div class="col-lg-10"> | ||
33 | + <input id="inputNome" name="url.url" type="text" class="form-control" placeholder="Url"> | ||
34 | + </div> | ||
35 | + </div> | ||
36 | + | ||
37 | + <div class="form-group"> | ||
38 | + <div class="col-lg-10 col-lg-offset-2"> | ||
39 | + <button class="btn btn-default btn-cancel">Cancelar</button> | ||
40 | + <button type="submit" class="btn btn-primary">Salvar</button> | ||
41 | + </div> | ||
42 | + </div> | ||
43 | + </fieldset> | ||
44 | + </form> | ||
45 | + </div> | ||
46 | + </div> <!--/row--> | ||
47 | + </tiles:putAttribute> | ||
48 | +</tiles:insertTemplate> | ||
0 | \ No newline at end of file | 49 | \ No newline at end of file |
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/avaliacao/index.jsp
0 → 100644
@@ -0,0 +1,86 @@ | @@ -0,0 +1,86 @@ | ||
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | ||
2 | + pageEncoding="UTF-8"%> | ||
3 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | ||
4 | +<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%> | ||
5 | + | ||
6 | +<tiles:insertTemplate template="/WEB-INF/jsp/template/template.jsp"> | ||
7 | + <tiles:putAttribute name="body"> | ||
8 | + <a href="<c:url value="/avaliacoes" />"><strong><span class="glyphicon glyphicon-check"></span> Avaliações</strong></a> | ||
9 | + | ||
10 | + <a href="<c:url value="/url" />" class="btn btn-default pull-right"><span class="glyphicon glyphicon-plus"></span> Incluir Avaliação</a> | ||
11 | + | ||
12 | + <br /> | ||
13 | + | ||
14 | + <hr /> | ||
15 | + | ||
16 | + <form name="pesquisa" class="form-inline" action="<c:url value="/avaliacoes/pesquisa"/>" method="post"> | ||
17 | + <div class="form-group"> | ||
18 | + <label for="inputNome">Filtrar Por</label> | ||
19 | + <input id="inputNome" name="nUrl" type="text" class="form-control input-sm" required placeholder="Url"> | ||
20 | + </div> | ||
21 | + | ||
22 | + <div class="form-group"> | ||
23 | + <label for="select">Ordenar por:</label> | ||
24 | + <select id="select" class="form-control input-sm"> | ||
25 | + <option>Data</option> | ||
26 | + </select> | ||
27 | + </div> | ||
28 | + | ||
29 | + <input type="hidden" name="paginacao" id="paginacao" value="1"> | ||
30 | + <button type="submit" class="btn btn-primary btn-sm" style="margin-top: 24.5px;">Pesquisar</button> | ||
31 | + </form> | ||
32 | + | ||
33 | + <br /> | ||
34 | + | ||
35 | + <c:if test="${not empty mensagem}"> | ||
36 | + <div class="alert alert-success alert-dismissable"> | ||
37 | + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | ||
38 | + ${mensagem} | ||
39 | + </div> | ||
40 | + </c:if> | ||
41 | + | ||
42 | + <div class="row"> | ||
43 | + <div class="col-md-12"> | ||
44 | + <div class="table-responsive"> | ||
45 | + <table id="usuariosTable" pagesize="10" class="table table-striped table-bordered table-hover table-condensed"> | ||
46 | + <thead> | ||
47 | + <tr> | ||
48 | + <th>ID Avaliação</th> | ||
49 | + <th>URL</th> | ||
50 | + <th>Data da Avaliação</th> | ||
51 | + <th>Token</th> | ||
52 | + <th> </th> | ||
53 | + </tr> | ||
54 | + </thead> | ||
55 | + <tbody> | ||
56 | + <c:forEach items="${avaliacaoList}" var="avaliacao"> | ||
57 | + <tr> | ||
58 | + <td>${avaliacao.id}</td> | ||
59 | + <td>${avaliacao.idUrl.url}</td> | ||
60 | + <td>${avaliacao.dataAvaliacao}</td> | ||
61 | + <td> </td> | ||
62 | + <td> | ||
63 | + <div class="btn-group"> | ||
64 | + <a | ||
65 | + href="<c:url value="/avaliacoes/resultado/${avaliacao.id}" />" | ||
66 | + class="btn btn-default btn-sm">Consultar</a> | ||
67 | + </div> | ||
68 | + </td> | ||
69 | + </tr> | ||
70 | + </c:forEach> | ||
71 | + </table> | ||
72 | + ${regInic} a ${regFim} de ${registros} registros | ||
73 | + </div> | ||
74 | + | ||
75 | + | ||
76 | + <ul class="pagination"> | ||
77 | + <li class="disabled"><a href="#">«</a></li> | ||
78 | + <c:forEach var="i" begin="1" end="${paginas}"> | ||
79 | + <li><a href="<c:url value="/avaliacoes/${i}"/>">${i}</a></li> | ||
80 | + </c:forEach> | ||
81 | + <li><a href="#">»</a></li> | ||
82 | + </ul> | ||
83 | + </div> | ||
84 | + </div> | ||
85 | + </tiles:putAttribute> | ||
86 | +</tiles:insertTemplate> | ||
0 | \ No newline at end of file | 87 | \ No newline at end of file |
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/avaliacao/lista.jsp
0 → 100644
@@ -0,0 +1,112 @@ | @@ -0,0 +1,112 @@ | ||
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | ||
2 | + pageEncoding="UTF-8"%> | ||
3 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | ||
4 | +<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%> | ||
5 | + | ||
6 | +<tiles:insertTemplate template="/WEB-INF/jsp/template/template.jsp"> | ||
7 | + <tiles:putAttribute name="body"> | ||
8 | + <a href="<c:url value="/avaliacoes" />"><strong><span | ||
9 | + class="glyphicon glyphicon-check"></span> Avaliações</strong></a> | ||
10 | + | ||
11 | + <a href="<c:url value="/url" />" | ||
12 | + class="btn btn-default pull-right"><span | ||
13 | + class="glyphicon glyphicon-plus"></span> Incluir Avaliação</a> | ||
14 | + | ||
15 | + <br /> | ||
16 | + | ||
17 | + <hr /> | ||
18 | + | ||
19 | + <c:if test="${not empty mensagem}"> | ||
20 | + <div class="alert alert-success alert-dismissable"> | ||
21 | + <button type="button" class="close" data-dismiss="alert" | ||
22 | + aria-hidden="true">×</button> | ||
23 | + ${mensagem} | ||
24 | + </div> | ||
25 | + </c:if> | ||
26 | + | ||
27 | + | ||
28 | + <form name="pesquisa" class="form-inline" | ||
29 | + action="<c:url value="/avaliacoes/pesquisa"/>" method="post"> | ||
30 | + <div class="form-group"> | ||
31 | + <label for="inputNome">Filtrar Por</label> <input id="inputNome" | ||
32 | + name="nUrl" type="text" class="form-control input-sm" required | ||
33 | + placeholder="Url" value="${nUrl}"> | ||
34 | + </div> | ||
35 | + | ||
36 | + <div class="form-group"> | ||
37 | + <label for="select">Ordenar por:</label> <select id="select" | ||
38 | + class="form-control input-sm"> | ||
39 | + <option>Data</option> | ||
40 | + </select> | ||
41 | + </div> | ||
42 | + | ||
43 | + | ||
44 | + <button type="submit" class="btn btn-primary btn-sm" | ||
45 | + style="margin-top: 24.5px;">Pesquisar</button> | ||
46 | + </form> | ||
47 | + | ||
48 | + <br> | ||
49 | + | ||
50 | + <div class="row"> | ||
51 | + <div class="col-md-12"> | ||
52 | + <div class="table-responsive"> | ||
53 | + <table id="usuariosTable" pagesize="10" | ||
54 | + class="table table-striped table-bordered table-hover table-condensed"> | ||
55 | + <thead> | ||
56 | + <tr> | ||
57 | + <th>ID</th> | ||
58 | + <th>URL</th> | ||
59 | + <th>Data da Avaliação</th> | ||
60 | + <th>Token</th> | ||
61 | + <th> </th> | ||
62 | + </tr> | ||
63 | + </thead> | ||
64 | + <tbody> | ||
65 | + <c:forEach items="${avaliacaoList}" var="avaliacao"> | ||
66 | + <tr> | ||
67 | + <td><a href="<c:url value="/usuarios/${avaliacao.id}" />">${avaliacao.id}</a></td> | ||
68 | + <td>${avaliacao.idUrl.url}</td> | ||
69 | + <td>${avaliacao.dataAvaliacao}</td> | ||
70 | + <td></td> | ||
71 | + <td> | ||
72 | + <div class="btn-group"> | ||
73 | + <a | ||
74 | + href="<c:url value="/avaliacoes/resultado/${avaliacao.id}" />" | ||
75 | + class="btn btn-default btn-sm">Consultar</a> | ||
76 | + </div> | ||
77 | + </td> | ||
78 | + </tr> | ||
79 | + </c:forEach> | ||
80 | + </tbody> | ||
81 | + </table> | ||
82 | + </div> | ||
83 | + | ||
84 | + <form action="<c:url value="/avaliacoes/pesquisa"/>" method=post name="formulario1"> | ||
85 | + <input type="hidden" name="nUrl" value="${nUrl}"> | ||
86 | + <input type="hidden" name="paginacao" id="paginacao" > | ||
87 | + </form> | ||
88 | + | ||
89 | + <script> | ||
90 | + function enviar_formulario(i) { | ||
91 | + //document.formulario1. | ||
92 | + document.getElementById("paginacao").value = i; | ||
93 | + document.formulario1.submit(); | ||
94 | + } | ||
95 | + </script> | ||
96 | + | ||
97 | + | ||
98 | + <input type="hidden" value="${nUrl}"> | ||
99 | + <ul class="pagination"> | ||
100 | + <li>${paginacao}</li> | ||
101 | + <li class="disabled"><a href="#">«</a></li> | ||
102 | + <li class="active"><a href="#">1</a></li> | ||
103 | + <li><a href="javascript:enviar_formulario(2)">2</a></li> | ||
104 | + <li><a href="#">3</a></li> | ||
105 | + <li><a href="#">4</a></li> | ||
106 | + <li><a href="#">5</a></li> | ||
107 | + <li><a href="#">»</a></li> | ||
108 | + </ul> | ||
109 | + </div> | ||
110 | + </div> | ||
111 | + </tiles:putAttribute> | ||
112 | +</tiles:insertTemplate> | ||
0 | \ No newline at end of file | 113 | \ No newline at end of file |
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/avaliacao/resultado.jsp
0 → 100644
@@ -0,0 +1,66 @@ | @@ -0,0 +1,66 @@ | ||
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | ||
2 | + pageEncoding="UTF-8"%> | ||
3 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | ||
4 | +<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%> | ||
5 | + | ||
6 | +<tiles:insertTemplate template="/WEB-INF/jsp/template/template.jsp"> | ||
7 | + <tiles:putAttribute name="body"> | ||
8 | + <a href="<c:url value="/avaliacoes" />"><strong><span class="glyphicon glyphicon-check"></span> Avaliações</strong></a> | ||
9 | + | ||
10 | + <a href="<c:url value="/avaliacao/form" />" class="btn btn-default pull-right"><span class="glyphicon glyphicon-plus"></span> Incluir Avaliação</a> | ||
11 | + | ||
12 | + <br /> | ||
13 | + | ||
14 | + <hr /> | ||
15 | + | ||
16 | + <c:if test="${not empty mensagem}"> | ||
17 | + <div class="alert alert-success alert-dismissable"> | ||
18 | + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | ||
19 | + ${mensagem} | ||
20 | + </div> | ||
21 | + </c:if> | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + <div class="row"> | ||
27 | + <div class="col-md-12"> | ||
28 | + <label for="inputNome">Id Avaliação: </label>${idAval}<br> | ||
29 | + <label for="inputNome">Url Avaliada: </label>${nomeUrl}<br> | ||
30 | + <label for="inputNome">Data da Avaliação: </label>${dataAval}<br> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + <div class="row"> | ||
38 | + <div class="col-md-12"> | ||
39 | + <div class="table-responsive"> | ||
40 | + <table id="usuariosTable" pagesize="10" class="table table-striped table-bordered table-hover table-condensed"> | ||
41 | + <thead> | ||
42 | + <tr> | ||
43 | + <th>Id Avaliação</th> | ||
44 | + <th>Diretriz</th> | ||
45 | + <th>Erros Obitidos</th> | ||
46 | + <th>Avisos Obitidos</th> | ||
47 | + </tr> | ||
48 | + </thead> | ||
49 | + <tbody> | ||
50 | + | ||
51 | + <c:forEach items="${resultadoList}" var="resultado"> | ||
52 | + <tr> | ||
53 | + <td>${resultado.avaliacao.id}</td> | ||
54 | + <td>${resultado.numDiretriz}</td> | ||
55 | + <td>${resultado.numErros}</td> | ||
56 | + <td>${resultado.numAvisos}</td> | ||
57 | + </tr> | ||
58 | + </c:forEach> | ||
59 | + | ||
60 | + </tbody> | ||
61 | + </table> | ||
62 | + </div> | ||
63 | + </div> | ||
64 | + </div> | ||
65 | + </tiles:putAttribute> | ||
66 | +</tiles:insertTemplate> | ||
0 | \ No newline at end of file | 67 | \ No newline at end of file |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/dao/AvaliacaoDao.java
0 → 100644
@@ -0,0 +1,59 @@ | @@ -0,0 +1,59 @@ | ||
1 | +package br.com.eselo.dao; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +import org.hibernate.Session; | ||
6 | +import org.hibernate.criterion.Order; | ||
7 | +import org.hibernate.criterion.Projections; | ||
8 | +import org.hibernate.criterion.Restrictions; | ||
9 | + | ||
10 | +import br.com.caelum.vraptor.ioc.Component; | ||
11 | +import br.com.eselo.model.Avaliacao; | ||
12 | +import br.com.eselo.model.ParametroCalculo; | ||
13 | +import br.com.eselo.model.Url; | ||
14 | + | ||
15 | +@Component | ||
16 | +public class AvaliacaoDao extends GenericDAO<Avaliacao> { | ||
17 | + | ||
18 | + public AvaliacaoDao(Session _session) { | ||
19 | + super(_session); | ||
20 | + } | ||
21 | + | ||
22 | + @SuppressWarnings("unchecked") | ||
23 | + public List<Avaliacao> listAll(int regIni, int regFim) { | ||
24 | + return getSession().createCriteria(getPersistentClass()) | ||
25 | + //.setFirstResult(regIni) | ||
26 | + //.setMaxResults(regFim) | ||
27 | + .addOrder(Order.desc("dataAvaliacao")).list(); | ||
28 | + } | ||
29 | + | ||
30 | + public Avaliacao getAvaliacao(Long idAval) { | ||
31 | + return (Avaliacao) getSession().createCriteria(getPersistentClass()) | ||
32 | + .add(Restrictions.eq("id", idAval)) | ||
33 | + .uniqueResult(); | ||
34 | + | ||
35 | + } | ||
36 | + | ||
37 | + public Long getAvaliacaoByURL(Url url) { | ||
38 | + return (Long) getSession().createCriteria(getPersistentClass()) | ||
39 | + .add(Restrictions.eq("idUrl", url)) | ||
40 | + .setProjection(Projections.max("id")) | ||
41 | + .uniqueResult(); | ||
42 | + } | ||
43 | + | ||
44 | + public int numLinhas(){ | ||
45 | + return (Integer) session.createCriteria(Avaliacao.class) | ||
46 | + .setProjection(Projections.rowCount()) | ||
47 | + .uniqueResult(); | ||
48 | + } | ||
49 | + | ||
50 | + public boolean existeAvaliacao(ParametroCalculo parametroCalculo) { | ||
51 | + @SuppressWarnings("unchecked") | ||
52 | + List<Avaliacao> encontrado = getSession() | ||
53 | + .createCriteria(getPersistentClass()) | ||
54 | + .add(Restrictions.eq("parametroAvaliacao", parametroCalculo)) | ||
55 | + .list(); | ||
56 | + return encontrado.size() >0; | ||
57 | + } | ||
58 | + | ||
59 | +} |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/dao/ResultadoDao.java
0 → 100644
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +package br.com.eselo.dao; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +import org.hibernate.Session; | ||
6 | +import org.hibernate.criterion.Order; | ||
7 | +import org.hibernate.criterion.Restrictions; | ||
8 | + | ||
9 | +import br.com.caelum.vraptor.ioc.Component; | ||
10 | +import br.com.eselo.model.Resultado; | ||
11 | + | ||
12 | +@Component | ||
13 | +public class ResultadoDao extends GenericDAO<Resultado> { | ||
14 | + | ||
15 | + public ResultadoDao(Session _session) { | ||
16 | + super(_session); | ||
17 | + } | ||
18 | + | ||
19 | + @SuppressWarnings("unchecked") | ||
20 | + public List<Resultado> listAll() { | ||
21 | + return getSession().createCriteria(getPersistentClass()) | ||
22 | + .addOrder(Order.asc("id")).list(); | ||
23 | + } | ||
24 | + | ||
25 | + @SuppressWarnings("unchecked") | ||
26 | + public List<Resultado> listResultado(Long idAvaliacao) { | ||
27 | + return getSession().createCriteria(getPersistentClass()) | ||
28 | + .add(Restrictions.eq("avaliacao.id", idAvaliacao)) | ||
29 | + .addOrder(Order.asc("id")).list(); | ||
30 | + } | ||
31 | + | ||
32 | +} |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/model/Avaliacao.java
0 → 100644
@@ -0,0 +1,100 @@ | @@ -0,0 +1,100 @@ | ||
1 | +package br.com.eselo.model; | ||
2 | + | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.Date; | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +import javax.persistence.CascadeType; | ||
8 | +import javax.persistence.Column; | ||
9 | +import javax.persistence.Entity; | ||
10 | +import javax.persistence.FetchType; | ||
11 | +import javax.persistence.GeneratedValue; | ||
12 | +import javax.persistence.Id; | ||
13 | +import javax.persistence.JoinColumn; | ||
14 | +import javax.persistence.ManyToOne; | ||
15 | +import javax.persistence.OneToMany; | ||
16 | +import javax.persistence.Table; | ||
17 | +import javax.persistence.Temporal; | ||
18 | +import javax.persistence.TemporalType; | ||
19 | + | ||
20 | +import org.hibernate.annotations.ForeignKey; | ||
21 | + | ||
22 | +@Entity | ||
23 | +@Table(name = "sel_avaliacao") | ||
24 | +public class Avaliacao { | ||
25 | + | ||
26 | + public Avaliacao() { | ||
27 | + this.resultados = new ArrayList<Resultado>(); | ||
28 | + } | ||
29 | + | ||
30 | + @Id | ||
31 | + @GeneratedValue | ||
32 | + @Column(name = "id_avaliacao", columnDefinition = "serial", unique = true, nullable = false) | ||
33 | + private Long id; | ||
34 | + | ||
35 | + @ManyToOne(fetch = FetchType.EAGER) | ||
36 | + @JoinColumn(name = "id_parametro_calculo", insertable = true, updatable = true) | ||
37 | + @ForeignKey(name = "fk_sel_parametro_calculo_sel_avaliacao") | ||
38 | + private ParametroCalculo parametroCalculo; | ||
39 | + | ||
40 | + @ManyToOne(fetch = FetchType.LAZY) | ||
41 | + @JoinColumn(name="id_url", insertable=true, updatable=true) | ||
42 | + private Url url; | ||
43 | + | ||
44 | + @Column(name = "ts_avaliacao", columnDefinition = "timestamp without time zone",nullable = false) | ||
45 | + @Temporal(TemporalType.TIMESTAMP) | ||
46 | + private Date dataAvaliacao; | ||
47 | + | ||
48 | + @OneToMany(mappedBy = "avaliacao", targetEntity = br.com.eselo.model.Resultado.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
49 | + private List<Resultado> resultados; | ||
50 | + | ||
51 | + public Long getId() { | ||
52 | + return id; | ||
53 | + } | ||
54 | + | ||
55 | + public void setId(Long id) { | ||
56 | + this.id = id; | ||
57 | + } | ||
58 | + | ||
59 | + public ParametroCalculo getParametroCalculo() { | ||
60 | + return parametroCalculo; | ||
61 | + } | ||
62 | + | ||
63 | + public void setParametroCalculo(ParametroCalculo parametroCalculo) { | ||
64 | + this.parametroCalculo = parametroCalculo; | ||
65 | + } | ||
66 | + | ||
67 | + public Url getUrl() { | ||
68 | + return url; | ||
69 | + } | ||
70 | + | ||
71 | + public void setUrl(Url url) { | ||
72 | + this.url = url; | ||
73 | + } | ||
74 | + | ||
75 | + public Date getDataAvaliacao() { | ||
76 | + return dataAvaliacao; | ||
77 | + } | ||
78 | + | ||
79 | + public void setDataAvaliacao(Date dataAvaliacao) { | ||
80 | + this.dataAvaliacao = dataAvaliacao; | ||
81 | + } | ||
82 | + | ||
83 | + | ||
84 | + public List<Resultado> getResultados() { | ||
85 | + return resultados; | ||
86 | + } | ||
87 | + | ||
88 | + | ||
89 | + public void setResultados(List<Resultado> resultados) { | ||
90 | + this.resultados = resultados; | ||
91 | + } | ||
92 | + | ||
93 | + public void addResultado(Resultado resultado){ | ||
94 | + this.resultados.add(resultado); | ||
95 | + } | ||
96 | + | ||
97 | + public void removeResultado(Resultado resultado){ | ||
98 | + this.resultados.remove(resultado); | ||
99 | + } | ||
100 | +} |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/model/Criterio.java
@@ -35,7 +35,7 @@ public class Criterio { | @@ -35,7 +35,7 @@ public class Criterio { | ||
35 | @Column(name = "id_criterio", columnDefinition = "serial", unique = true, nullable = false) | 35 | @Column(name = "id_criterio", columnDefinition = "serial", unique = true, nullable = false) |
36 | private Long id; | 36 | private Long id; |
37 | 37 | ||
38 | - @Column(name = "vl_peso") | 38 | + @Column(name = "vl_peso",nullable = false) |
39 | private Integer peso; | 39 | private Integer peso; |
40 | 40 | ||
41 | @Column(name = "ds_descricao", nullable = false) | 41 | @Column(name = "ds_descricao", nullable = false) |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/model/ParametroCalculo.java
@@ -56,6 +56,26 @@ public class ParametroCalculo { | @@ -56,6 +56,26 @@ public class ParametroCalculo { | ||
56 | 56 | ||
57 | @OneToMany(mappedBy = "parametroCalculo", targetEntity = br.com.eselo.model.Recomendacao.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL) | 57 | @OneToMany(mappedBy = "parametroCalculo", targetEntity = br.com.eselo.model.Recomendacao.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL) |
58 | private List<Recomendacao> recomendacoes; | 58 | private List<Recomendacao> recomendacoes; |
59 | + | ||
60 | + @OneToMany(mappedBy = "parametroCalculo", targetEntity = br.com.eselo.model.Avaliacao.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
61 | + private List<Avaliacao> avaliacoes; | ||
62 | + | ||
63 | + public List<Avaliacao> getAvaliacoes() { | ||
64 | + return avaliacoes; | ||
65 | + } | ||
66 | + | ||
67 | + public void setAvaliacoes(List<Avaliacao> avaliacoes) { | ||
68 | + this.avaliacoes = avaliacoes; | ||
69 | + } | ||
70 | + | ||
71 | + public void addAvaliacao(Avaliacao avaliacao){ | ||
72 | + this.avaliacoes.add(avaliacao); | ||
73 | + } | ||
74 | + | ||
75 | + public void removeAvaliacao(Avaliacao avaliacao){ | ||
76 | + this.avaliacoes.remove(avaliacao); | ||
77 | + } | ||
78 | + | ||
59 | 79 | ||
60 | public List<Recomendacao> getRecomendacoes() { | 80 | public List<Recomendacao> getRecomendacoes() { |
61 | return recomendacoes; | 81 | return recomendacoes; |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/model/Resultado.java
0 → 100644
@@ -0,0 +1,91 @@ | @@ -0,0 +1,91 @@ | ||
1 | +package br.com.eselo.model; | ||
2 | + | ||
3 | +import javax.persistence.Column; | ||
4 | +import javax.persistence.Entity; | ||
5 | +import javax.persistence.FetchType; | ||
6 | +import javax.persistence.GeneratedValue; | ||
7 | +import javax.persistence.Id; | ||
8 | +import javax.persistence.JoinColumn; | ||
9 | +import javax.persistence.OneToOne; | ||
10 | +import javax.persistence.Table; | ||
11 | + | ||
12 | +import org.hibernate.annotations.Fetch; | ||
13 | +import org.hibernate.annotations.FetchMode; | ||
14 | +import org.hibernate.annotations.ForeignKey; | ||
15 | + | ||
16 | +@Entity | ||
17 | +@Table(name = "sel_resultado") | ||
18 | +public class Resultado { | ||
19 | + | ||
20 | + @Id | ||
21 | + @GeneratedValue | ||
22 | + @Column(name = "id_resultado", columnDefinition = "serial", unique = true, nullable = false) | ||
23 | + private Long id; | ||
24 | + | ||
25 | + @OneToOne(fetch = FetchType.EAGER) | ||
26 | + @JoinColumn(name="id_avaliacao", insertable=true, updatable=true) | ||
27 | + @ForeignKey(name = "fk_sel_resultado_sel_avaliacao") | ||
28 | + @Fetch(FetchMode.SELECT) | ||
29 | + private Avaliacao avaliacao; | ||
30 | + | ||
31 | + @Column(name = "nu_recomendacao",nullable = false) | ||
32 | + private Long numRecomendacao; | ||
33 | + | ||
34 | + @Column(name = "nu_criterio",nullable = false) | ||
35 | + private Long numCriterio; | ||
36 | + | ||
37 | + @Column(name = "nu_erros",nullable = false) | ||
38 | + private Long numErros; | ||
39 | + | ||
40 | + @Column(name = "nu_avisos",nullable = false) | ||
41 | + private Long numAvisos; | ||
42 | + | ||
43 | + public Long getId() { | ||
44 | + return id; | ||
45 | + } | ||
46 | + | ||
47 | + public void setId(Long id) { | ||
48 | + this.id = id; | ||
49 | + } | ||
50 | + | ||
51 | + public Avaliacao getAvaliacao() { | ||
52 | + return avaliacao; | ||
53 | + } | ||
54 | + | ||
55 | + public void setAvaliacao(Avaliacao avaliacao) { | ||
56 | + this.avaliacao = avaliacao; | ||
57 | + } | ||
58 | + | ||
59 | + public Long getNumRecomendacao() { | ||
60 | + return numRecomendacao; | ||
61 | + } | ||
62 | + | ||
63 | + public void setNumRecomendacao(Long numRecomendacao) { | ||
64 | + this.numRecomendacao = numRecomendacao; | ||
65 | + } | ||
66 | + | ||
67 | + public Long getNumCriterio() { | ||
68 | + return numCriterio; | ||
69 | + } | ||
70 | + | ||
71 | + public void setNumCriterio(Long numCriterio) { | ||
72 | + this.numCriterio = numCriterio; | ||
73 | + } | ||
74 | + | ||
75 | + public Long getNumErros() { | ||
76 | + return numErros; | ||
77 | + } | ||
78 | + | ||
79 | + public void setNumErros(Long numErros) { | ||
80 | + this.numErros = numErros; | ||
81 | + } | ||
82 | + | ||
83 | + public Long getNumAvisos() { | ||
84 | + return numAvisos; | ||
85 | + } | ||
86 | + | ||
87 | + public void setNumAvisos(Long numAvisos) { | ||
88 | + this.numAvisos = numAvisos; | ||
89 | + } | ||
90 | + | ||
91 | +} |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/model/Usuario.java
@@ -30,18 +30,19 @@ public class Usuario { | @@ -30,18 +30,19 @@ public class Usuario { | ||
30 | @Column(name = "id_usuario", columnDefinition = "serial", unique = true, nullable = false) | 30 | @Column(name = "id_usuario", columnDefinition = "serial", unique = true, nullable = false) |
31 | private Long id; | 31 | private Long id; |
32 | 32 | ||
33 | - @Column(name = "no_usuario") | 33 | + @Column(name = "no_usuario",nullable = false) |
34 | private String nome; | 34 | private String nome; |
35 | 35 | ||
36 | - @Column(name = "nu_cpf") | 36 | + @Column(name = "nu_cpf",nullable = false) |
37 | private String cpf; | 37 | private String cpf; |
38 | 38 | ||
39 | + @Column(name = "senha",nullable = false) | ||
39 | private String senha; | 40 | private String senha; |
40 | 41 | ||
41 | - @Column(name = "ds_email") | 42 | + @Column(name = "ds_email", nullable = false) |
42 | private String email; | 43 | private String email; |
43 | 44 | ||
44 | - @Column(name = "ds_chave_alteracao_senha", nullable = true) | 45 | + @Column(name = "ds_chave_alteracao_senha") |
45 | private String chaveAlteracaoSenha; | 46 | private String chaveAlteracaoSenha; |
46 | 47 | ||
47 | @Transient | 48 | @Transient |
Desenvolvimento/Codificacao/e-Selo/src/main/resources/hibernate.cfg.xml
@@ -21,10 +21,12 @@ | @@ -21,10 +21,12 @@ | ||
21 | <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> | 21 | <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> |
22 | 22 | ||
23 | <mapping class="br.com.eselo.model.Usuario" /> | 23 | <mapping class="br.com.eselo.model.Usuario" /> |
24 | + <mapping class="br.com.eselo.model.Avaliacao" /> | ||
24 | <mapping class="br.com.eselo.model.ParametroCalculo" /> | 25 | <mapping class="br.com.eselo.model.ParametroCalculo" /> |
25 | <mapping class="br.com.eselo.model.Permissao" /> | 26 | <mapping class="br.com.eselo.model.Permissao" /> |
26 | <mapping class="br.com.eselo.model.Faixa" /> | 27 | <mapping class="br.com.eselo.model.Faixa" /> |
27 | <mapping class="br.com.eselo.model.Grupo" /> | 28 | <mapping class="br.com.eselo.model.Grupo" /> |
29 | + <mapping class="br.com.eselo.model.Resultado" /> | ||
28 | <mapping class="br.com.eselo.model.Criterio" /> | 30 | <mapping class="br.com.eselo.model.Criterio" /> |
29 | <mapping class="br.com.eselo.model.Recomendacao" /> | 31 | <mapping class="br.com.eselo.model.Recomendacao" /> |
30 | <mapping class="br.com.eselo.model.TipoTeste" /> | 32 | <mapping class="br.com.eselo.model.TipoTeste" /> |
Desenvolvimento/Codificacao/e-Selo/target/classes/hibernate.cfg.xml
@@ -21,10 +21,12 @@ | @@ -21,10 +21,12 @@ | ||
21 | <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> | 21 | <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> |
22 | 22 | ||
23 | <mapping class="br.com.eselo.model.Usuario" /> | 23 | <mapping class="br.com.eselo.model.Usuario" /> |
24 | + <mapping class="br.com.eselo.model.Avaliacao" /> | ||
24 | <mapping class="br.com.eselo.model.ParametroCalculo" /> | 25 | <mapping class="br.com.eselo.model.ParametroCalculo" /> |
25 | <mapping class="br.com.eselo.model.Permissao" /> | 26 | <mapping class="br.com.eselo.model.Permissao" /> |
26 | <mapping class="br.com.eselo.model.Faixa" /> | 27 | <mapping class="br.com.eselo.model.Faixa" /> |
27 | <mapping class="br.com.eselo.model.Grupo" /> | 28 | <mapping class="br.com.eselo.model.Grupo" /> |
29 | + <mapping class="br.com.eselo.model.Resultado" /> | ||
28 | <mapping class="br.com.eselo.model.Criterio" /> | 30 | <mapping class="br.com.eselo.model.Criterio" /> |
29 | <mapping class="br.com.eselo.model.Recomendacao" /> | 31 | <mapping class="br.com.eselo.model.Recomendacao" /> |
30 | <mapping class="br.com.eselo.model.TipoTeste" /> | 32 | <mapping class="br.com.eselo.model.TipoTeste" /> |