comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/State.java @ 1119:7c4f81f74c47

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

http://dive4elements.wald.intevation.org