annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java @ 1061:13bea93a070a

Do not call the endOfLife method of the current state before advancing to a next state, because this would remove elements from cache that have been inserted just before - it would be impossible to make use of a cache in that case. gnv-artifacts/trunk@1144 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 01 Jun 2010 16:59:15 +0000
parents 05bf8534a35a
children f953c9a559d8
rev   line source
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.state;
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2
779
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
3 import de.intevation.artifactdatabase.Config;
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
4
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
5 import de.intevation.artifacts.CallContext;
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
6
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
7 import de.intevation.gnv.state.exception.StateException;
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
8
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 import java.util.ArrayList;
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import java.util.Collection;
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 import java.util.Map;
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import org.w3c.dom.Element;
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import org.w3c.dom.Node;
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 /**
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
17 * This method looks for former inserted coordinates before initialization.
803
feae2f9d6c6f Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 796
diff changeset
18 *
780
c4156275c1e1 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 779
diff changeset
19 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 */
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 public class PreSettingsTransferCoordinateSelectionState extends CoordinateSelectionState {
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 /**
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 * The UID of this Class.
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 */
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 private static final long serialVersionUID = -3972304838976884048L;
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 private String transferPreSettingsName = null;
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 747
diff changeset
30
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 private String transferInputDataname = null;
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 /**
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 * Constructor
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 */
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 public PreSettingsTransferCoordinateSelectionState() {
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 super();
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 }
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
39
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 /**
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
41 * Lookup mechanism for former inserted data before intialization begins.
803
feae2f9d6c6f Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 796
diff changeset
42 *
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
43 * @param uuid
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
44 * @param context
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
45 * @throws StateException
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 */
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 @Override
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 public void initialize(String uuid, CallContext context)
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 throws StateException {
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 Map<String, InputData> preSettings = this.getPreSettings();
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 if (preSettings != null){
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 InputData ip = preSettings.get(transferPreSettingsName);
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 if (ip != null){
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 Collection<InputData> localInputdata = new ArrayList<InputData>(1);
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 localInputdata.add(new DefaultInputData(transferInputDataname,
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 ip.getValue()));
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 this.putInputData(localInputdata, uuid);
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 }
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 747
diff changeset
60
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 super.initialize(uuid, context);
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 }
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
64
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 /**
803
feae2f9d6c6f Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 796
diff changeset
66 *
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
67 * @param configuration
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 */
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 @Override
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 public void setup(Node configuration) {
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 747
diff changeset
71
747
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 Element preSettingsNode = (Element)Config.getNodeXPath(configuration,
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 "presettings-transfer");
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 if (preSettingsNode != null){
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 this.transferPreSettingsName = preSettingsNode.getAttribute("presetting");
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 this.transferInputDataname = preSettingsNode.getAttribute("inputvalue");
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 }
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 super.setup(configuration);
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 }
a5e860f17a52 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 }
836
05bf8534a35a Using unix line endings only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 803
diff changeset
81 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org