annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 1065:193c49b7f6a3

Minor changes to stub MainValuesArtifact. flys-artifacts/trunk@2545 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 24 Aug 2011 08:42:31 +0000
parents b1b0a0b61845
children 80aecb01d79a
rev   line source
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4 import java.util.List;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 import org.apache.log4j.Logger;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import org.w3c.dom.Document;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import org.w3c.dom.Element;
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
10 import org.w3c.dom.Node;
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
12 import de.intevation.artifacts.Artifact;
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import de.intevation.artifacts.ArtifactFactory;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import de.intevation.artifacts.ArtifactNamespaceContext;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.CallContext;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.CallMeta;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import de.intevation.flys.artifacts.context.FLYSContext;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.artifacts.states.DefaultState;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import de.intevation.artifactdatabase.ProtocolUtils;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import de.intevation.artifactdatabase.state.Facet;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 import de.intevation.artifactdatabase.state.DefaultOutput;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 import de.intevation.artifactdatabase.state.Output;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 import de.intevation.artifacts.common.utils.XMLUtils;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 /**
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 * Artifact to access names of Points Of Interest along a segment of a river.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 */
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 public class MainValuesArtifact
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 extends StaticFLYSArtifact
1059
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1051
diff changeset
32 {
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 /** The logger for this class. */
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
34 private static Logger logger = Logger.getLogger(MainValuesArtifact.class);
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 /** The name of the artifact. */
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
37 public static final String ARTIFACT_NAME = "mainvalue";
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 public MainValuesArtifact() {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 logger.warn("MainValuesArtifact.MainValuesartifact()");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 /**
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 * Gets called from factory, to set things up.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 * Do nothing.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 */
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 @Override
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 public void setup(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 String identifier,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 ArtifactFactory factory,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 Object context,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 CallMeta callMeta,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 Document data)
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 logger.warn("MainValuesArtifact.setup");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 /**
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 * Create the description of this MainValuesArtiface-instance.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 *
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 * @param data some data.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 * @param context the CallContext.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 *
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 * @return the description of this artifact.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 */
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 @Override
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 public Document describe(Document data, CallContext context) {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 logger.debug("MainValuesArtifact.describe");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 if (logger.isDebugEnabled()) {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 dumpArtifact();
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 FLYSContext flysContext = getFlysContext(context);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 Document description = XMLUtils.newDocument();
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 description,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 ArtifactNamespaceContext.NAMESPACE_URI,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 ArtifactNamespaceContext.NAMESPACE_PREFIX);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 Element root = ProtocolUtils.createRootNode(creator);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 description.appendChild(root);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 Element name = ProtocolUtils.createArtNode(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 creator, "name",
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 new String[] { "value" },
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 new String[] { getName() });
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 Element outs = ProtocolUtils.createArtNode(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 creator, "outputmodes", null, null);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 appendOutputModes(description, outs, context);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 root.appendChild(name);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 root.appendChild(outs);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 return description;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 /**
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 * Append outputmode elements to given document.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 *
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 * @param doc Document to add outputmodes to.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 * @param outs Element to add outputmode elements to.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 * @param context The given CallContext (mostly for internationalization).
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 */
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 protected void appendOutputModes(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 Document doc,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 Element outs,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113 CallContext context)
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114 {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 // TODO outputmodes
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117 doc,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 ArtifactNamespaceContext.NAMESPACE_URI,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 ArtifactNamespaceContext.NAMESPACE_PREFIX);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121 FLYSContext flysContext = getFlysContext(context);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 for (int i = 0; i < 1; i++) {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 logger.debug("Append output mode.");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 // TODO create outputs.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 /*
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 List<Output> list = state.getOutputs();
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 if (list == null || list.size() == 0) {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 logger.debug("-> No output modes for this state.");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 continue;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 }*/
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133 List<Facet> fs = new ArrayList<Facet>();
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134 DefaultOutput mainValuesOutput = new DefaultOutput(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 "discharge_curve", "output.discharge_curve", "image/png",
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136 fs,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 "chart");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 // Create facets.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 if (fs == null || fs.size() == 0) {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 logger.debug("No facets found.");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 continue;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 logger.debug("Built stateless facets.");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 // TODO remember issues here.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 //List<Output> generated = generateOutputs(list, fs);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 //ProtocolUtils.appendOutputModes(doc, outs, generated);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 try {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 DefaultState cur = (DefaultState) getCurrentState(context);
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1047
diff changeset
152 if (cur.validate(this)) {
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 List<Output> list = cur.getOutputs();
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 if (list != null && list.size() > 0) {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 logger.debug(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156 "Append output modes for state: " + cur.getID());
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 List<Facet> fs = facets.get(cur.getID());
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 if (fs != null && fs.size() > 0) {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 List<Output> generated = generateOutputs(list, fs);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 logger.debug("Found " + fs.size() + " current facets.");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 if (!generated.isEmpty()) {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164 ProtocolUtils.appendOutputModes(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165 doc, outs, generated);
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 else{
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 logger.debug("Cannot append output to generated document.");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 else {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 logger.debug("No facets found for the current state.");
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 catch (IllegalArgumentException iae) {
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 // state is not valid, so we do not append its outputs.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 }
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
181
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
182
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
183 /* FACET IMPLEMENTATION */
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
184 class MainValuesFacet implements Facet {
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
185
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
186 // TODO implement; what is index used for?
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
187 /**
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
188 * Returns the index of this facet.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
189 *
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
190 * @return the index of this facet.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
191 */
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
192 public int getIndex() {
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
193 return 0;
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
194 }
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
195
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
196
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
197 /**
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
198 * Returns the name of this facet.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
199 *
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
200 * @return the name of this facet.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
201 */
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
202 public String getName() {
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
203 // TODO define, static
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
204 return "facet.mainvalue";
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
205 }
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
206
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
207
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
208 /**
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
209 * Returns the description of this facet.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
210 *
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
211 * @return the description of this facet.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
212 */
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
213 public String getDescription() {
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
214 return null;
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
215 }
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
216
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
217
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
218 /**
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
219 * Returns the data this facet requires.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
220 *
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
221 * @param artifact The owner artifact.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
222 * @param context The CallContext.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
223 *
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
224 * @return the data.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
225 */
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
226 public Object getData(Artifact artifact, CallContext context) {
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
227 return null;
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
228 }
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
229
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
230
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
231 /**
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
232 * Write the internal representation of a facet to a node.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
233 *
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
234 * @param doc A Document.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
235 *
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
236 * @return the representation as Node.
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
237 */
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
238 public Node toXML(Document doc) {
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
239 return null;
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
240 }
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
241
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
242 public MainValuesFacet deepCopy() {
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
243 return null;
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
244 }
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
245 }
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
246
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
247 }

http://dive4elements.wald.intevation.org