Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/FlowVelocityMeasurementArtifact.java @ 4454:c0a418cbd80c
Register flowvelocity artifact factory.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 08 Nov 2012 16:51:58 +0100 |
parents | bdf321802d3d |
children | b66285ece774 |
rev | line source |
---|---|
4452
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifactdatabase.state.DefaultOutput; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifactdatabase.state.Facet; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifactdatabase.state.FacetActivity; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifactdatabase.state.State; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.Artifact; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.ArtifactFactory; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.CallMeta; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.common.utils.XMLUtils; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.model.FlowVelocityMeasurement; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.artifacts.model.minfo.FlowVelocityMeasurementFacet; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.artifacts.model.minfo.FlowVelocityMeasurementFactory; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.flys.artifacts.states.StaticState; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.flys.artifacts.model.FacetTypes; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 /** Artefact to access flow velocity measurements. */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 public class FlowVelocityMeasurementArtifact |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 extends StaticFLYSArtifact |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 implements FacetTypes |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 /** The logger for this class. */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 private static Logger logger = |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 Logger.getLogger(FlowVelocityMeasurementArtifact.class); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 /** Artifact key name. */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 private static final String NAME = "flowvelocitymeasurement"; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 /** Spawn only inactive facets. */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 static { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 // TODO: Move to configuration. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 FacetActivity.Registry.getInstance() |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 .register(NAME, FacetActivity.INACTIVE); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 } |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 /** Need to give the state an id. */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 public static final String STATIC_STATE_NAME = |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 "state.flowvelocitymeasurement.static"; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 /** One and only state to be in. */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 protected transient State state = null; |
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 /** |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 * Trivial Constructor. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 public FlowVelocityMeasurementArtifact() { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 logger.debug("FlowVelocityMeasurementArtifact.FlowVelocityMeasurementArtifact"); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 } |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 /** Get artifact key name. */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 @Override |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 public String getName() { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 return NAME; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 } |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 |
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 /** Create a new state with bogus output. */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 protected State spawnState() { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 state = new StaticState(STATIC_STATE_NAME); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 List<Facet> fs = facets.get(STATIC_STATE_NAME); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 DefaultOutput output = new DefaultOutput( |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 "general", |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 "general", |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 "image/png", |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 fs, |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 "chart"); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 state.getOutputs().add(output); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 return state; |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 } |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 /** |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 * Gets called from factory, to set things up. |
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 @Override |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 public void setup( |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 String identifier, |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 ArtifactFactory factory, |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 Object context, |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 CallMeta callMeta, |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 Document data) |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 logger.debug("FlowVelocityMeasurementArtifact.setup"); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 state = new StaticState(STATIC_STATE_NAME); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 if (logger.isDebugEnabled()) { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 logger.debug(XMLUtils.toString(data)); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 } |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 List<Facet> fs = new ArrayList<Facet>(); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 String code = getDatacageIDValue(data); |
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 if (code != null) { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 // parse code, interact with factory, add real facets. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 // store relevant parts of code as data. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 } |
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 Facet facet = new FlowVelocityMeasurementFacet( |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 FLOW_VELOCITY_MEASUREMENT, |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 "flowvelocity-name"); |
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 fs.add(facet); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 facets.put(state.getID(), fs); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 spawnState(); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 super.setup(identifier, factory, context, callMeta, data); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 } |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 /** |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 * 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
|
125 * @param context ignored. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 * @return list with one and only state. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 @Override |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 protected List<State> getStates(Object context) { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 ArrayList<State> states = new ArrayList<State>(); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 states.add(getState()); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 return states; |
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 /** |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 * Get the "current" state (there is but one). |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 * @param cc ignored. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 * @return the "current" (only possible) state. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 @Override |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 public State getCurrentState(Object cc) { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 return getState(); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 } |
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 * Get the only possible state. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 * @return the state. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 protected State getState() { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 return getState(null, null); |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 } |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 |
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 * Get the state. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 * @param context ignored. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 * @param stateID ignored. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 * @return the state. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 @Override |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 protected State getState(Object context, String stateID) { |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 return (state != null) |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 ? state |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 : spawnState(); |
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 |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 /** |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 * 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
|
172 * |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 * @param artifact The master-artifact. |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 */ |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
175 @Override |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 protected void initialize( |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 Artifact artifact, |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 Object context, |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 CallMeta meta) |
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 logger.debug("initialize"); |
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 } |
bdf321802d3d
Add FlowVelocityMeasurementArtifact and -facet. Yet dummies.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |