Commit 64530d25e8ca7a47fb902081337bfc7edb9f3e53
1 parent
8a038bb2
Exists in
master
criação do método para web service (incompleto)
Showing
1 changed file
with
326 additions
and
20 deletions
Show diff stats
src/main/java/br/com/ases/controller/AvaliacaoController.java
... | ... | @@ -13,7 +13,6 @@ import java.io.File; |
13 | 13 | import java.io.IOException; |
14 | 14 | import java.io.InputStreamReader; |
15 | 15 | import java.io.UnsupportedEncodingException; |
16 | -import java.net.URL; | |
17 | 16 | import java.net.URLEncoder; |
18 | 17 | import java.text.SimpleDateFormat; |
19 | 18 | import java.util.ArrayList; |
... | ... | @@ -28,6 +27,7 @@ import java.util.regex.Matcher; |
28 | 27 | import java.util.regex.Pattern; |
29 | 28 | |
30 | 29 | import javax.servlet.ServletContext; |
30 | +import javax.ws.rs.QueryParam; | |
31 | 31 | |
32 | 32 | import net.sf.jasperreports.engine.JRException; |
33 | 33 | import br.com.ases.business.AvaliacaoBusiness; |
... | ... | @@ -36,6 +36,7 @@ import br.com.ases.domain.DetalheAvaliacao; |
36 | 36 | import br.com.ases.domain.DetalheAvaliacao.Criterio; |
37 | 37 | import br.com.ases.domain.OccurrenceKey; |
38 | 38 | import br.com.ases.domain.ResumoAvaliacao; |
39 | +import br.com.ases.infra.CriterioProperties; | |
39 | 40 | import br.com.ases.infra.EseloProperties; |
40 | 41 | import br.com.ases.infra.UtilitiesProperties; |
41 | 42 | import br.com.ases.infra.WebChecker; |
... | ... | @@ -57,6 +58,7 @@ import br.com.checker.emag.SummarizedOccurrence; |
57 | 58 | import br.com.checker.emag.core.Checker; |
58 | 59 | import br.com.checker.emag.core.ContentEvaluation; |
59 | 60 | |
61 | + | |
60 | 62 | @Resource |
61 | 63 | public class AvaliacaoController { |
62 | 64 | EseloProperties eseloProperties = null; |
... | ... | @@ -80,6 +82,8 @@ public class AvaliacaoController { |
80 | 82 | private ServletContext application; |
81 | 83 | private DetalheAvaliacao detalheAvaliacao; |
82 | 84 | private UtilitiesProperties utilitiesProperties; |
85 | + private StringBuffer xml; | |
86 | + private CriterioProperties criterioProperties; | |
83 | 87 | |
84 | 88 | public AvaliacaoController(Result result, Validator validator, |
85 | 89 | AvaliacaoBusiness avaliacaoBusiness, ServletContext application, |
... | ... | @@ -91,6 +95,7 @@ public class AvaliacaoController { |
91 | 95 | this.detalheAvaliacao = detalheAvaliacao; |
92 | 96 | this.avaliacaoBusiness.initEseloProperties(application); |
93 | 97 | this.initEseloProperties(application); |
98 | + this.criterioProperties = new CriterioProperties(application); | |
94 | 99 | this.utilitiesProperties = new UtilitiesProperties(application); |
95 | 100 | |
96 | 101 | } |
... | ... | @@ -157,7 +162,7 @@ public class AvaliacaoController { |
157 | 162 | |
158 | 163 | ContentEvaluation conteudo = new ContentEvaluation(checker.getDocument()); |
159 | 164 | this.tituloSite = conteudo.retornarTituloSiteAvaliado(); |
160 | - | |
165 | + | |
161 | 166 | result.include("titulosite", tituloSite); |
162 | 167 | Nota nota = null; |
163 | 168 | |
... | ... | @@ -188,7 +193,7 @@ public class AvaliacaoController { |
188 | 193 | VRaptorRequestHolder.currentRequest().getServletContext().setAttribute("notaAvaliacao", nota); |
189 | 194 | |
190 | 195 | // Seta o valor do t�tulo no template |
191 | - tituloPagina = "Resumo de avalia��o por upload de arquivo - ASES"; | |
196 | + tituloPagina = "Resumo de avaliação por upload de arquivo - ASES"; | |
192 | 197 | VRaptorRequestHolder.currentRequest().getServletContext().setAttribute("tituloPagina", tituloPagina); |
193 | 198 | |
194 | 199 | VRaptorRequestHolder.currentRequest().getServletContext().setAttribute("titulosite", tituloSite); |
... | ... | @@ -300,7 +305,7 @@ public class AvaliacaoController { |
300 | 305 | VRaptorRequestHolder.currentRequest().getServletContext().setAttribute("notaAvaliacao", nota); |
301 | 306 | |
302 | 307 | // Seta o valor do t�tulo no template |
303 | - tituloPagina = "Resumo de avalia��o por URI - ASES"; | |
308 | + tituloPagina = "Resumo de avaliação por URI - ASES"; | |
304 | 309 | VRaptorRequestHolder.currentRequest().getServletContext().setAttribute("tituloPagina", tituloPagina); |
305 | 310 | |
306 | 311 | VRaptorRequestHolder.currentRequest().getServletContext().setAttribute("titulosite", tituloSite); |
... | ... | @@ -319,7 +324,7 @@ public class AvaliacaoController { |
319 | 324 | .getServletContext() |
320 | 325 | .setAttribute("avisosFerramentasHtmlCssW3c", |
321 | 326 | avisosFerramentasHtmlCssW3c); |
322 | - | |
327 | + | |
323 | 328 | } else { |
324 | 329 | // Atribui �ncora para as mensagens de erros dos campos vazios |
325 | 330 | ancoraCampoVazio = "url"; |
... | ... | @@ -384,7 +389,7 @@ public class AvaliacaoController { |
384 | 389 | } |
385 | 390 | |
386 | 391 | map.put("pPagina", urlAvaliada != "" ? urlAvaliada |
387 | - : "C�digo Fonte ou Arquivo"); | |
392 | + : "Código Fonte ou Arquivo"); | |
388 | 393 | |
389 | 394 | if (urlAvaliada != "") { |
390 | 395 | Pattern pp = Pattern.compile("(http://www.)?([a-z]*)(.)?"); |
... | ... | @@ -410,9 +415,8 @@ public class AvaliacaoController { |
410 | 415 | int totalAvisos = 0; |
411 | 416 | |
412 | 417 | for (ResumoAvaliacao resumo : resumoErrosAvisos) { |
413 | - map.put(resumo.getTipo() + "_A", resumo.getQuantidadeAvisos()); | |
414 | - map.put(resumo.getTipo() + "_E", resumo.getQuantidadeErros()); | |
415 | - | |
418 | + map.put(resumo.getTipo() + "_A", resumo.getQuantidadeAvisos()); | |
419 | + map.put(resumo.getTipo() + "_E", resumo.getQuantidadeErros()); | |
416 | 420 | totalErros += resumo.getQuantidadeErros(); |
417 | 421 | totalAvisos += resumo.getQuantidadeAvisos(); |
418 | 422 | } |
... | ... | @@ -530,7 +534,7 @@ public class AvaliacaoController { |
530 | 534 | .setAttribute("notaAvaliacao", nota); |
531 | 535 | |
532 | 536 | // Seta o valor do t�tulo no template |
533 | - tituloPagina = "Resumo de avalia��o por c�digo fonte - ASES"; | |
537 | + tituloPagina = "Resumo de avaliação por código fonte - ASES"; | |
534 | 538 | VRaptorRequestHolder.currentRequest().getServletContext() |
535 | 539 | .setAttribute("tituloPagina", tituloPagina); |
536 | 540 | result.of(this).avaliar(null, mark, content, presentation, |
... | ... | @@ -629,6 +633,7 @@ public class AvaliacaoController { |
629 | 633 | List<Occurrence> listOcorrencias = this.detalheAvaliacao.get(rn, type).getOcorrencias(); |
630 | 634 | |
631 | 635 | |
636 | + | |
632 | 637 | Collections.sort(listOcorrencias, new Comparator<Occurrence>() { |
633 | 638 | public int compare(Occurrence occurrence1, Occurrence occurrence2) { |
634 | 639 | return occurrence1.getLine().compareTo(occurrence2.getLine()); |
... | ... | @@ -642,20 +647,13 @@ public class AvaliacaoController { |
642 | 647 | @Path("/detalhes-avaliacao/{rn}/{type}") |
643 | 648 | public void detalhesAvaliacao(OccurrenceKey rn, boolean type) { |
644 | 649 | String url = ""; |
645 | - tituloPagina = "Detalhes da avalia��o - ASES"; | |
650 | + tituloPagina = "Detalhes da avalição - ASES"; | |
646 | 651 | VRaptorRequestHolder.currentRequest().getServletContext() |
647 | 652 | .setAttribute("tituloPagina", tituloPagina); |
648 | 653 | |
649 | 654 | List<Occurrence> listOcorrencias = this.detalheAvaliacao.get(rn, type).getOcorrencias(); |
650 | 655 | |
651 | - // Sorting | |
652 | - /* | |
653 | - * Collections.sort(listOcorrencias, new Comparator<Occurrence>() { | |
654 | - * public int compare(Occurrence occurrence1, Occurrence occurrence2){ | |
655 | - * return | |
656 | - * occurrence1.getCriterio().compareTo(occurrence2.getCriterio()); } }); | |
657 | - */ | |
658 | - | |
656 | + | |
659 | 657 | // Sorting |
660 | 658 | Collections.sort(listOcorrencias, new Comparator<Occurrence>() { |
661 | 659 | public int compare(Occurrence occurrence1, Occurrence occurrence2) { |
... | ... | @@ -665,6 +663,7 @@ public class AvaliacaoController { |
665 | 663 | |
666 | 664 | result.include("detalhe", this.detalheAvaliacao.get(rn, type)); |
667 | 665 | result.include("listOcorrencia", listOcorrencias); |
666 | + | |
668 | 667 | result.include("isError", type); |
669 | 668 | if (type) { |
670 | 669 | result.include("qtdOcorrenciasCss", |
... | ... | @@ -681,8 +680,9 @@ public class AvaliacaoController { |
681 | 680 | List<SummarizedOccurrence> ob = (List<SummarizedOccurrence>) VRaptorRequestHolder.currentRequest().getServletContext().getAttribute("resultadoAvaliacao"); |
682 | 681 | String recomendacao = ""; |
683 | 682 | |
683 | + | |
684 | 684 | for (SummarizedOccurrence occurrence : ob) { |
685 | - recomendacao = occurrence.getMapDescription().get(rn.getCode()); | |
685 | + recomendacao = occurrence.getMapDescription().get(rn.getCode()); | |
686 | 686 | break; |
687 | 687 | } |
688 | 688 | |
... | ... | @@ -810,4 +810,310 @@ public class AvaliacaoController { |
810 | 810 | VRaptorRequestHolder.currentRequest().getServletContext() |
811 | 811 | .setAttribute("mensagem_avaliacao", mensagem_avaliacao); |
812 | 812 | } |
813 | + | |
814 | + @Get("/servico-avaliacao-acessibilidade") | |
815 | + @Post("/servico-avaliacao-acessibilidade") | |
816 | + public void servicoAvaliacaoAcessibilidade(@QueryParam("url") String url) { | |
817 | + | |
818 | + xml = new StringBuffer(); | |
819 | + | |
820 | + | |
821 | + Validate validate = new Validate(this.validator); | |
822 | + | |
823 | + if (validate.url(url)) { | |
824 | + | |
825 | + | |
826 | + if (url.startsWith("www")) | |
827 | + { | |
828 | + url = "http://" + url; | |
829 | + } | |
830 | + | |
831 | + WebChecker pagina = WebChecker.from(url).withGetRequest().execute(); | |
832 | + | |
833 | + int[] errorsWarningsCss = avaliacaoBusiness.getErrorCount(true, url); | |
834 | + int[] errorsWarningsHtml = avaliacaoBusiness.getErrorCount(false,url); | |
835 | + | |
836 | + Checker checker = from(pagina.getContent(), url); | |
837 | + | |
838 | + checker.with(marking()); | |
839 | + checker.with(content()); | |
840 | + checker.with(presentation()); | |
841 | + checker.with(multimedia()); | |
842 | + checker.with(form()); | |
843 | + checker.with(behavior()); | |
844 | + | |
845 | + Pattern pp = Pattern.compile("(http://www.)?([a-z]*)(.)?"); | |
846 | + Matcher mm = pp.matcher(url.toLowerCase().replace("https", "http")); | |
847 | + | |
848 | + if (mm.find()) | |
849 | + { | |
850 | + this.tituloSite = ""; | |
851 | + } | |
852 | + | |
853 | + ContentEvaluation conteudo = new ContentEvaluation(checker.getDocument()); | |
854 | + | |
855 | + this.tituloSite = conteudo.retornarTituloSiteAvaliado(); | |
856 | + | |
857 | + Nota nota = null; | |
858 | + | |
859 | + List<Entry<OccurrenceKey,List<Occurrence>>> mapaListaOcorrencias = avaliacaoBusiness.retornarCriteriosTeste(checker.check()); | |
860 | + | |
861 | + nota = avaliacaoBusiness.obterNotaEselo(checker.getDocument(),url, mapaListaOcorrencias); | |
862 | + | |
863 | + this.sumarizarResultasNoResponse(checker.checkSumarized(), result); | |
864 | + | |
865 | + this.detalheAvaliacao.inicializar(avaliacaoBusiness.retornarCriterios(checker.check()),errorsWarningsCss, errorsWarningsHtml); | |
866 | + | |
867 | + | |
868 | + this.dataHoraAvaliacao = (String) DateUtil.dataHoraAtual(); | |
869 | + List<SummarizedOccurrence> checkSumarized = checker.checkSumarized(); | |
870 | + | |
871 | + avisosFerramentasHtmlCssW3c = new ArrayList<String>(); | |
872 | + List<ResumoAvaliacao> resumoErrosAvisos = obterResumoAvaliacao(); | |
873 | + | |
874 | + //pegar os dados e montar o xml | |
875 | + //List<Occurrence> listOcorrencias; | |
876 | + //Occurrence detalhe; | |
877 | + OccurrenceKey rn = null; | |
878 | + boolean type = false; | |
879 | + //boolean criterioAdicionar = false; | |
880 | + //String criterioAdicionado = ""; | |
881 | + //String idCriterio = null; | |
882 | + int totalErros = 0; | |
883 | + int totalAvisos = 0; | |
884 | + | |
885 | + xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); | |
886 | + xml.append("<avaliacao-automatica>\n"); | |
887 | + xml.append("<pagina-avaliada>\n"); | |
888 | + xml.append("<titulo>" + this.tituloSite + "</titulo>\n"); | |
889 | + xml.append("<tamanho>" + pagina.getContentLength() + "</tamanho>\n"); | |
890 | + xml.append("<data-hora>" + this.dataHoraAvaliacao + "</data-hora>\n"); | |
891 | + xml.append("</pagina-avaliada>\n"); | |
892 | + xml.append("<resumo-avaliacao>\n"); | |
893 | + xml.append("<nota-avaliacao>" + nota.getValor() + "</nota-avaliacao>\n"); | |
894 | + | |
895 | + for (ResumoAvaliacao resumoAvaliacao : resumoErrosAvisos) { | |
896 | + | |
897 | + | |
898 | + xml.append("<secao>"); | |
899 | + xml.append("<nome>" + resumoAvaliacao.getTipo().getDescription() + "</nome>\n"); | |
900 | + xml.append("<quantidade-erro>" + resumoAvaliacao.getQuantidadeErros() + "</quantidade-erro>\n"); | |
901 | + xml.append("<quantidade-aviso>" + resumoAvaliacao.getQuantidadeAvisos() + "</quantidade-aviso>\n"); | |
902 | + xml.append("</secao>\n"); | |
903 | + | |
904 | + totalErros += resumoAvaliacao.getQuantidadeErros(); | |
905 | + totalAvisos += resumoAvaliacao.getQuantidadeAvisos(); | |
906 | + } | |
907 | + | |
908 | + xml.append("<total-erros>"+ totalErros +"</total-erros>\n"); | |
909 | + xml.append("<total-avisos>"+ totalAvisos +"</total-avisos>\n"); | |
910 | + xml.append("</resumo-avaliacao>\n"); | |
911 | + | |
912 | + String recomendacaoCompara = ""; | |
913 | + | |
914 | + for (SummarizedOccurrence avaliacao : checkSumarized) | |
915 | + { | |
916 | + rn = OccurrenceKey.valueOf(avaliacao.getCheckPoint()); | |
917 | + type = avaliacao.isError(); | |
918 | + | |
919 | + //if(!recomendacaoCompara.equalsIgnoreCase(avaliacao.getCheckPoint().toString())) | |
920 | + //{ | |
921 | + if(!recomendacaoCompara.equalsIgnoreCase("")) | |
922 | + { | |
923 | + xml.append("</recomendacao-avaliacao>\n"); | |
924 | + } | |
925 | + | |
926 | + xml.append("<recomendacao-avaliacao>\n"); | |
927 | + xml.append("<numero-recomendacao>" + avaliacao.getCheckPoint() + "</numero-recomendacao>\n"); | |
928 | + xml.append("<erro-recomendacao>" + type + "</erro-recomendacao>\n"); | |
929 | + xml.append("<descricao-recomendacao>" + avaliacao.getDescription() + "</descricao-recomendacao>\n"); | |
930 | + xml.append("<quantidade-recomendacao>" + avaliacao.getNumberOfOccurrences() + "</quantidade-recomendacao>\n"); | |
931 | + xml.append("<linhas-codigo-fonte-recomendacao>" + avaliacao.getStringLines() + "</linhas-codigo-fonte-recomendacao>\n"); | |
932 | + //} | |
933 | + | |
934 | + | |
935 | + | |
936 | + //Critérios iniciam aqui | |
937 | + | |
938 | + criarRelatorioCriterios(rn,type); | |
939 | + | |
940 | + //Critérios terminam aqui | |
941 | + | |
942 | + | |
943 | + recomendacaoCompara = avaliacao.getCheckPoint().toString(); | |
944 | + } | |
945 | + | |
946 | + xml.append("</recomendacao-avaliacao>\n"); | |
947 | + | |
948 | + xml.append("</avaliacao-automatica>\n"); | |
949 | + | |
950 | + } else { | |
951 | + System.out.println("Enviar xml de erro"); | |
952 | + } | |
953 | + result.include("testeWeb", xml); | |
954 | + | |
955 | + } | |
956 | + | |
957 | + public void criarRelatorioCriterios(OccurrenceKey rn, boolean isError) { | |
958 | + | |
959 | + boolean recomendacao1_1_1Adicionada = false; | |
960 | + boolean recomendacao1_1_2Adicionada = false; | |
961 | + | |
962 | + /* Cria um Map de parametros */ | |
963 | + //HashMap<String, Object> map = new HashMap<String, Object>(); | |
964 | + | |
965 | + // List list = this.detalheAvaliacao.get(rn,isError).getCriterios(); | |
966 | + | |
967 | + //List<String> aReq = new ArrayList(); | |
968 | + // List<Integer> index = new ArrayList(); | |
969 | + | |
970 | + //String[] crit = this.utilitiesProperties.get("notExibCrit").split(" "); | |
971 | + | |
972 | + //for (String c : crit) | |
973 | + //{ | |
974 | + // aReq.add(c.trim()); | |
975 | + //} | |
976 | + | |
977 | + //List<Criterio> listCrit = this.detalheAvaliacao.get(rn, isError).getCriterios(); | |
978 | + | |
979 | + //List<Criterio> list = new ArrayList<DetalheAvaliacao.Criterio>(); | |
980 | + | |
981 | + /*for (Criterio criterio : listCrit) { | |
982 | + if (aReq.contains(rn.getCode() + "." + criterio.getId())) | |
983 | + { | |
984 | + criterio.setLinhas(new ArrayList()); | |
985 | + } | |
986 | + | |
987 | + if (criterio.getId() != null) | |
988 | + { | |
989 | + list.add(criterio); | |
990 | + } | |
991 | + }*/ | |
992 | + | |
993 | + String codigoFonte = ""; | |
994 | + String criterioCompara = ""; | |
995 | + String numeroCriterio = ""; | |
996 | + | |
997 | + | |
998 | + for (Occurrence occurrence : this.detalheAvaliacao.get(rn, isError).getOcorrencias()) | |
999 | + { | |
1000 | + | |
1001 | + numeroCriterio = occurrence.getCriterio(); | |
1002 | + | |
1003 | + //if (!aReq.contains(rn.getCode() + "." + numeroCriterio)) | |
1004 | + //{ | |
1005 | + | |
1006 | + if(!rn.getCode().toString().equalsIgnoreCase("1.1") || !isError) | |
1007 | + { | |
1008 | + if(rn.getCode().toString().equalsIgnoreCase("1.1") && numeroCriterio.equalsIgnoreCase("7")) | |
1009 | + { | |
1010 | + codigoFonte = "Serviço de validação de HTML do W3C"; | |
1011 | + } | |
1012 | + else if(rn.getCode().toString().equalsIgnoreCase("1.1") && numeroCriterio.equalsIgnoreCase("8")) | |
1013 | + { | |
1014 | + codigoFonte = "Serviço de validação de CSS do W3C"; | |
1015 | + } | |
1016 | + else | |
1017 | + { | |
1018 | + codigoFonte = occurrence.getTag().replaceAll("<", "<").replaceAll(">", ">").replaceAll(" ", " "); | |
1019 | + } | |
1020 | + | |
1021 | + if(!criterioCompara.equalsIgnoreCase(occurrence.getCriterio().toString())) | |
1022 | + { | |
1023 | + if(!criterioCompara.equalsIgnoreCase("")) | |
1024 | + { | |
1025 | + System.out.println("</criterio>\n"); | |
1026 | + xml.append("</criterio>\n"); | |
1027 | + } | |
1028 | + | |
1029 | + | |
1030 | + xml.append("<criterio>\n"); | |
1031 | + xml.append("<numero-criterio>" + numeroCriterio + "</numero-criterio>\n"); | |
1032 | + xml.append("<nome-criterio>" + criterioProperties.getDescricao(rn.getCode() + "." + numeroCriterio) + "</nome-criterio>\n"); | |
1033 | + xml.append("<erro-criterio>" + occurrence.isError() + "</tipo-criterio>\n"); | |
1034 | + xml.append("<quantidade-criterio>" + verificaQuantidadeCriterio(rn, isError, numeroCriterio) + "</quantidade-criterio>\n"); | |
1035 | + xml.append("<codigo-fonte-criterio>\n"); | |
1036 | + xml.append("<numero-linha>" + occurrence.getLine() + "</numero-linha>\n"); | |
1037 | + xml.append("<conteudo-linha><![CDATA[" + codigoFonte + "]]></conteudo-linha>\n"); | |
1038 | + xml.append("</codigo-fonte-criterio>\n"); | |
1039 | + | |
1040 | + | |
1041 | + criterioCompara = occurrence.getCriterio(); | |
1042 | + }else | |
1043 | + { | |
1044 | + xml.append("<codigo-fonte-criterio>\n"); | |
1045 | + xml.append("<numero-linha>" + occurrence.getLine() + "</numero-linha>\n"); | |
1046 | + xml.append("<conteudo-linha><![CDATA[" + occurrence.getTag().replaceAll("<", "<") | |
1047 | + .replaceAll(">", ">").replaceAll(" ", " ") + "]]></conteudo-linha>\n"); | |
1048 | + xml.append("</codigo-fonte-criterio>\n"); | |
1049 | + } | |
1050 | + | |
1051 | + } | |
1052 | + else | |
1053 | + { | |
1054 | + if(numeroCriterio.equalsIgnoreCase("1") && !recomendacao1_1_1Adicionada) | |
1055 | + { | |
1056 | + if(!criterioCompara.equalsIgnoreCase("")) | |
1057 | + { | |
1058 | + xml.append("</criterio>\n"); | |
1059 | + } | |
1060 | + xml.append("<criterio>\n"); | |
1061 | + xml.append("<numero-criterio>" + numeroCriterio + "</numero-criterio>\n"); | |
1062 | + xml.append("<nome-criterio>" + criterioProperties.getDescricao(rn.getCode() + "." + numeroCriterio) + "</nome-criterio>\n"); | |
1063 | + xml.append("<erro-criterio>" + occurrence.isError() + "</tipo-criterio>\n"); | |
1064 | + xml.append("<quantidade-criterio>" + verificaQuantidadeCriterio(rn, isError, numeroCriterio) + "</quantidade-criterio>\n"); | |
1065 | + xml.append("<codigo-fonte-criterio>\n"); | |
1066 | + xml.append("<numero-linha>" + occurrence.getLine() + "</numero-linha>\n"); | |
1067 | + xml.append("<conteudo-linha>Serviço de validação de HTML do W3C</conteudo-linha>\n"); | |
1068 | + xml.append("</codigo-fonte-criterio>\n"); | |
1069 | + | |
1070 | + criterioCompara = occurrence.getCriterio(); | |
1071 | + recomendacao1_1_1Adicionada = true; | |
1072 | + } | |
1073 | + | |
1074 | + if(numeroCriterio.equalsIgnoreCase("2") && !recomendacao1_1_2Adicionada) | |
1075 | + { | |
1076 | + if(!criterioCompara.equalsIgnoreCase("")) | |
1077 | + { | |
1078 | + System.out.println("</criterio>\n"); | |
1079 | + xml.append("</criterio>\n"); | |
1080 | + } | |
1081 | + | |
1082 | + xml.append("<criterio>\n"); | |
1083 | + xml.append("<numero-criterio>" + numeroCriterio + "</numero-criterio>\n"); | |
1084 | + xml.append("<nome-criterio>" + criterioProperties.getDescricao(rn.getCode() + "." + numeroCriterio) + "</nome-criterio>\n"); | |
1085 | + xml.append("<erro-criterio>" + occurrence.isError() + "</tipo-criterio>\n"); | |
1086 | + xml.append("<quantidade-criterio>" + verificaQuantidadeCriterio(rn, isError, numeroCriterio) + "</quantidade-criterio>\n"); | |
1087 | + xml.append("<codigo-fonte-criterio>\n"); | |
1088 | + xml.append("<numero-linha>" + occurrence.getLine() + "</numero-linha>\n"); | |
1089 | + xml.append("<conteudo-linha>Serviço de validação de CSS do W3C</conteudo-linha>\n"); | |
1090 | + xml.append("</codigo-fonte-criterio>\n"); | |
1091 | + | |
1092 | + criterioCompara = occurrence.getCriterio(); | |
1093 | + recomendacao1_1_2Adicionada = true; | |
1094 | + } | |
1095 | + | |
1096 | + } | |
1097 | + //} | |
1098 | + } | |
1099 | + | |
1100 | + xml.append("</criterio>\n"); | |
1101 | + | |
1102 | + } | |
1103 | + | |
1104 | + private Integer verificaQuantidadeCriterio(OccurrenceKey rn, boolean isError, String numeroCriterio) | |
1105 | + { | |
1106 | + Integer quantidadeCriterios = 0; | |
1107 | + | |
1108 | + for (Occurrence occurrence2 : this.detalheAvaliacao.get(rn, isError).getOcorrencias()) | |
1109 | + { | |
1110 | + if(occurrence2.getCriterio().toString().equalsIgnoreCase(numeroCriterio)) | |
1111 | + { | |
1112 | + quantidadeCriterios++; | |
1113 | + } | |
1114 | + } | |
1115 | + | |
1116 | + return quantidadeCriterios; | |
1117 | + } | |
1118 | + | |
813 | 1119 | } |
814 | 1120 | \ No newline at end of file | ... | ... |