Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ScenarioSelect.java @ 4768:99f9e371371b
Move distance calculation to Coordinate class. Use inheritance instead of composition in Anchor class. Made Anchor class static. Use epsilon equal comparision when checking for same station: Boy, do you ever learn that sharp equal comparison of doubles is not a clever idea!?
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 04 Jan 2013 15:35:51 +0100 |
parents | 442fbb290fa8 |
children | 2c1045a1e3fe |
rev | line source |
---|---|
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
|
1 package de.intevation.flys.artifacts.states; |
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
|
2 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
3 import de.intevation.artifactdatabase.ProtocolUtils; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
4 import de.intevation.artifacts.Artifact; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
5 import de.intevation.artifacts.CallContext; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
6 import de.intevation.artifacts.CallMeta; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
7 import de.intevation.artifacts.common.utils.FileTools; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
8 import de.intevation.artifacts.common.utils.XMLUtils; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
9 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
10 import de.intevation.flys.artifacts.FLYSArtifact; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
11 import de.intevation.flys.artifacts.resources.Resources; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
12 import de.intevation.flys.utils.FLYSUtils; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
13 |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
14 import java.io.File; |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
15 |
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
|
16 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
|
17 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
|
18 |
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
|
19 /** |
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
|
20 * @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
|
21 */ |
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
|
22 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
|
23 |
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 /** The logger that is used in this class.*/ |
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 private static Logger logger = Logger.getLogger(ScenarioSelect.class); |
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 |
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
|
28 public static final String FIELD_MODE = "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
|
29 public static final String FIELD_BARRIERS = "uesk.barriers"; |
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
|
30 |
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
|
31 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
|
32 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
|
33 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
|
34 |
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
|
35 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
|
36 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
|
37 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
|
38 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
|
39 |
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 |
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
|
41 |
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
|
42 @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
|
43 protected String getUIProvider() { |
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
|
44 return "map_digitize"; |
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
|
45 } |
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
|
46 |
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 |
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
|
48 @Override |
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
|
49 protected void appendStaticData( |
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
|
50 FLYSArtifact flys, |
1180
1aba1a75beb2
Write the name of the selected waterlevels (used for the floodmap) into the static DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1159
diff
changeset
|
51 CallContext cc, |
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 ElementCreator creator, |
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
|
53 Element ui, |
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
|
54 String name |
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
|
55 ) { |
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
|
56 if (name != null && name.equals(FIELD_BARRIERS)) { |
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
|
57 return; |
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
|
58 } |
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
|
59 else { |
1180
1aba1a75beb2
Write the name of the selected waterlevels (used for the floodmap) into the static DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1159
diff
changeset
|
60 super.appendStaticData(flys, cc, creator, ui, name); |
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
|
61 } |
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
|
62 } |
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
|
63 |
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
|
64 |
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
|
65 @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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 { |
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
|
72 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
|
73 |
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
|
74 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
|
75 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
|
76 |
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
|
77 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
|
78 |
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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 }); |
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 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
|
88 } |
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
|
89 else { |
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
|
90 FLYSArtifact flys = (FLYSArtifact) artifact; |
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
|
91 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
|
92 |
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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 } |
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
|
99 )}; |
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
|
100 } |
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
|
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 |
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 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
104 @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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 |
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
|
110 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
|
111 |
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
|
112 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
|
113 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
|
114 |
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
|
115 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
|
116 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
|
117 |
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
|
118 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
|
119 } |
2639
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 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
122 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
123 @Override |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
124 public void endOfLife(Artifact artifact, Object callContext) { |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
125 super.endOfLife(artifact, callContext); |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
126 logger.info("ScenarioSelect.endOfLife: " + artifact.identifier()); |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
127 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
128 FLYSArtifact flys = (FLYSArtifact) artifact; |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
129 removeDirectory(flys); |
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 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
132 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
133 /** |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
134 * 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
|
135 * results of WSPLGEN are stored. Should be called in endOfLife(). |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
136 */ |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
137 // FIXME: I've seen this code somewhere else... |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
138 protected void removeDirectory(FLYSArtifact artifact) { |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
139 String shapePath = FLYSUtils.getXPathString( |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4049
diff
changeset
|
140 FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR); |
2639
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 File artifactDir = new File(shapePath, artifact.identifier()); |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
143 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
144 if (artifactDir.exists()) { |
4049
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2646
diff
changeset
|
145 logger.debug("Delete directory: " + artifactDir.getAbsolutePath()); |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
146 boolean success = FileTools.deleteRecursive(artifactDir); |
4049
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2646
diff
changeset
|
147 if (!success) { |
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2646
diff
changeset
|
148 logger.warn("could not remove dir '" + artifactDir + "'"); |
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2646
diff
changeset
|
149 } |
2639
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
150 } |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
151 else { |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
152 logger.debug("There is no directory to remove."); |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
153 } |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
154 } |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
155 |
a78dafdd8590
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1180
diff
changeset
|
156 |
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
|
157 } |
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
|
158 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |