annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java @ 4047:3dc26ec2558d

Removed dead code
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 06 Oct 2012 11:08:24 +0200
parents 2fdbe78a8fc2
children 8e66293c5369
rev   line source
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 import java.util.List;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 import org.w3c.dom.Document;
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
8 import org.w3c.dom.Element;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 import de.intevation.artifacts.ArtifactFactory;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 import de.intevation.artifacts.CallMeta;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 import de.intevation.artifacts.CallContext;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
14 import de.intevation.artifacts.common.utils.XMLUtils;
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
15 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
16 import de.intevation.artifacts.common.ArtifactNamespaceContext;
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
17
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
18 import de.intevation.artifactdatabase.ProtocolUtils;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 import de.intevation.artifactdatabase.state.Facet;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 import de.intevation.artifactdatabase.state.State;
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
21 import de.intevation.artifactdatabase.state.StateEngine;
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
22 import de.intevation.artifactdatabase.state.Output;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 import de.intevation.flys.model.River;
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
25 import de.intevation.flys.utils.FLYSUtils;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
27 import de.intevation.flys.artifacts.RiverAxisArtifact.RiverAxisState;
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
28 import de.intevation.flys.artifacts.states.DefaultState;
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
29 import de.intevation.flys.artifacts.context.FLYSContext;
3302
453d2d0c4258 Organized and added missing imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3193
diff changeset
30 import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
33 public class MapArtifact extends FLYSArtifact {
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 private static final Logger logger =
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 Logger.getLogger(MapArtifact.class);
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 @Override
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 public void setup(
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 String identifier,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 ArtifactFactory factory,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 Object context,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 CallMeta callmeta,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 Document data)
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 {
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 logger.debug("MapArtifact.setup");
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 this.identifier = identifier;
2109
60e3bf470c5b Changed the MapArtifact name to 'new_map'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2089
diff changeset
48 name = "new_map";
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
50 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
52 List<State> states = getStates(context);
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
54 setCurrentState(states.get(0));
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 }
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 @Override
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3083
diff changeset
59 protected void appendBackgroundActivity(
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
60 ElementCreator cr,
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
61 Element root,
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
62 CallContext context
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
63 ) {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
64 Element inBackground = cr.create("background-processing");
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
65 root.appendChild(inBackground);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
66
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
67 cr.addAttr(
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
68 inBackground,
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
69 "value",
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
70 String.valueOf(context.isInBackground()),
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
71 true);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
72 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
73
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
74
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
75 /**
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
76 * Append output mode nodes to a document.
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
77 */
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3083
diff changeset
78 @Override
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
79 protected void appendOutputModes(
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
80 Document doc,
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
81 Element outs,
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
82 CallContext context,
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
83 String uuid)
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
84 {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
85 List<String> stateIds = getPreviousStateIds();
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
86
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
87 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
88 doc,
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
89 ArtifactNamespaceContext.NAMESPACE_URI,
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
90 ArtifactNamespaceContext.NAMESPACE_PREFIX);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
91
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
92 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
93 StateEngine engine = (StateEngine) flysContext.get(
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
94 FLYSContext.STATE_ENGINE_KEY);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
95
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
96 for (String stateId: stateIds) {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
97 logger.debug("Append output modes for state: " + stateId);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
98 DefaultState state = (DefaultState) engine.getState(stateId);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
99
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
100 List<Output> list = state.getOutputs();
3555
b1912514e0f5 s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3302
diff changeset
101 if (list == null || list.isEmpty()) {
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
102 logger.debug("-> No output modes for this state.");
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
103 continue;
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
104 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
105
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
106 List<Facet> fs = facets.get(stateId);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
107
3555
b1912514e0f5 s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3302
diff changeset
108 if (fs == null || fs.isEmpty()) {
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
109 logger.debug("No facets for previous state found.");
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
110 continue;
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
111 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
112
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
113 logger.debug("Found " + fs.size() + " facets in previous states.");
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
114
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
115 List<Output> generated = generateOutputs(list, fs);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
116
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
117 ProtocolUtils.appendOutputModes(doc, outs, generated);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
118 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
119
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
120 try {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
121 DefaultState cur = (DefaultState) getCurrentState(context);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
122 if (cur.validate(this)) {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
123 List<Output> list = cur.getOutputs();
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
124 if (list != null && list.size() > 0) {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
125 logger.debug(
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
126 "Append output modes for current state: " + cur.getID());
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
127
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
128 List<Facet> fs = facets.get(cur.getID());
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
129
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
130 if (fs != null && fs.size() > 0) {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
131 List<Output> generated = generateOutputs(list, fs);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
132
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
133 logger.debug("Found " + fs.size() + " current facets.");
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
134 if (!generated.isEmpty()) {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
135 ProtocolUtils.appendOutputModes(
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
136 doc, outs, generated);
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
137 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
138 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
139 else {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
140 logger.debug("No facets found for the current state.");
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
141 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
142 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
143 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
144 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
145 catch (IllegalArgumentException iae) {
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
146 // state is not valid, so we do not append its outputs.
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
147 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
148 }
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
149
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 public static class MapState extends RiverAxisState {
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 @Override
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
153 public Object computeAdvance(
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 FLYSArtifact artifact,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 String hash,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 CallContext context,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 List<Facet> facets,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 Object old)
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 {
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
160 logger.debug("MapState.computeAdvance");
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
161
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
162 this.artifact = artifact;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 String type = getFacetType();
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 WMSDBLayerFacet facet = new WMSDBLayerFacet(
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 0,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 type,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 getTitle(context.getMeta()),
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
170 ComputeType.ADVANCE,
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 getID(), hash,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 getUrl());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 String name = type + "-" + artifact.identifier();
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 facet.addLayer(name);
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3555
diff changeset
177 facet.setExtent(getExtent(false));
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3555
diff changeset
178 facet.setOriginalExtent(getExtent(true));
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 facet.setSrid(getSrid());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 facet.setData(getDataString());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 facet.setFilter(getFilter());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 facet.setGeometryType(getGeometryType());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 facet.setConnection(getConnection());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 facet.setConnectionType(getConnectionType());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 facet.setLabelItem(getLabelItem());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 facets.add(facet);
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 return null;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 }
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 @Override
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 public int getRiverId() {
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 River r = FLYSUtils.getRiver(artifact);
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 int riverId = r.getId();
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 return riverId;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 }
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 }
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 }
3083
4bd3d8bbb60c Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2109
diff changeset
201 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org