annotate artifacts/src/main/java/org/dive4elements/river/artifacts/MapArtifact.java @ 9726:0a5239a1e46e 3.2.x

Upgrade to Log4j 2
author Tom Gottfried <tom@intevation.de>
date Wed, 02 Mar 2022 10:26:50 +0100
parents 5e38e2924c07
children
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
9 package org.dive4elements.river.artifacts;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
11 import org.dive4elements.artifactdatabase.ProtocolUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
12 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
13 import org.dive4elements.artifactdatabase.state.Output;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
14 import org.dive4elements.artifactdatabase.state.State;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
15 import org.dive4elements.artifactdatabase.state.StateEngine;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
16 import org.dive4elements.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
17 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
18 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
19 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
20 import org.dive4elements.river.artifacts.RiverAxisArtifact.RiverAxisState;
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
21 import org.dive4elements.river.artifacts.context.RiverContext;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
22 import org.dive4elements.river.artifacts.model.map.WMSDBLayerFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
23 import org.dive4elements.river.artifacts.states.DefaultState;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
24 import org.dive4elements.river.model.River;
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
25 import org.dive4elements.river.utils.RiverUtils;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
26 import org.dive4elements.river.utils.MapUtils;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4841
diff changeset
28 import java.util.List;
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4841
diff changeset
29
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
30 import org.apache.logging.log4j.Logger;
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
31 import org.apache.logging.log4j.LogManager;
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4841
diff changeset
32 import org.w3c.dom.Document;
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4841
diff changeset
33 import org.w3c.dom.Element;
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
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
36 public class MapArtifact extends D4EArtifact {
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
38 private static final Logger log =
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
39 LogManager.getLogger(MapArtifact.class);
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 @Override
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 public void setup(
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 String identifier,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 ArtifactFactory factory,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 Object context,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 CallMeta callmeta,
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7747
diff changeset
47 Document data,
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7747
diff changeset
48 List<Class> loadFacets)
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
50 log.debug("MapArtifact.setup");
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 this.identifier = identifier;
2109
60e3bf470c5b Changed the MapArtifact name to 'new_map'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2089
diff changeset
52 name = "new_map";
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 List<State> states = getStates(context);
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55
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
56 setCurrentState(states.get(0));
7747
cfa7e2164f87 Partial fix issue1532: at least clone artifacts data when cloning
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
57
cfa7e2164f87 Partial fix issue1532: at least clone artifacts data when cloning
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
58 // Needed if cloning another artifact.
cfa7e2164f87 Partial fix issue1532: at least clone artifacts data when cloning
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
59 super.handleInitModel(data, context, callmeta);
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 @Override
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3083
diff changeset
64 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
65 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
66 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
67 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
68 ) {
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 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
70 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
71
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 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
73 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
74 "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
75 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
76 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
77 }
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
78
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
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 /**
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 * 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
82 */
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3083
diff changeset
83 @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
84 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
85 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
86 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
87 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
88 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
89 {
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 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
91
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
92 RiverContext flysContext = RiverUtils.getFlysContext(context);
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
93 StateEngine engine = (StateEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
94 RiverContext.STATE_ENGINE_KEY);
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
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) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
97 log.debug("Append output modes for state: " + stateId);
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
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()) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
102 log.debug("-> No output modes for this 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
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
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4049
diff changeset
106 List<Facet> fs = getFacets(stateId);
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
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()) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
109 log.debug("No facets for previous state found.");
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
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
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
113 log.debug("Found " + fs.size() + " facets in previous states.");
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
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) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
125 log.debug(
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
126 "Append output modes for current state: "
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
127 + cur.getID());
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
128
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4049
diff changeset
129 List<Facet> fs = getFacets(cur.getID());
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
130
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 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
132 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
133
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
134 log.debug("Found " + fs.size() + " current facets.");
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
135 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
136 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
137 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
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 }
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 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
141 log.debug("No facets found for the current 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
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 }
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 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
147 // 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
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 }
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
150
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 public static class MapState extends RiverAxisState {
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 @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
154 public Object computeAdvance(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
155 D4EArtifact artifact,
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 String hash,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 CallContext context,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 List<Facet> facets,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 Object old)
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
161 log.debug("MapState.computeAdvance");
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
162
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
163 this.artifact = artifact;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 String type = getFacetType();
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 WMSDBLayerFacet facet = new WMSDBLayerFacet(
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 0,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 type,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 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
171 ComputeType.ADVANCE,
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 getID(), hash,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 getUrl());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174
5272
da3101abc9da Use river name as layername in new map projects.
Raimund Renkert <rrenkert@intevation.de>
parents: 4864
diff changeset
175 String name = artifact.getDataAsString("river");
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4841
diff changeset
176
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 facet.addLayer(name);
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3555
diff changeset
178 facet.setExtent(getExtent(false));
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3555
diff changeset
179 facet.setOriginalExtent(getExtent(true));
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 facet.setSrid(getSrid());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 facet.setData(getDataString());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 facet.setFilter(getFilter());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 facet.setGeometryType(getGeometryType());
4841
ad0990a82ab8 Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents: 4497
diff changeset
184 facet.setConnection(MapUtils.getConnection());
ad0990a82ab8 Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents: 4497
diff changeset
185 facet.setConnectionType(MapUtils.getConnectionType());
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 facet.setLabelItem(getLabelItem());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 facets.add(facet);
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 return null;
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
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 @Override
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 public int getRiverId() {
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
195 River r = RiverUtils.getRiver(artifact);
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 int riverId = r.getId();
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 return riverId;
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 }
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 }
3083
4bd3d8bbb60c Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2109
diff changeset
202 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org