annotate artifacts/src/main/java/org/dive4elements/river/artifacts/FlowVelocityMeasurementArtifact.java @ 6942:b77a1e804c0a

Slightly better name for flowvelocitymeasurementvaluefacets.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 29 Aug 2013 12:15:05 +0200
parents af13ceeba52a
children 602dac32a996
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
9 package org.dive4elements.river.artifacts;
4452
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import java.util.ArrayList;
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import java.util.List;
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import org.apache.log4j.Logger;
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Document;
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
17 import org.dive4elements.artifactdatabase.state.DefaultOutput;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
18 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
19 import org.dive4elements.artifactdatabase.state.FacetActivity;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
20 import org.dive4elements.artifactdatabase.state.State;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
21 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
22 import org.dive4elements.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
23 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
24 import org.dive4elements.artifacts.common.utils.XMLUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
25 import org.dive4elements.river.model.FlowVelocityMeasurementValue;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
26 import org.dive4elements.river.artifacts.model.minfo.FlowVelocityMeasurementFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
27 import org.dive4elements.river.artifacts.model.minfo.FlowVelocityMeasurementFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
28 import org.dive4elements.river.artifacts.states.StaticState;
4452
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
30 import org.dive4elements.river.artifacts.model.FacetTypes;
4452
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 /** Artefact to access flow velocity measurements. */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 public class FlowVelocityMeasurementArtifact
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
35 extends StaticD4EArtifact
4452
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 implements FacetTypes
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 /** The logger for this class. */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 private static Logger logger =
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 Logger.getLogger(FlowVelocityMeasurementArtifact.class);
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 /** Artifact key name. */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 private static final String NAME = "flowvelocitymeasurement";
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 /** Spawn only inactive facets. */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 static {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 // TODO: Move to configuration.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 FacetActivity.Registry.getInstance()
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 .register(NAME, FacetActivity.INACTIVE);
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 /** Need to give the state an id. */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 public static final String STATIC_STATE_NAME =
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 "state.flowvelocitymeasurement.static";
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 /** One and only state to be in. */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 protected transient State state = null;
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
4464
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
59 protected String DATA_NAME = "ID";
4452
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 /**
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 * Trivial Constructor.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 public FlowVelocityMeasurementArtifact() {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 logger.debug("FlowVelocityMeasurementArtifact.FlowVelocityMeasurementArtifact");
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 /** Get artifact key name. */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 @Override
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 public String getName() {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 return NAME;
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 /** Create a new state with bogus output. */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 protected State spawnState() {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 state = new StaticState(STATIC_STATE_NAME);
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4483
diff changeset
79 List<Facet> fs = getFacets(STATIC_STATE_NAME);
4452
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 DefaultOutput output = new DefaultOutput(
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 "general",
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 "general",
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 "image/png",
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 fs,
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 "chart");
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 state.getOutputs().add(output);
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 return state;
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 /**
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 * Gets called from factory, to set things up.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 @Override
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 public void setup(
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 String identifier,
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 ArtifactFactory factory,
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 Object context,
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 CallMeta callMeta,
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 Document data)
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 logger.debug("FlowVelocityMeasurementArtifact.setup");
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 state = new StaticState(STATIC_STATE_NAME);
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 if (logger.isDebugEnabled()) {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 logger.debug(XMLUtils.toString(data));
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 List<Facet> fs = new ArrayList<Facet>();
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113 String code = getDatacageIDValue(data);
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 if (code != null) {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 // parse code, interact with factory, add real facets.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117 // store relevant parts of code as data.
6942
b77a1e804c0a Slightly better name for flowvelocitymeasurementvaluefacets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
118 // TODO i18n/Name for facet: Include date with dateformatter.
b77a1e804c0a Slightly better name for flowvelocitymeasurementvaluefacets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
119 String name =
b77a1e804c0a Slightly better name for flowvelocitymeasurementvaluefacets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
120 FlowVelocityMeasurementFactory.getFlowVelocityMeasurement(
b77a1e804c0a Slightly better name for flowvelocitymeasurementvaluefacets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
121 Integer.parseInt(code)).getDescription();
4464
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
122 Facet facet = new FlowVelocityMeasurementFacet(
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
123 FLOW_VELOCITY_MEASUREMENT,
6942
b77a1e804c0a Slightly better name for flowvelocitymeasurementvaluefacets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
124 name);
4464
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
125 fs.add(facet);
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4483
diff changeset
126 addFacets(state.getID(), fs);
4464
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
127 addStringData(DATA_NAME, code);
4452
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 spawnState();
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 super.setup(identifier, factory, context, callMeta, data);
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 /**
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136 * Get a list containing the one and only State.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 * @param context ignored.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 * @return list with one and only state.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 @Override
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 protected List<State> getStates(Object context) {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 ArrayList<State> states = new ArrayList<State>();
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 states.add(getState());
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 return states;
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 /**
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 * Get the "current" state (there is but one).
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 * @param cc ignored.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 * @return the "current" (only possible) state.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 @Override
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 public State getCurrentState(Object cc) {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 return getState();
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 /**
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 * Get the only possible state.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161 * @return the state.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 protected State getState() {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164 return getState(null, null);
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 /**
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 * Get the state.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 * @param context ignored.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 * @param stateID ignored.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 * @return the state.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 @Override
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 protected State getState(Object context, String stateID) {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 return (state != null)
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 ? state
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 : spawnState();
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182 /**
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183 * Called via setup. Overridden to avoid cloning all data.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 *
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185 * @param artifact The master-artifact.
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 */
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 @Override
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 protected void initialize(
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 Artifact artifact,
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 Object context,
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 CallMeta meta)
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 {
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 logger.debug("initialize");
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194 }
4464
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
195
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
196
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
197 /** Get the db-unbound flow velocity measurement value with given
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
198 * id. */
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
199 public FlowVelocityMeasurementValue.FastFlowVelocityMeasurementValue
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
200 getFlowVelocityMeasurementValue()
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
201 {
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
202 return FlowVelocityMeasurementFactory.getFlowVelocityMeasurement(
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
203 Integer.parseInt(getDataAsString(DATA_NAME)));
b66285ece774 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4452
diff changeset
204 }
4452
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205 }
bdf321802d3d Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
206 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org