annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/ScenarioSelect.java @ 5867:59ff03ff48f1

River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 15:23:01 +0200
parents 73da40528cf2
children af13ceeba52a
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 *
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
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
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
6 * documentation coming with Dive4Elements River for details.
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;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5312
diff changeset
17 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
18 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5312
diff changeset
19 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
20 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
21
2639
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
22 import java.io.File;
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
23
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
24 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
25 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
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 /**
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 * @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
29 */
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 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
31
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 /** 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
33 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
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
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
36 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
37
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_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
39 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
40 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
41
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 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
43 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
44 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
45 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
46
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
47
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
48 @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
49 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
50 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
51 }
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
52
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
53 @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
54 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
55 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
56 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
57 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
58 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
59 {
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
60 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
61
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
62 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
63 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
64
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 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
66
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 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
68 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
69 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
70 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
71 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
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
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 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
76 }
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
77 else {
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
78 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
79 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
80
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
81 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
82 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
83 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
84 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
85 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
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 )};
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
88 }
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
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
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
91
4656
442fbb290fa8 Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents: 4049
diff changeset
92 @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
93 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
94 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
95 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
96 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
97
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 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
99
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 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
101 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
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 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
104 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
105
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 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
107 }
2639
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
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
111 @Override
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
112 public void endOfLife(Artifact artifact, Object callContext) {
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
113 super.endOfLife(artifact, callContext);
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
114 logger.info("ScenarioSelect.endOfLife: " + artifact.identifier());
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
115
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
116 D4EArtifact flys = (D4EArtifact) artifact;
2639
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
117 removeDirectory(flys);
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 /**
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
122 * 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
123 * results of WSPLGEN are stored. Should be called in endOfLife().
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
124 */
4656
442fbb290fa8 Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents: 4049
diff changeset
125 // 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
126 protected void removeDirectory(D4EArtifact artifact) {
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
127 String shapePath = RiverUtils.getXPathString(
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
128 RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
2639
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
129
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
130 File artifactDir = new File(shapePath, artifact.identifier());
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 if (artifactDir.exists()) {
4049
8e66293c5369 Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2646
diff changeset
133 logger.debug("Delete directory: " + artifactDir.getAbsolutePath());
2639
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
134 boolean success = FileTools.deleteRecursive(artifactDir);
4049
8e66293c5369 Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2646
diff changeset
135 if (!success) {
8e66293c5369 Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2646
diff changeset
136 logger.warn("could not remove dir '" + artifactDir + "'");
8e66293c5369 Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2646
diff changeset
137 }
2639
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
138 }
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
139 else {
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
140 logger.debug("There is no directory to remove.");
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
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1180
diff changeset
144
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
145 }
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
146 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org