Commit e1b1f69e7af200a85db5fb999c8638ac2f7f373f
1 parent
b7e5295e
Exists in
master
Ajustes para utilização no servidor Azure.
Showing
14 changed files
with
1020 additions
and
177 deletions
Show diff stats
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/painelAcessibilidade/painelAcessibilidade.jsp
... | ... | @@ -33,6 +33,8 @@ |
33 | 33 | <div id="emag"> |
34 | 34 | <label>eMAG</label> |
35 | 35 | </div> |
36 | + | |
37 | + ${url.id}"-" ${url.url}"-" ${url.codHash} "-" ${url.idSitio} "-" | |
36 | 38 | <div id="testesAutomaticos"> |
37 | 39 | <label>Testes Automáticos<br>7.3/10</label> </div> |
38 | 40 | |
... | ... | @@ -42,6 +44,7 @@ |
42 | 44 | </div> |
43 | 45 | <div class="avaliacao"> |
44 | 46 | |
47 | + | |
45 | 48 | <label><strong>Teste Automático de Acessibilidade</strong></label><br><br> |
46 | 49 | <label><strong>Órão: ${orgao }</strong></label><br> |
47 | 50 | <label><strong>Página: ${pagina }</strong></label><br> | ... | ... |
Desenvolvimento/Codificacao/e-Selo/WebContent/static/css/painelAcessibilidade.css
1 | +@media only screen and (min-width : 768px) { | |
1 | 2 | body { |
2 | - margin: 0; | |
3 | + margin-top: 30px; | |
4 | + margin-left: 0; | |
5 | + margin-right:0; | |
6 | + margin-bottom:0; | |
3 | 7 | background-color: #ffffff; |
4 | 8 | color: #000000; |
5 | 9 | font-size: 61%; |
... | ... | @@ -62,7 +66,7 @@ a { |
62 | 66 | #accessibility { |
63 | 67 | display: inline; |
64 | 68 | margin-left: 12%; |
65 | - padding-top: 15px; | |
69 | + padding-top: 5px; | |
66 | 70 | text-align: left; |
67 | 71 | float: left; |
68 | 72 | padding-left: 0; |
... | ... | @@ -70,7 +74,7 @@ a { |
70 | 74 | } |
71 | 75 | |
72 | 76 | h1 { |
73 | - padding-top: 100px; | |
77 | + padding-top: 50px; | |
74 | 78 | } |
75 | 79 | |
76 | 80 | #accessibility li { |
... | ... | @@ -130,7 +134,7 @@ Table { |
130 | 134 | height: 280px; |
131 | 135 | border-left: 1px solid #000000; |
132 | 136 | border-right: 1px solid #000000; |
133 | - background: #97aeec; | |
137 | + /*background: #97aeec;*/ | |
134 | 138 | text-align: center; |
135 | 139 | float: left; |
136 | 140 | } |
... | ... | @@ -214,4 +218,422 @@ a.oculto { |
214 | 218 | #voltar-topo { |
215 | 219 | text-align: right; |
216 | 220 | font-size: 12px; |
217 | -} | |
218 | 221 | \ No newline at end of file |
222 | +} | |
223 | + | |
224 | + | |
225 | +#webaxscore { | |
226 | + /*background: transparent url("img/bg.png") repeat scroll left top;*/ | |
227 | + color: #000000; | |
228 | + float: left; | |
229 | + margin: 8px 10% 1em 12%; | |
230 | + padding: 2em; | |
231 | + text-align: center; | |
232 | + width: 6em; | |
233 | + height: 4em; | |
234 | + } | |
235 | + #webaxscore h3 { | |
236 | + font-size: 2em; | |
237 | + font-weight: normal; | |
238 | + line-height: 1em; | |
239 | + margin: 0; | |
240 | + padding: 0; | |
241 | + } | |
242 | + #webaxscore em, #webaxscore strong { | |
243 | + font-size: 0.7em; | |
244 | + margin: 0; | |
245 | + padding: 0; | |
246 | + } | |
247 | + #webaxscore span { | |
248 | + display: block; | |
249 | + font-size: 2em; | |
250 | + font-weight: bold; | |
251 | + line-height: 1em; | |
252 | + } | |
253 | + | |
254 | + div.scoreB_bom { | |
255 | + background-color: #0d0 !important; | |
256 | + border: 4px solid #090; | |
257 | + color: #fff !important; | |
258 | + /*text-shadow: 0.1em 0.1em 0.1em #000000;*/ | |
259 | + } | |
260 | + | |
261 | + div.scoreB_razoavel { | |
262 | + background-color: #ffff00 !important; | |
263 | + border: 4px solid #f2f200; | |
264 | + color: #000000!important; | |
265 | + /*text-shadow: 0.1em 0.1em 0.1em #000000;*/ | |
266 | + } | |
267 | + div.scoreB_ruim { | |
268 | + background-color: #ff8000 !important; | |
269 | + border: 4px solid #e17100; | |
270 | + color: #000000!important; | |
271 | + /*text-shadow: 0.1em 0.1em 0.1em #000000;*/ | |
272 | + } | |
273 | + | |
274 | + div.scoreB_pessimo { | |
275 | + background-color: #ff0000 !important; | |
276 | + border: 4px solid #ea0000; | |
277 | + color: #fff !important; | |
278 | + /*text-shadow: 0.1em 0.1em 0.1em #000000;*/ | |
279 | + } | |
280 | + div.block { | |
281 | + background: #ffa none repeat scroll 0 0; | |
282 | + border: 1px solid #999; | |
283 | + color: #000000; | |
284 | + margin-left: 10%; | |
285 | + width: 28%; | |
286 | + } | |
287 | + | |
288 | + #bom | |
289 | + { | |
290 | + width: 80px; | |
291 | + height: 20px; | |
292 | + | |
293 | + } | |
294 | + #razoavel | |
295 | + { | |
296 | + width: 125px; | |
297 | + height: 20px;; | |
298 | + } | |
299 | + #ruim | |
300 | + { | |
301 | + width: 127px; | |
302 | + height: 20px;; | |
303 | + } | |
304 | + #pessimo | |
305 | + { | |
306 | + width: 70px; | |
307 | + height: 20px; | |
308 | + } | |
309 | + | |
310 | + #legenda{ | |
311 | + text-align: left; | |
312 | + padding-left: 10px; | |
313 | + width: 180px; | |
314 | + float: left; | |
315 | + } | |
316 | + .legenda | |
317 | + { | |
318 | + list-style: none; | |
319 | + margin-top: 2px; | |
320 | + } | |
321 | +} /*-----Fim max-width: 1024px */ | |
322 | + | |
323 | +/*------Inicio max-width: 768px----*/ | |
324 | +@media only screen and (max-width : 768px) { | |
325 | + body { | |
326 | + margin-top: 30px; | |
327 | + margin-left: 0; | |
328 | + margin-right:0; | |
329 | + margin-bottom:0; | |
330 | + background-color: #ffffff; | |
331 | + color: #000000; | |
332 | + font-size: 61%; | |
333 | + font-weight: normal; | |
334 | + font-family: "Open Sans", Arial, Helvetica, sans-serif; | |
335 | +} | |
336 | + | |
337 | +header { | |
338 | + width: 100%; | |
339 | + /*Banner*/ | |
340 | + /* height: 132px;*/ | |
341 | + background-color: #19882c; | |
342 | + /* Old browsers */ | |
343 | + background-color: #0A5517; | |
344 | + background-image: -moz-radial-gradient(center, ellipse cover, #19882c 1%, #025310 100%); | |
345 | + /* FF3.6+ */ | |
346 | + background-image: -webkit-gradient(radial, center center, 0px, center center, 100%, | |
347 | + color-stop(1%, #19882c), color-stop(100%, #025310)); | |
348 | + /* Chrome,Safari4+ */ | |
349 | + background-image: -webkit-radial-gradient(center, ellipse cover, #19882c 1%, #025310 100%); | |
350 | + /* Chrome10+,Safari5.1+ */ | |
351 | + background-image: -o-radial-gradient(center, ellipse cover, #19882c 1%, #025310 100%); | |
352 | + /* Opera 12+ */ | |
353 | + background-image: -ms-radial-gradient(center, ellipse cover, #19882c 1%, #025310 100%); | |
354 | + /* IE10+ */ | |
355 | + background-image: radial-gradient(ellipse at center, #19882c 1%, #025310 100%); | |
356 | + /* W3C */ | |
357 | + /*filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#19882c',endColorstr='#025310', GradientType=1); | |
358 | + IE6-9 fallback on horizontal gradient */ | |
359 | + height: 200px; | |
360 | +} | |
361 | + | |
362 | +.oculto { | |
363 | + display: none; | |
364 | +} | |
365 | + | |
366 | +.oculto_visao { | |
367 | + list-style-type: none; | |
368 | + position: absolute; | |
369 | + left: -999em; | |
370 | +} | |
371 | + | |
372 | +a { | |
373 | + text-decoration: none; | |
374 | +} | |
375 | + | |
376 | +#barra-brasil { | |
377 | + position: absolute; | |
378 | + width: 100%; | |
379 | + top: 0; | |
380 | + left: 0; | |
381 | +} | |
382 | + | |
383 | +#topo { | |
384 | + width: 93.75%; | |
385 | + margin: auto; | |
386 | + padding: 0; | |
387 | +} | |
388 | + | |
389 | +#accessibility { | |
390 | + display: inline; | |
391 | + margin-left: 12%; | |
392 | + padding-top: 5px; | |
393 | + text-align: left; | |
394 | + float: left; | |
395 | + padding-left: 0; | |
396 | + width: 100% | |
397 | +} | |
398 | + | |
399 | +h1 { | |
400 | + padding-top: 100px; | |
401 | +} | |
402 | + | |
403 | +#accessibility li { | |
404 | + display: inline; | |
405 | +} | |
406 | + | |
407 | +#accessibility a { | |
408 | + color: #ffffff; | |
409 | + font-size: 1.2em; | |
410 | + padding-right: 10px; | |
411 | + font-family: Arial, Helvetica, sans-serif; | |
412 | +} | |
413 | + | |
414 | +#accessibility span { | |
415 | + background: #ffffff; | |
416 | + font-weight: bold; | |
417 | + color: #327241; | |
418 | + padding: 0 4px; | |
419 | +} | |
420 | + | |
421 | +#accessibility a:hover { | |
422 | + border-bottom: 1px solid; | |
423 | +} | |
424 | + | |
425 | +.contanner { | |
426 | + font-size: 14px; | |
427 | + margin: auto; | |
428 | + border: 0; | |
429 | +} | |
430 | + | |
431 | + | |
432 | + | |
433 | +#logo { | |
434 | + color: #ffffff !important; | |
435 | + padding: 0; | |
436 | + padding-left: 12%; | |
437 | +} | |
438 | + | |
439 | +#portal-title-1 { | |
440 | + position: relative; | |
441 | +} | |
442 | + | |
443 | +#emag { | |
444 | + width: 15em; | |
445 | + height: 20em; | |
446 | + background: #92d68f; | |
447 | + text-align: center; | |
448 | + float: left; | |
449 | +} | |
450 | + | |
451 | +#testesAutomaticos { | |
452 | + width: 15em; | |
453 | + height: 20em; | |
454 | + border-left: 1px solid #000000; | |
455 | + border-right: 1px solid #000000; | |
456 | + /*background: #97aeec;*/ | |
457 | + text-align: center; | |
458 | + float: left; | |
459 | +} | |
460 | + | |
461 | +#grafico { | |
462 | + width: 35em; | |
463 | + height: 20em; | |
464 | + text-align: center; | |
465 | + | |
466 | +} | |
467 | + | |
468 | +.myChart { | |
469 | + width: 30em !important; | |
470 | + height: 15em !important; | |
471 | +} | |
472 | + | |
473 | +element.style { | |
474 | + width: 35em; | |
475 | + height: 20em; | |
476 | +} | |
477 | + | |
478 | +.logoAvaliacao { | |
479 | + margin-top: 10px; | |
480 | + width: 30.15em; | |
481 | + height: 35em; | |
482 | + background: #ffffff; | |
483 | + border-style: solid; | |
484 | + border-color: #000000; | |
485 | + border-width: 1px; | |
486 | +} | |
487 | + | |
488 | +.logoAvaliacao label { | |
489 | + position: relative; | |
490 | + top: 45%; | |
491 | +} | |
492 | + | |
493 | +.avaliacao { | |
494 | + width: 30.15em; | |
495 | + background: #ffffff; | |
496 | + border-style: solid; | |
497 | + border-color: #000000; | |
498 | + border-width: 1px; | |
499 | +} | |
500 | + | |
501 | +table { | |
502 | + margin-left: 10px; | |
503 | + width: 35em; | |
504 | + font-size: 0.8em; | |
505 | + border-collapse: collapse; | |
506 | +} | |
507 | + | |
508 | + | |
509 | +.table, th, td { | |
510 | + border: 2px solid #000000; | |
511 | +} | |
512 | + | |
513 | +table th { | |
514 | + background: #585450; | |
515 | + color: #ffffff; | |
516 | +} | |
517 | + | |
518 | +.avaliacao label { | |
519 | + margin-left: 10px; | |
520 | +} | |
521 | + | |
522 | +.avaliacao hr { | |
523 | + margin-left: 10px; | |
524 | + margin-right: 10px; | |
525 | +} | |
526 | + | |
527 | +#footer-brasil { | |
528 | + background: none repeat scroll 0% 0% #00420c; | |
529 | + padding: 1em 0px; | |
530 | + max-width: 100%; | |
531 | +} | |
532 | + | |
533 | +a.oculto { | |
534 | + display: inline-block; | |
535 | + font-size: 0; | |
536 | + text-indent: -20000px; | |
537 | +} | |
538 | + | |
539 | +#voltar-topo { | |
540 | + text-align: right; | |
541 | + font-size: 12px; | |
542 | +} | |
543 | + | |
544 | +#webaxscore { | |
545 | + /*background: transparent url("img/bg.png") repeat scroll left top;*/ | |
546 | + color: #000000; | |
547 | + float: left; | |
548 | + margin: 8px 10% 1em 12%; | |
549 | + padding: 2em; | |
550 | + text-align: center; | |
551 | + width: 6em; | |
552 | + height: 4em; | |
553 | + } | |
554 | + #webaxscore h3 { | |
555 | + font-size: 2em; | |
556 | + font-weight: normal; | |
557 | + line-height: 1em; | |
558 | + margin: 0; | |
559 | + padding: 0; | |
560 | + } | |
561 | + #webaxscore em, #webaxscore strong { | |
562 | + font-size: 0.7em; | |
563 | + margin: 0; | |
564 | + padding: 0; | |
565 | + } | |
566 | + #webaxscore span { | |
567 | + display: block; | |
568 | + font-size: 2em; | |
569 | + font-weight: bold; | |
570 | + line-height: 1em; | |
571 | + } | |
572 | + | |
573 | + div.scoreB_bom { | |
574 | + background-color: #0d0 !important; | |
575 | + border: 4px solid #090; | |
576 | + color: #fff !important; | |
577 | + /*text-shadow: 0.1em 0.1em 0.1em #000000;*/ | |
578 | + } | |
579 | + | |
580 | + div.scoreB_razoavel { | |
581 | + background-color: #ffff00 !important; | |
582 | + border: 4px solid #f2f200; | |
583 | + color: #000000!important; | |
584 | + /*text-shadow: 0.1em 0.1em 0.1em #000000;*/ | |
585 | + } | |
586 | + div.scoreB_ruim { | |
587 | + background-color: #ff8000 !important; | |
588 | + border: 4px solid #e17100; | |
589 | + color: #000000!important; | |
590 | + /*text-shadow: 0.1em 0.1em 0.1em #000000;*/ | |
591 | + } | |
592 | + | |
593 | + div.scoreB_pessimo { | |
594 | + background-color: #ff0000 !important; | |
595 | + border: 4px solid #ea0000; | |
596 | + color: #fff !important; | |
597 | + /*text-shadow: 0.1em 0.1em 0.1em #000000;*/ | |
598 | + } | |
599 | + div.block { | |
600 | + background: #ffa none repeat scroll 0 0; | |
601 | + border: 1px solid #999; | |
602 | + color: #000000; | |
603 | + margin-left: 10%; | |
604 | + width: 28%; | |
605 | + } | |
606 | + | |
607 | + #bom | |
608 | + { | |
609 | + width: 80px; | |
610 | + height: 20px; | |
611 | + | |
612 | + } | |
613 | + #razoavel | |
614 | + { | |
615 | + width: 125px; | |
616 | + height: 20px;; | |
617 | + } | |
618 | + #ruim | |
619 | + { | |
620 | + width: 127px; | |
621 | + height: 20px;; | |
622 | + } | |
623 | + #pessimo | |
624 | + { | |
625 | + width: 70px; | |
626 | + height: 20px; | |
627 | + } | |
628 | + | |
629 | + #legenda{ | |
630 | + text-align: left; | |
631 | + padding-left: 10px; | |
632 | + width: 180px; | |
633 | + float: left; | |
634 | + } | |
635 | + .legenda | |
636 | + { | |
637 | + list-style: none; | |
638 | + margin-top: 2px; | |
639 | + } | |
640 | + } | |
219 | 641 | \ No newline at end of file | ... | ... |
12.4 KB
11.9 KB
7.05 KB
5.99 KB
Desenvolvimento/Codificacao/e-Selo/WebContent/static/js/chart.js
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/AvaliacaoController.java
... | ... | @@ -12,13 +12,19 @@ import java.io.FileReader; |
12 | 12 | import java.io.FileWriter; |
13 | 13 | import java.io.IOException; |
14 | 14 | import java.io.InputStream; |
15 | +import java.io.InputStreamReader; | |
15 | 16 | import java.io.OutputStreamWriter; |
16 | 17 | import java.io.PrintWriter; |
17 | 18 | import java.io.UnsupportedEncodingException; |
19 | +import java.math.BigInteger; | |
20 | +import java.net.HttpURLConnection; | |
18 | 21 | import java.net.MalformedURLException; |
22 | +import java.net.URL; | |
23 | +import java.nio.charset.StandardCharsets; | |
24 | +import java.security.MessageDigest; | |
25 | +import java.security.NoSuchAlgorithmException; | |
19 | 26 | import java.text.SimpleDateFormat; |
20 | 27 | import java.util.ArrayList; |
21 | -import java.util.Collection; | |
22 | 28 | import java.util.Collections; |
23 | 29 | import java.util.Date; |
24 | 30 | import java.util.List; |
... | ... | @@ -28,11 +34,16 @@ import java.util.Properties; |
28 | 34 | import javax.imageio.ImageIO; |
29 | 35 | import javax.servlet.ServletContext; |
30 | 36 | import javax.servlet.http.HttpServletRequest; |
31 | -import javax.servlet.http.HttpServletResponse; | |
32 | -import javax.swing.text.html.HTML; | |
33 | 37 | import javax.ws.rs.QueryParam; |
34 | 38 | |
35 | -import org.hibernate.Session; | |
39 | +import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; | |
40 | +import org.apache.commons.httpclient.HttpClient; | |
41 | +import org.apache.commons.httpclient.HttpMethod; | |
42 | +import org.apache.commons.httpclient.methods.GetMethod; | |
43 | +import org.apache.commons.httpclient.methods.HeadMethod; | |
44 | +import org.apache.commons.httpclient.params.HttpConnectionParams; | |
45 | +import org.apache.commons.httpclient.params.HttpMethodParams; | |
46 | +import org.apache.http.Header; | |
36 | 47 | import org.slf4j.Logger; |
37 | 48 | import org.slf4j.LoggerFactory; |
38 | 49 | |
... | ... | @@ -93,7 +104,9 @@ public class AvaliacaoController { |
93 | 104 | |
94 | 105 | private static final String CAMINHO_SELOS = "eselo.config.avaliacao.caminhoSelos"; |
95 | 106 | private static final String URL_SERVICO = "eselo.config.avaliacao.urlServico"; |
96 | - private static final String URL_ARQUIVOS_HTML = "eselo.config.avaliacao.arquivosHtml"; | |
107 | + private static final String URL_ARQUIVOS_HTML = "eselo.config.avaliacao.enderecoHtml"; | |
108 | + private static final String SALVAR_ARQUIVOS_HTML = "eselo.config.avaliacao.arquivosHtml"; | |
109 | + private static final String SALVAR_ARQUIVOS_JSON = "eselo.config.avaliacao.arquivosJson"; | |
97 | 110 | |
98 | 111 | private final Properties properties = new Properties(); |
99 | 112 | |
... | ... | @@ -104,9 +117,10 @@ public class AvaliacaoController { |
104 | 117 | ServletContext application, |
105 | 118 | ResultadoRecomendacaoDao _daoResultadoRecomendacao, |
106 | 119 | ResultadoCriterioDao _daoResultadoCriterio, |
107 | - CriterioDAO _daoCriterio, RecomendacaoDAO _daoRecomendacao, SitioDAO _daoSitio)// gibran | |
108 | - // ResultadoCriterioDao | |
109 | - // _resultadoCriterioDao | |
120 | + CriterioDAO _daoCriterio, RecomendacaoDAO _daoRecomendacao, | |
121 | + SitioDAO _daoSitio)// gibran | |
122 | + // ResultadoCriterioDao | |
123 | + // _resultadoCriterioDao | |
110 | 124 | throws IOException { |
111 | 125 | daoUrl = _daoUrl; |
112 | 126 | dao = _dao; |
... | ... | @@ -186,18 +200,24 @@ public class AvaliacaoController { |
186 | 200 | double notaRecomendacao = 0.0; |
187 | 201 | double somatorioNotaTeste = 0.0; |
188 | 202 | double somatorioPesosCriterios = 0.0; |
189 | - System.out.println(relatorioAvaliacao); | |
203 | + | |
204 | + //System.out.println(relatorioAvaliacao); | |
205 | + | |
190 | 206 | /* |
191 | 207 | * Nota da Recomendação = Nota da Avaliação * Peso da Recomendação Nota |
192 | 208 | * da Recomendação = 0,61785 * 3 Nota da Recomendação = 1,8535 |
193 | 209 | */ |
194 | 210 | double somatorioNotaRecomendacoes = 0.0; |
195 | 211 | |
212 | + | |
196 | 213 | // obter os resultados |
197 | 214 | recomendacoesAvaliadas = relatorioAvaliacao.getRecomendacoes(); |
198 | 215 | |
216 | + | |
217 | + | |
199 | 218 | ParametroCalculo parametroCalculo = paramDao |
200 | 219 | .getLastParametrosCalculoAtivo(); |
220 | + | |
201 | 221 | if (parametroCalculo != null) { |
202 | 222 | |
203 | 223 | // foi colocada abaixo (Gibran) |
... | ... | @@ -270,7 +290,7 @@ public class AvaliacaoController { |
270 | 290 | } |
271 | 291 | |
272 | 292 | } |
273 | - | |
293 | + | |
274 | 294 | criterioAvaliado.setNu_nota(notaCriterio); |
275 | 295 | criterioAvaliado.setIdCriterio(criterioSalvar |
276 | 296 | .getId()); |
... | ... | @@ -279,7 +299,7 @@ public class AvaliacaoController { |
279 | 299 | // criterioAvaliado.setNu_nota(notaCriterio); |
280 | 300 | // lsCriterioAvaliado.add(criterioAvaliado); |
281 | 301 | } |
282 | - | |
302 | + | |
283 | 303 | if (somatorioPesosCriterios > 0) { |
284 | 304 | |
285 | 305 | notaRecomendacao = (somatorioNotaTeste / somatorioPesosCriterios) |
... | ... | @@ -332,24 +352,29 @@ public class AvaliacaoController { |
332 | 352 | * 1 + 2 + 3 Conformidade Acessibilidade = 4,25975 / 9 Conformidade |
333 | 353 | * Acessibilidade = 0,4733 ==> 47,33 % |
334 | 354 | */ |
355 | + | |
356 | + | |
357 | + | |
335 | 358 | conformidadeAcessibilidade = 100 * (somatorioNotaRecomendacoes / somaPesosRecomendacoes); |
336 | 359 | |
360 | + | |
337 | 361 | conformidadeAcessibilidade = (double) new Double( |
338 | 362 | conformidadeAcessibilidade * 100).intValue() / 100; |
339 | - | |
363 | + System.out.println("erro_01"); | |
340 | 364 | // System.out.println("conformidadeAcessibilidade = " + |
341 | 365 | // conformidadeAcessibilidade); |
342 | 366 | recomendacoesCriteriosParaImprimir |
343 | 367 | .add("conformidadeAcessibilidade = " |
344 | 368 | + conformidadeAcessibilidade); |
345 | - | |
346 | - for (String string : recomendacoesCriteriosParaImprimir) { | |
347 | - System.out.println(string); | |
348 | - } | |
369 | + System.out.println("erro_02"); | |
370 | + //for (String string : recomendacoesCriteriosParaImprimir) { | |
371 | + // System.out.println(string); | |
372 | + //} | |
349 | 373 | |
350 | 374 | relatorioAvaliacao.setRecomendacoes(lsRecomendacaoAvaliada); |
351 | - | |
375 | + | |
352 | 376 | if (salvarAvaliacao) { |
377 | + | |
353 | 378 | Avaliacao novaAvalicao = salvarAvaliacao(relatorioAvaliacao, |
354 | 379 | parametroCalculo, conformidadeAcessibilidade); |
355 | 380 | |
... | ... | @@ -363,19 +388,18 @@ public class AvaliacaoController { |
363 | 388 | resumoAvaliacao.setDataAvaliacao(Util.dataHoraAtual()); |
364 | 389 | // this.result.forwardTo(PersistenciaFileSystemController.class).salvarhtml(resumoAvaliacao, |
365 | 390 | // novaAvalicao, urlComProtocolo); |
366 | - | |
367 | - //salvarJsGrafico(url); | |
391 | + | |
392 | + // salvarJsGrafico(url); | |
368 | 393 | salvarhtml(resumoAvaliacao, novaAvalicao, url.getUrl(), url); |
369 | 394 | } |
370 | 395 | |
371 | 396 | } |
372 | - | |
373 | - gerarSelo(url, conformidadeAcessibilidade); | |
374 | - | |
397 | + | |
398 | + //gerarSelo(url, conformidadeAcessibilidade); | |
399 | + | |
375 | 400 | return conformidadeAcessibilidade; |
376 | 401 | } |
377 | 402 | |
378 | - | |
379 | 403 | /** |
380 | 404 | * Função REST que executa uma avaliação e devolve seu resultado no formato |
381 | 405 | * JSON |
... | ... | @@ -383,19 +407,23 @@ public class AvaliacaoController { |
383 | 407 | * @param relatorioAvaliacao |
384 | 408 | */ |
385 | 409 | @Post("/calcular-nota") |
386 | - public void calcularNota(RelatorioAvaliacao relatorioAvaliacao, boolean salvarAvaliacao) { | |
387 | - // System.out.println(relatorioAvaliacao); | |
410 | + public void calcularNota(RelatorioAvaliacao relatorioAvaliacao, boolean salvarAvaliacao) { | |
411 | + System.out.println(relatorioAvaliacao); | |
388 | 412 | ResultadoAvaliacao resultadoAvaliacao = new ResultadoAvaliacao(); |
389 | 413 | String observacao = "Foi impossivel realizar a avaliação."; |
390 | 414 | String urlComProtocolo = relatorioAvaliacao.getUrl(); |
391 | 415 | |
416 | + | |
392 | 417 | ParametroCalculo parametroCalculo = paramDao |
393 | 418 | .getLastParametrosCalculoAtivo(); |
419 | + | |
394 | 420 | if (parametroCalculo != null) { |
395 | - String fullContextPath = request.getScheme() + "://" | |
396 | - + request.getServerName() + ":" + request.getServerPort() | |
397 | - + request.getContextPath(); | |
398 | - | |
421 | + //String fullContextPath = request.getScheme() + "://" | |
422 | + // + request.getServerName() + ":" + request.getServerPort() | |
423 | + // + request.getContextPath(); | |
424 | + String fullContextPath = "/"; | |
425 | + | |
426 | + | |
399 | 427 | if (relatorioAvaliacao.getRecomendacoes() != null |
400 | 428 | && relatorioAvaliacao.getRecomendacoes().size() > 0 |
401 | 429 | && relatorioAvaliacao.getDate() != null |
... | ... | @@ -406,24 +434,32 @@ public class AvaliacaoController { |
406 | 434 | } catch (MalformedURLException e) { |
407 | 435 | e.printStackTrace(); |
408 | 436 | } |
437 | + | |
409 | 438 | Url url = daoUrl.getStringUrl(relatorioAvaliacao.getUrl()); |
410 | - | |
439 | + | |
411 | 440 | if (url == null) { |
412 | 441 | url = new Url(); |
413 | 442 | url.setUrl(relatorioAvaliacao.getUrl()); |
414 | 443 | daoUrl.save(url); |
415 | 444 | } |
416 | - | |
417 | - resultadoAvaliacao.setPath(fullContextPath + "/" | |
445 | + | |
446 | + //resultadoAvaliacao.setPath(fullContextPath + "/" | |
447 | + // + properties.getProperty(CAMINHO_SELOS) + "/" | |
448 | + // + url.getId().toString() + "/selo.png"); | |
449 | + | |
450 | + resultadoAvaliacao.setPath("/" | |
418 | 451 | + properties.getProperty(CAMINHO_SELOS) + "/" |
419 | 452 | + url.getId().toString() + "/selo.png"); |
420 | 453 | |
454 | + | |
455 | + | |
421 | 456 | resultadoAvaliacao.setUrl(url.getUrl()); |
422 | 457 | resultadoAvaliacao.setDataSolicitacao(relatorioAvaliacao |
423 | 458 | .getDate()); |
424 | - | |
459 | + | |
425 | 460 | double nota = avaliar(relatorioAvaliacao, url, urlComProtocolo, |
426 | 461 | salvarAvaliacao); |
462 | + | |
427 | 463 | if (nota > 0) { |
428 | 464 | resultadoAvaliacao.setNota(nota); |
429 | 465 | observacao = "Avaliação realizada com sucesso!"; |
... | ... | @@ -444,7 +480,7 @@ public class AvaliacaoController { |
444 | 480 | resultadoAvaliacao.setDataSolicitacao(relatorioAvaliacao.getDate()); |
445 | 481 | resultadoAvaliacao.setDataResultado(new Date()); |
446 | 482 | resultadoAvaliacao.setObservacoes(observacao); |
447 | - | |
483 | + | |
448 | 484 | result.use(Results.json()).withoutRoot().from(resultadoAvaliacao) |
449 | 485 | .serialize(); |
450 | 486 | } |
... | ... | @@ -537,23 +573,75 @@ public class AvaliacaoController { |
537 | 573 | @Post("/avaliar-url") |
538 | 574 | public void avaliarUrl(@QueryParam("url") String url) { |
539 | 575 | |
540 | - | |
541 | - /* String fullContextPath = request.getScheme() + "://" | |
542 | - + request.getServerName() + ":" + request.getServerPort() | |
543 | - + request.getContextPath();*/ | |
576 | + //boolean paginaAvaliada = false; | |
577 | + boolean urlAvaliada = false; | |
578 | + //String paginaAlterada = ""; | |
544 | 579 | |
545 | 580 | String urlServico = properties.getProperty(URL_SERVICO); |
546 | - | |
547 | - | |
548 | - WebChecker.PostParams postParams = WebChecker.from(urlServico).withPostRequest(); | |
549 | - | |
581 | + | |
582 | + WebChecker.PostParams postParams = WebChecker.from(urlServico) | |
583 | + .withPostRequest(); | |
584 | + | |
550 | 585 | postParams.addParam("url", url); |
551 | 586 | Gson g = new GsonBuilder().create(); |
552 | - | |
553 | - Boolean urlAvaliada = g.fromJson(postParams.execute().getContent(), | |
587 | + urlAvaliada = g.fromJson(postParams.execute().getContent(), | |
554 | 588 | Boolean.class); |
555 | - | |
589 | + | |
556 | 590 | result.use(Results.xml()).from(urlAvaliada).recursive().serialize(); |
591 | + | |
592 | + /* | |
593 | + | |
594 | + int codResponse = 0; | |
595 | + HttpMethod metodoRequisicaoGET = null; | |
596 | + HttpClient clienteHTTPJakartaCommons; | |
597 | + url = url.replace("https", "http"); | |
598 | + | |
599 | + System.out.println("iniciou a verificarConexao"); | |
600 | + codResponse = verificarConexao(url, "http.agent", "Jakarta Commons-HttpClient/3.1"); | |
601 | + if (codResponse != 200) { | |
602 | + codResponse = verificarConexao(url, "user-agent", "NewUseAgent/1.0"); | |
603 | + } | |
604 | + | |
605 | + | |
606 | + | |
607 | + if(codResponse == 200) | |
608 | + { | |
609 | + System.out.println("iniciou a verificarAlteracaoPagina"); | |
610 | + if(verificarAlteracaoPagina(url)) | |
611 | + { | |
612 | + String urlServico = properties.getProperty(URL_SERVICO); | |
613 | + | |
614 | + WebChecker.PostParams postParams = WebChecker.from(urlServico) | |
615 | + .withPostRequest(); | |
616 | + | |
617 | + postParams.addParam("url", url); | |
618 | + Gson g = new GsonBuilder().create(); | |
619 | + System.out.println("chamou servico ases"); | |
620 | + urlAvaliada = g.fromJson(postParams.execute().getContent(), | |
621 | + Boolean.class); | |
622 | + //result.use(Results.xml()).from(urlAvaliada).recursive().serialize(); | |
623 | + paginaAvaliada = true; | |
624 | + System.out.println("retornou servico ases"); | |
625 | + } | |
626 | + else | |
627 | + { | |
628 | + paginaAlterada = " Página não alterada."; | |
629 | + } | |
630 | + } | |
631 | + else | |
632 | + { | |
633 | + paginaAlterada = " Url inválida!"; | |
634 | + } | |
635 | + | |
636 | + | |
637 | + if(paginaAvaliada) | |
638 | + { | |
639 | + result.use(Results.xml()).from(urlAvaliada).recursive().serialize(); | |
640 | + } | |
641 | + else { | |
642 | + result.use(Results.xml()).from(paginaAlterada).recursive().serialize(); | |
643 | + }*/ | |
644 | + | |
557 | 645 | } |
558 | 646 | |
559 | 647 | @Get("/buscar-avaliacao") |
... | ... | @@ -561,59 +649,65 @@ public class AvaliacaoController { |
561 | 649 | public void buscarAvaliacao(@QueryParam("url") String url) |
562 | 650 | throws FileNotFoundException { |
563 | 651 | |
564 | - String nomeArquivo = url.toLowerCase().replace("https://", "").replace("http://", "").replace("/", "").replace(".", "").replace("\"", "") + ".json"; | |
652 | + url = url.replace("https", "http"); | |
653 | + String nomeArquivo = url.toLowerCase().replace("http://", "").replace("/", "").replace(".", "") | |
654 | + .replace("\"", "") | |
655 | + + ".json"; | |
656 | + | |
657 | + File diretorioJson = new File( properties.getProperty(SALVAR_ARQUIVOS_JSON) + "/" + nomeArquivo); | |
658 | + | |
659 | + //File diretorioJson = new File(this.application.getRealPath("") | |
660 | + // + "/WEB-INF/arquivosJson/" + nomeArquivo); | |
565 | 661 | |
566 | - File diretorioJson = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosJson/"+ nomeArquivo); | |
567 | - //+ nomeArquivo); | |
568 | 662 | |
569 | 663 | ResumoAvaliacao resumoAvaliacao = null; |
570 | - | |
664 | + | |
571 | 665 | if (diretorioJson.exists()) { |
572 | - | |
666 | + | |
573 | 667 | BufferedReader br = new BufferedReader(new FileReader( |
574 | 668 | diretorioJson.toString())); |
575 | - | |
669 | + | |
576 | 670 | Gson gson = new Gson(); |
577 | 671 | |
578 | - resumoAvaliacao = gson.fromJson(br, | |
579 | - ResumoAvaliacao.class); | |
580 | - } | |
581 | - else | |
582 | - { | |
672 | + resumoAvaliacao = gson.fromJson(br, ResumoAvaliacao.class); | |
673 | + } else { | |
583 | 674 | resumoAvaliacao = new ResumoAvaliacao(); |
584 | - | |
675 | + | |
585 | 676 | resumoAvaliacao.setDataAvaliacao(Util.dataHoraAtual()); |
586 | 677 | resumoAvaliacao.setUrl(url); |
587 | 678 | resumoAvaliacao.setUrlResultado(""); |
588 | 679 | resumoAvaliacao.setValor(null); |
589 | 680 | } |
590 | - | |
591 | - | |
592 | 681 | |
593 | 682 | result.use(Results.json()).withoutRoot().from(resumoAvaliacao) |
594 | 683 | .recursive().serialize(); |
595 | 684 | } |
596 | 685 | |
597 | 686 | public void salvarAvaliacao(ResumoAvaliacao resumoAvaliacao) { |
598 | - File diretorioJson = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosJson"); | |
599 | 687 | |
600 | - | |
601 | - diretorioJson.mkdir(); | |
688 | + //File diretorioJson = new File(this.application.getRealPath("") | |
689 | + // + "/WEB-INF/arquivosJson"); | |
690 | + //diretorioJson.mkdir(); | |
691 | + | |
692 | + File diretorioJson = new File( properties.getProperty(SALVAR_ARQUIVOS_JSON)); | |
693 | + | |
602 | 694 | |
695 | + | |
603 | 696 | String urlArquivosHtml = properties.getProperty(URL_ARQUIVOS_HTML); |
604 | - | |
697 | + | |
605 | 698 | File diretorioHtml = new File(urlArquivosHtml); |
606 | - | |
699 | + | |
607 | 700 | String nomeArquivo = ""; |
608 | 701 | |
609 | 702 | try { |
610 | - nomeArquivo = URLNormalizer.normalize(resumoAvaliacao.getUrl()).toLowerCase() | |
611 | - .replace("/", "").replace(".", ""); | |
703 | + nomeArquivo = URLNormalizer.normalize(resumoAvaliacao.getUrl()) | |
704 | + .toLowerCase().replace("/", "").replace(".", ""); | |
612 | 705 | } catch (MalformedURLException e1) { |
613 | 706 | e1.printStackTrace(); |
614 | 707 | } |
615 | 708 | |
616 | - resumoAvaliacao.setUrlResultado(urlArquivosHtml + nomeArquivo + ".html"); | |
709 | + resumoAvaliacao | |
710 | + .setUrlResultado(urlArquivosHtml + nomeArquivo + ".html"); | |
617 | 711 | |
618 | 712 | String json; |
619 | 713 | Gson gson = new Gson(); |
... | ... | @@ -629,54 +723,72 @@ public class AvaliacaoController { |
629 | 723 | gravarArq.printf(json); |
630 | 724 | |
631 | 725 | arq.close(); |
632 | - | |
633 | - | |
726 | + | |
634 | 727 | } catch (IOException e) { |
635 | 728 | e.printStackTrace(); |
636 | 729 | } |
637 | 730 | } |
638 | 731 | |
639 | - | |
640 | 732 | public void salvarhtml(ResumoAvaliacao resumoAvaliacao, |
641 | 733 | Avaliacao avaliacao, String urlSemProtocolo, Url url) { |
642 | - | |
643 | - | |
644 | 734 | |
645 | 735 | List<ResultadoRecomendacao> resultadosRecomendacao; |
646 | 736 | List<ResultadoCriterio> resultadosCriterio; |
647 | 737 | Criterio criterio; |
648 | 738 | Recomendacao recomendacao; |
649 | 739 | |
650 | - // File diretorioHtml = new File("arquivosHtml"); | |
651 | - File diretorioHtml = new File(this.application.getRealPath("") + "/WEB-INF/arquivosHtml"); | |
652 | - diretorioHtml.mkdir(); | |
740 | + //File diretorioHtml = new File(this.application.getRealPath("") | |
741 | + // + "/WEB-INF/arquivosHtml"); | |
742 | + //diretorioHtml.mkdir(); | |
743 | + | |
744 | + File diretorioHtml = new File(properties.getProperty(SALVAR_ARQUIVOS_HTML)); | |
745 | + | |
653 | 746 | String nomeArquivo; |
654 | 747 | StringBuffer html = new StringBuffer(); |
655 | 748 | |
656 | - | |
657 | - | |
658 | - | |
659 | 749 | try { |
660 | - nomeArquivo = URLNormalizer.normalize(urlSemProtocolo).toLowerCase() | |
661 | - .replace("/", "").replace(".", "") | |
750 | + nomeArquivo = URLNormalizer.normalize(urlSemProtocolo) | |
751 | + .toLowerCase().replace("/", "").replace(".", "") | |
662 | 752 | + ".txt"; |
753 | + | |
754 | + OutputStreamWriter bufferOut = new OutputStreamWriter( | |
755 | + new FileOutputStream(diretorioHtml + "/" + nomeArquivo), | |
756 | + "UTF-8"); | |
663 | 757 | |
664 | - | |
665 | - | |
666 | - OutputStreamWriter bufferOut = new OutputStreamWriter(new FileOutputStream(diretorioHtml + "/" + nomeArquivo),"UTF-8"); | |
667 | - | |
758 | + Double notaAvaliacao = resumoAvaliacao.getValor(); | |
759 | + | |
760 | + String webaxscore = ""; | |
761 | + | |
762 | + if (notaAvaliacao >= 95) { | |
763 | + webaxscore = "bom"; | |
764 | + } else if (notaAvaliacao >= 85 & notaAvaliacao < 95) { | |
765 | + webaxscore = "razoavel"; | |
766 | + } else if (notaAvaliacao >= 70 & notaAvaliacao < 85) { | |
767 | + webaxscore = "ruim"; | |
768 | + }else { | |
769 | + webaxscore = "pessimo"; | |
770 | + } | |
771 | + | |
772 | + | |
773 | + | |
668 | 774 | bufferOut.write("<!DOCTYPE html>"); |
669 | 775 | bufferOut.write("<html lang=\"pt-br\">"); |
670 | 776 | bufferOut.write("<head>"); |
671 | - bufferOut.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"); | |
672 | - bufferOut.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"); | |
673 | - | |
674 | - bufferOut.write("<link rel=\"shortcut icon\" href=\"static/ico/favicon.png\">"); | |
675 | - | |
676 | - bufferOut.write("<title>Painel de Acessibilidade Digital do Governo</title>"); | |
677 | - bufferOut.write("<link href=\"/eselo/static/css/painelAcessibilidade.css\" rel=\"stylesheet\">"); | |
678 | - bufferOut.write("<link href=\"/eselo/static/css/barra_brasil.css\" rel=\"stylesheet\">"); | |
777 | + bufferOut | |
778 | + .write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"); | |
779 | + bufferOut | |
780 | + .write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"); | |
781 | + | |
782 | + bufferOut | |
783 | + .write("<link rel=\"shortcut icon\" href=\"static/ico/favicon.png\">"); | |
784 | + | |
785 | + bufferOut | |
786 | + .write("<title>Painel de Acessibilidade Digital do Governo</title>"); | |
787 | + bufferOut.write("<link href=\"/static/css/painelAcessibilidade.css\" rel=\"stylesheet\">"); | |
788 | + //bufferOut.write("<link href=\"" + this.application.getRealPath("") + "/static/css/painelAcessibilidade.css\" rel=\"stylesheet\">"); | |
679 | 789 | |
790 | + bufferOut | |
791 | + .write("<link href=\"/static/css/barra_brasil.css\" rel=\"stylesheet\">"); | |
680 | 792 | |
681 | 793 | bufferOut.write("</head>"); |
682 | 794 | bufferOut.write("<body>"); |
... | ... | @@ -684,28 +796,31 @@ public class AvaliacaoController { |
684 | 796 | bufferOut.write("<div>"); |
685 | 797 | bufferOut.write(" <div id=\"topo\">"); |
686 | 798 | bufferOut.write(" <ul id=\"accessibility\">"); |
687 | - bufferOut.write(" <li> <a accesskey=\"1\" href=\"#inicioConteudo\" id=\"link-conteudo\">Ir"); | |
799 | + bufferOut | |
800 | + .write(" <li> <a accesskey=\"1\" href=\"#inicioConteudo\" id=\"link-conteudo\">Ir"); | |
688 | 801 | bufferOut.write(" para o conteúdo <span>1</span>"); |
689 | 802 | bufferOut.write(" </a></li>"); |
690 | - bufferOut.write(" <li><a accesskey=\"4\" href=\"#footer-brasil\" id=\"link-rodape\">Ir"); | |
803 | + bufferOut | |
804 | + .write(" <li><a accesskey=\"4\" href=\"#footer-brasil\" id=\"link-rodape\">Ir"); | |
691 | 805 | bufferOut.write(" para o rodapé <span>4</span>"); |
692 | 806 | bufferOut.write(" </a></li>"); |
693 | - bufferOut.write(" </ul>"); | |
694 | - | |
695 | - | |
807 | + bufferOut.write(" </ul><br><br>"); | |
808 | + | |
696 | 809 | bufferOut.write("<div id=\"logo\">"); |
697 | - bufferOut.write("<h1 id=\"portal-title-1\">"); | |
810 | + bufferOut.write("<h1 id=\"portal-title-1\">"); | |
698 | 811 | bufferOut.write(" Painel de Acessibilidade Digital do Governo "); |
699 | 812 | bufferOut.write("</h1>"); |
700 | 813 | bufferOut.write("</div>"); |
701 | - | |
814 | + | |
702 | 815 | bufferOut.write("<div id=\"barra-brasil\" class=\"barra_brasil\">"); |
703 | 816 | |
704 | 817 | bufferOut.write("<ul id=\"menu-barra-temp\">"); |
705 | - bufferOut.write("<li><a class=\"primeiro-link\" href=\"http://brasil.gov.br\">Portal"); | |
818 | + bufferOut | |
819 | + .write("<li><a class=\"primeiro-link\" href=\"http://brasil.gov.br\">Portal"); | |
706 | 820 | bufferOut.write("do Governo Brasileiro</a></li>"); |
707 | 821 | bufferOut.write("<li><a class=\"segundo-link\""); |
708 | - bufferOut.write("href=\"http://epwg.governoeletronico.gov.br/barra/atualize.html\">Atualize"); | |
822 | + bufferOut | |
823 | + .write("href=\"http://epwg.governoeletronico.gov.br/barra/atualize.html\">Atualize"); | |
709 | 824 | bufferOut.write("sua Barra de Governo</a></li>"); |
710 | 825 | bufferOut.write("</ul>"); |
711 | 826 | bufferOut.write("</div>"); |
... | ... | @@ -713,69 +828,132 @@ public class AvaliacaoController { |
713 | 828 | bufferOut.write("<div class=\"contanner\"> "); |
714 | 829 | |
715 | 830 | bufferOut.write("<div id=\"contato\">"); |
716 | - bufferOut.write(" <a href=\"http://www.planejamento.gov.br/\">Ministério do Planejamento - http://www.planejamento.gov.br (link para um novo sítio)</a>"); | |
831 | + bufferOut | |
832 | + .write(" <a href=\"http://www.planejamento.gov.br/\">Ministério do Planejamento - http://www.planejamento.gov.br (link para um novo sítio)</a>"); | |
717 | 833 | bufferOut.write("</div>"); |
718 | 834 | |
719 | 835 | bufferOut.write("<div class=\"contanner\">"); |
720 | - bufferOut.write("<a id=\"inicioConteudo\" class=\"oculto\">Início do conteúdo</a>"); | |
836 | + bufferOut | |
837 | + .write("<a id=\"inicioConteudo\" class=\"oculto\">Início do conteúdo</a>"); | |
838 | + | |
839 | + | |
721 | 840 | bufferOut.write(" <div class=\"logoAvaliacao\">"); |
722 | 841 | bufferOut.write(" <div id=\"emag\">"); |
723 | 842 | bufferOut.write(" <label>eMAG v. 3.1</label> "); |
724 | 843 | bufferOut.write(" </div>"); |
844 | + | |
845 | + | |
725 | 846 | bufferOut.write(" <div id=\"testesAutomaticos\"> "); |
726 | - bufferOut.write(" <label>Testes Automáticos<br> Nota: " | |
727 | - + resumoAvaliacao.getValor() + "/100</label> </div> "); | |
847 | + //bufferOut.write(" <label>Testes Automáticos<br> Nota: " + resumoAvaliacao.getValor() + "/100</label> </div> "); | |
728 | 848 | |
729 | - bufferOut.write(" <div id=\"grafico\" > "); | |
849 | + bufferOut.write(" <div class=\"cell width-5 position-2 >"); | |
730 | 850 | |
731 | - bufferOut.write(" <h2 class=\"oculto_visao\" >Gráfico com as notas das últimas avaliações ordenada da mais antiga para a mais atual, limitado até quatro avaliações.</h2> "); | |
732 | - List<Avaliacao> lsAvaliacao = dao.getTresUltimasAvaliacoesByURL(url); | |
733 | 851 | |
852 | + bufferOut.write(" <div id=\"block\">"); | |
853 | + bufferOut.write(" <div id=\"webaxscore\" class=\"scoreB_" + webaxscore + "\">Porcentagem"); | |
854 | + bufferOut.write(" <strong>ASES</strong>"); | |
855 | + bufferOut.write(" <span>" + notaAvaliacao +"%</span>"); | |
856 | + bufferOut.write(" </div>"); | |
857 | + bufferOut.write(" </div>"); | |
734 | 858 | |
735 | - int i = 5; | |
736 | - bufferOut.write("<ul class=\"oculto_visao\" > "); | |
859 | + //bufferOut.write(" <br>"); | |
737 | 860 | |
738 | - List<Avaliacao> avaliacoesOrdenada = new ArrayList<Avaliacao>(); | |
739 | 861 | |
862 | + bufferOut.write("<div id=\"legenda\" >"); | |
863 | + bufferOut.write("<label>Legenda</label><br>"); | |
864 | + bufferOut.write("<ul>"); | |
865 | + bufferOut.write(" <li class=\"legenda\"><img id=\"bom\" alt=\"farol verde, nota maior ou igual a 95%\" src=\"http://189.9.137.162:8080/eselo/static/img/verde.png\"></li>"); | |
866 | + bufferOut.write(" <li class=\"legenda\"><img id=\"razoavel\" alt=\"farol amarela, nota maior ou igual a 85% e menor que 95%\" src=\"http://189.9.137.162:8080/eselo/static/img/amarelo.png\"></li>"); | |
867 | + bufferOut.write(" <li class=\"legenda\"><img id=\"ruim\" alt=\"farol laranja, nota maior ou igual a 70% e menor que 85%\" src=\"http://189.9.137.162:8080/eselo/static/img/laranja.png\"></li>"); | |
868 | + bufferOut.write(" <li class=\"legenda\"><img id=\"pessimo\" alt=\"farol vermelho, nota menor que 70%\" src=\"http://189.9.137.162:8080/eselo/static/img/vermelho.png\"></li>"); | |
869 | + bufferOut.write("</ul>"); | |
870 | + bufferOut.write("</div>"); | |
871 | + | |
872 | + bufferOut.write(" </div> <br>"); | |
873 | + | |
874 | + //bufferOut.write(" </div> "); | |
875 | + /*bufferOut.write(" <div id=\"testesAutomaticos\"> "); | |
876 | + | |
877 | + | |
878 | + bufferOut.write(" <div class=\"cell width-5 position-2 >"); | |
879 | + bufferOut.write(" <div id=\"block\">"); | |
880 | + bufferOut.write(" <div id=\"webaxscore\" class=\"scoreB_" + webaxscore + ">Porcentagem"); | |
881 | + bufferOut.write(" <strong>ASES</strong>"); | |
882 | + bufferOut.write(" <span>" + notaAvaliacao +"%</span>"); | |
883 | + bufferOut.write(" </div>"); | |
884 | + bufferOut.write(" </div>"); | |
885 | + | |
886 | + bufferOut.write("</div>"); | |
887 | + | |
888 | + | |
889 | + | |
890 | + bufferOut.write(" </div> ");*/ | |
891 | + | |
892 | + | |
893 | + bufferOut.write(" <div id=\"grafico\" > "); | |
894 | + | |
895 | + bufferOut | |
896 | + .write(" <h2 class=\"oculto_visao\" >Gráfico com as notas das últimas avaliações ordenada da mais antiga para a mais atual, limitado até quatro avaliações.</h2> "); | |
897 | + List<Avaliacao> lsAvaliacao = dao | |
898 | + .getTresUltimasAvaliacoesByURL(url); | |
899 | + | |
900 | + int i = 5; | |
901 | + bufferOut.write("<ul class=\"oculto_visao\" > "); | |
902 | + | |
903 | + List<Avaliacao> avaliacoesOrdenada = new ArrayList<Avaliacao>(); | |
904 | + | |
740 | 905 | for (Avaliacao avaliacao2 : lsAvaliacao) { |
741 | - i--; | |
906 | + i--; | |
742 | 907 | avaliacoesOrdenada.add(avaliacao2); |
743 | - if(i <= 1) | |
744 | - { | |
908 | + if (i <= 1) { | |
745 | 909 | break; |
746 | 910 | } |
747 | 911 | } |
748 | 912 | Collections.sort(avaliacoesOrdenada); |
749 | - | |
913 | + | |
750 | 914 | i = 0; |
751 | 915 | for (Avaliacao avaliacaoOrdenada : avaliacoesOrdenada) { |
752 | 916 | i++; |
753 | - bufferOut.write("<li >Nota " + i + ": <span id=\"nota" + i + "\">" + avaliacaoOrdenada.getNota() + "</span><span>Data da avaliação:" + avaliacaoOrdenada.getDataAvaliacao() + "</span></li>"); | |
754 | - | |
917 | + bufferOut | |
918 | + .write("<li >Nota " + i + ": <span id=\"nota" + i | |
919 | + + "\">" + avaliacaoOrdenada.getNota() | |
920 | + + "</span><span>Data da avaliação:" | |
921 | + + avaliacaoOrdenada.getDataAvaliacao() | |
922 | + + "</span></li>"); | |
923 | + | |
755 | 924 | } |
756 | - | |
925 | + | |
757 | 926 | Long idSitio = avaliacao.getUrl().getIdSitio(); |
758 | - | |
759 | - Sitio sitio = daoSitio.getSitioById(idSitio); | |
760 | - | |
761 | - String nomeOrgao = (sitio != null) ? sitio.getDominio().getOrgao().getNomeOrgao():""; | |
762 | - | |
927 | + | |
928 | + Sitio sitio = daoSitio.getSitioById(idSitio); | |
929 | + | |
930 | + String nomeOrgao = (sitio != null) ? sitio.getDominio().getOrgao() | |
931 | + .getNomeOrgao() : ""; | |
932 | + | |
763 | 933 | bufferOut.write("</ul>"); |
764 | - bufferOut.write("<label id=\"qntAvaliacoes\" class=\"oculto\">" + i +"</label>"); | |
934 | + bufferOut.write("<label id=\"qntAvaliacoes\" class=\"oculto\">" + i | |
935 | + + "</label>"); | |
765 | 936 | bufferOut.write(" <div class=\"myChart\" > "); |
766 | 937 | bufferOut.write(" <canvas id=\"myChart\" ></canvas> "); |
767 | 938 | bufferOut.write(" </div>"); |
768 | 939 | bufferOut.write(" </div>"); |
769 | 940 | bufferOut.write(" </div>"); |
770 | - bufferOut.write("<div class=\"avaliacao\">"); | |
771 | - | |
772 | - String dataFormatada = avaliacao.getDataAvaliacao().toString(); | |
941 | + bufferOut.write(" </div>"); | |
773 | 942 | |
774 | - bufferOut.write("<label><h2><strong>Teste Automático de Acessibilidade</strong></label></h2>"); | |
775 | - bufferOut.write("<label><strong>Órgão: </strong>" + nomeOrgao + "</label><br>"); | |
776 | - bufferOut.write("<label><strong>Página: </strong>" + resumoAvaliacao.getUrl() + "</label><br>"); | |
777 | - bufferOut.write("<label><strong>Data de Avaliação: </strong>" + dataFormatada + "</label><br>"); | |
778 | - bufferOut.write("<label><strong>Nota: </strong>" + avaliacao.getNota() + "</label><br>"); | |
943 | + bufferOut.write("<div class=\"avaliacao\">"); | |
944 | + | |
945 | + String dataFormatada = avaliacao.getDataAvaliacao().toString(); | |
946 | + | |
947 | + bufferOut | |
948 | + .write("<label><h2><strong>Teste Automático de Acessibilidade</strong></label></h2>"); | |
949 | + bufferOut.write("<label><strong>Órgão: </strong>" + nomeOrgao | |
950 | + + "</label><br>"); | |
951 | + bufferOut.write("<label><strong>Página: </strong>" | |
952 | + + resumoAvaliacao.getUrl() + "</label><br>"); | |
953 | + bufferOut.write("<label><strong>Data de Avaliação: </strong>" | |
954 | + + dataFormatada + "</label><br>"); | |
955 | + bufferOut.write("<label><strong>Nota: </strong>" | |
956 | + + avaliacao.getNota() + "</label><br>"); | |
779 | 957 | bufferOut.write("<hr>"); |
780 | 958 | |
781 | 959 | resultadosRecomendacao = new ArrayList<ResultadoRecomendacao>(); |
... | ... | @@ -791,17 +969,21 @@ public class AvaliacaoController { |
791 | 969 | |
792 | 970 | bufferOut.write("<h3><label><strong>Recomendação " |
793 | 971 | + resultadoRecomendacao.getNumRecomendacao() + " - " |
794 | - + recomendacao.getDescricao() + "</strong></label></h3>"); | |
795 | - bufferOut.write("<label><strong>Peso da Recomendação: </strong>" | |
796 | - + recomendacao.getPeso() + "</label><br>"); | |
797 | - bufferOut.write("<label><strong>Nota da Recomendação: </strong>" | |
798 | - + resultadoRecomendacao.getNotaRecomendacao() | |
799 | - + "</label><br>"); | |
972 | + + recomendacao.getDescricao() | |
973 | + + "</strong></label></h3>"); | |
974 | + bufferOut | |
975 | + .write("<label><strong>Peso da Recomendação: </strong>" | |
976 | + + recomendacao.getPeso() + "</label><br>"); | |
977 | + bufferOut | |
978 | + .write("<label><strong>Nota da Recomendação: </strong>" | |
979 | + + resultadoRecomendacao.getNotaRecomendacao() | |
980 | + + "</label><br>"); | |
800 | 981 | |
801 | 982 | resultadosCriterio = daoResultadoCriterio |
802 | 983 | .getResultadoCriterio(resultadoRecomendacao); |
803 | 984 | |
804 | - bufferOut.write("<h3><label><strong>Critérios Avaliados</strong></label></h3>"); | |
985 | + bufferOut | |
986 | + .write("<h3><label><strong>Critérios Avaliados</strong></label></h3>"); | |
805 | 987 | bufferOut.write("<table>"); |
806 | 988 | |
807 | 989 | bufferOut.write("<thead>"); |
... | ... | @@ -821,15 +1003,19 @@ public class AvaliacaoController { |
821 | 1003 | |
822 | 1004 | for (ResultadoCriterio resultadoCriterio : resultadosCriterio) { |
823 | 1005 | criterio = new Criterio(); |
824 | - criterio = daoCriterio.load(resultadoCriterio.getIdCriterio()); | |
1006 | + criterio = daoCriterio.load(resultadoCriterio | |
1007 | + .getIdCriterio()); | |
825 | 1008 | |
826 | 1009 | bufferOut.write("<tr>"); |
827 | 1010 | bufferOut.write("<td headers=\"numero\" class=\"celula\">" |
828 | 1011 | + criterio.getNumeroCriterio() + "</td>"); |
829 | - bufferOut.write("<td headers=\"criterio\" class=\"celula\">" | |
830 | - + criterio.getDescricao() + "</td>"); | |
831 | - bufferOut.write("<td headers=\"tipoTeste\" class=\"celula\">" | |
832 | - + criterio.getTipoTeste().getTipo() + "</td>"); | |
1012 | + bufferOut | |
1013 | + .write("<td headers=\"criterio\" class=\"celula\">" | |
1014 | + + criterio.getDescricao() + "</td>"); | |
1015 | + bufferOut | |
1016 | + .write("<td headers=\"tipoTeste\" class=\"celula\">" | |
1017 | + + criterio.getTipoTeste().getTipo() | |
1018 | + + "</td>"); | |
833 | 1019 | bufferOut.write("<td headers=\"peso\" class=\"celula\">" |
834 | 1020 | + criterio.getPeso() + "</td>"); |
835 | 1021 | bufferOut.write("<td headers=\"erros\" class=\"celula\">" |
... | ... | @@ -846,24 +1032,39 @@ public class AvaliacaoController { |
846 | 1032 | bufferOut.write("</table><br>"); |
847 | 1033 | } |
848 | 1034 | |
849 | - bufferOut.write("<a id=\"fimConteudo\" class=\"oculto\">Fim do conteúdo</a>"); | |
1035 | + bufferOut | |
1036 | + .write("<a id=\"fimConteudo\" class=\"oculto\">Fim do conteúdo</a>"); | |
850 | 1037 | bufferOut.write("</div>"); |
851 | 1038 | bufferOut.write("<div id=\"voltar-topo\">"); |
852 | 1039 | bufferOut.write("<a href=\"#topoPagina\">Voltar para o topo</a>"); |
853 | 1040 | bufferOut.write("</div>"); |
854 | 1041 | bufferOut.write("</div>"); |
855 | 1042 | bufferOut.write("<footer id=\"footer-brasil\"></footer>"); |
856 | - bufferOut.write("<script defer=\"defer\" src=\"//barra.brasil.gov.br/barra.js\""); | |
1043 | + bufferOut | |
1044 | + .write("<script defer=\"defer\" src=\"//barra.brasil.gov.br/barra.js\""); | |
857 | 1045 | bufferOut.write("type=\"text/javascript\"></script>"); |
858 | - bufferOut.write("<script type=\"text/javascript\" src=\"/eselo/static/js/jquery-1.10.2.min.js\"></script>"); | |
859 | - bufferOut.write("<script type=\"text/javascript\" src=\"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js\"></script>"); | |
860 | - bufferOut.write("<script src=\"/eselo/static/js/chart.js\"></script>"); | |
861 | - bufferOut.write("<noscript>Seu navegador não possui suporte para JavaScript!</noscript>"); | |
1046 | + | |
1047 | + bufferOut.write("<script type=\"text/javascript\" src=\"/static/js/jquery-1.10.2.min.js\"></script>"); | |
1048 | + //bufferOut.write("<script type=\"text/javascript\" src=\"" + this.application.getRealPath("") + "/static/js/jquery-1.10.2.min.js\"></script>"); | |
1049 | + | |
1050 | + bufferOut | |
1051 | + .write("<script type=\"text/javascript\" src=\"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js\"></script>"); | |
1052 | + | |
1053 | + | |
1054 | + bufferOut.write("<script src=\"/static/js/chart.js\"></script>"); | |
1055 | + //bufferOut.write("<script src=\"" + this.application.getRealPath("") + "/static/js/chart.js\"></script>"); | |
1056 | + | |
1057 | + | |
1058 | + | |
1059 | + | |
1060 | + | |
1061 | + bufferOut | |
1062 | + .write("<noscript>Seu navegador não possui suporte para JavaScript!</noscript>"); | |
862 | 1063 | bufferOut.write("</body>"); |
863 | 1064 | bufferOut.write("</html>"); |
864 | - | |
1065 | + | |
865 | 1066 | bufferOut.close(); |
866 | - | |
1067 | + | |
867 | 1068 | if (diretorioHtml.exists()) { |
868 | 1069 | salvarAvaliacao(resumoAvaliacao); |
869 | 1070 | } |
... | ... | @@ -876,7 +1077,125 @@ public class AvaliacaoController { |
876 | 1077 | } catch (IOException e) { |
877 | 1078 | e.printStackTrace(); |
878 | 1079 | } |
1080 | + | |
1081 | + } | |
1082 | + | |
1083 | + private boolean verificarAlteracaoPagina(String url) { | |
1084 | + | |
1085 | + boolean paginaAlterada = false; | |
1086 | + System.out.println("iniciou a verificacao"); | |
1087 | + //WebChecker pagina = WebChecker.from(url).withGetRequest().execute(); | |
1088 | + String html = "1234";//pagina.getContent().toLowerCase(); | |
1089 | + MessageDigest digest; | |
1090 | + byte[] secured = null; | |
1091 | + | |
1092 | + System.out.println("iniciou a criacao hash"); | |
1093 | + try { | |
1094 | + digest = MessageDigest.getInstance("MD5"); | |
1095 | + digest.reset(); | |
1096 | + secured = digest.digest(html.getBytes()); | |
1097 | + | |
1098 | + } catch (NoSuchAlgorithmException e) { | |
1099 | + e.printStackTrace(); | |
1100 | + } | |
1101 | + System.out.println("terminou criacao hash"); | |
1102 | + | |
1103 | + Url urlCompleta = null; | |
1104 | + try { | |
1105 | + urlCompleta = daoUrl.getStringUrl(URLNormalizer.normalize(url)); | |
1106 | + | |
1107 | + System.out.println("buscou urlCompleta"); | |
1108 | + } catch (MalformedURLException e) { | |
1109 | + e.printStackTrace(); | |
1110 | + } | |
1111 | + | |
1112 | + if(urlCompleta != null) | |
1113 | + { | |
1114 | + if (urlCompleta.getCodHash() == null || !MessageDigest.isEqual(urlCompleta.getCodHash(), secured)) | |
1115 | + { | |
1116 | + | |
1117 | + try { | |
1118 | + urlCompleta.setCodHash(secured); | |
1119 | + daoUrl.update(urlCompleta); | |
1120 | + paginaAlterada = true; | |
1121 | + } catch (Exception e) { | |
1122 | + e.getCause(); | |
1123 | + } | |
1124 | + | |
1125 | + | |
1126 | + | |
1127 | + | |
1128 | + } | |
1129 | + } | |
1130 | + else | |
1131 | + { | |
1132 | + paginaAlterada = true; | |
1133 | + } | |
879 | 1134 | |
1135 | + return paginaAlterada; | |
880 | 1136 | } |
881 | 1137 | |
1138 | + private Integer verificarConexao(String href, String usuario, String agente) { | |
1139 | + | |
1140 | + System.setProperty("jsse.enableSNIExtension", "false"); | |
1141 | + HttpMethod metodoRequisicao = null; | |
1142 | + HttpClient clienteHTTPJakartaCommons; | |
1143 | + URL UrlConvertida; | |
1144 | + int codResponse = -1; | |
1145 | + | |
1146 | + try { | |
1147 | + | |
1148 | + String[] test = href.split("\\../"); | |
1149 | + String newurl = ""; | |
1150 | + for (String tes : test) | |
1151 | + newurl = newurl + tes.trim(); | |
1152 | + | |
1153 | + newurl = newurl.replace(" ", "%20"); | |
1154 | + | |
1155 | + UrlConvertida = new URL(newurl); | |
1156 | + | |
1157 | + clienteHTTPJakartaCommons = new HttpClient(); | |
1158 | + clienteHTTPJakartaCommons.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, | |
1159 | + new DefaultHttpMethodRetryHandler(3, false)); | |
1160 | + clienteHTTPJakartaCommons.getParams().setParameter("http.protocol.allow-circular-redirects", | |
1161 | + true); | |
1162 | + clienteHTTPJakartaCommons.getParams().setParameter(HttpConnectionParams.CONNECTION_TIMEOUT, | |
1163 | + new Integer(2000)); | |
1164 | + | |
1165 | + | |
1166 | + metodoRequisicao = new HeadMethod(UrlConvertida.toExternalForm()); | |
1167 | + | |
1168 | + metodoRequisicao.setRequestHeader(usuario, agente); | |
1169 | + | |
1170 | + codResponse = clienteHTTPJakartaCommons.executeMethod(metodoRequisicao); | |
1171 | + | |
1172 | + if(codResponse >= 400 && codResponse < 500) | |
1173 | + { | |
1174 | + metodoRequisicao = new GetMethod(UrlConvertida.toExternalForm()); | |
1175 | + codResponse = clienteHTTPJakartaCommons.executeMethod(metodoRequisicao); | |
1176 | + } | |
1177 | + | |
1178 | + } catch (MalformedURLException e) { | |
1179 | + e.printStackTrace(); | |
1180 | + return -1; | |
1181 | + | |
1182 | + } catch (IOException e) { | |
1183 | + e.printStackTrace(); | |
1184 | + return -1; | |
1185 | + | |
1186 | + } catch (IllegalArgumentException e) { | |
1187 | + e.printStackTrace(); | |
1188 | + return -1; | |
1189 | + | |
1190 | + } finally { | |
1191 | + | |
1192 | + if (metodoRequisicao != null) { | |
1193 | + metodoRequisicao.releaseConnection(); | |
1194 | + } | |
1195 | + | |
1196 | + } | |
1197 | + return codResponse; | |
1198 | + | |
1199 | + } | |
1200 | + | |
882 | 1201 | } | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/PainelAcessibilidadeController.java
1 | 1 | package br.com.eselo.controller; |
2 | 2 | |
3 | 3 | |
4 | +import java.net.MalformedURLException; | |
5 | +import java.util.ArrayList; | |
6 | +import java.util.List; | |
7 | + | |
8 | +import javax.ws.rs.QueryParam; | |
9 | + | |
4 | 10 | import br.com.caelum.vraptor.Get; |
5 | 11 | import br.com.caelum.vraptor.Post; |
6 | 12 | import br.com.caelum.vraptor.Resource; |
7 | 13 | import br.com.caelum.vraptor.Result; |
8 | 14 | import br.com.caelum.vraptor.Validator; |
15 | +import br.com.eselo.component.URLNormalizer; | |
16 | +import br.com.eselo.dao.UrlDAO; | |
17 | +import br.com.eselo.model.Url; | |
9 | 18 | |
10 | 19 | @Resource |
11 | 20 | public class PainelAcessibilidadeController { |
12 | 21 | |
13 | 22 | private Result result; |
14 | 23 | private Validator validator; |
24 | + private final UrlDAO daoUrl; | |
15 | 25 | |
16 | - public PainelAcessibilidadeController(Result result, Validator validator){ | |
26 | + public PainelAcessibilidadeController(Result result, Validator validator, UrlDAO _dao){ | |
17 | 27 | this.result = result; |
18 | 28 | this.validator = validator; |
29 | + this.daoUrl = _dao; | |
19 | 30 | } |
20 | 31 | |
21 | 32 | @Get("/painelAcessibilidade") |
22 | - public void painelAcessibilidade() { | |
33 | + public void painelAcessibilidade(@QueryParam("url") String url,@QueryParam("sitio") String sitio,@QueryParam("id") String id) { | |
23 | 34 | String teste = ""; |
35 | + String te = "Objeto montado"; | |
36 | + Url url1 = new Url(); | |
37 | + Url url2 = null; | |
38 | + //try { | |
39 | + // url = new Url();//daoUrl. getStringUrl(URLNormalizer.normalize("http://asesweb.governoeletronico.gov.br/ases/")); | |
40 | + //} catch (MalformedURLException e) { | |
41 | + // TODO Auto-generated catch block | |
42 | + // e.printStackTrace(); | |
43 | + //} | |
44 | + | |
45 | + try { | |
46 | + | |
47 | + System.out.println("montagem do objeto"); | |
48 | + url1.setId(Long.parseLong(id)); | |
49 | + url1.setUrl(URLNormalizer.normalize(url)); | |
50 | + url1.setIdSitio(Long.parseLong(sitio)); | |
51 | + url1.setCodHash(te.getBytes()); | |
52 | + System.out.println("Objeto montado"); | |
53 | + System.out.println("Update do objeto"); | |
54 | + daoUrl.update(url1); | |
55 | + System.out.println("Objeto atualizado no banco"); | |
56 | + } catch (Exception e) { | |
57 | + e.printStackTrace(); | |
58 | + e.getCause(); | |
59 | + } | |
60 | + | |
61 | + | |
62 | + | |
63 | + | |
64 | + try { | |
65 | + url2 = daoUrl. getStringUrl(URLNormalizer.normalize(url)); | |
66 | + | |
67 | + result.include("url", url2); | |
68 | + } catch (MalformedURLException e) { | |
69 | + e.printStackTrace(); | |
70 | + } | |
71 | + | |
72 | + | |
24 | 73 | } |
25 | 74 | |
26 | 75 | |
27 | - @Post("/painelAcessibilidade") | |
28 | - public void painelAcessibilidade(String idOrgao) { | |
29 | - | |
30 | - String teste = ""; | |
31 | - //this.validator = validate.getMessage(); | |
32 | - //this.validator.onErrorUsePageOf(this).painelAcessibilidade(); | |
33 | - } | |
76 | + | |
34 | 77 | } | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/arquivosHtmlController.java
... | ... | @@ -6,38 +6,58 @@ import java.io.FileInputStream; |
6 | 6 | import java.io.FileNotFoundException; |
7 | 7 | import java.io.FileReader; |
8 | 8 | import java.io.IOException; |
9 | +import java.io.InputStream; | |
9 | 10 | import java.io.InputStreamReader; |
11 | +import java.util.Properties; | |
10 | 12 | |
11 | 13 | import javax.servlet.ServletContext; |
12 | 14 | import javax.swing.text.html.HTML; |
13 | 15 | |
16 | +import org.slf4j.Logger; | |
17 | +import org.slf4j.LoggerFactory; | |
18 | + | |
14 | 19 | import br.com.caelum.vraptor.Get; |
15 | 20 | import br.com.caelum.vraptor.Resource; |
16 | 21 | import br.com.caelum.vraptor.Result; |
22 | +import br.com.eselo.component.Mailer; | |
17 | 23 | import br.com.eselo.model.ResumoAvaliacao; |
18 | 24 | |
19 | 25 | @Resource |
20 | 26 | public class arquivosHtmlController { |
21 | 27 | |
28 | + private static final Logger LOGGER = LoggerFactory | |
29 | + .getLogger(AvaliacaoController.class); | |
30 | + | |
22 | 31 | private ServletContext application; |
23 | 32 | private Result result; |
24 | - | |
25 | - | |
33 | + private static final String BUSCAR_ARQUIVOS_HTML = "eselo.config.avaliacao.arquivosHtml"; | |
34 | + private static Properties properties = new Properties(); | |
26 | 35 | |
27 | - public arquivosHtmlController(ServletContext application, Result result) { | |
36 | + public arquivosHtmlController(ServletContext application, Result result) throws IOException { | |
28 | 37 | super(); |
29 | 38 | this.application = application; |
30 | 39 | this.result = result; |
31 | 40 | |
32 | - | |
41 | + String fileName = "config.properties"; | |
42 | + InputStream stream = Mailer.class.getResourceAsStream("/" + fileName); | |
43 | + Properties propertiesFile = new Properties(); | |
44 | + | |
45 | + if (stream != null) { | |
46 | + propertiesFile.load(stream); | |
47 | + this.properties.putAll(propertiesFile); | |
48 | + } else { | |
49 | + LOGGER.warn("Could not find the file '{}' to load.", fileName); | |
50 | + } | |
33 | 51 | } |
34 | 52 | |
35 | 53 | @Get("/arquivosHtml/{nomeArquivo}") |
36 | 54 | public void arquivosHtml(String nomeArquivo) |
37 | 55 | { |
38 | 56 | |
39 | - File diretorioHtml = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosHtml/"+ nomeArquivo.replace(".html",".txt")); | |
40 | - //+ nomeArquivo); | |
57 | + //File diretorioHtml = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosHtml/"+ nomeArquivo.replace(".html",".txt")); | |
58 | + | |
59 | + | |
60 | + File diretorioHtml = new File(properties.getProperty(BUSCAR_ARQUIVOS_HTML) + "/" + nomeArquivo.replace(".html",".txt")); | |
41 | 61 | StringBuilder html = new StringBuilder(); |
42 | 62 | try { |
43 | 63 | BufferedReader myBuffer = new BufferedReader(new InputStreamReader(new FileInputStream(diretorioHtml), "UTF-8")); | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/dao/GenericDAO.java
... | ... | @@ -87,6 +87,8 @@ public abstract class GenericDAO<T> { |
87 | 87 | this.session.update(entity); |
88 | 88 | this.session.flush(); |
89 | 89 | } catch (HibernateException e) { |
90 | + System.out.println("erro ao atualizar"); | |
91 | + System.out.println(e.getMessage()); | |
90 | 92 | logger.debug(e.getMessage()); |
91 | 93 | throw e; |
92 | 94 | } | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/model/Url.java
1 | 1 | package br.com.eselo.model; |
2 | 2 | |
3 | +import java.math.BigInteger; | |
3 | 4 | import java.util.ArrayList; |
4 | 5 | import java.util.List; |
5 | 6 | |
... | ... | @@ -41,6 +42,10 @@ public class Url { |
41 | 42 | @Column(name="id_sitio", nullable = true) |
42 | 43 | private Long idSitio; |
43 | 44 | |
45 | + @Column(name="cod_hash", nullable = true) | |
46 | + private byte[] codHash; | |
47 | + | |
48 | + | |
44 | 49 | public Long getId() { |
45 | 50 | return id; |
46 | 51 | } |
... | ... | @@ -65,4 +70,18 @@ public class Url { |
65 | 70 | this.idSitio = idSitio; |
66 | 71 | } |
67 | 72 | |
73 | + public byte[] getCodHash() { | |
74 | + return codHash; | |
75 | + } | |
76 | + | |
77 | + public void setCodHash(byte[] codHash) { | |
78 | + this.codHash = codHash; | |
79 | + } | |
80 | + | |
81 | + | |
82 | + | |
83 | + | |
84 | + | |
85 | + | |
86 | + | |
68 | 87 | } | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/resources/config.properties
1 | 1 | eselo.config.avaliacao.caminhoSelos = imgSelo |
2 | +eselo.config.avaliacao.urlServico =http://asesweb-prd.brazilsouth.cloudapp.azure.com/servico-avaliacao-acessibilidade-salvando | |
3 | +#eselo.config.avaliacao.urlServico = http://189.9.137.162:8080/ases/servico-avaliacao-acessibilidade-salvando | |
2 | 4 | #eselo.config.avaliacao.urlServico = http://localhost:18080/ases/servico-avaliacao-acessibilidade-salvando |
3 | -eselo.config.avaliacao.urlServico = http://189.9.137.162:8080/ases/servico-avaliacao-acessibilidade-salvando | |
5 | + | |
6 | + | |
7 | +eselo.config.avaliacao.arquivosHtml=/var/www/arquivo/painel/html | |
8 | +eselo.config.avaliacao.arquivosJson=/var/www/arquivo/painel/json | |
9 | + | |
10 | + | |
11 | +#eselo.config.avaliacao.enderecoHtml=http://localhost:18080/eselo/arquivosHtml/ | |
12 | +#eselo.config.avaliacao.enderecoHtml=http://189.9.137.162:8080/eselo/arquivosHtml/ | |
13 | +eselo.config.avaliacao.enderecoHtml=http://eselo-prd.brazilsouth.cloudapp.azure.com/arquivosHtml | |
4 | 14 | \ No newline at end of file | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/resources/hibernate.cfg.xml
... | ... | @@ -7,17 +7,17 @@ |
7 | 7 | <hibernate-configuration> |
8 | 8 | <session-factory> |
9 | 9 | <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property> |
10 | - <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/eselo</property> | |
10 | + <property name="hibernate.connection.url">jdbc:postgresql://database:5432/eselo</property> | |
11 | 11 | <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> |
12 | 12 | <property name="hibernate.connection.username">postgres</property> |
13 | - <property name="hibernate.connection.password">postgres</property> | |
13 | + <property name="hibernate.connection.password">dgeSLTIcgpge2015</property> | |
14 | 14 | <property name="hibernate.connection.CharSet">utf8</property> |
15 | 15 | <property name="hibernate.connection.characterEncoding">utf8</property> |
16 | 16 | <property name="hibernate.connection.useUnicode">true</property> |
17 | 17 | |
18 | - <property name="hibernate.hbm2ddl.auto">update</property> | |
18 | + <!-- <property name="hibernate.hbm2ddl.auto">validate</property>--> | |
19 | 19 | <property name="hibernate.format_sql">true</property> |
20 | - <property name="hibernate.show_sql">true</property> | |
20 | + <property name="hibernate.show_sql">false</property> | |
21 | 21 | <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> |
22 | 22 | |
23 | 23 | <mapping class="br.com.eselo.model.Usuario" /> |
... | ... | @@ -33,6 +33,10 @@ |
33 | 33 | <mapping class="br.com.eselo.model.Recomendacao" /> |
34 | 34 | <mapping class="br.com.eselo.model.TipoTeste" /> |
35 | 35 | <mapping class="br.com.eselo.model.Url" /> |
36 | + <mapping class="br.com.eselo.model.Sitio" /> | |
37 | + <mapping class="br.com.eselo.model.Dominio" /> | |
38 | + <mapping class="br.com.eselo.model.Orgao" /> | |
39 | + | |
36 | 40 | <mapping class="br.com.eselo.model.ResultadoRecomendacao" /> |
37 | 41 | <mapping class="br.com.eselo.model.ResultadoCriterio" /> |
38 | 42 | </session-factory> | ... | ... |