[Dive4elements-commits] [PATCH 13 of 13] Implement function to spawn a mainvalueartifact, given gauge and river
Wald Commits
scm-commit at wald.intevation.org
Thu May 16 17:51:33 CEST 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1368719896 -7200
# Node ID 477d2d18452eb9b217ea531f65aa378d8dbd04f2
# Parent c47337657f8c268e173bc44df08f46713073ef8b
Implement function to spawn a mainvalueartifact, given gauge and river.
diff -r c47337657f8c -r 477d2d18452e gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java
--- 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
More information about the Dive4elements-commits
mailing list