[Dive4elements-commits] [PATCH 09 of 13] Add a new function to create a GaugeDischarge+MainValueArtifact collection

Wald Commits scm-commit at wald.intevation.org
Thu May 16 17:51:29 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1368714669 -7200
# Node ID cbdf839008a771bd1499783f3e53dc03f64c783f
# Parent  b6dab05553e26e165fe93eeccc9ee308b6f2e690
Add a new function to create a GaugeDischarge+MainValueArtifact collection.

diff -r b6dab05553e2 -r cbdf839008a7 gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactService.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactService.java	Thu May 16 16:30:36 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactService.java	Thu May 16 16:31:09 2013 +0200
@@ -68,5 +68,19 @@
             String river,
             int measurementStation
     ) throws ServerException;
+
+    /**
+     * Create a new GaugeDischageCurveArtifact and also a Mainvalueartifact.
+     *
+     * @param collection the collection to add the artifacts to.
+     * @param river      the river.
+     * @param gaugeref   reference id of the gauge.
+     */
+    public Artifact createGaugeDischargeView(
+        Collection collection,
+        String locale,
+        String river,
+        Long   gaugeRef)
+    throws ServerException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r b6dab05553e2 -r cbdf839008a7 gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactServiceAsync.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactServiceAsync.java	Thu May 16 16:30:36 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactServiceAsync.java	Thu May 16 16:31:09 2013 +0200
@@ -44,5 +44,12 @@
         int measurementStation,
         AsyncCallback<Artifact> callback
     );
+
+    public void createGaugeDischargeView(
+        Collection collection,
+        String locale,
+        String river,
+        Long   gaugeRef,
+        AsyncCallback<Artifact> callback);
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r b6dab05553e2 -r cbdf839008a7 gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java	Thu May 16 16:30:36 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java	Thu May 16 16:31:09 2013 +0200
@@ -58,6 +58,43 @@
         return ArtifactHelper.createArtifact(url, locale, factory, recom);
     }
 
+
+    /**
+     * Create a new GaugeDischageCurveArtifact and MainValueArtifact, stuff
+     * them into a collection.
+     *
+     * @param river    the river.
+     * @param gaugeref reference id of the gauge.
+     */
+    public Artifact createGaugeDischargeView(
+        Collection collection,
+        String locale,
+        String river,
+        Long   gaugeRef)
+    throws ServerException
+    {
+        logger.info("ArtifactServiceImpl.createGaugeDischargeCurveView");
+        String url  = getServletContext().getInitParameter("server-url");
+
+        Artifact artifact = ArtifactHelper.createGaugeDischargeCurveArtifact(url,
+                locale, river, gaugeRef);
+        if (artifact == null) {
+            return null;
+        }
+        logger.info("GaugeDischargeCurveArtifact created successfully");
+
+        CollectionHelper.addArtifact(collection, artifact, url, locale);
+        Artifact mainVArtifact = ArtifactHelper.createMainvalueArtifact(url,
+                locale, river, gaugeRef);
+        if (mainVArtifact == null) {
+            logger.info("Failed to create MainValueArtifact");
+            return null;
+        }
+        CollectionHelper.addArtifact(collection, mainVArtifact, url, locale);
+
+        return artifact;
+    }
+
     /**
      * Create a new GaugeDischageCurveArtifact
      *


More information about the Dive4elements-commits mailing list