Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/ScenarioSelect.java @ 8914:e3519c3e7a0a
Workflow for SINFO-Transport bodies heights inclduing winfo calculation
author | gernotbelger |
---|---|
date | Tue, 27 Feb 2018 18:06:52 +0100 |
parents | 0beb34d55630 |
children | 2323d005f9a5 0a5239a1e46e |
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:
5312
diff
changeset
|
9 package org.dive4elements.river.artifacts.states; |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5312
diff
changeset
|
11 import org.dive4elements.artifactdatabase.ProtocolUtils; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5312
diff
changeset
|
12 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5312
diff
changeset
|
13 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5312
diff
changeset
|
14 import org.dive4elements.artifacts.CallMeta; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5312
diff
changeset
|
15 import org.dive4elements.artifacts.common.utils.FileTools; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5312
diff
changeset
|
16 import org.dive4elements.artifacts.common.utils.XMLUtils; |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
17 import org.dive4elements.river.artifacts.D4EArtifact; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5312
diff
changeset
|
18 import org.dive4elements.river.artifacts.resources.Resources; |
5865
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
19 import org.dive4elements.river.utils.RiverUtils; |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
20 |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
21 import java.io.File; |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
22 |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import org.apache.log4j.Logger; |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import org.w3c.dom.Element; |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 /** |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 */ |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 public class ScenarioSelect extends DefaultState { |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
31 /** The log that is used in this class.*/ |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
32 private static Logger log = Logger.getLogger(ScenarioSelect.class); |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
1064
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
35 public static final String FIELD_MODE = "scenario"; |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 public static final String SCENARIO_CURRENT = "scenario.current"; |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 public static final String SCENARIO_POTENTIEL = "scenario.potentiel"; |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 public static final String SCENARIO_SCENRAIO = "scenario.scenario"; |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 public static final String[] SCENARIOS = { |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 SCENARIO_CURRENT, |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 SCENARIO_POTENTIEL, |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 SCENARIO_SCENRAIO }; |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
1064
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
47 @Override |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
48 protected String getUIProvider() { |
5312
2c1045a1e3fe
Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
49 return ""; |
1064
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
50 } |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
51 |
1159
fb5a7ff9feb8
Suppress the GeoJSON string for the FloodMap creation to be included in the static DESCRIBE part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1064
diff
changeset
|
52 @Override |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 protected Element[] createItems( |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 XMLUtils.ElementCreator cr, |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 Artifact artifact, |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 String name, |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 CallContext context) |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 { |
1064
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
59 CallMeta meta = context.getMeta(); |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
1064
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
61 if (name.equals(FIELD_MODE)) { |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
62 Element[] scenarios = new Element[SCENARIOS.length]; |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
63 |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
64 int i = 0; |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
65 |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
66 for (String scenario: SCENARIOS) { |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
67 scenarios[i++] = createItem( |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
68 cr, new String[] { |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
69 Resources.getMsg(meta, scenario, scenario), |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
70 scenario |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
71 }); |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
72 } |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
73 |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
74 return scenarios; |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 } |
1064
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
76 else { |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
77 D4EArtifact flys = (D4EArtifact) artifact; |
1064
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
78 String data = flys.getDataAsString(name); |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 |
1064
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
80 return new Element[] { createItem( |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
81 cr, |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
82 new String[] { |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
83 Resources.getMsg(meta, name, name), |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
84 data |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
85 } |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
86 )}; |
13784581ab0c
Moved the input of user defined barriers for the floodmap to an earlier state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1050
diff
changeset
|
87 } |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 } |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
91 @Override |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) { |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 Element item = ProtocolUtils.createArtNode(cr, "item", null, null); |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 Element label = ProtocolUtils.createArtNode(cr, "label", null, null); |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 Element value = ProtocolUtils.createArtNode(cr, "value", null, null); |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 String[] arr = (String[]) obj; |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 label.setTextContent(arr[0]); |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 value.setTextContent(arr[1]); |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 item.appendChild(label); |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 item.appendChild(value); |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 return item; |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 } |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
107 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
108 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
109 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
110 @Override |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
111 public void endOfLife(Artifact artifact, Object callContext) { |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
112 super.endOfLife(artifact, callContext); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
113 log.info("ScenarioSelect.endOfLife: " + artifact.identifier()); |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
114 |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
115 D4EArtifact flys = (D4EArtifact) artifact; |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
116 removeDirectory(flys); |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
117 } |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
118 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
119 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
120 /** |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
121 * Removes the directory and all its content where the required data and the |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
122 * results of WSPLGEN are stored. Should be called in endOfLife(). |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
123 */ |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
124 // FIXME: I've seen this code somewhere else... |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
125 protected void removeDirectory(D4EArtifact artifact) { |
5865
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
126 String shapePath = RiverUtils.getXPathString( |
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
127 RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR); |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
128 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
129 File artifactDir = new File(shapePath, artifact.identifier()); |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
130 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
131 if (artifactDir.exists()) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
132 log.debug("Delete directory: " + artifactDir.getAbsolutePath()); |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
133 boolean success = FileTools.deleteRecursive(artifactDir); |
4049
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2646
diff
changeset
|
134 if (!success) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
135 log.warn("could not remove dir '" + artifactDir + "'"); |
4049
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2646
diff
changeset
|
136 } |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
137 } |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
138 else { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
139 log.debug("There is no directory to remove."); |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
140 } |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
141 } |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
142 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
143 |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 } |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |