annotate artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java @ 231:1ea35226a6de

Database cleaner: Ignoring locked artifacts is now done on database level. artifacts/trunk@1635 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 31 Mar 2011 15:56:50 +0000
parents 41404961c804
children 3d14fe6e05f7
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
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
10 import java.util.ArrayList;
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import java.util.HashMap;
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
12 import java.util.List;
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import java.util.Map;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
15 import javax.xml.xpath.XPathConstants;
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
16
226
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
17 import org.apache.log4j.Logger;
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
18
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 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
20 import org.w3c.dom.Element;
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import org.w3c.dom.Node;
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
22 import org.w3c.dom.NodeList;
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
24 import de.intevation.artifacts.ArtifactNamespaceContext;
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import de.intevation.artifacts.CallContext;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
27 import de.intevation.artifacts.common.utils.XMLUtils;
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
28
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 import de.intevation.artifactdatabase.data.StateData;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
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 /**
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 * 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
34 * 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
35 * <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
36 * and need to be implemented by those.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 */
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 public abstract class AbstractState implements State {
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
40 /** 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
41 * configuration. */
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
42 public static final String XPATH_ID = "@id";
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
43
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
44 /** 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
45 * the configuration. */
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
46 public static final String XPATH_DESCRIPTION = "@description";
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
47
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
48 /** The XPath to the output nodes of the state configuration.*/
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
49 public static final String XPATH_OUTPUT_MODES = "outputmodes/outputmode";
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
50
226
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
51 /** The XPath to the list of facets relative to the output mode it belongs
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
52 * to.*/
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
53 public static final String XPATH_FACETS = "facets/facet";
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
54
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
55
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
56 /** The logger that is used in this class.*/
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
57 private static Logger logger = Logger.getLogger(AbstractState.class);
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
58
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
59
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 /** The ID of the state. */
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 protected String id;
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 /** The description of the state. */
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 protected String description;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 /** The data provided by this state. */
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 protected Map<String, StateData> data;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
69 /** A list of output modes which are available for this state.*/
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
70 protected List<Output> outputs;
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
71
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
205
2a9591f76270 Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
73 public AbstractState() {
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
74 outputs = new ArrayList<Output>();
205
2a9591f76270 Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
75 }
2a9591f76270 Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
76
2a9591f76270 Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
77
105
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 * The default constructor.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 *
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 * @param id The ID of the state.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 * @param description The description 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 AbstractState(String id, String description) {
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
85 super();
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
86
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 this.id = id;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 this.description = description;
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
89
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 }
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
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 * Returns the ID of the state.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 *
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 * @return the ID of the state.
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 public String getID() {
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 return id;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 }
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
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 * Set the ID of the state.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 *
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 * @param id The ID of the state.
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 public void setID(String id) {
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 this.id = id;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 }
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
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 * Returns the description of the state.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 *
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 * @return the description of the state.
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 public String getDescription() {
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 return description;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 }
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
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 /**
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 * Set the description of the state.
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 * @param description The description of the state.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 */
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 public void setDescription(String description) {
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 this.description = description;
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
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 * Returns the data of the state.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 *
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 * @return the data of the state.
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 public Map<String, StateData> getData() {
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 return data;
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 }
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 /**
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 * 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
145 * 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
146 *
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 * @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
148 * @param StateData The data object.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 */
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 public void addData(String name, StateData data) {
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 if (this.data == null) {
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 this.data = new HashMap<String, StateData>();
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 }
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 this.data.put(name, data);
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 }
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 /**
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
160 * Returns the list of possible outputs of this state. The list is empty
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
161 * if no output is available for this state.
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
162 *
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
163 * @return a list of possible outputs of this state.
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
164 */
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
165 public List<Output> getOutputs() {
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
166 return outputs;
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
167 }
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
168
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
169
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
170 /**
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
171 * 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
172 *
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 * @param config The state configuration node.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 */
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
175 public void setup(Node config) {
226
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
176 logger.info("AbstractState.setup");
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
177
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
178 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
179
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
180 description = (String) XMLUtils.xpath(
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
181 config, XPATH_DESCRIPTION, XPathConstants.STRING);
209
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
182
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
183 setupOutputs(config);
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
184 }
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
185
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
186
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
187 /**
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
188 * This method tries reading the available output nodes configured in the
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
189 * state configuration and adds possible Outputs to the outputs list.
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
190 *
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
191 * @param config The state configuration node.
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
192 */
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
193 protected void setupOutputs(Node config) {
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
194 NodeList outs = (NodeList) XMLUtils.xpath(
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
195 config,
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
196 XPATH_OUTPUT_MODES,
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
197 XPathConstants.NODESET,
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
198 ArtifactNamespaceContext.INSTANCE);
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
199
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
200 if (outs == null || outs.getLength() == 0) {
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
201 return;
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
202 }
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
203
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
204 int size = outs.getLength();
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
205
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
206 for (int i = 0; i < size; i++) {
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
207 outputs.add(buildOutput(outs.item(i)));
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
208 }
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
209 }
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
210
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
211
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
212 /**
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
213 * A helper method that creates an Output object based on the <i>out</i>
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
214 * node.
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
215 *
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
216 * @param out The output node configuration.
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
217 *
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
218 * @return an Output object.
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
219 */
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
220 protected Output buildOutput(Node out) {
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
221 String name = XMLUtils.xpathString(
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
222 out, "@name", ArtifactNamespaceContext.INSTANCE);
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
223
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
224 String desc = XMLUtils.xpathString(
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
225 out, "@description", ArtifactNamespaceContext.INSTANCE);
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
226
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
227 String mimetype = XMLUtils.xpathString(
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
228 out, "@mime-type", ArtifactNamespaceContext.INSTANCE);
1a3fb29b8b2e Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 205
diff changeset
229
226
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
230 if (name == null) {
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
231 return null;
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
232 }
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
233
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
234 NodeList facets = (NodeList) XMLUtils.xpath(
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
235 out,
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
236 XPATH_FACETS,
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
237 XPathConstants.NODESET,
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
238 ArtifactNamespaceContext.INSTANCE);
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
239
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
240 if (facets == null || facets.getLength() == 0) {
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
241 return new DefaultOutput(name, desc, mimetype);
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
242 }
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
243
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
244 int num = facets.getLength();
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
245
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
246 List<Facet> facetList = new ArrayList<Facet>(num);
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
247
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
248 for (int i = 0; i < num; i++) {
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
249 Facet facet = buildFacet(facets.item(i));
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
250
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
251 if (facet != null) {
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
252 facetList.add(facet);
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
253 }
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
254 }
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
255
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
256 return new DefaultOutput(name, desc, mimetype, facetList);
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
257 }
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
258
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
259
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
260 /**
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
261 * A helper method that creates a Facet object based on the <i>facet</i>
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
262 * node.
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
263 *
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
264 * @param facet The facet node.
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
265 *
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
266 * @return a Facet object or null if no valid Facet was found.
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
267 */
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
268 protected Facet buildFacet(Node facet) {
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
269 String name = XMLUtils.xpathString(
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
270 facet, "@name", ArtifactNamespaceContext.INSTANCE);
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
271
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
272 String desc = XMLUtils.xpathString(
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
273 facet, "@description", ArtifactNamespaceContext.INSTANCE);
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
274
41404961c804 Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 209
diff changeset
275 return name != null ? new DefaultFacet(name, desc) : null;
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
276 }
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
277
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
279 /**
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280 * 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
281 * concrete subclasses.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282 *
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
283 * @param document Describe doucment.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284 * @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
285 * @param context The CallContext.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
286 * @param uuid The uuid of an artifact.
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
287 */
205
2a9591f76270 Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
288 public abstract Element describe(
105
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
289 Document document,
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
290 Node rootNode,
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
291 CallContext context,
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
292 String uuid
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
293 );
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
294 }
265f150f4f7f Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
295 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org