annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/MINFOArtifact.java @ 3180:4d5b15049ac2

Fix ChangeLog encoding flys-artifacts/trunk@4795 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 26 Jun 2012 10:45:33 +0000
parents b60751cfdd6c
children 2f922be407ea
rev   line source
2693
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import de.intevation.artifactdatabase.ProtocolUtils;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import de.intevation.artifactdatabase.state.Output;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import de.intevation.artifactdatabase.state.State;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import de.intevation.artifactdatabase.state.StateEngine;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import de.intevation.artifactdatabase.transition.TransitionEngine;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import de.intevation.artifacts.CallContext;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import de.intevation.artifacts.Message;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import de.intevation.artifacts.common.ArtifactNamespaceContext;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import de.intevation.artifacts.common.utils.XMLUtils;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.artifacts.context.FLYSContext;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import de.intevation.flys.artifacts.model.CalculationMessage;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.artifacts.model.FacetTypes;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import de.intevation.flys.artifacts.states.DefaultState;
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
26 import de.intevation.flys.artifacts.states.SoundingsSelect;
2693
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 import de.intevation.flys.utils.FLYSUtils;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
30 import gnu.trove.TIntArrayList;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
31
2693
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 import java.util.LinkedList;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 import java.util.List;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 import org.apache.log4j.Logger;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 import org.w3c.dom.Document;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 import org.w3c.dom.Element;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 import org.w3c.dom.Node;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 /**
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 * The default MINFO artifact.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 *
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 public class MINFOArtifact
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 extends FLYSArtifact
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 implements FacetTypes {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 /** The logger for this class. */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 private static Logger logger = Logger.getLogger(MINFOArtifact.class);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 /** The name of the artifact. */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 public static final String ARTIFACT_NAME = "minfo";
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 /** XPath */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 public static final String XPATH_STATIC_UI ="/art:result/art:ui/art:static";
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 /**
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 * The default constructor.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 public MINFOArtifact() {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 /**
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 * This method returns a description of this artifact.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 *
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 * @param data Some data.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 * @param context The CallContext.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 *
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 * @return the description of this artifact.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 public Document describe(Document data, CallContext context) {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 logger.debug("Describe: the current state is: " + getCurrentStateId());
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 StateEngine stateEngine = (StateEngine) flysContext.get(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 FLYSContext.STATE_ENGINE_KEY);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 TransitionEngine transitionEngine = (TransitionEngine) flysContext.get(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 FLYSContext.TRANSITION_ENGINE_KEY);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 List<State> reachable = transitionEngine.getReachableStates(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 this, getCurrentState(context), stateEngine);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 Document description = XMLUtils.newDocument();
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 description,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 ArtifactNamespaceContext.NAMESPACE_URI,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 ArtifactNamespaceContext.NAMESPACE_PREFIX);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 Element root = ProtocolUtils.createRootNode(creator);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 description.appendChild(root);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 State current = getCurrentState(context);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 ProtocolUtils.appendState(creator, root, current);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 ProtocolUtils.appendReachableStates(creator, root, reachable);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 appendBackgroundActivity(creator, root, context);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 Element name = ProtocolUtils.createArtNode(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 creator, "name",
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 new String[] { "value" },
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 new String[] { getName() });
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 Element ui = ProtocolUtils.createArtNode(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 creator, "ui", null, null);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 Element staticUI = ProtocolUtils.createArtNode(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 creator, "static", null, null);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 Element outs = ProtocolUtils.createArtNode(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 creator, "outputmodes", null, null);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 appendOutputModes(description, outs, context, identifier());
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 appendStaticUI(description, staticUI, context, identifier());
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 Element dynamic = current.describe(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 this,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 description,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 root,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 context,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 identifier());
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 if (dynamic != null) {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 ui.appendChild(dynamic);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 ui.appendChild(staticUI);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 root.appendChild(name);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 root.appendChild(ui);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 root.appendChild(outs);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 return description;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 /**
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 * Returns the name of the concrete artifact.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 *
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 * @return the name of the concrete artifact.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 public String getName() {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 return ARTIFACT_NAME;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 protected static void appendBackgroundActivity(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 ElementCreator cr,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 Element root,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 CallContext context
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 ) {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 Element inBackground = cr.create("background-processing");
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 root.appendChild(inBackground);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 cr.addAttr(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 inBackground,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 "value",
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 String.valueOf(context.isInBackground()),
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 true);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 LinkedList<Message> messages = context.getBackgroundMessages();
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 if (messages == null) {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 return;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 CalculationMessage message = (CalculationMessage) messages.getLast();
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 cr.addAttr(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 inBackground,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 "steps",
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177 String.valueOf(message.getSteps()),
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 true);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 cr.addAttr(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 inBackground,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 "currentStep",
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 String.valueOf(message.getCurrentStep()),
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 true);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 inBackground.setTextContent(message.getMessage());
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 /**
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 * Append output mode nodes to a document.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 protected void appendOutputModes(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 Document doc,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195 Element outs,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 CallContext context,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 String uuid)
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 List<Output> generated = getOutputs(context);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 logger.debug("This Artifact has " + generated.size() + " Outputs.");
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 ProtocolUtils.appendOutputModes(doc, outs, generated);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206 /**
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207 * This method appends the static data - that has already been inserted by
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208 * the user - to the static node of the DESCRIBE document.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 *
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 * @param doc The document.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 * @param ui The root node.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 * @param context The CallContext.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213 * @param uuid The identifier of the artifact.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 protected void appendStaticUI(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 Document doc,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 Node ui,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 CallContext context,
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 String uuid)
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220 {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 List<String> stateIds = getPreviousStateIds();
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
224 StateEngine engine = (StateEngine) flysContext.get(
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
225 FLYSContext.STATE_ENGINE_KEY);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
226
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
227 for (String stateId: stateIds) {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228 logger.debug("Append static data for state: " + stateId);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229 DefaultState state = (DefaultState) engine.getState(stateId);
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
230
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
231 ui.appendChild(state.describeStatic(this, doc, ui, context, uuid));
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
233 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
235
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236 /**
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237 * Determines Facets initial disposition regarding activity (think of
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
238 * selection in Client ThemeList GUI). This will be checked one time
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 * when the facet enters a collections describe document.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 *
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
241 * @param facetName name of the facet.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
242 * @param index index of the facet.
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
243 * @return 0 if not active
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 */
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
245 @Override
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246 public int getInitialFacetActivity(String outputName, String facetName, int index) {
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247 logger.warn("MINFOArtifact.getInitialFacetActivity: not implemented!");
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
248 return 1;
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 }
2702
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
250
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
251
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
252 public int[] getMainChannels() {
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
253 String data = getDataAsString("main.channel");
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
254
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
255 if (data == null) {
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
256 logger.warn("No 'main.channel' parameter specified!");
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
257 return null;
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
258 }
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
259
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
260 return FLYSUtils.intArrayFromString(data);
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
261 }
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
262
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
263
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
264 public int[] getTotalChannels() {
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
265 String data = getDataAsString("total.channel");
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
266
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
267 if (data == null) {
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
268 logger.warn("No 'total.channel' parameter specified!");
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
269 return null;
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
270 }
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
271
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
272 return FLYSUtils.intArrayFromString(data);
4c00cf83fff1 Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2693
diff changeset
273 }
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
274
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
275
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
276 public int[] getBedHeightSingleIDs() {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
277 String data = getDataAsString("soundings");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
278
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
279 if (data == null) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
280 logger.warn("No 'soundings' parameter specified!");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
281 return null;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
282 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
283
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
284 String[] parts = data.split(";");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
285
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
286 TIntArrayList ids = new TIntArrayList();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
287
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
288 for (String part: parts) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
289 if (part.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
290 String tmp = part.replace(SoundingsSelect.PREFIX_SINGLE, "");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
291
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
292 try {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
293 ids.add(Integer.parseInt(tmp));
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
294 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
295 catch (NumberFormatException nfe) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
296 logger.warn("Cannot parse int from string: '" + tmp + "'");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
297 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
298 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
299 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
300
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
301 return ids.toNativeArray();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
302 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
303
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
304
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
305 public int[] getBedHeightEpochIDs() {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
306 String data = getDataAsString("soundings");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
307
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
308 if (data == null) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
309 logger.warn("No 'soundings' parameter specified!");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
310 return null;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
311 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
312
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
313 String[] parts = data.split(";");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
314
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
315 TIntArrayList ids = new TIntArrayList();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
316
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
317 for (String part: parts) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
318 if (part.indexOf(SoundingsSelect.PREFIX_EPOCH) >= 0) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
319 String tmp = part.replace(SoundingsSelect.PREFIX_EPOCH, "");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
320
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
321 try {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
322 ids.add(Integer.parseInt(tmp));
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
323 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
324 catch (NumberFormatException nfe) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
325 logger.warn("Cannot parse int from string: '" + tmp + "'");
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
326 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
327 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
328 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
329
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
330 return ids.toNativeArray();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2702
diff changeset
331 }
2693
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
332 }
edaa2297aea3 Started module MINFO (MINFOArtifact, state to choose calculations, configurations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
333 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org