changeset 9087:fb976ea01463

Fixed :bed heights finder did not consider the river correctly
author gernotbelger
date Fri, 25 May 2018 10:47:38 +0200
parents b5dbcbaed42b
children 7e60457f9d26
files artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/DefaultBedHeights.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties
diffstat 3 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/DefaultBedHeights.java	Fri May 25 10:47:18 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/DefaultBedHeights.java	Fri May 25 10:47:38 2018 +0200
@@ -103,22 +103,17 @@
         }
     }
 
-    private static List<BedHeight> loadBedHeightsByName(final River shouldBeRiver, final Collection<String> bedHeightNames, final Calculation problems) {
+    private static List<BedHeight> loadBedHeightsByName(final River river, final Collection<String> bedHeightNames, final Calculation problems) {
 
         final List<BedHeight> bedHeights = new ArrayList<>(bedHeightNames.size());
 
         for (final String name : bedHeightNames) {
             try {
-                final BedHeight bedHeight = BedHeight.getBedHeightByDescription(name);
+                final BedHeight bedHeight = BedHeight.getBedHeightByDescription(river, name);
                 if (bedHeight == null)
-                    problems.addProblem("sinfo.bedheightsfinder.missingdescription", name);
-                else {
-                    final River river = bedHeight.getRiver();
-                    if (!shouldBeRiver.getId().equals(river.getId()))
-                        problems.addProblem("sinfo.bedheightsfinder.wrongriver", name, shouldBeRiver.getName());
-                    else
-                        bedHeights.add(bedHeight);
-                }
+                    problems.addProblem("sinfo.bedheightsfinder.missingdescription", river.getName(), name);
+                else
+                    bedHeights.add(bedHeight);
             }
             catch (final Exception e) {
                 e.printStackTrace();
--- a/artifacts/src/main/resources/messages.properties	Fri May 25 10:47:18 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties	Fri May 25 10:47:38 2018 +0200
@@ -800,8 +800,7 @@
 
 sinfo.bedheightsfinder.badrange = Invalid range for bed heights {0}.
 sinfo.bedheightsfinder.overlappingrange = Range of bed height {0} overlaps with other ranges.
-sinfo.bedheightsfinder.missingdescription = No bed heights found with description = {0}
-sinfo.bedheightsfinder.wrongriver = Bed heights {0} does not belong to river {1}
+sinfo.bedheightsfinder.missingdescription = River {0} has no bed heights with description {1}
 sinfo.bedheightsfinder.configfile.missingriver = River not defined in config file ''{0}'': {1}
 sinfo.bedheightsfinder.configfile.loaderror = Failed to load config file ''{0}'': {1}
 sinfo.bedheightsfinder.notfound = Failed to access sounding with id ''{0}''
--- a/artifacts/src/main/resources/messages_de.properties	Fri May 25 10:47:18 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Fri May 25 10:47:38 2018 +0200
@@ -800,8 +800,7 @@
 
 sinfo.bedheightsfinder.badrange = Ung\u00fcltige -range- f\u00fcr Sohlh\u00f6hen {0}.
 sinfo.bedheightsfinder.overlappingrange = -Range- der Sohlh\u00f6hen {0} \u00fcberlappt andere Sohlh\u00f6hen.
-sinfo.bedheightsfinder.missingdescription = Sohlh\u00f6he mit -description- {0} nicht vorhanden
-sinfo.bedheightsfinder.wrongriver = Sohlh\u00f6he {0} geh\u00f6rt nicht zum Gew\u00e4sser {1}
+sinfo.bedheightsfinder.missingdescription = Gew\u00e4sser {0} hat keine Sohlh\u00f6he mit Bezeichnung {1}
 sinfo.bedheightsfinder.configfile.missingriver = Gew\u00e4sser  {1} ist in Konfigurationsdatei {0} nicht definiert.
 sinfo.bedheightsfinder.configfile.loaderror = Fehler beim Laden der Konfigurationsdatei ''{0}'': {1}
 sinfo.bedheightsfinder.notfound = Keine Sohlh\u00f6he mit id ''{0}'' vorhanden

http://dive4elements.wald.intevation.org