comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/State.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.artifacts.CallContext;
4
5 import de.intevation.gnv.state.exception.StateException;
6
7 import java.io.Serializable;
8
9 import java.util.Collection;
10 import java.util.Map;
11
12 import org.w3c.dom.Document;
13 import org.w3c.dom.Node;
14
15 /**
16 * This interface describes the basic method a concrete state class needs to
17 * implement.
18 *
19 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
21 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
22 */
23 public interface State extends Serializable {
24
25 /**
26 * Setup the state.
27 *
28 * @param configuration State configuration.
29 */
30 public void setup(Node configuration);
31
32 /**
33 * Return the id of the state.
34 *
35 * @return the id.
36 */
37 public String getID();
38
39 /**
40 * Return the description of the state.
41 *
42 * @return the description of the state.
43 */
44 public String getDescription();
45
46 /**
47 * This method is called when an artifacts retrieves a describe request. It
48 * creates the user interface description of the current state.
49 *
50 * @param document Describe doucment.
51 * @param rootNode Parent node for all new xml elements.
52 * @param context The CallContext.
53 * @param uuid The uuid of an artifact.
54 */
55 public void describe(
56 Document document,
57 Node rootNode,
58 CallContext context,
59 String uuid
60 );
61
62 /**
63 * This method is used to insert new data into this state. Concrete
64 * subclasses should valide the input before saving it.
65 *
66 * @param context The CallContext.
67 * @param inputData New InputData items.
68 * @param uuid The uuid of an artifact.
69 * @return a document with an error or sucess message.
70 * @throws StateException
71 */
72 public Document feed(
73 CallContext context, Collection<InputData> inputData, String uuid)
74 throws StateException;
75
76 /**
77 * Set the previous state.
78 *
79 * @param state The previous state.
80 */
81 public void setParent(State state);
82
83 /**
84 * Returns the previous state.
85 *
86 * @return the previous state.
87 */
88 public State getParent();
89
90 /**
91 * Retrieve a collection of required input values.
92 *
93 * @return required input values.
94 */
95 public Collection<InputValue> getRequiredInputValues();
96
97 /**
98 * Retrieves a map with InputData items.
99 *
100 * @return a map with InputData items.
101 */
102 public Map<String, InputData> inputData();
103
104 /**
105 * Use this method to feed a state with some data.
106 *
107 * @param inputData InputData collection.
108 * @param uuid UUID of an artifact.
109 * @throws StateException
110 */
111 public void putInputData(Collection<InputData> inputData, String uuid)
112 throws StateException;
113
114 /**
115 * Retrieves a collection with the InputData stored in this state.
116 *
117 * @return An InputData collection.
118 * @throws StateException
119 */
120 public Collection<InputData> getInputData() throws StateException;
121
122 /**
123 * This method is called to advance to a next or previous state.
124 *
125 * @param uuid The uuid of an artifact.
126 * @param context The CallContext object.
127 * @throws StateException
128 */
129 public void advance(String uuid, CallContext context)
130 throws StateException;
131
132 /**
133 * This method is called when the state is created.
134 *
135 * @param uuid The uuid of an artifact.
136 * @param context The CallContext object.
137 * @throws StateException
138 */
139 public void initialize(String uuid, CallContext context)
140 throws StateException;
141
142 /**
143 * This method can be used to reset the state.
144 *
145 * @param uuid The uuid of an artifact.
146 */
147 public void reset(String uuid);
148
149 /**
150 * This method is called when the lifetime of an artifact ends or if the
151 * user decides to step back to a previous state.
152 *
153 * @param globalContext The CallContext.
154 */
155 public void endOfLife(Object globalContext);
156
157 /**
158 * This method is used to put some InputData objects into an artifact before
159 * the parameterization begins.
160 *
161 * @param preSettings
162 */
163 public void setPreSettings(Map<String,InputData> preSettings);
164
165 /**
166 * This method retrieves a map with InputData objects which have been
167 * inserted into this state before the parameterization has started. The key
168 * used to store the objects is the name of the state.
169 *
170 * @return map with InputData objects.
171 */
172 public Map<String,InputData> getPreSettings();
173
174 /**
175 * Method to remove the data stored at a state which should not be
176 * serialized while an artifact is exported.
177 *
178 * @param context The CallContext
179 */
180 public void cleanup(Object context);
181 }
182 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org