Commit 3610be70 authored by Matthias Betz's avatar Matthias Betz
Browse files

more translation

parent 2d43c43b
Pipeline #1077 passed with stage
in 2 minutes and 18 seconds
...@@ -21,7 +21,7 @@ package de.hft.stuttgart.citydoctor2.check; ...@@ -21,7 +21,7 @@ package de.hft.stuttgart.citydoctor2.check;
import de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError; import de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError;
import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError; import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError;
import de.hft.stuttgart.citydoctor2.check.error.DependenciesNotMetError; import de.hft.stuttgart.citydoctor2.check.error.DependenciesNotMetError;
import de.hft.stuttgart.citydoctor2.check.error.DistanceError; import de.hft.stuttgart.citydoctor2.check.error.NonPlanarPolygonDistancePlaneError;
import de.hft.stuttgart.citydoctor2.check.error.DuplicatePointError; import de.hft.stuttgart.citydoctor2.check.error.DuplicatePointError;
import de.hft.stuttgart.citydoctor2.check.error.EdgeIntersectionError; import de.hft.stuttgart.citydoctor2.check.error.EdgeIntersectionError;
import de.hft.stuttgart.citydoctor2.check.error.HoleOutsideError; import de.hft.stuttgart.citydoctor2.check.error.HoleOutsideError;
...@@ -37,7 +37,7 @@ import de.hft.stuttgart.citydoctor2.check.error.NotGroundError; ...@@ -37,7 +37,7 @@ import de.hft.stuttgart.citydoctor2.check.error.NotGroundError;
import de.hft.stuttgart.citydoctor2.check.error.NotWallError; import de.hft.stuttgart.citydoctor2.check.error.NotWallError;
import de.hft.stuttgart.citydoctor2.check.error.NullAreaError; import de.hft.stuttgart.citydoctor2.check.error.NullAreaError;
import de.hft.stuttgart.citydoctor2.check.error.PointTouchesEdgeError; import de.hft.stuttgart.citydoctor2.check.error.PointTouchesEdgeError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonSelfIntError; import de.hft.stuttgart.citydoctor2.check.error.PolygonIntersectingRingsError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonWrongOrientationError; import de.hft.stuttgart.citydoctor2.check.error.PolygonWrongOrientationError;
import de.hft.stuttgart.citydoctor2.check.error.RingNotClosedError; import de.hft.stuttgart.citydoctor2.check.error.RingNotClosedError;
import de.hft.stuttgart.citydoctor2.check.error.RingSelfIntError; import de.hft.stuttgart.citydoctor2.check.error.RingSelfIntError;
...@@ -96,9 +96,9 @@ public interface ErrorVisitor { ...@@ -96,9 +96,9 @@ public interface ErrorVisitor {
public void visit(NormalDeviationError err); public void visit(NormalDeviationError err);
public void visit(DistanceError err); public void visit(NonPlanarPolygonDistancePlaneError err);
public void visit(PolygonSelfIntError err); public void visit(PolygonIntersectingRingsError err);
public void visit(SolidSelfIntError err); public void visit(SolidSelfIntError err);
......
...@@ -21,7 +21,7 @@ package de.hft.stuttgart.citydoctor2.check; ...@@ -21,7 +21,7 @@ package de.hft.stuttgart.citydoctor2.check;
import de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError; import de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError;
import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError; import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError;
import de.hft.stuttgart.citydoctor2.check.error.DependenciesNotMetError; import de.hft.stuttgart.citydoctor2.check.error.DependenciesNotMetError;
import de.hft.stuttgart.citydoctor2.check.error.DistanceError; import de.hft.stuttgart.citydoctor2.check.error.NonPlanarPolygonDistancePlaneError;
import de.hft.stuttgart.citydoctor2.check.error.DuplicatePointError; import de.hft.stuttgart.citydoctor2.check.error.DuplicatePointError;
import de.hft.stuttgart.citydoctor2.check.error.EdgeIntersectionError; import de.hft.stuttgart.citydoctor2.check.error.EdgeIntersectionError;
import de.hft.stuttgart.citydoctor2.check.error.HoleOutsideError; import de.hft.stuttgart.citydoctor2.check.error.HoleOutsideError;
...@@ -37,7 +37,7 @@ import de.hft.stuttgart.citydoctor2.check.error.NotGroundError; ...@@ -37,7 +37,7 @@ import de.hft.stuttgart.citydoctor2.check.error.NotGroundError;
import de.hft.stuttgart.citydoctor2.check.error.NotWallError; import de.hft.stuttgart.citydoctor2.check.error.NotWallError;
import de.hft.stuttgart.citydoctor2.check.error.NullAreaError; import de.hft.stuttgart.citydoctor2.check.error.NullAreaError;
import de.hft.stuttgart.citydoctor2.check.error.PointTouchesEdgeError; import de.hft.stuttgart.citydoctor2.check.error.PointTouchesEdgeError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonSelfIntError; import de.hft.stuttgart.citydoctor2.check.error.PolygonIntersectingRingsError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonWrongOrientationError; import de.hft.stuttgart.citydoctor2.check.error.PolygonWrongOrientationError;
import de.hft.stuttgart.citydoctor2.check.error.RingNotClosedError; import de.hft.stuttgart.citydoctor2.check.error.RingNotClosedError;
import de.hft.stuttgart.citydoctor2.check.error.RingSelfIntError; import de.hft.stuttgart.citydoctor2.check.error.RingSelfIntError;
...@@ -85,7 +85,7 @@ public interface HealingMethod { ...@@ -85,7 +85,7 @@ public interface HealingMethod {
return false; return false;
} }
default boolean visit(DistanceError err, ModificationListener l) { default boolean visit(NonPlanarPolygonDistancePlaneError err, ModificationListener l) {
return false; return false;
} }
...@@ -125,7 +125,7 @@ public interface HealingMethod { ...@@ -125,7 +125,7 @@ public interface HealingMethod {
return false; return false;
} }
default boolean visit(PolygonSelfIntError err, ModificationListener l) { default boolean visit(PolygonIntersectingRingsError err, ModificationListener l) {
return false; return false;
} }
......
...@@ -37,7 +37,7 @@ import de.hft.stuttgart.citydoctor2.utils.Localization; ...@@ -37,7 +37,7 @@ import de.hft.stuttgart.citydoctor2.utils.Localization;
* @author Matthias Betz * @author Matthias Betz
* *
*/ */
public class DistanceError extends CheckError { public class NonPlanarPolygonDistancePlaneError extends CheckError {
private static final long serialVersionUID = -3504364055236383519L; private static final long serialVersionUID = -3504364055236383519L;
...@@ -46,7 +46,7 @@ public class DistanceError extends CheckError { ...@@ -46,7 +46,7 @@ public class DistanceError extends CheckError {
private Vertex v; private Vertex v;
private Plane plane; private Plane plane;
public DistanceError(Polygon p, double distance, Vertex v, Plane plane) { public NonPlanarPolygonDistancePlaneError(Polygon p, double distance, Vertex v, Plane plane) {
super(ErrorId.GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE, ErrorType.ERROR, p); super(ErrorId.GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE, ErrorType.ERROR, p);
this.p = p; this.p = p;
this.distance = distance; this.distance = distance;
......
...@@ -36,14 +36,14 @@ import de.hft.stuttgart.citydoctor2.utils.SerializablePair; ...@@ -36,14 +36,14 @@ import de.hft.stuttgart.citydoctor2.utils.SerializablePair;
* @author Matthias Betz * @author Matthias Betz
* *
*/ */
public class PolygonSelfIntError extends CheckError { public class PolygonIntersectingRingsError extends CheckError {
private static final long serialVersionUID = -7043521697085991901L; private static final long serialVersionUID = -7043521697085991901L;
private Polygon p; private Polygon p;
private SerializablePair<LinearRing, LinearRing> intersectingRings; private SerializablePair<LinearRing, LinearRing> intersectingRings;
public PolygonSelfIntError(Polygon p, SerializablePair<LinearRing, LinearRing> intersectingRings) { public PolygonIntersectingRingsError(Polygon p, SerializablePair<LinearRing, LinearRing> intersectingRings) {
super(ErrorId.GE_P_INTERSECTING_RINGS, ErrorType.ERROR, p); super(ErrorId.GE_P_INTERSECTING_RINGS, ErrorType.ERROR, p);
this.p = p; this.p = p;
this.intersectingRings = intersectingRings; this.intersectingRings = intersectingRings;
......
...@@ -3,6 +3,7 @@ DistanceError.distanceFromPlane=distance from plane ...@@ -3,6 +3,7 @@ DistanceError.distanceFromPlane=distance from plane
AboutDialog.developedBy=Developed by AboutDialog.developedBy=Developed by
AboutDialog.contact=Contact AboutDialog.contact=Contact
AboutDialog.title=CityDoctor 3 - About AboutDialog.title=CityDoctor 3 - About
AboutDialog.closeBtn=Close
CheckDialog.title=Check Configuration CheckDialog.title=Check Configuration
CheckDialog.schematronFiles=Schematron Files CheckDialog.schematronFiles=Schematron Files
CheckDialog.schematronChooserTitle=Choose schematron file.. CheckDialog.schematronChooserTitle=Choose schematron file..
...@@ -53,5 +54,28 @@ MainWindow.showLabel=Show: ...@@ -53,5 +54,28 @@ MainWindow.showLabel=Show:
MainWindow.searchLabel=Search: MainWindow.searchLabel=Search:
MainWindow.searchBtn=Search MainWindow.searchBtn=Search
MainWindow.clearBtn=Clear MainWindow.clearBtn=Clear
MainWindow.errorsTab=Errors
MainWindow.polygonsTab=Polygons
MainWindow.edgesTab=Edges
MainWindow.verticesTab=Vertices
MainWindow.logTab=Log
MainWindow.globalErrorsTab=Global Errors
OpenFileDialog.fileLabel=File: OpenFileDialog.fileLabel=File:
OpenFileDialog.selectBtn=Select OpenFileDialog.selectBtn=Select
\ No newline at end of file OpenFileDialog.loadBtn=Load
OpenFileDialog.settingsPane=Parser Preferences
OpenFileDialog.roundingPlacesLabel=NumberOfRoundingPlaces
OpenFileDialog.xmlValidationLabel=Use XML Validation
Checker.failXml=Failed to write XML Error Report.
Checker.failPdf=Failed to write PDF Report.
Checker.checksFinished=Finished executing checks
Checker.schematronValidation=Starting Schematron validation
Checker.finishedSchematron=Finished Schematron validation
Checker.failReports=Failed to write reports.
Checker.checkFeature=Checking feature: {}
Checker.executeCheck=Executing check: {}
ValidationConfiguration.reenable={} has been disabled but {} depends on it, reenabling
ValidationConfiguration.missingSchematron={} is not an existing file, disabling schematron check
CheckContainer.error=Unexpected exception while executing check: {}
Checks.missingCheck=Could not find check for id: {}
OpenFileDialog.cancelBtn=Cancel
\ No newline at end of file
DistanceError.distanceFromPlane=Abstand von der Ebene DistanceError.distanceFromPlane=Abstand von der Ebene
AboutDialog.developedBy=Entwickelt von AboutDialog.developedBy=Entwickelt von
AboutDialog.contact=Kontakt AboutDialog.contact=Kontakt
AboutDialog.title=CityDoctor 3 - ber AboutDialog.title=CityDoctor 3 - \u00DCber
CheckDialog.title=Prfungskonfiguration AboutDialog.closeBtn=Schlie\u00DFen
CheckDialog.title=Pr\u00fcfungskonfiguration
CheckDialog.schematronFiles=Schematron Dateien CheckDialog.schematronFiles=Schematron Dateien
CheckDialog.schematronChooserTitle=Whle Schematron Datei.. CheckDialog.schematronChooserTitle=W\u00e4hle Schematron Datei..
CheckDialog.validationConfiguration=Validierungs Konfiguration CheckDialog.validationConfiguration=Validierungs Konfiguration
CheckDialog.startingChecks=Starte Prfung CheckDialog.startingChecks=Starte Pr\u00fcfung
CheckDialog.checksDone=Prfung abgeschlossen CheckDialog.checksDone=Pr\u00fcfung abgeschlossen
CheckDialog.failedChecks=Konnte Prfungen nicht ausfhren CheckDialog.failedChecks=Konnte Pr\u00fcfungen nicht ausf\u00fchren
CheckDialog.schematronFileNotExisting=Schematron Datei existiert nicht, ignoriere CheckDialog.schematronFileNotExisting=Schematron Datei existiert nicht, ignoriere
CheckDialog.checkEnabled=Aktiv CheckDialog.checkEnabled=Aktiv
CheckDialog.parameterValue=Wert CheckDialog.parameterValue=Wert
CheckDialog.parameterUnit=Einheit CheckDialog.parameterUnit=Einheit
CityDoctorController.noDatamodel=Datenmodell ist null, keine Prfungen konnten ausgefhrt werden CityDoctorController.noDatamodel=Datenmodell ist null, keine Pr\u00fcfungen konnten ausgef\u00fchrt werden
CityDoctorController.noSourceFile=Quelldatei ist null, keine Prfungen konnten ausgefhrt werden CityDoctorController.noSourceFile=Quelldatei ist null, keine Pr\u00fcfungen konnten ausgef\u00fchrt werden
ExceptionDialog.stacktrace=Der Stacktrace des Fehlers war: ExceptionDialog.stacktrace=Der Stacktrace des Fehlers war:
FilterPane.buildings=Gebude FilterPane.buildings=Geb\u00e4ude
FilterPane.bridges=Brcken FilterPane.bridges=Br\u00fccken
FilterPane.landUse=Landnutzung FilterPane.landUse=Landnutzung
FilterPane.transportation=Transport FilterPane.transportation=Transport
FilterPane.vegetation=Vegetation FilterPane.vegetation=Vegetation
FilterPane.water=Wasser FilterPane.water=Wasser
MainToolBar.wireframe=Zeige/Verstecke Gitternetz MainToolBar.wireframe=Zeige/Verstecke Gitternetz
MainToolBar.culling=Aktiviere/Deaktiviere Entfernen der Rckseiten MainToolBar.culling=Aktiviere/Deaktiviere Entfernen der R\u00fcckseiten
MainToolBar.writeReports=Schreibe Reports MainToolBar.writeReports=Schreibe Reports
MainToolBar.executeChecks=Fhre Prfungen aus MainToolBar.executeChecks=F\u00fchre Pr\u00fcfungen aus
MainWindow.missingConfig=Konnte Konfigurationsdatei nicht finden. MainWindow.missingConfig=Konnte Konfigurationsdatei nicht finden.
MainWindow.loadGivenFile=Lade vorhandene Datei, bitte warten MainWindow.loadGivenFile=Lade vorhandene Datei, bitte warten
MainWindow.finishedLoading=Fertig geladen MainWindow.finishedLoading=Fertig geladen
MainWindow.checking=Prfe, bitte warten MainWindow.checking=Pr\u00fcfe, bitte warten
MainWindow.writeXml=Schreibe Xml Report MainWindow.writeXml=Schreibe Xml Report
MainWindow.finishedXml=Xml Report abgeschlossen MainWindow.finishedXml=Xml Report abgeschlossen
MainWindow.writePdf=Schreibe Pdf Report MainWindow.writePdf=Schreibe Pdf Report
...@@ -38,18 +39,41 @@ MainWindow.loadFailed=Konnte GML-Datei nicht laden: {} ...@@ -38,18 +39,41 @@ MainWindow.loadFailed=Konnte GML-Datei nicht laden: {}
MainWindow.all=Alle MainWindow.all=Alle
MainWindow.withErrors=Mit Fehlern MainWindow.withErrors=Mit Fehlern
MainWindow.export=Exportieren MainWindow.export=Exportieren
OpenFileDialog.select=Whle CityGML Datei aus OpenFileDialog.select=W\u00e4hle CityGML Datei aus
MainWindow.languageChange=Um die Spracheinstellung zu bernehmen muss CityDoctor2 neugestartet werden. MainWindow.languageChange=Um die Spracheinstellung zu \u00fcbernehmen muss CityDoctor2 neugestartet werden.
MainWindow.buildingsTab=Gebude MainWindow.buildingsTab=Geb\u00e4ude
MainWindow.vegetationTab=Vegetation MainWindow.vegetationTab=Vegetation
MainWindow.transportationTab=Verkehrsobjekte MainWindow.transportationTab=Verkehrsobjekte
MainWindow.bridgeTab=Brcken MainWindow.bridgeTab=Br\u00fccken
MainWindow.waterTab=Gewsser MainWindow.waterTab=Gew\u00e4sser
MainWindow.terrainTab=Gelnde MainWindow.terrainTab=Gel\u00e4nde
MainWindow.viewLabel=Ansicht MainWindow.viewLabel=Ansicht
MainWindow.showLabel=Zeige: MainWindow.showLabel=Zeige:
MainWindow.searchLabel=Suche: MainWindow.searchLabel=Suche:
MainWindow.searchBtn=Suche MainWindow.searchBtn=Suche
MainWindow.clearBtn=Leeren MainWindow.clearBtn=Leeren
MainWindow.errorsTab=Fehler
MainWindow.polygonsTab=Polygone
MainWindow.edgesTab=Kanten
MainWindow.verticesTab=Punkte
MainWindow.logTab=Log
MainWindow.globalErrorsTab=Globale Fehler
OpenFileDialog.fileLabel=Datei: OpenFileDialog.fileLabel=Datei:
OpenFileDialog.selectBtn=Auswhlen OpenFileDialog.selectBtn=Ausw\u00e4hlen
\ No newline at end of file OpenFileDialog.loadBtn=Laden
OpenFileDialog.settingsPane=Parser Einstellungen
OpenFileDialog.roundingPlacesLabel=NumberOfRoundingPlaces
OpenFileDialog.xmlValidationLabel=F\u00fchre XML-Validierung aus
Checker.failXml=Konnte XML Fehlerbericht nicht schreiben.
Checker.failPdf=Konnte PDF Fehlerbericht nicht schreiben.
Checker.checksFinished=Pr\u00fcfungen beendet
Checker.schematronValidation=Starte Schematron Pr\u00fcfung
Checker.finishedSchematron=Schematron Pr\u00fcfung abgeschlossen
Checker.failReports=Konnte Pr\u00fcfberichte nicht schreiben.
Checker.checkFeature=Pr\u00fcfe Feature: {}
Checker.executeCheck=F\u00fchre Pr\u00fcfung aus: {}
ValidationConfiguration.reenable={} ist deaktiviert wird aber von {} ben\u00f6tigt, reaktiviere
ValidationConfiguration.missingSchematron={} existiert nicht, deaktiviere Schematron Pr\u00fcfung
CheckContainer.error=Unerwarteter Fehler bei der Ausf\u00fchrung von Pr\u00fcfung: {}
Checks.missingCheck=Konnte keine Pr\u00fcfung f\u00fcr id {} finden
OpenFileDialog.cancelBtn=Abbrechen
\ No newline at end of file
...@@ -27,9 +27,11 @@ import java.util.ArrayList; ...@@ -27,9 +27,11 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.xml.XMLConstants; import javax.xml.XMLConstants;
...@@ -47,7 +49,7 @@ import org.w3c.dom.Document; ...@@ -47,7 +49,7 @@ import org.w3c.dom.Document;
import de.hft.stuttgart.citydoctor2.check.error.SchematronError; import de.hft.stuttgart.citydoctor2.check.error.SchematronError;
import de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException; import de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException;
import de.hft.stuttgart.citydoctor2.checks.CheckContainer; import de.hft.stuttgart.citydoctor2.checks.CheckPrototype;
import de.hft.stuttgart.citydoctor2.checks.Checks; import de.hft.stuttgart.citydoctor2.checks.Checks;
import de.hft.stuttgart.citydoctor2.checks.SvrlContentHandler; import de.hft.stuttgart.citydoctor2.checks.SvrlContentHandler;
import de.hft.stuttgart.citydoctor2.checks.util.FeatureCheckedListener; import de.hft.stuttgart.citydoctor2.checks.util.FeatureCheckedListener;
...@@ -65,6 +67,7 @@ import de.hft.stuttgart.citydoctor2.reporting.XmlStreamReporter; ...@@ -65,6 +67,7 @@ import de.hft.stuttgart.citydoctor2.reporting.XmlStreamReporter;
import de.hft.stuttgart.citydoctor2.reporting.XmlValidationReporter; import de.hft.stuttgart.citydoctor2.reporting.XmlValidationReporter;
import de.hft.stuttgart.citydoctor2.reporting.pdf.PdfReporter; import de.hft.stuttgart.citydoctor2.reporting.pdf.PdfReporter;
import de.hft.stuttgart.citydoctor2.reporting.pdf.PdfStreamReporter; import de.hft.stuttgart.citydoctor2.reporting.pdf.PdfStreamReporter;
import de.hft.stuttgart.citydoctor2.utils.Localization;
import net.sf.saxon.s9api.DOMDestination; import net.sf.saxon.s9api.DOMDestination;
import net.sf.saxon.s9api.Destination; import net.sf.saxon.s9api.Destination;
import net.sf.saxon.s9api.Processor; import net.sf.saxon.s9api.Processor;
...@@ -133,7 +136,7 @@ public class Checker { ...@@ -133,7 +136,7 @@ public class Checker {
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(xmlFile.getAbsolutePath()))) { try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(xmlFile.getAbsolutePath()))) {
reporter.writeReport(checkConfig, bos, model, config); reporter.writeReport(checkConfig, bos, model, config);
} catch (CheckReportWriteException | IOException e) { } catch (CheckReportWriteException | IOException e) {
logger.error("Failed to write XML Error Report.", e); logger.error(Localization.getText("Checker.failXml"), e);
} }
} }
...@@ -149,7 +152,7 @@ public class Checker { ...@@ -149,7 +152,7 @@ public class Checker {
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(pdfFile.getAbsolutePath()))) { try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(pdfFile.getAbsolutePath()))) {
reporter.writeReport(checkConfig, bos, model, config); reporter.writeReport(checkConfig, bos, model, config);
} catch (IOException | CheckReportWriteException e) { } catch (IOException | CheckReportWriteException e) {
logger.error("Failed to write PDF Report.", e); logger.error(Localization.getText("Checker.failPdf"), e);
} }
} }
...@@ -179,7 +182,7 @@ public class Checker { ...@@ -179,7 +182,7 @@ public class Checker {
config = ValidationConfiguration.loadStandardValidationConfig(); config = ValidationConfiguration.loadStandardValidationConfig();
} }
checkCityModel(model, l); checkCityModel(model, l);
logger.info("Finished executing checks"); logger.info(Localization.getText("Checker.checksFinished"));
SvrlContentHandler handler = executeSchematronValidationIfAvailable(config, model.getFile()); SvrlContentHandler handler = executeSchematronValidationIfAvailable(config, model.getFile());
if (handler != null) { if (handler != null) {
model.addGlobalErrors(handler.getGeneralErrors()); model.addGlobalErrors(handler.getGeneralErrors());
...@@ -210,7 +213,7 @@ public class Checker { ...@@ -210,7 +213,7 @@ public class Checker {
private static SvrlContentHandler executeSchematronValidationIfAvailable(ValidationConfiguration config, private static SvrlContentHandler executeSchematronValidationIfAvailable(ValidationConfiguration config,
File file) { File file) {
if (config.getSchematronFilePath() != null && !config.getSchematronFilePath().isEmpty()) { if (config.getSchematronFilePath() != null && !config.getSchematronFilePath().isEmpty()) {
logger.info("Starting Schematron validation"); logger.info(Localization.getText("Checker.schematronValidation"));
Processor processor = new Processor(false); Processor processor = new Processor(false);
XsltCompiler xsltCompiler = processor.newXsltCompiler(); XsltCompiler xsltCompiler = processor.newXsltCompiler();
xsltCompiler.setURIResolver(new URIResolver() { xsltCompiler.setURIResolver(new URIResolver() {
...@@ -252,7 +255,7 @@ public class Checker { ...@@ -252,7 +255,7 @@ public class Checker {
Destination dest = new SAXDestination(handler); Destination dest = new SAXDestination(handler);
schematronTransformer.setDestination(dest); schematronTransformer.setDestination(dest);
schematronTransformer.transform(); schematronTransformer.transform();
logger.info("Finished Schematron validation"); logger.info(Localization.getText("Checker.finishedSchematron"));
return handler; return handler;
} catch (SaxonApiException | ParserConfigurationException e) { } catch (SaxonApiException | ParserConfigurationException e) {
logger.catching(e); logger.catching(e);
...@@ -329,7 +332,6 @@ public class Checker { ...@@ -329,7 +332,6 @@ public class Checker {
ParserConfiguration parserConfig = config.getParserConfiguration(); ParserConfiguration parserConfig = config.getParserConfiguration();
List<Check> checks = collectEnabledChecksAndInit(parserConfig, config); List<Check> checks = collectEnabledChecksAndInit(parserConfig, config);
execLayers = buildExecutionLayers(checks); execLayers = buildExecutionLayers(checks);
// model has not been validated against the new configuration
} }
private List<Check> collectEnabledChecksAndInit(ParserConfiguration parserConfig, ValidationConfiguration config) { private List<Check> collectEnabledChecksAndInit(ParserConfiguration parserConfig, ValidationConfiguration config) {
...@@ -409,46 +411,56 @@ public class Checker { ...@@ -409,46 +411,56 @@ public class Checker {
public void executeChecksForCheckable(Checkable co) { public void executeChecksForCheckable(Checkable co) {
// throw away old results // throw away old results
co.clearAllContainedCheckResults(); co.clearAllContainedCheckResults();
logger.debug("Checking feature: {}", co); if (logger.isDebugEnabled()) {
logger.debug(Localization.getText("Checker.checkFeature"), co);
}
for (int i = 0; i < execLayers.size(); i++) { for (int i = 0; i < execLayers.size(); i++) {
for (Check check : execLayers.get(i)) { for (Check check : execLayers.get(i)) {
logger.trace("Executing check: {}", check.getCheckId()); if (logger.isTraceEnabled()) {
logger.trace(Localization.getText("Checker.executeCheck"), check.getCheckId());
}
co.accept(check); co.accept(check);
} }
} }
} }
private List<List<Check>> buildExecutionLayers(List<Check> checks) { public static List<List<Check>> buildExecutionLayers(List<Check> checks) {
List<List<Check>> result = new ArrayList<>(); List<List<Check>> result = new ArrayList<>();
for (Check c : checks) {
int layer = getLayerDepthForCheck(c); Set<Check> availableChecks = new HashSet<>(checks);
while (layer >= result.size()) { Set<CheckId> usedChecks = new HashSet<>();
result.add(new ArrayList<Check>());
while (!availableChecks.isEmpty()) {
List<Check> layer = new ArrayList<>();
Iterator<Check> iterator = availableChecks.iterator();
while (iterator.hasNext()) {
Check c = iterator.next();
boolean hasUnusedDependency = searchForUnusedDependency(usedChecks, c);
if (!hasUnusedDependency) {
iterator.remove();
layer.add(c);
}
}
if (layer.isEmpty()) {
throw new IllegalStateException("There are checks that have dependencies that are not executed or are unknown");
}
result.add(layer);
for (Check c : layer) {
usedChecks.add(c.getCheckId());
} }
List<Check> checkLayer = result.get(layer);
checkLayer.add(new CheckContainer(c));
} }
return result; return result;
} }
private int getLayerDepthForCheck(Check c) { private static boolean searchForUnusedDependency(Set<CheckId> usedChecks, Check c) {
if (c.getDependencies().isEmpty()) { boolean hasUnusedDependency = false;
return 0; for (CheckId id : c.getDependencies()) {
} if (!usedChecks.contains(id)) {
HashSet<CheckId> checkedChecks = new HashSet<>(); hasUnusedDependency = true;
return getLayerDepthForCheck(c, checkedChecks); break;
} }
private int getLayerDepthForCheck(Check c, HashSet<CheckId> checkedChecks) {
checkedChecks.add(c.getCheckId());
if (c.getDependencies().isEmpty()) {
return 0;
}
int maxDepth = 0;
for (CheckId dependency : c.getDependencies()) {
maxDepth = Math.max(maxDepth, getLayerDepthForCheck(checkConfig.getCheckForId(dependency), checkedChecks));
} }
return maxDepth + 1; return hasUnusedDependency;
} }
public static void streamCheck(FeatureStream stream, String xmlOutput, String pdfOutput, public static void streamCheck(FeatureStream stream, String xmlOutput, String pdfOutput,
...@@ -481,7 +493,7 @@ public class Checker { ...@@ -481,7 +493,7 @@ public class Checker {
writeReport(xmlReporter, handler); writeReport(xmlReporter, handler);
writeReport(pdfReporter, handler); writeReport(pdfReporter, handler);