Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java @ 875:5e9efdda6894
merged gnv-artifacts/1.0
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:13:56 +0200 |
parents | 05bf8534a35a |
children | f953c9a559d8 |
comparison
equal
deleted
inserted
replaced
722:bb3ffe7d719e | 875:5e9efdda6894 |
---|---|
1 package de.intevation.gnv.state; | |
2 | |
3 import de.intevation.artifactdatabase.Config; | |
4 | |
5 import de.intevation.artifacts.CallContext; | |
6 | |
7 import de.intevation.gnv.state.exception.StateException; | |
8 | |
9 import java.util.ArrayList; | |
10 import java.util.Collection; | |
11 import java.util.Map; | |
12 | |
13 import org.w3c.dom.Element; | |
14 import org.w3c.dom.Node; | |
15 | |
16 /** | |
17 * This method looks for former inserted coordinates before initialization. | |
18 * | |
19 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> | |
20 */ | |
21 public class PreSettingsTransferCoordinateSelectionState extends CoordinateSelectionState { | |
22 | |
23 | |
24 /** | |
25 * The UID of this Class. | |
26 */ | |
27 private static final long serialVersionUID = -3972304838976884048L; | |
28 | |
29 private String transferPreSettingsName = null; | |
30 | |
31 private String transferInputDataname = null; | |
32 /** | |
33 * Constructor | |
34 */ | |
35 public PreSettingsTransferCoordinateSelectionState() { | |
36 super(); | |
37 } | |
38 | |
39 | |
40 /** | |
41 * Lookup mechanism for former inserted data before intialization begins. | |
42 * | |
43 * @param uuid | |
44 * @param context | |
45 * @throws StateException | |
46 */ | |
47 @Override | |
48 public void initialize(String uuid, CallContext context) | |
49 throws StateException { | |
50 Map<String, InputData> preSettings = this.getPreSettings(); | |
51 if (preSettings != null){ | |
52 InputData ip = preSettings.get(transferPreSettingsName); | |
53 if (ip != null){ | |
54 Collection<InputData> localInputdata = new ArrayList<InputData>(1); | |
55 localInputdata.add(new DefaultInputData(transferInputDataname, | |
56 ip.getValue())); | |
57 this.putInputData(localInputdata, uuid); | |
58 } | |
59 } | |
60 | |
61 super.initialize(uuid, context); | |
62 } | |
63 | |
64 | |
65 /** | |
66 * | |
67 * @param configuration | |
68 */ | |
69 @Override | |
70 public void setup(Node configuration) { | |
71 | |
72 Element preSettingsNode = (Element)Config.getNodeXPath(configuration, | |
73 "presettings-transfer"); | |
74 if (preSettingsNode != null){ | |
75 this.transferPreSettingsName = preSettingsNode.getAttribute("presetting"); | |
76 this.transferInputDataname = preSettingsNode.getAttribute("inputvalue"); | |
77 } | |
78 super.setup(configuration); | |
79 } | |
80 } | |
81 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |