Skip to content

Commit

Permalink
Imporved observatory status
Browse files Browse the repository at this point in the history
Hide deph/width controls when select certain cartidges in new observatory

Fix escape semicolon character in URLs thats used to split in database

Fix evloution compliance graphics and tables on global report
  • Loading branch information
Álvaro Peláez committed Mar 23, 2020
1 parent dec5915 commit f9affd3
Show file tree
Hide file tree
Showing 21 changed files with 185 additions and 92 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Rastreador Observatorio de Accesibilidad Web
Currently OAW is deployment under this configuration:

* Java 1.8.0_202
* Apache Tomcat 7.0.54
* MySQL 5.6.19
* Apache Tomcat 7
* MySQL 5

This is a Maven projet that requieres version 3.0.0 or high

Expand All @@ -30,7 +30,7 @@ Create a context configuration like this in *server.xml*:
timeBetweenEvictionRunsMillis="60000" testWhileIdle="true"
defaultTransactionIsolation="READ_UNCOMMITTED" username="<username>" password="<password>"/>
</Context>
```
``
Note to chenge *url*, *user* and *password* values

# Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static ObservatoryStatus findEstadoObservatorio(final Connection connecti
public static Integer updateEstado(final Connection connection, ObservatoryStatus estado) throws SQLException {
if (estado.getId() != null) {
try (PreparedStatement ps = connection.prepareStatement(
"UPDATE observatorio_estado SET nombre = ? , url =?, ultima_url = ?, actual_url = ?, fecha_ultima_url = ?, tiempo_medio = ?, total_url_analizadas= ? , tiempo_acumulado = ? WHERE id = ?")) {
"UPDATE observatorio_estado SET nombre = ? , url =?, ultima_url = ?, actual_url = ?, fecha_ultima_url = ?, tiempo_medio = ?, total_url_analizadas= ? , tiempo_acumulado = ?, total_url WHERE id = ?")) {
ps.setString(1, estado.getNombre());
ps.setString(2, estado.getUrl());
ps.setString(3, estado.getUltimaUrl());
Expand All @@ -89,7 +89,8 @@ public static Integer updateEstado(final Connection connection, ObservatoryStatu
ps.setFloat(6, estado.getTiempoMedio());
ps.setInt(7, estado.getTotalUrlAnalizadas());
ps.setFloat(8, estado.getTiempoAcumulado());
ps.setInt(9, estado.getId());
ps.setInt(9, estado.getTotalUrl());
ps.setInt(10, estado.getId());
ps.executeUpdate();
} catch (SQLException e) {
Logger.putLog("No se ha podido registrar el estado del análisis actual", EstadoObservatorioDAO.class, Logger.LOG_LEVEL_ERROR, e);
Expand Down
18 changes: 10 additions & 8 deletions crawler/src/main/java/es/inteco/crawler/job/CrawlerJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -674,12 +674,12 @@ private void analyze(final List<CrawledLink> analyzeDomains, final CrawlerData c
String urlRastreo = (crawlerData.getUrls() != null && !crawlerData.getUrls().isEmpty()) ? crawlerData.getUrls().get(0) : "";
Logger.putLog("[A] Iniciando los análisis del rastreo id: " + crawlerData.getIdCrawling() + " (" + urlRastreo + ")", CrawlerJob.class, Logger.LOG_LEVEL_INFO);
try (Connection connection = DataBaseManager.getConnection()) {
// Si viene del sevicio de diganóstico el ID del rastreo es negativo
// If it comes from the diagnostic service the trace ID is negative
ObservatoryStatus estado = null;
if (crawlerData.getIdCrawling() > 0) {
// Recupera la información que falta
ExtraInfo extra = RastreoDAO.getExtraInfo(DataBaseManager.getConnection(), crawlerData.getIdFulfilledCrawling());
// Meter en base de datos la información del rastreo
// Putting the tracking information into a database
estado = EstadoObservatorioDAO.findEstadoObservatorio(connection, (int) crawlerData.getIdObservatory(), extra.getIdEjecucionObservatorio());
estado.setIdObservatorio((int) crawlerData.getIdObservatory());
estado.setIdEjecucionObservatorio(extra.getIdEjecucionObservatorio());
Expand All @@ -698,13 +698,13 @@ private void analyze(final List<CrawledLink> analyzeDomains, final CrawlerData c
}
DataBaseManager.closeConnection(connection);
for (CrawledLink crawledLink : analyzeDomains) {
// Logs de inicio y fin de análisis
// Puntos para guardar datos de fecha, resumen de estado del observatorio
// Logs of start and end of analysis
// Points to save date data, summary of the status of the observatory
Date initDate = new Date();
Logger.putLog("[I] Iniciando análisis del enlace número " + (cont + 1) + "/" + analyzeDomains.size() + " (" + crawledLink.getUrl() + ")", CrawlerJob.class, Logger.LOG_LEVEL_INFO);
// Actualizamos el estado
try (Connection connection2 = DataBaseManager.getConnection()) {
// Si viene del sevicio de diganóstico el ID del rastreo es negativo
// If it comes from the diagnostic service the trace ID is negative
if (crawlerData.getIdCrawling() > 0) {
estado.setActualUrl(crawledLink.getUrl());
EstadoObservatorioDAO.updateEstado(connection2, estado);
Expand All @@ -717,7 +717,7 @@ private void analyze(final List<CrawledLink> analyzeDomains, final CrawlerData c
final boolean isLast = (cont >= analyzeDomains.size() - 1);
webAnalyzer.runCartuchos(crawledLink, df.format(initDate), crawlerData, cookie, isLast);
} else {
// Si se pide interrupción, se abandonan los análisis
// If an interruption is requested, the analyses are abandoned
break;
}
Date endDate = new Date();
Expand All @@ -726,10 +726,12 @@ private void analyze(final List<CrawledLink> analyzeDomains, final CrawlerData c
"Tiempo empleado: " + (endDate.getTime() - initDate.getTime()) / 1000 + " segundos. Tiempo acumulado: " + (endDate.getTime() - initFullDate.getTime()) / 1000 + " segundos",
CrawlerJob.class, Logger.LOG_LEVEL_INFO);
cont++;
// Actualizamos el estado
// We update the status
try (Connection connection2 = DataBaseManager.getConnection()) {
// Si viene del sevicio de diganóstico el ID del rastreo es negativo
// If it comes from the diagnostic service the trace ID is negative
if (crawlerData.getIdCrawling() > 0) {
// To prevent that sometimes you don't keep the right number, we also update it
estado.setTotalUrl(analyzeDomains.size());
estado.setUltimaUrl(crawledLink.getUrl());
estado.setFechaUltimaUrl(endDate);
estado.setTiempoMedio(((endDate.getTime() - initFullDate.getTime()) / cont) / 1000);
Expand Down
4 changes: 2 additions & 2 deletions intavcore/src/test/resources/crawler.core.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (C) 2012 INTECO, Instituto Nacional de Tecnolog�as de la Comunicaci�n,
# Copyright (C) 2012 INTECO, Instituto Nacional de Tecnologías de la Comunicación,
# This program is licensed and may be used, modified and redistributed under the terms
# of the European Public License (EUPL), either version 1.2 or (at your option) any later
# version as soon as they are approved by the European Commission.
Expand All @@ -10,7 +10,7 @@
# You should have received a copy of the EUPL1.2 license along with this program; if not,
# you may find it at http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Modificaciones: MINHAFP (Ministerio de Hacienda y Funci�n P�blica)
# Modificaciones: MINHAFP (Ministerio de Hacienda y Función Pública)
# Email: observ.accesibilidad@correo.gob.es
#-------------------------------------------------------------------------------
check.accessibility.default.entity = Inteco
Expand Down
4 changes: 2 additions & 2 deletions intavcore/src/test/resources/crawler.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (C) 2012 INTECO, Instituto Nacional de Tecnolog�as de la Comunicaci�n,
# Copyright (C) 2012 INTECO, Instituto Nacional de Tecnologías de la Comunicación,
# This program is licensed and may be used, modified and redistributed under the terms
# of the European Public License (EUPL), either version 1.2 or (at your option) any later
# version as soon as they are approved by the European Commission.
Expand All @@ -10,7 +10,7 @@
# You should have received a copy of the EUPL1.2 license along with this program; if not,
# you may find it at http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Modificaciones: MINHAFP (Ministerio de Hacienda y Funci�n P�blica)
# Modificaciones: MINHAFP (Ministerio de Hacienda y Función Pública)
# Email: observ.accesibilidad@correo.gob.es
#-------------------------------------------------------------------------------
# Ra\u00EDz de la aplicaci\u00F3n
Expand Down
14 changes: 14 additions & 0 deletions motor-js/nginx/reverse.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ server {
if ($prerender = 0) {
proxy_pass $arg_url;
}

proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}

}
Expand Down Expand Up @@ -88,6 +95,13 @@ server {
if ($prerender = 0) {
proxy_pass https://$host$request_uri?;
}

proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}

}
20 changes: 11 additions & 9 deletions oaw/OAW_00_changelog.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
5.0.3
------------------------------------------------------------------------------------------------------------------------------------
- Correcciones informe oficial UNE-EN301549:2019
- Correcciones varias validaciones
- Nueva forma de generar los informes individuales (enlaces por email)
- Corregidos contadores de ranking de portales, complejidad y segmento
- Corregida paginación de etiquetas
- Corregida paginación de semillas
- Corregido el cálculo del cumplimiento estimado de un sitio web
- Corregido acceso al motor de JS cuando un sitio web repospondia un código http 30x
- Corregido un error que provocaba que en la edición de un observatorio no se actualziar la normativa para las nuevas semillas
- Correcciones en el informe oficial del cartucho UNE-EN301549:2019.
- Correcciones en el informe oficial del cartucho de Accesibilidad.
- Correcciones en varias validaciones (1.11, 2.3).
- Nueva forma de generar los informes individuales en la que se envían los enlaces por email separados por dependencias en lugar de bajarse un zip con todos los informes.
- Corregidos contadores de ranking de portales, complejidad y segmento en los informes.
- Corregida paginación de etiquetas.
- Corregida paginación de semillas.
- Corregido el cálculo del cumplimiento estimado de un sitio web.
- Corregido acceso al motor de JS cuando un sitio web repospondia un código http 30x.
- Corregido un error que provocaba que en la edición de un observatorio no se actualizar la normativa para las nuevas semillas.
- Mostradas las etiquetas seleccionadas en el listado de observatorios.

5.0.2
------------------------------------------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion portal/profiles/desarrollo/crawler.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# You should have received a copy of the EUPL1.2 license along with this program; if not,
# you may find it at http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Modificaciones: MINHAFP (Ministerio de Hacienda y Funci�n P�blica)
# Modificaciones: MINHAFP (Ministerio de Hacienda y Función Pública)
# Email: observ.accesibilidad@correo.gob.es
#-------------------------------------------------------------------------------
# Ra\u00EDz de la aplicaci\u00F3n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@ public ActionForward listEtiquetas(ActionMapping mapping, ActionForm form, HttpS
* @return the string Valor normalizado
*/
private String normalizarUrl(String urlsSemilla) {
return urlsSemilla.replace("\r\n", ";").replace("\n", ";").replaceAll("\\s+", "");
// escape ";" thats used as split in several places
return urlsSemilla.replace(";", "%3B").replace("\r\n", ";").replace("\n", ";").replaceAll("\\s+", "");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public class SemillaForm extends ValidatorForm implements Serializable {
private Long id;

/** The nombre. */
private String nombre;

private String nombre;
/** The nombre antiguo. */
private String nombre_antiguo;

Expand Down Expand Up @@ -184,9 +183,8 @@ public void addListUrl(String url) {
if (this.listaUrls == null) {
this.listaUrls = new ArrayList<>();
}

this.setListaUrlsString(url.replace("\n", ";"));

// escape ";" thats used to sit
this.setListaUrlsString(url.replace(";", "%3B").replace("\n", ";"));
List<String> tmp = Arrays.asList(this.listaUrlsString.split(";"));
for (int i = 0; i < tmp.size(); i++) {
this.listaUrls.add(tmp.get(i).trim());
Expand Down Expand Up @@ -303,8 +301,7 @@ public ComplejidadForm getComplejidad() {
public void setComplejidad(ComplejidadForm complejidad) {
this.complejidad = complejidad;
}



/**
* Reset.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ private Integer minor(String[] version) {
// Cabecera
replaceText(odt, odfFileContent, "-" + rowId + ".a" + index + "-", entry.getKey());
String vCount = resultC.getKey().substring(resultC.getKey().lastIndexOf(".") + 1, resultC.getKey().indexOf("_"));
replaceText(odt, odfFileContent, "-" + rowId + vCount + ".a" + index + "-", entry.getKey());
// String vCount = resultC.getKey().substring(resultC.getKey().lastIndexOf(".") + 1, resultC.getKey().indexOf("_"));
final String oldTextC = "-" + rowId + vCount + ".b" + index + ".c-";
final String oldTextNC = "-" + rowId + vCount + ".b" + index + ".nc-";
// final String oldTextNA = "-" + rowId + vCount + ".b" + index + ".na-";
Expand All @@ -235,7 +237,7 @@ private Integer minor(String[] version) {
}
// Para el resto de la tabla borramos los placeholders para que al menos las celdas salgan vacías
while (index <= 7) {
for (int i = 0; i < 14; i++) {
for (int i = 0; i <= 14; i++) {
replaceText(odt, odfFileContent, "-" + rowId + i + ".a" + index + "-", "");
replaceText(odt, odfFileContent, "-" + rowId + i + ".b" + index + ".c-", "");
replaceText(odt, odfFileContent, "-" + rowId + i + ".b" + index + ".nc-", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,20 +881,32 @@ private void evolutionSectionsFixed(final String graphicPath, final MessageResou
MIME_TYPE_JPG);
replaceImageGeneric(odt, graphicPath + EVOLUCION_PUNTUACION_MEDIA_VERIFICACION_NAII_COMBINADA_FIXED + JPG_EXTENSION, EVOLUCION_PUNTUACION_MEDIA_VERIFICACION_NAII_COMBINADA_FIXED,
MIME_TYPE_JPG);
// Compliance by verification
ResultadosAnonimosObservatorioUNEEN2019Utils.generateEvolutionComplianceByVerificationChartSplit(messageResources,
// TODO Compliance by verification
ResultadosAnonimosObservatorioUNEEN2019Utils.generateEvolutionComplianceByVerificationChartSplitGrouped(messageResources,
new String[] { graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT1_FIXED + JPG_EXTENSION,
graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT2_FIXED + JPG_EXTENSION },
pageObservatoryMap, LEVEL_I_VERIFICATIONS);
title = messageResources.getMessage("report.evolution.compliance.graphic.title.fixed");
ResultadosAnonimosObservatorioUNEEN2019Utils.generateEvolutionComplianceByVerificationChart(messageResources,
new String[] { graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAII_COMBINADA_FIXED + JPG_EXTENSION }, pageObservatoryMap, LEVEL_II_VERIFICATIONS, title);
graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT2_FIXED + JPG_EXTENSION,
graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAII_COMBINADA_FIXED + JPG_EXTENSION },
pageObservatoryMap);
replaceSectionComplianceByVerification(messageResources, odt, odfFileContent, graphicPath, pageObservatoryMap, prefix);
replaceImageGeneric(odt, graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT1_FIXED + JPG_EXTENSION, EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT1_FIXED,
MIME_TYPE_JPG);
replaceImageGeneric(odt, graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT2_FIXED + JPG_EXTENSION, EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT2_FIXED,
MIME_TYPE_JPG);
replaceImageGeneric(odt, graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAII_COMBINADA_FIXED + JPG_EXTENSION, EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAII_COMBINADA_FIXED, MIME_TYPE_JPG);
// Compliance by verification
// ResultadosAnonimosObservatorioUNEEN2019Utils.generateEvolutionComplianceByVerificationChartSplit(messageResources,
// new String[] { graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT1_FIXED + JPG_EXTENSION,
// graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT2_FIXED + JPG_EXTENSION },
// pageObservatoryMap, LEVEL_I_VERIFICATIONS);
// title = messageResources.getMessage("report.evolution.compliance.graphic.title.fixed");
// ResultadosAnonimosObservatorioUNEEN2019Utils.generateEvolutionComplianceByVerificationChart(messageResources,
// new String[] { graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAII_COMBINADA_FIXED + JPG_EXTENSION }, pageObservatoryMap, LEVEL_II_VERIFICATIONS, title);
// replaceSectionComplianceByVerification(messageResources, odt, odfFileContent, graphicPath, pageObservatoryMap, prefix);
// replaceImageGeneric(odt, graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT1_FIXED + JPG_EXTENSION, EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT1_FIXED,
// MIME_TYPE_JPG);
// replaceImageGeneric(odt, graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT2_FIXED + JPG_EXTENSION, EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAI_COMBINADA_SPLIT2_FIXED,
// MIME_TYPE_JPG);
// replaceImageGeneric(odt, graphicPath + EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAII_COMBINADA_FIXED + JPG_EXTENSION, EVOLUCION_CUMPLIMIENTI_VERIFICACION_NAII_COMBINADA_FIXED, MIME_TYPE_JPG);
// By aspects
ResultadosAnonimosObservatorioUNEEN2019Utils.generateEvolutionAverageScoreByAspectChart(messageResources, graphicPath + EVOLUCION_PUNTUACION_MEDIA_ASPECTO_COMBINADA_FIXED + JPG_EXTENSION,
pageObservatoryMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,32 @@ private Integer minor(String[] version) {
// PENDING Checks this strings
// verificationText = Constants.OBS_COMPILANCE_PARTIAL;
verificationText = Constants.OBS_COMPILANCE_NONE;
dataSet.addValue(valueC, date + " " + verificationText, verificacionPoint);
// dataSet.addValue(valueC, date + " " + verificationText, verificacionPoint);
// TODO Check if dataset contains value to add
try {
if (dataSet.getValue(date + " " + verificationText, verificacionPoint) != null) {
dataSet.addValue(((BigDecimal) dataSet.getValue(date + " " + verificationText, verificacionPoint)).add(valueC), date + " " + verificationText, verificacionPoint);
} else {
dataSet.addValue(valueC, date + " " + verificationText, verificacionPoint);
}
} catch (Exception e) {
dataSet.addValue(valueC, date + " " + verificationText, verificacionPoint);
}
} else if (verficationC.endsWith(Constants.OBS_VALUE_NO_APPLY_COMPLIANCE_SUFFIX)) {
verificacionPoint = verficationC.replace(Constants.OBS_VALUE_NO_APPLY_COMPLIANCE_SUFFIX, "");
// PENDING Checks this strings
verificationText = Constants.OBS_COMPILANCE_NONE;
dataSet.addValue(valueC, date + " " + verificationText, verificacionPoint);
// dataSet.addValue(valueC, date + " " + verificationText, verificacionPoint);
// TODO Check if dataset contains value to add
try {
if (dataSet.getValue(date + " " + verificationText, verificacionPoint) != null) {
dataSet.addValue(((BigDecimal) dataSet.getValue(date + " " + verificationText, verificacionPoint)).add(valueC), date + " " + verificationText, verificacionPoint);
} else {
dataSet.addValue(valueC, date + " " + verificationText, verificacionPoint);
}
} catch (Exception e) {
dataSet.addValue(valueC, date + " " + verificationText, verificacionPoint);
}
}
}
}
Expand Down Expand Up @@ -1121,7 +1141,7 @@ private static LegendItemCollection generateLegend(List<Paint> colors, CategoryP
*/
private static LegendItemCollection generateLegendG(List<Paint> colors, CategoryPlot plot) {
LegendItemCollection newLegend = new LegendItemCollection();
final String[] legendLabels = new String[] { "No conforme", "Parcialmente conforme", "Totalmente conforme" };
final String[] legendLabels = new String[] { "No conforme", "Conforme" };
Shape shape = new Rectangle(15, 15);
BasicStroke stroke = new BasicStroke();
for (int i = 0; i < legendLabels.length; i++) {
Expand Down
Loading

0 comments on commit f9affd3

Please sign in to comment.