Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/state/State.java @ 232:202b6ae2fcad
Database cleaner: Removes outdated collections, too.
artifacts/trunk@1636 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 31 Mar 2011 17:14:22 +0000 |
parents | b75fca1ac215 |
children | 3d14fe6e05f7 |
rev | line source |
---|---|
104
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 /* |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 * |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 */ |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 package de.intevation.artifactdatabase.state; |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import java.io.Serializable; |
210
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
11 import java.util.List; |
104
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import java.util.Map; |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.w3c.dom.Document; |
205
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
15 import org.w3c.dom.Element; |
104
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import org.w3c.dom.Node; |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.CallContext; |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifactdatabase.data.StateData; |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 /** |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 * This interface describes the basic methods a concrete state class needs to |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 * implement. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 * |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 */ |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 public interface State extends Serializable { |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 /** |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 * Return the id of the state. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 * |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 * @return the id. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 */ |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 public String getID(); |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 /** |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 * Return the description of the state. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 * |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * @return the description of the state. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 */ |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 public String getDescription(); |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 /** |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 * Returns the data provided by this state. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 * |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 * @return the data stored in this state. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 */ |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 public Map<String, StateData> getData(); |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 /** |
110
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
56 * This method should be used to add a new {@link StateData} object to the |
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
57 * data pool of the state. |
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
58 * |
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
59 * @param name The name of the data object. |
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
60 * @param data The data object. |
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
61 */ |
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
62 public void addData(String name, StateData data); |
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
63 |
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
64 |
33271242e303
Prepared the State and StateData interfaces with methods to add new data to a State and implemented a DefaultStateData class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
104
diff
changeset
|
65 /** |
210
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
66 * Returns the list of possible outputs of this state. The list is empty |
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
67 * if no output is available for this state. |
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
68 * |
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
69 * @return a list of possible outputs of this state. |
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
70 */ |
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
71 public List<Output> getOutputs(); |
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
72 |
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
73 |
b75fca1ac215
Enhanced the State interface to retrieve its output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
74 /** |
104
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 * Initialize the state based on the state node in the configuration. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 * |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 * @param config The state configuration node. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 */ |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 public void setup(Node config); |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 /** |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 * This method is called when an artifacts retrieves a describe request. It |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 * creates the user interface description of the current state. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 * |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 * @param document Describe doucment. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 * @param rootNode Parent node for all new elements. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 * @param context The CallContext. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 * @param uuid The uuid of an artifact. |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 */ |
205
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
91 public Element describe( |
104
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 Document document, |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 Node rootNode, |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 CallContext context, |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 String uuid |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 ); |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 } |
26bfff409dd3
Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |