annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java @ 4519:3e1810e72199

Add report facet if calculation had problems.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 14 Nov 2012 17:11:56 +0100
parents 8c51c43e59ca
children 319565a48182
rev   line source
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
2
4190
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
3 import java.math.BigDecimal;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
4 import java.util.ArrayList;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
5 import java.util.List;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
6
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
8
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
9 import org.w3c.dom.Document;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
10
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
11 import de.intevation.artifactdatabase.state.DefaultOutput;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
12 import de.intevation.artifactdatabase.state.Facet;
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
13 import de.intevation.artifactdatabase.data.DefaultStateData;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
14
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.ArtifactFactory;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.CallMeta;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
17
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
18 import de.intevation.artifacts.common.ArtifactNamespaceContext;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
19 import de.intevation.artifacts.common.utils.XMLUtils;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
20
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
21 import de.intevation.flys.artifacts.model.GaugeDischargeCurveFacet;
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
22 import de.intevation.flys.artifacts.resources.Resources;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.artifacts.states.StaticState;
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
24
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
25 import de.intevation.flys.model.Gauge;
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
26 import de.intevation.flys.utils.FLYSUtils;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
27
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
28
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
29 /**
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
30 * Artifact to calculate a discharge curve from a gauge overview info
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
31 *
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
32 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
33 */
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
34 public class GaugeDischargeCurveArtifact
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
35 extends AbstractStaticStateArtifact
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
36 {
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
37
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
38 private static final Logger logger =
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
39 Logger.getLogger(GaugeDischargeCurveArtifact.class);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
40
4027
21cac9482958 Fix xpath for attributes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3991
diff changeset
41 public static final String XPATH_RIVER = "/art:action/art:river/@art:name";
21cac9482958 Fix xpath for attributes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3991
diff changeset
42 public static final String XPATH_GAUGE = "/art:action/art:gauge/@art:reference";
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
43 public static final String NAME = "gaugedischargecurve";
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
44 public static final String STATIC_STATE_NAME = "state.gaugedischargecurve.static";
4159
bbae306fcb4f Set uiprovider on the state
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4034
diff changeset
45 public static final String UIPROVIDER = "gauge_discharge_curve";
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
46 public static final String GAUGE_DISCHARGE_CURVE_FACET =
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
47 "gauge_discharge_curve";
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
48 public static final String GAUGE_DISCHARGE_CURVE_AT_EXPORT_FACET =
4305
8c51c43e59ca Rename gauge_discharge_curve_at_export facet to at
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4190
diff changeset
49 "at";
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
50 public static final String GAUGE_DISCHARGE_CURVE_OUT =
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
51 "discharge_curve";
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
52 public static final String GAUGE_DISCHARGE_CURVE_AT_EXPORT_OUT =
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
53 "computed_dischargecurve_at_export";
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
54
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
55 private Facet atexportfacet;
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
56 private Facet curvefacet;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
57
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
58 /**
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
59 * Setup initializes the data by extracting the river and gauge from
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
60 * the XML Document.
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
61 */
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
62 @Override
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
63 public void setup(
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
64 String identifier,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
65 ArtifactFactory factory,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
66 Object context,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
67 CallMeta callmeta,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
68 Document data)
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
69 {
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
70 logger.debug("GaugeDischargeCurveArtifact.setup");
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
71
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
72 if (logger.isDebugEnabled()) {
4028
b993d328f8b0 Improve debug output
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4027
diff changeset
73 logger.debug("GaugeDischargeCurveArtifact.setup" + XMLUtils.toString(data));
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
74 }
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
75 String gaugeref = XMLUtils.xpathString(data, XPATH_GAUGE,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
76 ArtifactNamespaceContext.INSTANCE);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
77 String rivername = XMLUtils.xpathString(data, XPATH_RIVER,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
78 ArtifactNamespaceContext.INSTANCE);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
79
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
80 addData("river", new DefaultStateData("river",
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
81 Resources.getMsg(callmeta,
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
82 "facet.gauge_discharge_curve.river",
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
83 "Name of the river"),
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
84 "String", rivername));
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
85 addData("reference_gauge", new DefaultStateData("reference_gauge",
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
86 Resources.getMsg(callmeta,
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
87 "facet.gauge_discharge_curve.reference_gauge",
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
88 "Gauge official number"),
4186
eba517419832 Change reference_gauge paremeter to Long
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4185
diff changeset
89 "Long", gaugeref));
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
90
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
91 Gauge gauge = FLYSUtils.getReferenceGauge(this);
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
92 String gaugename = "";
4190
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
93 Double gaugelocation = null;
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
94 if (gauge != null) {
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
95 gaugename = gauge.getName();
4190
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
96 BigDecimal station = gauge.getStation();
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
97 if (station != null) {
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
98 gaugelocation = station.doubleValue();
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
99 }
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
100 }
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
101
4164
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
102 addData("gauge_name", new DefaultStateData("gauge_name",
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
103 Resources.getMsg(callmeta,
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
104 "facet.gauge_discharge_curve.gauge_name",
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
105 "Name of the gauge"),
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
106 "String", gaugename));
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
107
4190
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
108 if (gaugelocation != null) {
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
109 addData("ld_locations", new DefaultStateData("ld_locations",
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
110 Resources.getMsg(callmeta,
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
111 "facet.gauge_discharge_curve.gauge_location",
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
112 "Location of the gauge"),
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
113 "Double", gaugelocation.toString()));
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
114 }
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
115
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
116 String description = Resources.format(callmeta,
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
117 "facet.gauge_discharge_curve.description",
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
118 "Discharge curve on gauge",
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
119 rivername,
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
120 gaugename);
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
121
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
122 List<Facet> fs = new ArrayList<Facet>(2);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
123 curvefacet = new GaugeDischargeCurveFacet(
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
124 GAUGE_DISCHARGE_CURVE_FACET, description);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
125 fs.add(curvefacet);
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
126
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
127 description = Resources.format(callmeta,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
128 "facet.gauge_discharge_curve_at_export.description",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
129 "Discharge curve AT export on gauge",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
130 rivername,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
131 gaugename);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
132 atexportfacet = new GaugeDischargeCurveFacet(
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
133 GAUGE_DISCHARGE_CURVE_AT_EXPORT_FACET, description);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
134 fs.add(atexportfacet);
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
135
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
136 addFacets(STATIC_STATE_NAME, fs);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
137
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
138 super.setup(identifier, factory, context, callmeta, data);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
139 }
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
140
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
141 @Override
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
142 public String getName() {
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
143 return NAME;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
144 }
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
145
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
146 @Override
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
147 protected void initStaticState() {
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
148 StaticState state = new StaticState(STATIC_STATE_NAME);
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
149
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
150 List<Facet> fs = new ArrayList<Facet>(1);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
151 fs.add(curvefacet);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
152
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
153 DefaultOutput output = new DefaultOutput(
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
154 GAUGE_DISCHARGE_CURVE_OUT,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
155 "output.discharge_curve",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
156 "image/png",
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
157 fs,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
158 "chart");
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
159 state.addOutput(output);
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
160
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
161 fs = new ArrayList<Facet>(1);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
162 fs.add(atexportfacet);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
163 output = new DefaultOutput(
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
164 GAUGE_DISCHARGE_CURVE_AT_EXPORT_OUT,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
165 "output.computed_dischargecurve_at_export",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
166 "text/plain",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
167 fs,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
168 "export");
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
169 state.addOutput(output);
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
170
4159
bbae306fcb4f Set uiprovider on the state
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4034
diff changeset
171 state.setUIProvider(UIPROVIDER);
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
172 setStaticState(state);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
173 }
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
174 }

http://dive4elements.wald.intevation.org