[PATCH 5 of 7] (issue1448) Extend SedimentLoadInfo request to handle sq time intervals

Wald Commits scm-commit at wald.intevation.org
Mon Sep 8 16:25:20 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410186218 -7200
# Node ID f54c4b858213b3c2c6cc659605f0459fa7682174
# Parent  0bf8887836838ee74204acc0bc173064059f48d1
(issue1448) Extend SedimentLoadInfo request to handle sq time intervals

diff -r 0bf888783683 -r f54c4b858213 gwt-client/src/main/java/org/dive4elements/river/client/client/services/SedimentLoadInfoService.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/services/SedimentLoadInfoService.java	Mon Sep 08 16:21:26 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/services/SedimentLoadInfoService.java	Mon Sep 08 16:23:38 2014 +0200
@@ -31,7 +31,8 @@
         String river,
         String type,
         double startKm,
-        double endKm)
+        double endKm,
+        String sq_ti_id)
     throws ServerException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 0bf888783683 -r f54c4b858213 gwt-client/src/main/java/org/dive4elements/river/client/client/services/SedimentLoadInfoServiceAsync.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/services/SedimentLoadInfoServiceAsync.java	Mon Sep 08 16:21:26 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/services/SedimentLoadInfoServiceAsync.java	Mon Sep 08 16:23:38 2014 +0200
@@ -23,6 +23,7 @@
         String type,
         double startKm,
         double endKm,
+        String sq_ti_id,
         AsyncCallback<SedimentLoadInfoObject[]> cb);
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 0bf888783683 -r f54c4b858213 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java	Mon Sep 08 16:21:26 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java	Mon Sep 08 16:23:38 2014 +0200
@@ -253,7 +253,18 @@
         double[] km = artifact.getArtifactDescription().getKMRange();
         String river = artifact.getArtifactDescription().getRiver();
 
-        sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1],
+        String sq_ti_id = "";
+        if (data.length > 0) {
+            Data str = getData(data[0].getAll(), "sq_ti_id");
+            if (str != null) {
+                DataItem[] strItems = str.getItems();
+                sq_ti_id = strItems[0].getStringValue();
+            } else {
+                GWT.log("Failed to find sq time interval id in data.");
+            }
+        }
+
+        sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1], sq_ti_id,
             new AsyncCallback<SedimentLoadInfoObject[]>() {
                 public void onFailure(Throwable caught) {
                     GWT.log("Could not recieve sediment load informations.");
diff -r 0bf888783683 -r f54c4b858213 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadOffEpochPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadOffEpochPanel.java	Mon Sep 08 16:21:26 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadOffEpochPanel.java	Mon Sep 08 16:23:38 2014 +0200
@@ -163,7 +163,7 @@
         double[] km = artifact.getArtifactDescription().getKMRange();
         String river = artifact.getArtifactDescription().getRiver();
 
-        sedLoadInfoService.getSedimentLoadInfo(locale, river, "off_epoch", km[0], km[1],
+        sedLoadInfoService.getSedimentLoadInfo(locale, river, "off_epoch", km[0], km[1], "",
             new AsyncCallback<SedimentLoadInfoObject[]>() {
                 public void onFailure(Throwable caught) {
                     GWT.log("Could not receive sediment load informations.");
diff -r 0bf888783683 -r f54c4b858213 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadPeriodPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadPeriodPanel.java	Mon Sep 08 16:21:26 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadPeriodPanel.java	Mon Sep 08 16:23:38 2014 +0200
@@ -206,7 +206,18 @@
         double[] km = artifact.getArtifactDescription().getKMRange();
         String river = artifact.getArtifactDescription().getRiver();
 
-        sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1],
+        String sq_ti_id = "";
+        if (data.length > 0) {
+            Data str = getData(data[0].getAll(), "sq_ti_id");
+            if (str != null) {
+                DataItem[] strItems = str.getItems();
+                sq_ti_id = strItems[0].getStringValue();
+            } else {
+                GWT.log("Failed to find sq time interval id in data.");
+            }
+        }
+
+        sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1], sq_ti_id,
             new AsyncCallback<SedimentLoadInfoObject[]>() {
                 public void onFailure(Throwable caught) {
                     GWT.log("Could not recieve sediment load informations.");
diff -r 0bf888783683 -r f54c4b858213 gwt-client/src/main/java/org/dive4elements/river/client/server/SedimentLoadInfoServiceImpl.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/SedimentLoadInfoServiceImpl.java	Mon Sep 08 16:21:26 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/SedimentLoadInfoServiceImpl.java	Mon Sep 08 16:23:38 2014 +0200
@@ -46,7 +46,8 @@
         String river,
         String type,
         double startKm,
-        double endKm)
+        double endKm,
+        String sq_ti_id)
     throws ServerException
     {
         log.info("SedimentLoadInfoServiceImpl.getSedimentLoadInfo");
@@ -65,15 +66,18 @@
         Element from = ec.create("from");
         Element to = ec.create("to");
         Element typeEl = ec.create("type");
+        Element sqTiEl = ec.create("sq_ti_id");
         riverEl.setTextContent(river);
         from.setTextContent(String.valueOf(startKm));
         to.setTextContent(String.valueOf(endKm));
+        sqTiEl.setTextContent(sq_ti_id);
         typeEl.setTextContent(type);
 
         location.appendChild(from);
         location.appendChild(to);
         riverEl.appendChild(location);
         riverEl.appendChild(typeEl);
+        riverEl.appendChild(sqTiEl);
         doc.appendChild(riverEl);
 
         HttpClient client = new HttpClientImpl(url, locale);
@@ -149,9 +153,11 @@
 
         String desc      = node.getAttribute("description").trim();
         String date      = node.getAttribute("date").trim();
+        String sq_ti_date= node.getAttribute("sq_date").trim();
+        String sq_ti_id  = node.getAttribute("sq_ti_id").trim();
 
         if (desc.length() > 0 && date.length() > 0) {
-            return new SedimentLoadInfoObjectImpl(desc, date);
+            return new SedimentLoadInfoObjectImpl(desc, date, sq_ti_date, sq_ti_id);
         }
 
         log.warn("Invalid sediment load info object found.");
diff -r 0bf888783683 -r f54c4b858213 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoObject.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoObject.java	Mon Sep 08 16:21:26 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoObject.java	Mon Sep 08 16:23:38 2014 +0200
@@ -19,5 +19,9 @@
     String getDescription();
 
     String getDate();
+
+    String getSQTiDate();
+
+    String getSQTiId();
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
\ No newline at end of file
diff -r 0bf888783683 -r f54c4b858213 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoObjectImpl.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoObjectImpl.java	Mon Sep 08 16:21:26 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoObjectImpl.java	Mon Sep 08 16:23:38 2014 +0200
@@ -16,16 +16,22 @@
 
     protected String description;
     protected String dateString;
+    protected String tiIdString;
+    protected String tiDateString;
 
     public SedimentLoadInfoObjectImpl() {
     }
 
     public SedimentLoadInfoObjectImpl(
         String description,
-        String dateString
+        String dateString,
+        String tiDateString,
+        String tiIdString
     ) {
         this.description = description;
         this.dateString = dateString;
+        this.tiDateString = tiDateString;
+        this.tiIdString = tiIdString;
     }
 
     public String getDescription() {
@@ -33,7 +39,15 @@
     }
 
     public String getDate() {
-        return this.dateString;
+        return dateString;
+    }
+
+    public String getSQTiDate() {
+        return tiDateString;
+    }
+
+    public String getSQTiId() {
+        return tiIdString;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
\ No newline at end of file
diff -r 0bf888783683 -r f54c4b858213 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoRecord.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoRecord.java	Mon Sep 08 16:21:26 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoRecord.java	Mon Sep 08 16:23:38 2014 +0200
@@ -20,6 +20,8 @@
         this.sedimentLoadInfo = info;
         setDescription(info.getDescription());
         setDate(info.getDate());
+        setSQTiDate(info.getSQTiDate());
+        setSQTiId(info.getSQTiId());
     }
 
     public void setDescription(String description) {
@@ -30,6 +32,14 @@
         setAttribute("date", date);
     }
 
+    public void setSQTiDate(String date) {
+        setAttribute("sq_date", date);
+    }
+
+    public void setSQTiId(String id) {
+        setAttribute("sq_ti_id", id);
+    }
+
     public String getDescription() {
         return getAttribute("description");
     }
@@ -37,4 +47,12 @@
     public String getDate() {
         return getAttribute("date");
     }
+
+    public String getSQTiId() {
+        return getAttribute("sq_ti_id");
+    }
+
+    public String getSQTiDate() {
+        return getAttribute("sq_date");
+    }
 }


More information about the Dive4Elements-commits mailing list