changeset 8305:f5ed7698c4db

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 22 Sep 2014 17:11:20 +0200
parents c4bd57172aa7 (diff) 2869a2e482e5 (current diff)
children 33d90858b2dc 7b282a3f50f0
files gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties
diffstat 17 files changed, 302 insertions(+), 240 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/gaugedischargecurve.xml	Fri Sep 19 16:29:11 2014 +0200
+++ b/artifacts/doc/conf/artifacts/gaugedischargecurve.xml	Mon Sep 22 17:11:20 2014 +0200
@@ -1,39 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="gaugedischargecurve">
     <states>
-         <state id="state.gaugedischargecurve.static" description="state.gaugedischargecurve.static" state="org.dive4elements.river.artifacts.states.StaticState">
-            <data name="river" type="String" />
-            <data name="reference_gauge" type="Long" />
-            <data name="gauge_name" type="String" />
-            <outputmodes>
-                <outputmode name="discharge_curve" description="output.discharge_curve" mime-type="image/png" type="chart">
-                    <facets>
-                        <facet name="gauge_discharge_curve"/>
-                        <facet name="mainvalues.q" description="mainvalues.q"/>
-                        <facet name="computed_discharge_curve.mainvalues.w" description="mainvalues.w"/>
-                        <facet name="discharge_curve.curve" description="facet.discharge_curve.curve"/>
-                        <facet name="heightmarks_points" description="facet.other.wqkms"/>
-                        <facet name="other.wqkms" description="facet.other.wqkms"/>
-                        <facet name="other.wq"    description="Point-like data like fixations"/>
-                        <facet name="other.wkms"  description="Point-like data like fixations"/>
-                        <facet name="other.wkms.interpol" description="Height over km, like flood protections."/>
-                        <facet name="computed_discharge_curve.manualpoints" description="Manuelle Punkte"/>
-                        <facet name="other.w.interpol" description="Interpolated (likely single) W Values"/>
-                        <facet name="other.wqkms.w" description="facet.other.wqkms"/>
-                    </facets>
-                </outputmode>
-                <outputmode name="computed_dischargecurve_at_export" description="output.computed_dischargecurve_at_export" mime-type="text/plain" type="export">
-                    <facets>
-                        <facet name="at" description="facet.gauge_discharge_curve_export.at"/>
-                    </facets>
-                </outputmode>
-                <outputmode name="computed_dischargecurve_export" description="output.computed_dischargecurve_export" mime-type="text/plain" type="export">
-                    <facets>
-                        <facet name="csv" description="facet.computed_dischargecurve_export.csv" />
-                        <facet name="pdf" description="facet.computed_dischargecurve_export.pdf" />
-                    </facets>
-                </outputmode>
-            </outputmodes>
-         </state>
+        <state id="state.gaugedischargecurve.init" description="state.gaugedischargecurve.init" state="org.dive4elements.river.artifacts.states.GaugeDischargeInitState">
+            <data name="river" type="String"/>
+            <data name="reference_gauge" type="Long"/>
+            <data name="ld_locations" type="Double"/>
+            <data name="gauge_name" type="String"/>
+        </state>
+        <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition">
+            <from state="state.gaugedischargecurve.init"/>
+            <to state="state.gaugedischargecurve.static"/>
+        </transition>
+        <state id="state.gaugedischargecurve.static" description="state.gaugedischargecurve.static" state="org.dive4elements.river.artifacts.states.GaugeDischargeCurveState">
+           <outputmodes>
+               <outputmode name="discharge_curve" description="output.discharge_curve" mime-type="image/png" type="chart">
+                   <facets>
+                       <facet name="gauge_discharge_curve"/>
+                       <facet name="mainvalues.q" description="mainvalues.q"/>
+                       <facet name="computed_discharge_curve.mainvalues.w" description="mainvalues.w"/>
+                       <facet name="discharge_curve.curve" description="facet.discharge_curve.curve"/>
+                       <facet name="heightmarks_points" description="facet.other.wqkms"/>
+                       <facet name="other.wqkms" description="facet.other.wqkms"/>
+                       <facet name="other.wq"    description="Point-like data like fixations"/>
+                       <facet name="other.wkms"  description="Point-like data like fixations"/>
+                       <facet name="other.wkms.interpol" description="Height over km, like flood protections."/>
+                       <facet name="computed_discharge_curve.manualpoints" description="Manuelle Punkte"/>
+                       <facet name="other.w.interpol" description="Interpolated (likely single) W Values"/>
+                       <facet name="other.wqkms.w" description="facet.other.wqkms"/>
+                   </facets>
+               </outputmode>
+               <outputmode name="computed_dischargecurve_at_export" description="output.computed_dischargecurve_at_export" mime-type="text/plain" type="export">
+                   <facets>
+                       <facet name="at" description="facet.gauge_discharge_curve_export.at"/>
+                   </facets>
+               </outputmode>
+               <outputmode name="computed_dischargecurve_export" description="output.computed_dischargecurve_export" mime-type="text/plain" type="export">
+                   <facets>
+                       <facet name="csv" description="facet.computed_dischargecurve_export.csv" />
+                       <facet name="pdf" description="facet.computed_dischargecurve_export.pdf" />
+                   </facets>
+               </outputmode>
+           </outputmodes>
+        </state>
     </states>
 </artifact>
--- a/artifacts/doc/conf/conf.xml	Fri Sep 19 16:29:11 2014 +0200
+++ b/artifacts/doc/conf/conf.xml	Mon Sep 22 17:11:20 2014 +0200
@@ -11,6 +11,7 @@
     <!ENTITY zoom-scales SYSTEM "zoom-scales.xml">
     <!ENTITY modules SYSTEM "modules.xml">
     <!ENTITY porosity-artifact  SYSTEM "artifacts/porosity.xml">
+    <!ENTITY gaugedischargecurve-artifact  SYSTEM "artifacts/gaugedischargecurve.xml">
     <!ENTITY sedimentload-artifact  SYSTEM "artifacts/sedimentload.xml">
     <!ENTITY sedimentload-ls-artifact  SYSTEM "artifacts/sedimentload-ls.xml">
 
@@ -146,7 +147,7 @@
 
             <artifact-factory name="gaugedischargecurve" description="Factory to create an artifact to show a discharge curve for a gauge."
                 ttl="3600000"
-                artifact="org.dive4elements.river.artifacts.GaugeDischargeCurveArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                artifact="org.dive4elements.river.artifacts.D4EArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory</artifact-factory>
             <artifact-factory name="flowvelocitymodel" description="Factory to create an artifact to show measured flow velocities."
                 ttl="3600000"
                 artifact="org.dive4elements.river.artifacts.FlowVelocityModelArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory</artifact-factory>
@@ -289,10 +290,10 @@
         <artifact name="staticwqkms" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/staticwqkms.xml" />
         <artifact name="fixanalysis" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/fixanalysis.xml" />
         <artifact name="gaugedischarge" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/gaugedischarge.xml" />
-        <artifact name="gaugedischargecurve" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/gaugedischargecurve.xml" />
         <artifact name="qsector" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/qsector.xml" />
         <artifact name="staticsqrelation" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/sqrelation.xml" />
         &porosity-artifact;
+        &gaugedischargecurve-artifact;
         &sedimentload-artifact;
         &sedimentload-ls-artifact;
     </artifacts>
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java	Mon Sep 22 17:11:20 2014 +0200
@@ -31,14 +31,17 @@
  * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
  */
 public class GaugeDischargeCurveFacet
-extends      DefaultFacet
+extends      DataFacet
 implements FacetTypes
 {
     private static final Logger log =
         Logger.getLogger(GaugeDischargeCurveFacet.class);
 
+    public GaugeDischargeCurveFacet() {
+    }
+
     public GaugeDischargeCurveFacet(String name, String description) {
-        super(0, name, description);
+        super(name, description);
     }
 
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeCurveState.java	Mon Sep 22 17:11:20 2014 +0200
@@ -0,0 +1,37 @@
+package org.dive4elements.river.artifacts.states;
+
+import java.util.List;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.model.GaugeDischargeCurveFacet;
+import org.dive4elements.river.artifacts.resources.Resources;
+
+
+public class GaugeDischargeCurveState
+extends DefaultState
+{
+
+    @Override
+    public Object computeAdvance(
+        D4EArtifact artifact,
+        String hash,
+        CallContext context,
+        List<Facet> facets,
+        Object old
+    ) {
+        RiverAccess access = new RiverAccess(artifact);
+        String description = Resources.format(context.getMeta(),
+                "facet.gauge_discharge_curve.description",
+                "Discharge curve on gauge",
+                access.getRiverName(),
+                artifact.getDataAsString("gauge_name"));
+        facets.add(new GaugeDischargeCurveFacet("gauge_discharge_curve", description));
+        facets.add(new GaugeDischargeCurveFacet("at", "gauge_discharge_curve"));
+        facets.add(new GaugeDischargeCurveFacet("csv", "gauge_discharge_curve"));
+        facets.add(new GaugeDischargeCurveFacet("pdf", "gauge_discharge_curve"));
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeInitState.java	Mon Sep 22 17:11:20 2014 +0200
@@ -0,0 +1,12 @@
+package org.dive4elements.river.artifacts.states;
+
+
+public class GaugeDischargeInitState
+extends DefaultState
+{
+
+    @Override
+    protected String getUIProvider() {
+        return "gauge_discharge_curve";
+    }
+}
--- a/artifacts/src/main/java/org/dive4elements/river/exports/injector/InjectorConstants.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/injector/InjectorConstants.java	Mon Sep 22 17:11:20 2014 +0200
@@ -4,5 +4,6 @@
 public interface InjectorConstants
 {
     public static final String CURRENT_KM = "currentkm";
+    public static final String PNP = "PNP";
     public static final double GAUGE_EPSILON = 0.1;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/injector/PNPInjector.java	Mon Sep 22 17:11:20 2014 +0200
@@ -0,0 +1,50 @@
+package org.dive4elements.river.exports.injector;
+
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.ContextInjector;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.model.Gauge;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
+import static org.dive4elements.river.exports.injector.InjectorConstants.PNP;
+import static org.dive4elements.river.exports.injector.InjectorConstants.GAUGE_EPSILON;
+
+public class PNPInjector
+implements ContextInjector
+{
+
+    @Override
+    public void setup(Element cfg) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void injectContext(
+        CallContext ctx,
+        Artifact artifact,
+        Document request
+    ) {
+        Object currentKm = ctx.getContextValue(CURRENT_KM);
+        if (currentKm == null) {
+            return;
+        }
+
+        RiverAccess access = new RiverAccess((D4EArtifact)artifact);
+        Double km = (Double)currentKm;
+        Gauge gauge =
+            access.getRiver().determineGaugeByStation(
+                km - GAUGE_EPSILON,
+                km + GAUGE_EPSILON);
+
+        if (gauge == null) {
+            return;
+        }
+        ctx.putContextValue(PNP, gauge.getDatum());
+    }
+
+}
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java	Mon Sep 22 17:11:20 2014 +0200
@@ -496,62 +496,6 @@
     }
 
 
-    /** Open window with gauges discharge curve. */
-    public void newGaugeDischargeCurve(String river, Long gaugeref) {
-        Config config = Config.getInstance();
-
-        final String locale = config.getLocale();
-        final String riv = river;
-        final Long ref = gaugeref;
-        final FLYS   flys = this;
-
-        User user = getCurrentUser();
-
-        if (user == null) {
-            SC.warn(MSG.error_not_logged_in());
-            return;
-        }
-
-        // TODO 1081, this collection needs to be added a mainvalue artifact
-        collectionService.create(locale, user.identifier(),
-            new AsyncCallback<Collection>() {
-                @Override
-                public void onFailure(Throwable caught) {
-                    GWT.log("Could not create new collection.");
-                    SC.warn(getExceptionString(MSG, caught));
-                }
-
-                @Override
-                public void onSuccess(Collection collection) {
-                    GWT.log("Successfully created a new collection.");
-                    final Collection col = collection;
-                    artifactService.createGaugeDischargeCurveArtifact(
-                        col, locale, riv, ref,
-                        new AsyncCallback<Artifact>() {
-                            @Override
-                            public void onFailure(Throwable caught) {
-                                GWT.log("Could not create the new artifact.");
-                                SC.warn(getExceptionString(MSG, caught));
-                            }
-
-                            @Override
-                            public void onSuccess(Artifact artifact) {
-                                GWT.log("Successfully created a new artifact.");
-                                CollectionView view = new CollectionView(flys,
-                                    col, artifact);
-                                workspace.addView(col.identifier(), view);
-
-                                view.addCollectionChangeHandler(getProjectList());
-                                view.addCloseClickHandler(
-                                    new CloseCollectionViewHandler(
-                                        FLYS.this, col.identifier()));
-                                projectList.updateUserCollections();
-                            }
-                    });
-                }
-            });
-    }
-
     public void newSQRelation(String river, int measurementStation) {
         Config config = Config.getInstance();
 
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Mon Sep 22 17:11:20 2014 +0200
@@ -1395,5 +1395,13 @@
     String analyzed_range();
 
     String minfo_type();
+
+    String river();
+
+    String ld_locations();
+
+    String gauge_name();
+
+    String reference_gauge();
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Mon Sep 22 17:11:20 2014 +0200
@@ -731,3 +731,7 @@
 FEDSTATE_KM = Landes-Stationierung
 official_regulation = amtl. Festlegung
 negative_values_not_allowed_for_to=Keine negativen Werte bei 'bis' erlaubt.
+river=Fluss
+ld_locations=Ort
+gauge_name=Pegel
+reference_gauge=Pegelnummer
\ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties	Mon Sep 22 17:11:20 2014 +0200
@@ -672,3 +672,7 @@
 PATH = Path
 official_regulation = Official Regulation
 negative_values_not_allowed_for_to=Negative are not allowed for 'to'.
+river=River
+ld_locations=Location
+gauge_name=Gauge
+reference_gauge=Gaugenumber
\ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactService.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactService.java	Mon Sep 22 17:11:20 2014 +0200
@@ -42,20 +42,6 @@
     ) throws ServerException;
 
     /**
-     * Create a new GaugeDischageCurveArtifact.
-     *
-     * @param collection the collection to add the artifact to.
-     * @param river      the river.
-     * @param gaugeref   reference id of the gauge.
-     */
-    public Artifact createGaugeDischargeCurveArtifact(
-            Collection collection,
-            String locale,
-            String river,
-            Long   gaugeref
-    ) throws ServerException;
-
-    /**
      * Create a new SQRelationArtifact.
      *
      * @param collection the collection to add the artifact to.
@@ -68,19 +54,5 @@
             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 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactServiceAsync.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactServiceAsync.java	Mon Sep 22 17:11:20 2014 +0200
@@ -29,14 +29,6 @@
         Recommendation recommendation,
         AsyncCallback<Artifact> callback);
 
-    public void createGaugeDischargeCurveArtifact(
-        Collection collection,
-        String locale,
-        String river,
-        Long   gaugeref,
-        AsyncCallback<Artifact> callback
-    );
-
     public void createSQRelationArtifact(
         Collection collection,
         String locale,
@@ -44,12 +36,5 @@
         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 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StaticDataPanel.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StaticDataPanel.java	Mon Sep 22 17:11:20 2014 +0200
@@ -57,7 +57,7 @@
             for (DataItem item: items) {
                 HLayout hLayout = new HLayout();
 
-                hLayout.addMember(new Label(item.getLabel()));
+                hLayout.addMember(new Label(MSG.getString(data.getLabel())));
                 hLayout.addMember(new Label(item.getStringValue()));
 
                 vLayout.addMember(hLayout);
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java	Mon Sep 22 17:11:20 2014 +0200
@@ -12,16 +12,32 @@
 import java.util.List;
 
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.util.SC;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.grid.ListGridField;
 import com.smartgwt.client.widgets.grid.ListGridRecord;
 import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
 import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
 
+import org.dive4elements.river.client.client.Config;
 import org.dive4elements.river.client.client.FLYS;
+import org.dive4elements.river.client.client.services.AdvanceService;
+import org.dive4elements.river.client.client.services.AdvanceServiceAsync;
+import org.dive4elements.river.client.client.services.ArtifactService;
+import org.dive4elements.river.client.client.services.ArtifactServiceAsync;
+import org.dive4elements.river.client.client.services.CreateCollectionService;
+import org.dive4elements.river.client.client.services.CreateCollectionServiceAsync;
+import org.dive4elements.river.client.client.services.StepForwardService;
+import org.dive4elements.river.client.client.services.StepForwardServiceAsync;
+import org.dive4elements.river.client.client.ui.CollectionView;
+import org.dive4elements.river.client.shared.model.Artifact;
+import org.dive4elements.river.client.shared.model.Collection;
 import org.dive4elements.river.client.shared.model.Data;
 import org.dive4elements.river.client.shared.model.DataItem;
 import org.dive4elements.river.client.shared.model.DataList;
+import org.dive4elements.river.client.shared.model.DefaultData;
+import org.dive4elements.river.client.shared.model.DefaultDataItem;
 import org.dive4elements.river.client.shared.model.GaugeInfo;
 import org.dive4elements.river.client.shared.model.RiverInfo;
 
@@ -33,6 +49,22 @@
 
     private static final int ABFLUSSTAFEL_COLUMN = 6;
 
+    /** The ArtifactService used to communicate with the Artifact server. */
+    protected ArtifactServiceAsync artifactService =
+        GWT.create(ArtifactService.class);
+
+    /** The StepForwardService used to put data into an existing artifact. */
+    protected StepForwardServiceAsync forwardService =
+        GWT.create(StepForwardService.class);
+
+    /** The ArtifactService used to communicate with the Artifact server. */
+    protected CreateCollectionServiceAsync createCollectionService =
+        GWT.create(CreateCollectionService.class);
+
+    /** The StepForwardService used to put data into an existing artifact. */
+    protected AdvanceServiceAsync advanceService =
+        GWT.create(AdvanceService.class);
+
     public GaugeListGrid(FLYS flys) {
         super(flys);
         //TODO i18n!!!
@@ -312,9 +344,110 @@
      */
     @Override
     public void onRecordClick(RecordClickEvent event) {
-        GaugeRecord gauge = (GaugeRecord)event.getRecord();
-        flys.newGaugeDischargeCurve(gauge.getRiverName(),
-                gauge.getOfficialNumber());
+        final GaugeRecord gauge = (GaugeRecord)event.getRecord();
+        Config config       = Config.getInstance();
+        final String locale = config.getLocale();
+        createCollectionService.create(
+                locale,
+                flys.getCurrentUser().identifier(),
+                new AsyncCallback<Collection>() {
+                    @Override
+                    public void onFailure(Throwable caught) {
+                        GWT.log("Could not create the new collection.");
+                        SC.warn(FLYS.getExceptionString(MSG, caught));
+                    }
+
+                    @Override
+                    public void onSuccess(Collection collection) {
+                        GWT.log("Successfully created a new collection.");
+                        createArtifact(collection, locale, gauge);
+                    }
+                }
+            );
+    }
+
+    private void createArtifact(
+        final Collection collection,
+        final String locale,
+        final GaugeRecord gauge
+    ) {
+        artifactService.create(
+           locale, "gaugedischargecurve", null,
+            new AsyncCallback<Artifact>() {
+                @Override
+                public void onFailure(Throwable caught) {
+                    GWT.log("Could not create the new artifact.");
+                    SC.warn(FLYS.getExceptionString(MSG, caught));
+                }
+
+                @Override
+                public void onSuccess(Artifact artifact) {
+                    GWT.log("Successfully created a new artifact.");
+
+                    DataItem riverItem = new DefaultDataItem(
+                        "river",
+                        "river",
+                        gauge.getRiverName());
+                    Data river = new DefaultData(
+                        "river",
+                        null,
+                        null,
+                        new DataItem[]{riverItem});
+
+                    DataItem refItem = new DefaultDataItem(
+                        "reference_gauge",
+                        "reference_gauge",
+                        gauge.getOfficialNumber().toString());
+                    Data ref = new DefaultData(
+                        "reference_gauge",
+                        null,
+                        null,
+                        new DataItem[]{refItem});
+
+                    DataItem locItem = new DefaultDataItem(
+                        "ld_locations",
+                        "ld_locations",
+                        gauge.getStation().toString());
+                    Data loc = new DefaultData(
+                        "ld_locations",
+                        null,
+                        null,
+                        new DataItem[]{locItem});
+
+                    DataItem nameItem = new DefaultDataItem(
+                        "gauge_name",
+                        "gauge_name",
+                        gauge.getName());
+                    Data name = new DefaultData(
+                        "gauge_name",
+                        null,
+                        null,
+                        new DataItem[]{nameItem});
+
+                    Data[] data = new Data[]{river, ref, loc, name};
+                    forwardService.go(locale, artifact, data,
+                        new AsyncCallback<Artifact>() {
+                        @Override
+                        public void onFailure(Throwable caught) {
+                            GWT.log("Could not feed the artifact.");
+                            SC.warn(caught.getMessage());
+                        }
+
+                        @Override
+                        public void onSuccess(Artifact artifact) {
+                            GWT.log("Successfully feed the artifact.");
+                            CollectionView view = new CollectionView(
+                                flys,
+                                collection,
+                                artifact);
+                            flys.getWorkspace().addView(
+                                collection.identifier(),
+                                view);
+                            view.addArtifactToCollection(artifact);
+                        }
+                    });
+                }
+            });
     }
 
     @Override
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java	Mon Sep 22 17:11:20 2014 +0200
@@ -132,40 +132,6 @@
 
         return sendCreate(serverUrl, locale, create);
     }
-    /**
-     * Creates a new GaugeDischargeCurverArtifact
-     *
-     * @param river the name of the river
-     * @param reference the reference id of the gauge (official number)
-     */
-    public static Artifact createGaugeDischargeCurveArtifact(
-            String serverUrl,
-            String locale,
-            String river,
-            Long   reference)
-    throws ServerException
-    {
-        Document create = ClientProtocolUtils.newCreateDocument(
-                GAUGE_DISCHARGE_CURVE_ARTIFACT);
-
-        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", reference.toString());
-
-        root.appendChild(eriver);
-        root.appendChild(egauge);
-
-        return sendCreate(serverUrl, locale, create);
-    }
 
     /**
      * Sends a create document to the artifact server.
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java	Fri Sep 19 16:29:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java	Mon Sep 22 17:11:20 2014 +0200
@@ -58,71 +58,6 @@
         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
-    {
-        log.info("ArtifactServiceImpl.createGaugeDischargeCurveView");
-        String url  = getServletContext().getInitParameter("server-url");
-
-        Artifact artifact = ArtifactHelper.createGaugeDischargeCurveArtifact(url,
-                locale, river, gaugeRef);
-        if (artifact == null) {
-            return null;
-        }
-        log.info("GaugeDischargeCurveArtifact created successfully");
-
-        CollectionHelper.addArtifact(collection, artifact, url, locale);
-        Artifact mainVArtifact = ArtifactHelper.createMainvalueArtifact(url,
-                locale, river, gaugeRef);
-        if (mainVArtifact == null) {
-            log.info("Failed to create MainValueArtifact");
-            return null;
-        }
-        CollectionHelper.addArtifact(collection, mainVArtifact, url, locale);
-
-        return artifact;
-    }
-
-    /**
-     * Create a new GaugeDischageCurveArtifact
-     *
-     * @param river    the river
-     * @param gaugeref reference id of the gauge
-     */
-    public Artifact createGaugeDischargeCurveArtifact(
-            Collection collection,
-            String locale,
-            String river,
-            Long   gaugeref)
-    throws ServerException
-    {
-        log.info("ArtifactServiceImpl.createGaugeDischargeCurveArtifact");
-        String url  = getServletContext().getInitParameter("server-url");
-
-        Artifact artifact = ArtifactHelper.createGaugeDischargeCurveArtifact(url,
-                locale, river, gaugeref);
-        if (artifact == null) {
-            return null;
-        }
-        log.info("GaugeDischargeCurveArtifact created successfully");
-
-        CollectionHelper.addArtifact(collection, artifact, url, locale);
-
-        return artifact;
-    }
-
     @Override
     public Artifact createSQRelationArtifact(
         Collection collection,

http://dive4elements.wald.intevation.org