changeset 6044:477d2d18452e

Implement function to spawn a mainvalueartifact, given gauge and river.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 16 May 2013 17:58:16 +0200
parents c47337657f8c
children 4493ef20d357
files gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java
diffstat 1 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java	Thu May 16 17:57:55 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java	Thu May 16 17:58:16 2013 +0200
@@ -91,6 +91,39 @@
     }
 
     /**
+     * Creates a new MainvaluesArtifact.
+     *
+     * @param river the name of the river
+     */
+    public static Artifact createMainvalueArtifact(
+            String serverUrl,
+            String locale,
+            String river,
+            Long   gaugeRef)
+    throws ServerException
+    {
+        Document create = ClientProtocolUtils.newCreateDocument(
+                MAINVALUE_ARTIFACT_FACTORY);
+
+        XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
+            create,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element root = create.getDocumentElement();
+
+        Element eriver = ec.create("river");
+        ec.addAttr(eriver, "name", river);
+
+        Element egauge = ec.create("gauge");
+        ec.addAttr(egauge, "reference", gaugeRef.toString());
+
+        root.appendChild(eriver);
+        root.appendChild(egauge);
+
+        return sendCreate(serverUrl, locale, create);
+    }
+    /**
      * Creates a new GaugeDischargeCurverArtifact
      *
      * @param river the name of the river

http://dive4elements.wald.intevation.org