Commit 905aea6c18732a1342695213ef8ab79f53347b24
1 parent
7e26134a
Exists in
master
git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/e-selo@9517 c2178572-b5ca…
…-4887-91d2-9e3a90c7d55b
Showing
14 changed files
with
286 additions
and
212 deletions
Show diff stats
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/conexaoAsesWeb/AvaliationReport.java
... | ... | @@ -1,75 +0,0 @@ |
1 | -package br.com.eselo.conexaoAsesWeb; | |
2 | - | |
3 | -import java.util.ArrayList; | |
4 | -import java.util.Date; | |
5 | -import java.util.List; | |
6 | - | |
7 | -import com.thoughtworks.xstream.XStream; | |
8 | -import com.thoughtworks.xstream.io.xml.DomDriver; | |
9 | -import com.thoughtworks.xstream.io.xml.XmlFriendlyReplacer; | |
10 | - | |
11 | -public class AvaliationReport { | |
12 | - | |
13 | - private String url; | |
14 | - private Date date; | |
15 | - private List<CheckPoint> checkPoints; | |
16 | - | |
17 | - public AvaliationReport() { | |
18 | - this.checkPoints = new ArrayList<CheckPoint>(); | |
19 | - } | |
20 | - | |
21 | - | |
22 | - public String getUrl() { | |
23 | - return url; | |
24 | - } | |
25 | - | |
26 | - public void setUrl(String url) { | |
27 | - this.url = url; | |
28 | - } | |
29 | - | |
30 | - public Date getDate() { | |
31 | - return date; | |
32 | - } | |
33 | - | |
34 | - public void setDate(Date date) { | |
35 | - this.date = date; | |
36 | - } | |
37 | - | |
38 | - public List<CheckPoint> getCheckPoints() { | |
39 | - return checkPoints; | |
40 | - } | |
41 | - | |
42 | - public void setCheckPoints(List<CheckPoint> checkPoints) { | |
43 | - this.checkPoints = checkPoints; | |
44 | - } | |
45 | - | |
46 | - public void addCheckPoint(CheckPoint checkPoint) { | |
47 | - this.checkPoints.add(checkPoint); | |
48 | - } | |
49 | - | |
50 | - @Override | |
51 | - public String toString() { | |
52 | - XStream xstream = new XStream(new DomDriver("UTF-8", new XmlFriendlyReplacer("__", "_"))); | |
53 | - | |
54 | - xstream.alias("relatorio_de_avaliacao", AvaliationReport.class); | |
55 | - xstream.alias("recomendacao", CheckPoint.class); | |
56 | - xstream.alias("criterio", Criterio.class); | |
57 | - | |
58 | - xstream.aliasField("resultados", AvaliationReport.class, "result"); | |
59 | - | |
60 | - xstream.aliasField("data", AvaliationReport.class, "date"); | |
61 | - xstream.addImplicitCollection(AvaliationReport.class, "checkPoints"); | |
62 | - | |
63 | - xstream.aliasField("criterio", CheckPoint.class, "criterio"); | |
64 | - xstream.aliasField("descricao", Criterio.class, "description"); | |
65 | - xstream.aliasField("qtde_erros", Criterio.class, "qtdeErrors"); | |
66 | - | |
67 | - xstream.aliasField("identificador", CheckPoint.class, "identificador"); | |
68 | - xstream.aliasField("total_erros", CheckPoint.class, "totalErrors"); | |
69 | - xstream.aliasField("total_avisos", CheckPoint.class, "totalWarnings"); | |
70 | - | |
71 | - return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+xstream.toXML(this); | |
72 | - | |
73 | - } | |
74 | - | |
75 | -} |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/conexaoAsesWeb/CheckPoint.java
... | ... | @@ -1,46 +0,0 @@ |
1 | -package br.com.eselo.conexaoAsesWeb; | |
2 | - | |
3 | -public class CheckPoint { | |
4 | - | |
5 | - private Criterio criterio; | |
6 | - private Long identificador; | |
7 | - private Long totalErrors; | |
8 | - private Long totalWarnings; | |
9 | - | |
10 | - public CheckPoint() { | |
11 | - this.criterio = new Criterio(); | |
12 | - } | |
13 | - | |
14 | - public Long getTotalErrors() { | |
15 | - return totalErrors; | |
16 | - } | |
17 | - | |
18 | - public void setTotalErrors(Long totalErrors) { | |
19 | - this.totalErrors = totalErrors; | |
20 | - } | |
21 | - | |
22 | - public Long getTotalWarnings() { | |
23 | - return totalWarnings; | |
24 | - } | |
25 | - | |
26 | - public void setTotalWarnings(Long totalWarnings) { | |
27 | - this.totalWarnings = totalWarnings; | |
28 | - } | |
29 | - | |
30 | - public Criterio getCriterio() { | |
31 | - return criterio; | |
32 | - } | |
33 | - | |
34 | - public void setCriterio(Criterio criterio) { | |
35 | - this.criterio = criterio; | |
36 | - } | |
37 | - | |
38 | - public Long getIdentificador() { | |
39 | - return identificador; | |
40 | - } | |
41 | - | |
42 | - public void setIdentificador(Long identificador) { | |
43 | - this.identificador = identificador; | |
44 | - } | |
45 | - | |
46 | -} |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/conexaoAsesWeb/Criterio.java
... | ... | @@ -2,20 +2,32 @@ package br.com.eselo.conexaoAsesWeb; |
2 | 2 | |
3 | 3 | public class Criterio { |
4 | 4 | |
5 | - private String description; | |
6 | - private int qtdeErrors; | |
5 | + private Long identificador; | |
6 | + private Long qtdeErros; | |
7 | + private Long qtdeItens; | |
7 | 8 | |
8 | - public String getDescription() { | |
9 | - return description; | |
9 | + public Long getIdentificador() { | |
10 | + return identificador; | |
10 | 11 | } |
11 | - public void setDescription(String description) { | |
12 | - this.description = description; | |
12 | + | |
13 | + public void setIdentificador(Long identificador) { | |
14 | + this.identificador = identificador; | |
13 | 15 | } |
14 | - public int getQtdeErrors() { | |
15 | - return qtdeErrors; | |
16 | + | |
17 | + public Long getQtdeErros() { | |
18 | + return qtdeErros; | |
16 | 19 | } |
17 | - public void setQtdeErrors(int qtdeErrors) { | |
18 | - this.qtdeErrors = qtdeErrors; | |
20 | + | |
21 | + public void setQtdeErros(Long qtdeErros) { | |
22 | + this.qtdeErros = qtdeErros; | |
19 | 23 | } |
20 | - | |
24 | + | |
25 | + public Long getQtdeItens() { | |
26 | + return qtdeItens; | |
27 | + } | |
28 | + | |
29 | + public void setQtdeItens(Long qtdeItens) { | |
30 | + this.qtdeItens = qtdeItens; | |
31 | + } | |
32 | + | |
21 | 33 | } | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/conexaoAsesWeb/LeitorXML.java
... | ... | @@ -13,46 +13,47 @@ import com.thoughtworks.xstream.io.xml.XmlFriendlyReplacer; |
13 | 13 | |
14 | 14 | public class LeitorXML { |
15 | 15 | |
16 | - public AvaliationReport lerAvaliacaoXML(String fonte){ | |
17 | - | |
18 | -XStream xstream = new XStream(new DomDriver("UTF-8", new XmlFriendlyReplacer("__", "_"))); | |
16 | + public RelatorioAvaliacao lerAvaliacaoXML(String fonte){ | |
17 | + | |
18 | + XStream xstream = new XStream(new DomDriver("UTF-8", new XmlFriendlyReplacer("__", "_"))); | |
19 | 19 | |
20 | - xstream.alias("relatorio_de_avaliacao", AvaliationReport.class); | |
21 | - xstream.alias("recomendacao", CheckPoint.class); | |
20 | + xstream.alias("relatorio_de_avaliacao", RelatorioAvaliacao.class); | |
21 | + xstream.alias("recomendacao", Recomendacao.class); | |
22 | 22 | xstream.alias("criterio", Criterio.class); |
23 | 23 | |
24 | - xstream.aliasField("resultados", AvaliationReport.class, "result"); | |
25 | - | |
26 | - xstream.aliasField("data", AvaliationReport.class, "date"); | |
27 | - xstream.addImplicitCollection(AvaliationReport.class, "checkPoints"); | |
24 | + | |
25 | + xstream.aliasField("data", RelatorioAvaliacao.class, "date"); | |
26 | + xstream.addImplicitCollection(RelatorioAvaliacao.class, "recomendacoes"); | |
28 | 27 | |
29 | - xstream.aliasField("criterio", CheckPoint.class, "criterio"); | |
30 | - xstream.aliasField("descricao", Criterio.class, "description"); | |
31 | - xstream.aliasField("qtde_erros", Criterio.class, "qtdeErrors"); | |
28 | + xstream.aliasField("criterio", Recomendacao.class, "criterio"); | |
29 | + xstream.aliasField("identificador", Criterio.class, "identificador"); | |
30 | + xstream.aliasField("itens_criterio", Criterio.class, "qtdeItens"); | |
31 | + xstream.aliasField("erros_criterio", Criterio.class, "qtdeErros"); | |
32 | 32 | |
33 | - xstream.aliasField("identificador", CheckPoint.class, "identificador"); | |
34 | - xstream.aliasField("total_erros", CheckPoint.class, "totalErrors"); | |
35 | - xstream.aliasField("total_avisos", CheckPoint.class, "totalWarnings"); | |
33 | + xstream.aliasField("identificador", Recomendacao.class, "identificador"); | |
34 | + xstream.aliasField("total_erros", Recomendacao.class, "totalErros"); | |
35 | + xstream.aliasField("total_avisos", Recomendacao.class, "totalAvisos"); | |
36 | + xstream.aliasField("qtde_linhas", RelatorioAvaliacao.class, "qtdeLinhas"); | |
36 | 37 | |
37 | - return (AvaliationReport) xstream.fromXML(fonte); | |
38 | + return (RelatorioAvaliacao) xstream.fromXML(fonte); | |
38 | 39 | } |
39 | 40 | |
40 | 41 | public List<Resultado> lerResultadosXML(String xml, Avaliacao avaliacao){ |
41 | - List<CheckPoint> cps = ((AvaliationReport)lerAvaliacaoXML(xml)).getCheckPoints(); | |
42 | + List<Recomendacao> cps = ((RelatorioAvaliacao)lerAvaliacaoXML(xml)).getRecomendacoes(); | |
42 | 43 | return lerResultadosXML(cps, avaliacao); |
43 | 44 | } |
44 | 45 | |
45 | - public List<Resultado> lerResultadosXML(List<CheckPoint> cps, Avaliacao avaliacao){ | |
46 | + public List<Resultado> lerResultadosXML(List<Recomendacao> recomendacoes, Avaliacao avaliacao){ | |
46 | 47 | |
47 | 48 | Resultado r; |
48 | 49 | List<Resultado> resultados = new ArrayList<Resultado>(); |
49 | 50 | |
50 | - for(CheckPoint cp:cps){ | |
51 | + for(Recomendacao recomendacao:recomendacoes){ | |
51 | 52 | r = new Resultado(); |
52 | 53 | r.setAvaliacao(avaliacao); |
53 | - r.setNumDiretriz(cp.getIdentificador()); | |
54 | - r.setNumAvisos(cp.getTotalWarnings()); | |
55 | - r.setNumErros(cp.getTotalErrors()); | |
54 | + r.setNumDiretriz(recomendacao.getIdentificador()); | |
55 | + r.setNumAvisos(recomendacao.getTotalAvisos()); | |
56 | + r.setNumErros(recomendacao.getTotalErros()); | |
56 | 57 | |
57 | 58 | resultados.add(r); |
58 | 59 | } |
... | ... | @@ -60,7 +61,7 @@ XStream xstream = new XStream(new DomDriver("UTF-8", new XmlFriendlyReplacer("__ |
60 | 61 | return resultados; |
61 | 62 | } |
62 | 63 | |
63 | - public String toJson(AvaliationReport ar){ | |
64 | + public String toJson(RelatorioAvaliacao ar){ | |
64 | 65 | return new Gson().toJson(ar); |
65 | 66 | } |
66 | 67 | } | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/conexaoAsesWeb/Recomendacao.java
0 → 100644
... | ... | @@ -0,0 +1,47 @@ |
1 | +package br.com.eselo.conexaoAsesWeb; | |
2 | + | |
3 | +public class Recomendacao { | |
4 | + | |
5 | + private Long identificador; | |
6 | + private Criterio criterio; | |
7 | + private Long totalErros; | |
8 | + private Long totalAvisos; | |
9 | + | |
10 | + public Recomendacao() { | |
11 | + this.criterio = new Criterio(); | |
12 | + } | |
13 | + | |
14 | + public Long getIdentificador() { | |
15 | + return identificador; | |
16 | + } | |
17 | + | |
18 | + public void setIdentificador(Long identificador) { | |
19 | + this.identificador = identificador; | |
20 | + } | |
21 | + | |
22 | + public Criterio getCriterio() { | |
23 | + return criterio; | |
24 | + } | |
25 | + | |
26 | + public void setCriterio(Criterio criterio) { | |
27 | + this.criterio = criterio; | |
28 | + } | |
29 | + | |
30 | + public Long getTotalErros() { | |
31 | + return totalErros; | |
32 | + } | |
33 | + | |
34 | + public void setTotalErros(Long totalErros) { | |
35 | + this.totalErros = totalErros; | |
36 | + } | |
37 | + | |
38 | + public Long getTotalAvisos() { | |
39 | + return totalAvisos; | |
40 | + } | |
41 | + | |
42 | + public void setTotalAvisos(Long totalAvisos) { | |
43 | + this.totalAvisos = totalAvisos; | |
44 | + } | |
45 | + | |
46 | + | |
47 | +} | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/conexaoAsesWeb/RelatorioAvaliacao.java
0 → 100644
... | ... | @@ -0,0 +1,86 @@ |
1 | +package br.com.eselo.conexaoAsesWeb; | |
2 | + | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.Date; | |
5 | +import java.util.List; | |
6 | + | |
7 | +import com.thoughtworks.xstream.XStream; | |
8 | +import com.thoughtworks.xstream.io.xml.DomDriver; | |
9 | +import com.thoughtworks.xstream.io.xml.XmlFriendlyReplacer; | |
10 | + | |
11 | +public class RelatorioAvaliacao { | |
12 | + | |
13 | + private String url; | |
14 | + private Date date; | |
15 | + private List<Recomendacao> recomendacoes; | |
16 | + private Long qtdeLinhas; | |
17 | + | |
18 | + public RelatorioAvaliacao() { | |
19 | + this.recomendacoes = new ArrayList<Recomendacao>(); | |
20 | + } | |
21 | + | |
22 | + | |
23 | + public String getUrl() { | |
24 | + return url; | |
25 | + } | |
26 | + | |
27 | + public void setUrl(String url) { | |
28 | + this.url = url; | |
29 | + } | |
30 | + | |
31 | + public Date getDate() { | |
32 | + return date; | |
33 | + } | |
34 | + | |
35 | + public void setDate(Date date) { | |
36 | + this.date = date; | |
37 | + } | |
38 | + | |
39 | + public List<Recomendacao> getRecomendacoes() { | |
40 | + return recomendacoes; | |
41 | + } | |
42 | + | |
43 | + public void setRecomendacoes(List<Recomendacao> recomendacoes) { | |
44 | + this.recomendacoes = recomendacoes; | |
45 | + } | |
46 | + | |
47 | + public void addRecomendacao(Recomendacao recomendacao) { | |
48 | + this.recomendacoes.add(recomendacao); | |
49 | + } | |
50 | + | |
51 | + public Long getQtdeLinhas() { | |
52 | + return qtdeLinhas; | |
53 | + } | |
54 | + | |
55 | + | |
56 | + public void setQtdeLinhas(Long qtdeLinhas) { | |
57 | + this.qtdeLinhas = qtdeLinhas; | |
58 | + } | |
59 | + | |
60 | + @Override | |
61 | + public String toString() { | |
62 | + XStream xstream = new XStream(new DomDriver("UTF-8", new XmlFriendlyReplacer("__", "_"))); | |
63 | + | |
64 | + xstream.alias("relatorio_de_avaliacao", RelatorioAvaliacao.class); | |
65 | + xstream.alias("recomendacao", Recomendacao.class); | |
66 | + xstream.alias("criterio", Criterio.class); | |
67 | + | |
68 | + | |
69 | + xstream.aliasField("data", RelatorioAvaliacao.class, "date"); | |
70 | + xstream.addImplicitCollection(RelatorioAvaliacao.class, "recomendacoes"); | |
71 | + | |
72 | + xstream.aliasField("criterio", Recomendacao.class, "criterio"); | |
73 | + xstream.aliasField("identificador", Criterio.class, "identificador"); | |
74 | + xstream.aliasField("itens_criterio", Criterio.class, "qtdeItens"); | |
75 | + xstream.aliasField("erros_criterio", Criterio.class, "qtdeErros"); | |
76 | + | |
77 | + xstream.aliasField("identificador", Recomendacao.class, "identificador"); | |
78 | + xstream.aliasField("total_erros", Recomendacao.class, "totalErros"); | |
79 | + xstream.aliasField("total_avisos", Recomendacao.class, "totalAvisos"); | |
80 | + xstream.aliasField("qtde_linhas", RelatorioAvaliacao.class, "qtdeLinhas"); | |
81 | + | |
82 | + | |
83 | + return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+xstream.toXML(this); | |
84 | + | |
85 | + } | |
86 | +} | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/conexaoAsesWeb/Result.java
... | ... | @@ -9,14 +9,14 @@ public class Result{ |
9 | 9 | private String url; |
10 | 10 | private Date date; |
11 | 11 | |
12 | - private List<CheckPoint> checkPoints; | |
12 | + private List<Recomendacao> checkPoints; | |
13 | 13 | |
14 | 14 | public Result(){ |
15 | - this.checkPoints = new ArrayList<CheckPoint>(); | |
15 | + this.checkPoints = new ArrayList<Recomendacao>(); | |
16 | 16 | //this.date = new GregorianCalendar(); |
17 | 17 | } |
18 | 18 | |
19 | - public void addCheckPoint(CheckPoint checkPoint) { this.checkPoints.add(checkPoint) ; } | |
19 | + public void addCheckPoint(Recomendacao checkPoint) { this.checkPoints.add(checkPoint) ; } | |
20 | 20 | |
21 | 21 | public String getUrl() { return url; } |
22 | 22 | |
... | ... | @@ -26,6 +26,6 @@ public class Result{ |
26 | 26 | |
27 | 27 | public void setDate(Date date) { this.date = date; } |
28 | 28 | |
29 | - public List<CheckPoint> getCheckPoints() { return checkPoints; } | |
29 | + public List<Recomendacao> getCheckPoints() { return checkPoints; } | |
30 | 30 | |
31 | 31 | } | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/AvaliacaoController.java
... | ... | @@ -22,20 +22,16 @@ import br.com.caelum.vraptor.Validator; |
22 | 22 | import br.com.caelum.vraptor.view.Results; |
23 | 23 | import br.com.eselo.annotations.Restrito; |
24 | 24 | import br.com.eselo.component.UsuarioWeb; |
25 | -import br.com.eselo.conexaoAsesWeb.AvaliationReport; | |
26 | -import br.com.eselo.conexaoAsesWeb.CheckPoint; | |
27 | 25 | import br.com.eselo.conexaoAsesWeb.LeitorXML; |
26 | +import br.com.eselo.conexaoAsesWeb.Recomendacao; | |
27 | +import br.com.eselo.conexaoAsesWeb.RelatorioAvaliacao; | |
28 | 28 | import br.com.eselo.conexaoAsesWeb.ResultadoAvaliacao; |
29 | 29 | import br.com.eselo.dao.AvaliacaoDAO; |
30 | -import br.com.eselo.dao.FaixaDAO; | |
31 | 30 | import br.com.eselo.dao.ParametroAvaliacaoDAO; |
32 | -import br.com.eselo.dao.RecomendacaoDAO; | |
33 | 31 | import br.com.eselo.dao.ResultadoDAO; |
34 | 32 | import br.com.eselo.dao.UrlDAO; |
35 | 33 | import br.com.eselo.model.Avaliacao; |
36 | -import br.com.eselo.model.Faixa; | |
37 | 34 | import br.com.eselo.model.ParametroAvaliacao; |
38 | -import br.com.eselo.model.Recomendacao; | |
39 | 35 | import br.com.eselo.model.Resultado; |
40 | 36 | import br.com.eselo.model.Url; |
41 | 37 | |
... | ... | @@ -218,14 +214,15 @@ public class AvaliacaoController { |
218 | 214 | |
219 | 215 | //obter os resultados |
220 | 216 | resultadosObtidos = new ResultadoDAO(dao.getSession()).listResultado(idAvaliacao); |
221 | - | |
217 | +/* | |
222 | 218 | //obter as diretrizes e níveis de conformidade |
223 | 219 | recomendacoesValidas = new RecomendacaoDAO(dao.getSession()).getByParametroAvaliacao(avaliacao.getParametroAvaliacao()); |
224 | 220 | |
225 | 221 | //Comparando |
222 | + /* | |
226 | 223 | for (Recomendacao recomendacao: recomendacoesValidas){ |
227 | 224 | for (Resultado resultado : resultadosObtidos) { |
228 | - if(resultado.getNumDiretriz().equals(recomendacao.getNumeroRecomendacao())){ | |
225 | + if(resultado.getNumDiretriz().equals(recomendacao.getIdentificador())){ | |
229 | 226 | List<Faixa> conformidades = new FaixaDAO(dao.getSession()).getByDiretriz(recomendacao); |
230 | 227 | for (Faixa conformidade: conformidades){ |
231 | 228 | if (resultado.getNumErros() >= conformidade.getFaixaInicio() && resultado.getNumErros() <= conformidade.getFaixaFim()){ |
... | ... | @@ -236,6 +233,7 @@ public class AvaliacaoController { |
236 | 233 | } |
237 | 234 | } |
238 | 235 | } |
236 | + */ | |
239 | 237 | |
240 | 238 | |
241 | 239 | nota = 100*(nota/somaDosPesos); |
... | ... | @@ -258,18 +256,18 @@ public class AvaliacaoController { |
258 | 256 | } |
259 | 257 | |
260 | 258 | @Post("/calcular-nota") |
261 | - public void calcularNota(AvaliationReport avaliationReport) { | |
259 | + public void calcularNota(RelatorioAvaliacao avaliationReport) { | |
262 | 260 | ResultadoAvaliacao ra = new ResultadoAvaliacao(); |
263 | 261 | |
264 | 262 | Long idAval=null; |
265 | 263 | Url url = new Url(); |
266 | - List<CheckPoint> recomendacoes; | |
264 | + List<Recomendacao> recomendacoes; | |
267 | 265 | |
268 | - if (avaliationReport.getCheckPoints() != null && avaliationReport.getDate() != null && avaliationReport.getUrl() != null) { | |
266 | + if (avaliationReport.getRecomendacoes() != null && avaliationReport.getDate() != null && avaliationReport.getUrl() != null) { | |
269 | 267 | url.setUrl(avaliationReport.getUrl()); |
270 | 268 | daoUrl.save(url); |
271 | 269 | |
272 | - recomendacoes = avaliationReport.getCheckPoints(); | |
270 | + recomendacoes = avaliationReport.getRecomendacoes(); | |
273 | 271 | |
274 | 272 | ParametroAvaliacao parametroAvaliacao = new ParametroAvaliacaoDAO(dao.getSession()).getLastParametrosAvaliacao(); |
275 | 273 | |
... | ... | @@ -321,6 +319,7 @@ public class AvaliacaoController { |
321 | 319 | public File selo() { |
322 | 320 | BufferedImage img = null; |
323 | 321 | SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); |
322 | + @SuppressWarnings("deprecation") | |
324 | 323 | String caminhoSelo = request.getRealPath("/static/img"); |
325 | 324 | Date dataAtual = new Date(System.currentTimeMillis()); |
326 | 325 | String dataFormatada = sdf.format(dataAtual); | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/UsuariosController.java
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/conversor/ESeloDateConverter.java
... | ... | @@ -22,7 +22,7 @@ public class ESeloDateConverter implements Converter<Date> { |
22 | 22 | if (isNullOrEmpty(value)) { |
23 | 23 | return null; |
24 | 24 | } |
25 | - | |
25 | +System.out.println("passei aqui"); | |
26 | 26 | try { |
27 | 27 | return new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US).parse(value); |
28 | 28 | } catch (ParseException e) { | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/test/java/teste/LeitorXMLTest.java
1 | 1 | package teste; |
2 | +import java.text.ParseException; | |
3 | +import java.text.SimpleDateFormat; | |
4 | +import java.util.Date; | |
2 | 5 | import java.util.List; |
6 | +import java.util.Locale; | |
3 | 7 | |
4 | -import br.com.eselo.conexaoAsesWeb.AvaliationReport; | |
5 | 8 | import br.com.eselo.conexaoAsesWeb.LeitorXML; |
9 | +import br.com.eselo.conexaoAsesWeb.RelatorioAvaliacao; | |
6 | 10 | import br.com.eselo.model.Avaliacao; |
7 | 11 | import br.com.eselo.model.Resultado; |
8 | 12 | |
... | ... | @@ -15,9 +19,20 @@ public class LeitorXMLTest { |
15 | 19 | */ |
16 | 20 | public static void main(String[] args) { |
17 | 21 | |
18 | - String input = exemploAvaliacao(); | |
22 | + // String input = exemploAvaliacao(); | |
19 | 23 | |
20 | - List<Resultado> resultados = new LeitorXML().lerResultadosXML(input, new Avaliacao()); | |
24 | + String value = "Fri Jun 20 17:39:50 GMT-03:00 2014"; | |
25 | + Date hoje=null; | |
26 | + try { | |
27 | + hoje = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US).parse(value); | |
28 | + } catch (ParseException e) { | |
29 | + // TODO Auto-generated catch =null block | |
30 | + System.err.println("Nao deiu certo"); | |
31 | + e.printStackTrace(); | |
32 | + } | |
33 | + | |
34 | + System.out.println(hoje.toString()); | |
35 | +/* List<Resultado> resultados = new LeitorXML().lerResultadosXML(input, new Avaliacao()); | |
21 | 36 | |
22 | 37 | String titulo = |
23 | 38 | "\n\n\n_____________________________________\n"+ |
... | ... | @@ -30,43 +45,34 @@ public class LeitorXMLTest { |
30 | 45 | int i=0; |
31 | 46 | for(Resultado r:resultados){ |
32 | 47 | System.out.println(" \nResultado "+(i++)); |
33 | - System.out.println("Avaliação: "+r.getAvaliacao().getId()); | |
48 | + System.out.println("Avaliação: "+r.getAvaliacao().getId()); | |
34 | 49 | System.out.println("Identificador: "+r.getNumDiretriz()); |
35 | 50 | System.out.println("Total de Erros: "+r.getNumErros()); |
36 | 51 | System.out.println("Total de Avisos: "+r.getNumAvisos()); |
37 | 52 | |
38 | 53 | } |
39 | - | |
54 | + */ | |
40 | 55 | } |
41 | 56 | |
42 | 57 | public static String exemploAvaliacao(){ |
43 | - String input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+ | |
44 | - "<relatorio_de_avaliacao>"+ | |
45 | - "<resultados>"+ | |
46 | - " <url>www.bol.com.br</url>"+ | |
47 | - " <data>2014-04-24 10:07:02.447 GMT-03:00</data>"+ | |
48 | - " <recomendacao>"+ | |
49 | - " <criterio>"+ | |
50 | - " <descricao>51</descricao>"+ | |
51 | - " <qtde_erros>1</qtde_erros>"+ | |
52 | - " </criterio>"+ | |
53 | - " <identificador>1</identificador>"+ | |
54 | - " <total_erros>11</total_erros>"+ | |
55 | - " <total_avisos>50</total_avisos>"+ | |
56 | - " </recomendacao>" + | |
57 | - " <recomendacao>"+ | |
58 | - " <criterio>"+ | |
59 | - " <descricao>31</descricao>"+ | |
60 | - " <qtde_erros>2</qtde_erros>"+ | |
61 | - " </criterio>"+ | |
62 | - " <identificador>2</identificador>"+ | |
63 | - " <total_erros>13</total_erros>"+ | |
64 | - " <total_avisos>30</total_avisos>"+ | |
65 | - " </recomendacao>" + | |
66 | - "</resultados>"+ | |
67 | - "</relatorio_de_avaliacao>"; | |
58 | + String input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+ | |
59 | + "<relatorio_de_avaliacao>"+ | |
60 | + " <url>www.teste.com.br</url>"+ | |
61 | + " <data>Fri Jun 20 17:39:50 GMT-03:00 2014</data>"+ | |
62 | + " <recomendacao>"+ | |
63 | + " <identificador>1</identificador>"+ | |
64 | + " <criterio>"+ | |
65 | + " <identificador>1</identificador>"+ | |
66 | + " <erros_criterio>13</erros_criterio>"+ | |
67 | + " <itens_criterio>100</itens_criterio>"+ | |
68 | + " </criterio>"+ | |
69 | + " <total_erros>12</total_erros>"+ | |
70 | + " <total_avisos>10</total_avisos>"+ | |
71 | + " </recomendacao>"+ | |
72 | + " <qtde_linhas>1000</qtde_linhas>"+ | |
73 | + "</relatorio_de_avaliacao>"; | |
68 | 74 | |
69 | - AvaliationReport ar = new LeitorXML().lerAvaliacaoXML(input); | |
75 | + RelatorioAvaliacao ar = new LeitorXML().lerAvaliacaoXML(input); | |
70 | 76 | System.out.println(ar.toString()); |
71 | 77 | |
72 | 78 | return ar.toString(); | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/test/java/teste/RelatorioAvaliacaoTest.java
0 → 100644
... | ... | @@ -0,0 +1,42 @@ |
1 | +package teste; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +import br.com.eselo.conexaoAsesWeb.Criterio; | |
6 | +import br.com.eselo.conexaoAsesWeb.Recomendacao; | |
7 | +import br.com.eselo.conexaoAsesWeb.RelatorioAvaliacao; | |
8 | + | |
9 | +public class RelatorioAvaliacaoTest { | |
10 | + | |
11 | + /** | |
12 | + * @param args | |
13 | + */ | |
14 | + public static void main(String[] args) { | |
15 | + | |
16 | + RelatorioAvaliacao resultadoAvaliacao = new RelatorioAvaliacao(); | |
17 | + | |
18 | + resultadoAvaliacao.setUrl("www.teste.com.br"); | |
19 | + resultadoAvaliacao.setDate(new Date()); | |
20 | + resultadoAvaliacao.setQtdeLinhas(1000l); | |
21 | + | |
22 | + Recomendacao recomendacao; | |
23 | + recomendacao = new Recomendacao(); | |
24 | + recomendacao.setIdentificador(1L); | |
25 | + recomendacao.setTotalAvisos(10L); | |
26 | + recomendacao.setTotalErros(12l); | |
27 | + | |
28 | + Criterio criterio = new Criterio(); | |
29 | + criterio.setIdentificador(1l); | |
30 | + criterio.setQtdeErros(13l); | |
31 | + criterio.setQtdeItens(100l); | |
32 | + recomendacao.setCriterio(criterio); | |
33 | + | |
34 | + resultadoAvaliacao.addRecomendacao(recomendacao); | |
35 | + | |
36 | + | |
37 | + System.out.println(resultadoAvaliacao); | |
38 | + | |
39 | + | |
40 | + } | |
41 | + | |
42 | +} | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/test/java/teste/ResultadoAvaliacaoTest.java
Desenvolvimento/Codificacao/e-Selo/src/test/java/teste/WebChecker.java
... | ... | @@ -115,17 +115,20 @@ public class WebChecker { |
115 | 115 | String s = new Date().toString(); |
116 | 116 | System.out.println(s); |
117 | 117 | |
118 | - WebChecker pagina = WebChecker.from("http://localhost:18080/e-Selo/calcular-nota").withPostRequest() | |
118 | + WebChecker pagina = WebChecker.from("http://localhost:18080/eselo/calcular-nota").withPostRequest() | |
119 | 119 | //WebChecker pagina = WebChecker.from("https://sistemas-treinamento.ifbaiano.edu.br/eselo/calcular-nota").withPostRequest() |
120 | 120 | |
121 | 121 | .addParam("avaliationReport.date", s) |
122 | 122 | .addParam("avaliationReport.url", "http://www.globo.com.br") |
123 | - .addParam("avaliationReport.checkPoints[0].identificador", "1") | |
124 | - .addParam("avaliationReport.checkPoints[0].totalErrors", "10") | |
125 | - .addParam("avaliationReport.checkPoints[0].totalWarnings", "5") | |
126 | - .addParam("avaliationReport.checkPoints[1].identificador", "2") | |
127 | - .addParam("avaliationReport.checkPoints[1].totalErrors", "3") | |
128 | - .addParam("avaliationReport.checkPoints[1].totalWarnings", "6") | |
123 | + .addParam("avaliationReport.recomendacao[0].identificador", "1") | |
124 | + .addParam("avaliationReport.recomendacao[0].totalErros", "10") | |
125 | + .addParam("avaliationReport.recomendacao[0].totalAvisos", "5") | |
126 | + .addParam("avaliationReport.recomendacao[0].criterio.identificador","1") | |
127 | + .addParam("avaliationReport.recomendacao[0].criterio.qtdeErros","13") | |
128 | + .addParam("avaliationReport.recomendacao[0].criterio.qtdeItens","120") | |
129 | + .addParam("avaliationReport.recomendacao[1].identificador", "2") | |
130 | + .addParam("avaliationReport.recomendacao[1].totalErros", "3") | |
131 | + .addParam("avaliationReport.recomendacao[1].totalAvisos", "6") | |
129 | 132 | .execute(); |
130 | 133 | |
131 | 134 | System.out.println(pagina.getContent()); | ... | ... |