diff --git a/CityDoctorParent/CityDoctorModel/pom.xml b/CityDoctorParent/CityDoctorModel/pom.xml index 8f399ad30b7d27caada8e003793957476eaaeb9e..efc426fd430cd138052b075f96abd8c6cab4fc1c 100644 --- a/CityDoctorParent/CityDoctorModel/pom.xml +++ b/CityDoctorParent/CityDoctorModel/pom.xml @@ -30,7 +30,7 @@ org.jogamp.jogl jogl-all-main - + junit junit test @@ -53,4 +53,13 @@ proj4j + + + + + src/main/resources + true + + + \ No newline at end of file diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/Localization.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/Localization.java index de8165c17014d96a560345cca6184ed1e7209ce2..595b9ad998b411ac5c824524a346f9f63e42cded 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/Localization.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/Localization.java @@ -27,6 +27,8 @@ import java.util.ResourceBundle; * */ public class Localization { + + public static final String VERSION = "CityDoctorValidation.Version"; private static ResourceBundle bundle; diff --git a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties index 8efe407c8c96eaa532780c5d6687978ce0a7e474..b03de54be1cd8befbca9b66e53b66932b1fa701b 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties +++ b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties @@ -1,3 +1,4 @@ +CityDoctorValidation.Version=${project.version} DistanceError.distanceFromPlane=distance from plane AboutDialog.developedBy=Developed by AboutDialog.contact=Contact diff --git a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CDVMessages.java b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CDVMessages.java deleted file mode 100644 index 65d329a33cff14aea7c19163a6b7937807a6c1f4..0000000000000000000000000000000000000000 --- a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CDVMessages.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart - * - * This file is part of CityDoctor2. - * - * CityDoctor2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * CityDoctor2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with CityDoctor2. If not, see . - */ -package de.hft.stuttgart.citydoctor2; - -import java.text.MessageFormat; -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * Provides access to message strings in different languages. - * - * @author Matthias Betz - 12bema1bif@hft-stuttgart.de - * @version 1.0 - * - */ -public class CDVMessages { - - public static final String MISSING_SOURCE_FILE = "ArgumentParser.MissingSourceFile"; - public static final String INVALID_PARAMETER = "ArgumentParser.InvalidParameter"; - public static final String VERSION = "CityDoctorValidation.Version"; - - private static final String BUNDLE_NAME = "de.hft.stuttgart.citydoctor2.cdvmessages"; - - private static final ResourceBundle RESOURCE_BUNDLE; - - static { - RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault()); - } - - /** - * Gives the message string for the given key based on the default locale. - * - * @param key - * the key for the message - * @return localized message. - */ - public static String getString(String key) { - return RESOURCE_BUNDLE.getString(key); - } - - /** - * Constructs a string out of the key and the given parameters with the - * MessageFormatter. - * - * @param key - * the key for the message - * @param params - * the parameters for the message - * @return the localized message with the parameters substituted. - * @see MessageFormat#format(String, Object...); - */ - public static String getString(String key, Object... params) { - String msg = getString(key); - return MessageFormat.format(msg, params); - } - - private CDVMessages() { - } - -} diff --git a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/XmlStreamReporter.java b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/XmlStreamReporter.java index c9fe9103a669d566c24c77a490607c83af037e70..c86c49398ee4d5385b75d0f08788e0043597ac09 100644 --- a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/XmlStreamReporter.java +++ b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/XmlStreamReporter.java @@ -32,7 +32,6 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import de.hft.stuttgart.citydoctor2.CDVMessages; import de.hft.stuttgart.citydoctor2.check.CheckConfiguration; import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckId; @@ -64,6 +63,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.LandObject; import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject; import de.hft.stuttgart.citydoctor2.datastructure.Vegetation; import de.hft.stuttgart.citydoctor2.datastructure.WaterObject; +import de.hft.stuttgart.citydoctor2.utils.Localization; /** * Report for creating a XML report out of a stream of feature results @@ -105,7 +105,7 @@ public class XmlStreamReporter implements StreamReporter { env.setJavaVmVersion(System.getProperties().getProperty("java.version")); env.setOsArch(System.getProperties().getProperty("os.arch")); env.setOsName(System.getProperties().getProperty("os.name")); - env.setValidationVersion(CDVMessages.getString(CDVMessages.VERSION)); + env.setValidationVersion(Localization.getText(Localization.VERSION)); return header; } diff --git a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java index 95683cc3ecaaf2ec7a23a27c2fac50c767534e6f..2a8ee2bc759bbdbd8a39dc49b32e31b564addce2 100644 --- a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java +++ b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java @@ -33,7 +33,6 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import de.hft.stuttgart.citydoctor2.CDVMessages; import de.hft.stuttgart.citydoctor2.check.CheckConfiguration; import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckId; @@ -57,6 +56,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject; import de.hft.stuttgart.citydoctor2.datastructure.Vegetation; import de.hft.stuttgart.citydoctor2.datastructure.WaterObject; import de.hft.stuttgart.citydoctor2.reporting.StreamReporter; +import de.hft.stuttgart.citydoctor2.utils.Localization; /** * Reporter to create a PDF report out of a stream of feature results @@ -156,7 +156,7 @@ public class PdfStreamReporter implements StreamReporter { env.addTextElement("The checks were executed under the following environment:"); Table t = new Table(2); t.setTitle("Name", "Value"); - t.addRow("City Doctor Version", CDVMessages.getString(CDVMessages.VERSION)); + t.addRow("City Doctor Version", Localization.getText(Localization.VERSION)); t.addRow("Java VM-Version", System.getProperties().getProperty("java.vm.version")); t.addRow("Java VM-Vendor", System.getProperties().getProperty("java.vm.vendor")); t.addRow("Java Version", System.getProperties().getProperty("java.version")); diff --git a/CityDoctorParent/CityDoctorValidation/src/main/resources/de/hft/stuttgart/citydoctor2/cdvmessages.properties b/CityDoctorParent/CityDoctorValidation/src/main/resources/de/hft/stuttgart/citydoctor2/cdvmessages.properties deleted file mode 100644 index 02279e153076b67602e6aed0698f16d8b3dd7e93..0000000000000000000000000000000000000000 --- a/CityDoctorParent/CityDoctorValidation/src/main/resources/de/hft/stuttgart/citydoctor2/cdvmessages.properties +++ /dev/null @@ -1,3 +0,0 @@ -CityDoctorValidation.Version=${project.version} - -