changeset 6005:d7eb007a57cc

merged
author Tom Gottfried <tom.gottfried@intevation.de>
date Mon, 13 May 2013 11:15:14 +0200
parents ec54bb4fe407 (diff) f049f9521a51 (current diff)
children 2c4be2375f63
files
diffstat 2 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportGauge.java	Mon May 13 11:20:08 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportGauge.java	Mon May 13 11:15:14 2013 +0200
@@ -267,9 +267,9 @@
         if (peer == null) {
             Session session = ImporterSession.getInstance().getDatabaseSession();
             Query query = session.createQuery(
-                "from Gauge where name=:name " +
+                "from Gauge where officialNumber=:officialNumber " +
                 "and river.id=:river");
-            query.setString("name", name);
+            query.setParameter("officialNumber", officialNumber);
             query.setParameter("river", river.getId());
             List<Gauge> gauges = query.list();
             if (gauges.isEmpty()) {
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/StaFileParser.java	Mon May 13 11:20:08 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/StaFileParser.java	Mon May 13 11:15:14 2013 +0200
@@ -42,9 +42,6 @@
     public static final String TYPES =
         System.getProperty("flys.backend.main.value.types", "QWTD");
 
-    public static final boolean NOT_PARSE_GAUGE_NUMBERS =
-        Boolean.getBoolean("flys.backend.sta.not.parse.gauge.numbers");
-
     public static final Pattern QWTD_ =
         Pattern.compile("\\s*([^\\s]+)\\s+([^\\s]+)\\s+([" +
             Pattern.quote(TYPES) + "]).*");
@@ -117,16 +114,14 @@
 
             Long gaugeNumber = null;
 
-            if (!NOT_PARSE_GAUGE_NUMBERS) {
-                String gaugeNumberString = line.substring(8, 16).trim();
+            String gaugeNumberString = line.substring(8, 16).trim();
 
-                try {
-                    gaugeNumber = Long.parseLong(gaugeNumberString);
-                }
-                catch (NumberFormatException nfe) {
-                    log.warn("STA: gauge number '" + gaugeNumberString +
-                        "' is not a valid long number.");
-                }
+            try {
+                gaugeNumber = Long.parseLong(gaugeNumberString);
+            }
+            catch (NumberFormatException nfe) {
+                log.warn("STA: gauge number '" + gaugeNumberString +
+                         "' is not a valid long number.");
             }
 
             gauge.setName(gaugeName);

http://dive4elements.wald.intevation.org