changeset 6894:389bf6b7d371

Backed out changeset 60f39ee19473
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 21 Aug 2013 16:14:29 +0200
parents 60f39ee19473
children e5675e85ac38
files etl/src/main/java/org/dive4elements/river/etl/aft/River.java etl/src/main/resources/sql/flys-common.properties gwt-client/src/main/java/org/dive4elements/river/client/server/filter/GGInAFilter.java
diffstat 3 files changed, 8 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/etl/src/main/java/org/dive4elements/river/etl/aft/River.java	Wed Aug 21 16:13:36 2013 +0200
+++ b/etl/src/main/java/org/dive4elements/river/etl/aft/River.java	Wed Aug 21 16:14:29 2013 +0200
@@ -15,11 +15,9 @@
 import java.sql.SQLException;
 
 import java.util.ArrayList;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.TreeMap;
 
 import org.apache.log4j.Logger;
 
@@ -138,25 +136,11 @@
             .clearParameters()
             .setInt("river_id", id1).executeQuery();
 
-        TreeMap<Double, String> station2gaugeName = new TreeMap<Double, String>(
-            new Comparator<Double>() {
-                @Override
-                public int compare(Double a, Double b) {
-                    double diff = a - b;
-                    if (diff < -0.0001) return -1;
-                    if (diff >  0.0001) return +1;
-                    return 0;
-                }
-            });
-
         try {
             while (gaugesRs.next()) {
                 int gaugeId = gaugesRs.getInt("id");
                 String name = gaugesRs.getString("name");
                 long   number = gaugesRs.getLong("official_number");
-                double station = gaugesRs.getDouble("station");
-                station2gaugeName.put(station, name);
-
                 if (gaugesRs.wasNull()) {
                     log.warn("FLYS: Gauge '" + name +
                         "' has no official number. Ignored.");
@@ -179,8 +163,7 @@
             gaugesRs.close();
         }
 
-        boolean modified = createGauges(
-            context, aftDIPSGauges, station2gaugeName);
+        boolean modified = createGauges(context, aftDIPSGauges);
 
         modified |= updateGauges(context, updateGauges);
 
@@ -381,8 +364,7 @@
 
     protected boolean createGauges(
         SyncContext          context,
-        Map<Long, DIPSGauge> gauges,
-        Map<Double, String>  station2gaugeName
+        Map<Long, DIPSGauge> gauges
     )
     throws SQLException
     {
@@ -403,14 +385,6 @@
             log.info("Gauge '" + gauge.getAftName() +
                 "' not in FLYS but in AFT/DIPS. -> Create");
 
-            String flysGaugeName = station2gaugeName.get(gauge.getStation());
-            if (flysGaugeName != null) {
-                log.warn("FLYS: AFT gauge " + gauge.getName() +
-                    " has same station as FLYS gauge " + flysGaugeName +
-                    " -> ignored.");
-                continue;
-            }
-
             if (!gauge.hasDatums()) {
                 log.warn("DIPS: Gauge '" +
                     gauge.getAftName() + "' has no datum. Ignored.");
--- a/etl/src/main/resources/sql/flys-common.properties	Wed Aug 21 16:13:36 2013 +0200
+++ b/etl/src/main/resources/sql/flys-common.properties	Wed Aug 21 16:14:29 2013 +0200
@@ -7,7 +7,7 @@
     WHERE w.kind = 0 \
     GROUP BY r.id, r.name
 select.gauges = \
-    SELECT id, name, official_number, station \
+    SELECT id, name, official_number \
     FROM gauges \
     WHERE river_id = :river_id
 next.gauge.id = \
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/filter/GGInAFilter.java	Wed Aug 21 16:13:36 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/filter/GGInAFilter.java	Wed Aug 21 16:14:29 2013 +0200
@@ -99,11 +99,11 @@
         logger.debug("Request for: " + requesturi);
 
         // Allow access to localhost
-        //if (isLocalAddress(req)) {
-        //    logger.debug("Request to localhost");
-        //    chain.doFilter(req, resp);
-        //    return;
-        //}
+        if (isLocalAddress(req)) {
+            logger.debug("Request to localhost");
+            chain.doFilter(req, resp);
+            return;
+        }
 
         // Allow access to login pages
         String path = this.sc.getContextPath();

http://dive4elements.wald.intevation.org