comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java @ 612:e86d37008fd1

Added new Transition and State for using the PreSettingsValue for the decision if a Transition could be used and the usage of PreSettings as InputValues. gnv-artifacts/trunk@678 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 12 Feb 2010 09:11:49 +0000
parents
children 1a0ed4c521bd
comparison
equal deleted inserted replaced
611:4b818f13e20a 612:e86d37008fd1
1 /**
2 *
3 */
4 package de.intevation.gnv.state;
5
6 import java.util.ArrayList;
7 import java.util.Collection;
8 import java.util.Map;
9
10 import org.w3c.dom.Element;
11 import org.w3c.dom.Node;
12
13 import de.intevation.artifactdatabase.Config;
14 import de.intevation.artifacts.CallContext;
15 import de.intevation.gnv.state.exception.StateException;
16
17 /**
18 * @author Tim Englich <tim.englich@intevation.de>
19 *
20 */
21 public class PreSettingsTransferState extends DefaultState {
22
23 /**
24 * The UID of this Class
25 */
26 private static final long serialVersionUID = 573381812690806922L;
27
28 private String transferPreSettingsName = null;
29
30 private String transferInputDataname = null;
31 /**
32 * Constructor
33 */
34 public PreSettingsTransferState() {
35 super();
36 }
37
38 /**
39 * @see de.intevation.gnv.state.StateBase#initialize(java.lang.String, de.intevation.artifacts.CallContext)
40 */
41 @Override
42 public void initialize(String uuid, CallContext context)
43 throws StateException {
44 Map<String, InputData> preSettings = this.getPreSettings();
45 if (preSettings != null){
46 InputData ip = preSettings.get(transferPreSettingsName);
47 if (ip != null){
48 Collection<InputData> localInputdata = new ArrayList<InputData>(1);
49 localInputdata.add(new DefaultInputData(transferInputDataname,
50 ip.getValue()));
51 this.putInputData(localInputdata, uuid);
52 }
53 }
54
55 super.initialize(uuid, context);
56 }
57
58 /**
59 * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node)
60 */
61 @Override
62 public void setup(Node configuration) {
63
64 Element preSettingsNode = (Element)Config.getNodeXPath(configuration,
65 "presettings-transfer");
66 if (preSettingsNode != null){
67 this.transferPreSettingsName = preSettingsNode.getAttribute("presetting");
68 this.transferPreSettingsName = preSettingsNode.getAttribute("inputvalue");
69 }
70 super.setup(configuration);
71 }
72
73
74
75 }

http://dive4elements.wald.intevation.org