Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java @ 207:b2115f484edb
Move Config and XMLUtils totally to commons package.
artifacts/trunk@1476 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 15 Mar 2011 15:49:24 +0000 |
parents | 2a9591f76270 |
children | 1a3fb29b8b2e |
rev | line source |
---|---|
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 /* |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 package de.intevation.artifactdatabase.state; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import java.util.HashMap; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import java.util.Map; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
13 import javax.xml.xpath.XPathConstants; |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
14 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.w3c.dom.Document; |
205
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
16 import org.w3c.dom.Element; |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import org.w3c.dom.Node; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifacts.CallContext; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
21 import de.intevation.artifacts.common.utils.XMLUtils; |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
22 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifactdatabase.data.StateData; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 * An abstract implementation of a {@link State}. It implements some basic |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 * methods that return the id, description and data. The methods |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 * <code>describe()</code> and <code>setup()</code> depend on the concrete class |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 * and need to be implemented by those. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 public abstract class AbstractState implements State { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
34 /** The XPath to the ID of the state relative to the state node in the |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
35 * configuration. */ |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
36 public static final String XPATH_ID = "@id"; |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
37 |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
38 /** The XPath to the description of the state relative to the state node in |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
39 * the configuration. */ |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
40 public static final String XPATH_DESCRIPTION = "@description"; |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
41 |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
42 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 /** The ID of the state. */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 protected String id; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 /** The description of the state. */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 protected String description; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 /** The data provided by this state. */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 protected Map<String, StateData> data; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
205
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
53 public AbstractState() { |
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
54 } |
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
55 |
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
56 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 * The default constructor. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 * @param id The ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 * @param description The description of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 public AbstractState(String id, String description) { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 this.id = id; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 this.description = description; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 * Returns the ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 * @return the ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 public String getID() { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 return id; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 * Set the ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 * @param id The ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 public void setID(String id) { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 this.id = id; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 * Returns the description of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 * @return the description of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 public String getDescription() { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 return description; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 * Set the description of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 * @param description The description of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 public void setDescription(String description) { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 this.description = description; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 * Returns the data of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 * @return the data of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 public Map<String, StateData> getData() { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 return data; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 * Add new data to the state. NOTE: If there is already an object existing |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 * with the key <i>name</i>, this object is overwritten by the new value. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 * @param name The name of the data object. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 * @param StateData The data object. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 public void addData(String name, StateData data) { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 if (this.data == null) { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 this.data = new HashMap<String, StateData>(); |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 this.data.put(name, data); |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 /** |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
136 * Initialize the state based on the state node in the configuration. |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 * @param config The state configuration node. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 */ |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
140 public void setup(Node config) { |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
141 id = (String) XMLUtils.xpath(config, XPATH_ID, XPathConstants.STRING); |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
142 |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
143 description = (String) XMLUtils.xpath( |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
144 config, XPATH_DESCRIPTION, XPathConstants.STRING); |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
145 } |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 * Describes the UI of the state. This method needs to be implemented by |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 * concrete subclasses. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 * @param document Describe doucment. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 * @param rootNode Parent node for all new elements. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 * @param context The CallContext. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 * @param uuid The uuid of an artifact. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 */ |
205
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
157 public abstract Element describe( |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 Document document, |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 Node rootNode, |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 CallContext context, |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 String uuid |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 ); |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |