Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ScenarioSelect.java @ 2639:a78dafdd8590
Issue 657.
Added file upload service to load a user defined shapefile.
User the shapefile for wsplgen calculation and display a new layer.
flys-artifacts/trunk@4292 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 25 Apr 2012 07:45:00 +0000 |
parents | 1aba1a75beb2 |
children | c11da3540b70 |
comparison
equal
deleted
inserted
replaced
2638:ccad7a6ddaa4 | 2639:a78dafdd8590 |
---|---|
1 package de.intevation.flys.artifacts.states; | 1 package de.intevation.flys.artifacts.states; |
2 | |
3 import java.util.List; | |
4 import java.io.File; | |
2 | 5 |
3 import org.apache.log4j.Logger; | 6 import org.apache.log4j.Logger; |
4 | 7 |
5 import org.w3c.dom.Element; | 8 import org.w3c.dom.Element; |
6 | 9 |
8 import de.intevation.artifacts.CallContext; | 11 import de.intevation.artifacts.CallContext; |
9 import de.intevation.artifacts.CallMeta; | 12 import de.intevation.artifacts.CallMeta; |
10 | 13 |
11 import de.intevation.artifacts.common.utils.XMLUtils; | 14 import de.intevation.artifacts.common.utils.XMLUtils; |
12 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; | 15 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
16 import de.intevation.artifacts.common.utils.FileTools; | |
13 | 17 |
14 import de.intevation.artifactdatabase.ProtocolUtils; | 18 import de.intevation.artifactdatabase.ProtocolUtils; |
19 import de.intevation.artifactdatabase.state.Facet; | |
15 | 20 |
16 import de.intevation.flys.artifacts.FLYSArtifact; | 21 import de.intevation.flys.artifacts.FLYSArtifact; |
17 import de.intevation.flys.artifacts.resources.Resources; | 22 import de.intevation.flys.artifacts.resources.Resources; |
23 import de.intevation.flys.utils.FLYSUtils; | |
18 | 24 |
19 /** | 25 /** |
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
21 */ | 27 */ |
22 public class ScenarioSelect extends DefaultState { | 28 public class ScenarioSelect extends DefaultState { |
114 item.appendChild(label); | 120 item.appendChild(label); |
115 item.appendChild(value); | 121 item.appendChild(value); |
116 | 122 |
117 return item; | 123 return item; |
118 } | 124 } |
125 | |
126 | |
127 | |
128 @Override | |
129 public void endOfLife(Artifact artifact, Object callContext) { | |
130 super.endOfLife(artifact, callContext); | |
131 logger.info("ScenarioSelect.endOfLife: " + artifact.identifier()); | |
132 | |
133 FLYSArtifact flys = (FLYSArtifact) artifact; | |
134 removeDirectory(flys); | |
135 } | |
136 | |
137 | |
138 /** | |
139 * Removes the directory and all its content where the required data and the | |
140 * results of WSPLGEN are stored. Should be called in endOfLife(). | |
141 */ | |
142 protected void removeDirectory(FLYSArtifact artifact) { | |
143 String shapePath = FLYSUtils.getXPathString( | |
144 FLYSUtils.XPATH_SHAPEFILE_DIR); | |
145 | |
146 File artifactDir = new File(shapePath, artifact.identifier()); | |
147 | |
148 if (artifactDir.exists()) { | |
149 logger.info("Delete directory: " + artifactDir.getAbsolutePath()); | |
150 boolean success = FileTools.deleteRecursive(artifactDir); | |
151 } | |
152 else { | |
153 logger.debug("There is no directory to remove."); | |
154 } | |
155 } | |
156 | |
157 | |
119 } | 158 } |
120 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 159 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |