Skip to content
Snippets Groups Projects

Resolve "Ajout des messages d'erreur générées par les contraintes SHACL"

1 file
+ 23
14
Compare changes
  • Side-by-side
  • Inline
@@ -1379,18 +1379,27 @@ public class MainApp extends Application implements Launcher {
SHACLValidationEndMessage.setResizable(true);
SHACLValidationEndMessage.setTitle("SHACL validation ended");
SHACLValidationEndMessage.setHeaderText("REPORT");
if (r.success()) {
SHACLValidationEndMessage.setContentText("Elapsed time : "
+ ((Long)timeElapsed).toString() + " ms\r\n"
+ "No SHACL violations detected.");
StringBuilder contentText = new StringBuilder("Elapsed time : " + ((Long)timeElapsed).toString() + " ms\r\n\r\n") ;
if (r.getInfos().size() > 0) {
contentText.append("Information constraints : \r\n");
contentText.append(r.prettyPrintInfos());
contentText.append("\r\n");
}
else {
SHACLValidationEndMessage.setContentText("Elapsed time : "
+ ((Long)timeElapsed).toString() + " ms\r\n"
+ "SHACL violations detected.");//r.prettyPrintError());
ButtonType saveLog = new ButtonType("Download log file", ButtonData.LEFT);
SHACLValidationEndMessage.getButtonTypes().add(saveLog);
SHACLValidationEndMessage.getDialogPane().lookupButton(saveLog).addEventFilter(
if (r.getWarning().size() > 0) {
contentText.append("Warning constraints : \r\n");
contentText.append(r.prettyPrintWarning());
contentText.append("\r\n");
}
if (r.getError().size() > 0) {
contentText.append("Violation constraints : \r\n");
contentText.append(r.prettyPrintError());
contentText.append("\r\n");
}
SHACLValidationEndMessage.setContentText(contentText.toString());
ButtonType saveLog = new ButtonType("Download log file", ButtonData.LEFT);
SHACLValidationEndMessage.getButtonTypes().add(saveLog);
SHACLValidationEndMessage.getDialogPane().lookupButton(saveLog).addEventFilter(
ActionEvent.ACTION,
event -> {
event.consume();
@@ -1401,15 +1410,15 @@ public class MainApp extends Application implements Launcher {
if (fileExport != null) {
try {
FileOutputStream fout = new FileOutputStream(fileExport, false);
org.apache.commons.io.IOUtils.write(r.prettyPrintError(), fout, StandardCharsets.UTF_8);
org.apache.commons.io.IOUtils.write(contentText.toString(), fout, StandardCharsets.UTF_8);
fout.close();
} catch (IOException ex) {
MainApp.logger.error(ex.getMessage());
}
}
}
);
}
);
SHACLValidationEndMessage.initOwner(MainApp.primaryStage);
SHACLValidationEndMessage.initModality(Modality.WINDOW_MODAL);
Loading