# HG changeset patch
# User gernotbelger
# Date 1532014404 -7200
# Node ID 1c8eeaf6031f26559b7cecfd3af082836c7cbc58
# Parent 1b2623dff742b00879fbb947a8644df374b859d4
bundu.wst workflow
diff -r 1b2623dff742 -r 1c8eeaf6031f artifacts/doc/conf/artifacts/bundu.xml
--- a/artifacts/doc/conf/artifacts/bundu.xml Thu Jul 19 17:32:27 2018 +0200
+++ b/artifacts/doc/conf/artifacts/bundu.xml Thu Jul 19 17:33:24 2018 +0200
@@ -326,7 +326,7 @@
-
+
@@ -351,7 +351,7 @@
-
+
@@ -374,17 +374,194 @@
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 1b2623dff742 -r 1c8eeaf6031f artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java Thu Jul 19 17:32:27 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java Thu Jul 19 17:33:24 2018 +0200
@@ -1,32 +1,169 @@
-/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
- * Software engineering by
- * Björnsen Beratende Ingenieure GmbH
- * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
*
* This file is Free Software under the GNU AGPL (>=v3)
* and comes with ABSOLUTELY NO WARRANTY! Check out the
* documentation coming with Dive4Elements River for details.
*/
+
package org.dive4elements.river.artifacts.bundu.bezugswst;
+import java.text.DateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.CallMeta;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.FixRealizingAccess;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.model.ReportFacet;
+import org.dive4elements.river.artifacts.model.WQCKms;
+import org.dive4elements.river.artifacts.model.WQKms;
+import org.dive4elements.river.artifacts.model.fixings.FixOutlierFacet;
+import org.dive4elements.river.artifacts.model.fixings.FixRealizingCalculation;
+import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult;
+import org.dive4elements.river.artifacts.model.fixings.FixReferenceEventsFacet;
+import org.dive4elements.river.artifacts.model.fixings.FixWQCurveFacet;
+import org.dive4elements.river.artifacts.model.fixings.FixWaterlevelFacet;
+import org.dive4elements.river.artifacts.resources.Resources;
import org.dive4elements.river.artifacts.states.DefaultState;
+import org.dive4elements.river.utils.Formatter;
+import org.dive4elements.river.utils.UniqueDateFormatter;
/**
- * @author Domenico Nardi Tironi
+ * State to compute the fixation realizing (vollmer) results.
+ *
+ * @author Raimund Renkert
*/
-public class BezugswstState extends DefaultState {
+public class BezugswstState extends DefaultState implements FacetTypes {
- /// ** The log that is used in this state. */
- // private static Logger log = Logger.getLogger(FlowDepthState.class);
+ /*
+ * TODO: THIS CLASS IS A CLONE OF FixRealizingCompute
+ * +
+ * ++
+ * +++
+ * ++++
+ * +++++
+ * ++++++
+ * +++++++
+ * ++++++++
+ * +++++++++
+ * ++++++++++
+ * +++++++++++
+ * IT does not work here
+ */
- private static final long serialVersionUID = 1L;
+ /** The log used in this class. */
+ private static Logger log = Logger.getLogger(BezugswstState.class);
+
+ public static final String I18N_WQ_CURVE = "fix.vollmer.wq.curve";
+
+ public static final String I18N_WQ_OUTLIER = "fix.vollmer.wq.outliers";
/**
- * From this state can only be continued trivially.
+ * The default constructor that initializes an empty State object.
*/
- @Override
- protected String getUIProvider() {
- return "continue";
+ public BezugswstState() {
}
-}
\ No newline at end of file
+ @Override
+ public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List facets, final Object old) {
+ log.debug("BezugswstState.computeAdvance");
+
+ CalculationResult res;
+
+ final FixRealizingAccess access = new FixRealizingAccess(artifact);
+
+ if (old instanceof CalculationResult) {
+ res = (CalculationResult) old;
+ } else {
+ final FixRealizingCalculation calc = new FixRealizingCalculation(access);
+ res = calc.calculate();
+ }
+
+ if (facets == null) {
+ return res;
+ }
+
+ if (res.getReport().hasProblems()) {
+ facets.add(new ReportFacet());
+ }
+
+ final String id = getID();
+ final CallMeta meta = context.getMeta();
+
+ final FixRealizingResult fixRes = (FixRealizingResult) res.getData();
+ final WQKms[] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0];
+
+ for (int i = 0; i < wqkms.length; i++) {
+ String nameW = null;
+ String nameQ = null;
+
+ if (access.isQ()) {
+ nameQ = wqkms[i].getName();
+ nameW = "W(" + nameQ + ")";
+ } else {
+ nameW = wqkms[i].getName();
+ nameQ = "Q(" + nameW + ")";
+ }
+
+ final Facet wq = new FixWaterlevelFacet(i, FIX_WQ_LS, nameW, ComputeType.ADVANCE, hash, id);
+
+ final Facet w = new FixWaterlevelFacet(i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, id);
+
+ final Facet q = new FixWaterlevelFacet(i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, id);
+ final Facet csFacet = new CrossSectionWaterLineFacet(i, nameW);
+
+ facets.add(wq);
+ facets.add(w);
+ facets.add(q);
+ facets.add(csFacet);
+
+ // XXX: THIS CAN NOT HAPPEN! REMOVE IT!
+ if (wqkms[i] instanceof WQCKms) {
+ final String nameC = nameW.replace("benutzerdefiniert", "benutzerdefiniert [korrigiert]");
+
+ final Facet c = new FixWaterlevelFacet(i, DISCHARGE_LONGITUDINAL_C, nameC);
+
+ facets.add(c);
+ }
+ }
+
+ if (wqkms.length > 0) {
+ final DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy");
+ final DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm");
+
+ final Collection reds = fixRes.getReferenceEventsDates();
+ final UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds);
+
+ int i = 0;
+ for (final Date d : reds) {
+ facets.add(new FixReferenceEventsFacet((1 << 9) | i, FIX_EVENTS, cf.format(d)));
+ i++;
+ }
+
+ facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
+
+ facets.add(new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id));
+
+ facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id));
+ }
+
+ facets.add(new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id));
+
+ facets.add(new FixWQCurveFacet(0, Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE) + " (" + access.getFunction() + ")"));
+
+ if (access.getPreprocessing()) {
+ facets.add(new FixOutlierFacet(0, FIX_OUTLIER, Resources.getMsg(meta, I18N_WQ_OUTLIER, I18N_WQ_OUTLIER)));
+ }
+
+ return res;
+ }
+}
diff -r 1b2623dff742 -r 1c8eeaf6031f artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/CalcChoice.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/CalcChoice.java Thu Jul 19 17:33:24 2018 +0200
@@ -0,0 +1,46 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.bundu.bezugswst;
+
+import java.util.LinkedHashMap;
+
+import org.dive4elements.artifactdatabase.data.StateData;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.CallMeta;
+import org.dive4elements.artifacts.common.utils.XMLUtils;
+import org.dive4elements.river.artifacts.states.RadioSelect;
+import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState;
+import org.w3c.dom.Element;
+
+/**
+ * @author Ingo Weinzierl
+ */
+public class CalcChoice extends RadioSelect {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected final String getUIProvider() {
+ return "radio_panel";
+ }
+
+ @Override
+ protected LinkedHashMap makeEntries(final CallMeta meta, final Artifact artifact) {
+ final LinkedHashMap entries = new LinkedHashMap<>();
+ entries.put("state.bundu.calc.auto", null);
+ entries.put("state.bundu.calc.manual", null);
+ return entries;
+ }
+
+ @Override
+ protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) {
+ return ScenarioTypeState.changeHeaderForCurrentState("state.bundu.wst.calc_choice", data.getName(), cr, context);
+ }
+
+}
\ No newline at end of file
diff -r 1b2623dff742 -r 1c8eeaf6031f artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/LoadQSeriesSelectState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/LoadQSeriesSelectState.java Thu Jul 19 17:32:27 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/LoadQSeriesSelectState.java Thu Jul 19 17:33:24 2018 +0200
@@ -8,7 +8,13 @@
package org.dive4elements.river.artifacts.bundu.bezugswst;
+import org.dive4elements.artifactdatabase.data.StateData;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.common.utils.XMLUtils;
import org.dive4elements.river.artifacts.states.DefaultState;
+import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState;
+import org.w3c.dom.Element;
public class LoadQSeriesSelectState extends DefaultState {
private static final long serialVersionUID = 1L;
@@ -27,4 +33,8 @@
return "bundu.wst.state.load_single_q_series";
}
+ @Override
+ protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) {
+ return ScenarioTypeState.changeHeaderForCurrentState("state.bundu.wst.fix.year_length", data.getName(), cr, context);
+ }
}
\ No newline at end of file
diff -r 1b2623dff742 -r 1c8eeaf6031f artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/MissingVolumeSelect.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/MissingVolumeSelect.java Thu Jul 19 17:33:24 2018 +0200
@@ -0,0 +1,51 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.bundu.bezugswst;
+
+import org.dive4elements.artifactdatabase.data.StateData;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.CallMeta;
+import org.dive4elements.artifacts.common.utils.XMLUtils;
+import org.dive4elements.river.artifacts.resources.Resources;
+import org.dive4elements.river.artifacts.states.DefaultState;
+import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState;
+import org.w3c.dom.Element;
+
+/**
+ * @author Raimund Renkert
+ */
+public class MissingVolumeSelect extends DefaultState {
+
+ /**
+ * The default constructor that initializes an empty State object.
+ */
+ public MissingVolumeSelect() {
+ }
+
+ @Override
+ protected Element[] createItems(final XMLUtils.ElementCreator ec, final Artifact artifact, final String name, final CallContext context) {
+ final CallMeta meta = context.getMeta();
+ final Element[] elements = new Element[1];
+ elements[0] = createItem(ec,
+ new String[] { Resources.getMsg(meta, "state.bundu.wst.missing_volume.select", "state.bundu.wst.missing_volume.select"), "missing_volume" });
+
+ return elements;
+ }
+
+ @Override
+ protected String getUIProvider() {
+ return "fix.missing_volume_panel"; // generalize?
+ }
+
+ @Override
+ protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) {
+ return ScenarioTypeState.changeHeaderForCurrentState("state.bundu.wst.missing_volume", data.getName(), cr, context);
+ }
+}
diff -r 1b2623dff742 -r 1c8eeaf6031f artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FunctionSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FunctionSelect.java Thu Jul 19 17:32:27 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FunctionSelect.java Thu Jul 19 17:33:24 2018 +0200
@@ -10,14 +10,16 @@
import java.util.Collection;
-import org.w3c.dom.Element;
-
+import org.dive4elements.artifactdatabase.data.StateData;
import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.CallContext;
import org.dive4elements.artifacts.common.utils.XMLUtils;
+import org.dive4elements.river.artifacts.bundu.BUNDUArtifact;
import org.dive4elements.river.artifacts.math.fitting.Function;
import org.dive4elements.river.artifacts.math.fitting.FunctionFactory;
import org.dive4elements.river.artifacts.states.DefaultState;
+import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState;
+import org.w3c.dom.Element;
/**
* @author Raimund Renkert
@@ -36,25 +38,31 @@
}
@Override
- protected Element[] createItems(
- XMLUtils.ElementCreator ec,
- Artifact artifact,
- String name,
- CallContext context)
- {
- FunctionFactory ff = FunctionFactory.getInstance();
- Collection fc = ff.getFunctions();
- Element[] functions = new Element[fc.size()];
+ protected Element[] createItems(final XMLUtils.ElementCreator ec, final Artifact artifact, final String name, final CallContext context) {
+ final FunctionFactory ff = FunctionFactory.getInstance();
+ final Collection fc = ff.getFunctions();
+ final Element[] functions = new Element[fc.size()];
int j = 0;
- for (Function f: fc) {
- String n = f.getName();
- String d = f.getDescription();
- functions[j] = createItem(ec, new String[] {d, n});
+ for (final Function f : fc) {
+ final String n = f.getName();
+ final String d = f.getDescription();
+ functions[j] = createItem(ec, new String[] { d, n });
j++;
}
return functions;
}
+
+ @Override
+ protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) {
+ if (artifact instanceof BUNDUArtifact) {
+ if (((BUNDUArtifact) artifact).getCurrentStateId().equals("state.bundu.wst.load.function")) {
+ return ScenarioTypeState.changeHeaderForCurrentState("state.bundu.wst.function", data.getName(), cr, context);
+ }
+
+ }
+ return super.createData(cr, artifact, data, context);
+ }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
diff -r 1b2623dff742 -r 1c8eeaf6031f gwt-client/src/main/java/org/dive4elements/river/client/client/ui/bundu/QSeriesLengthPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/bundu/QSeriesLengthPanel.java Thu Jul 19 17:32:27 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/bundu/QSeriesLengthPanel.java Thu Jul 19 17:33:24 2018 +0200
@@ -82,14 +82,22 @@
}
@Override
- public Canvas createOld(final DataList dataList) {// THIS is a Copy from abstractSingleItemPanel :-(
+ public Canvas createOld(final DataList dataList) {
final List items = dataList.getAll();
final Data years = getData(items, getDatakey());
final DataItem[] yearsItems = years.getItems();
- final String v1 = yearsItems[0].getStringValue().replace(" ", ", ");
+ final StringBuilder builder = new StringBuilder();
+ final int year = Integer.valueOf(yearsItems[0].getStringValue());
+ builder.append(year).append(" ");
- final Label old = new Label(v1);
+ if (year > 1) {
+ builder.append(this.MSG.years_general());
+ } else {
+ builder.append(this.MSG.year());
+ }
+
+ final Label old = new Label(builder.toString());
final HLayout layout = new HLayout();
layout.setWidth("400px");