Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java @ 470:19cb9729bd17
Added tag 3.0.1 for changeset c4cc49383cf8
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 24 Apr 2013 17:35:46 +0200 |
parents | 402cd5464723 |
children |
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 |
244
3d14fe6e05f7
Improved the describe() of a State - a reference to an artifact has been added.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
24 import de.intevation.artifacts.Artifact; |
209
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
25 import de.intevation.artifacts.ArtifactNamespaceContext; |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.artifacts.CallContext; |
363
4d3298295a64
Enhanced the State interface with a new method initialize() which might be used to initialize the State based on a model Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
27 import de.intevation.artifacts.CallMeta; |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
468
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
29 import de.intevation.artifacts.common.utils.Config; |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
30 import de.intevation.artifacts.common.utils.XMLUtils; |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
31 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 import de.intevation.artifactdatabase.data.StateData; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * 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
|
37 * 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
|
38 * <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
|
39 * and need to be implemented by those. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 public abstract class AbstractState implements State { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
43 /** 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
|
44 * configuration. */ |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
45 public static final String XPATH_ID = "@id"; |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
46 |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
47 /** 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
|
48 * the configuration. */ |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
49 public static final String XPATH_DESCRIPTION = "@description"; |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
50 |
386
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
51 /** The XPath that points to the help text.*/ |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
52 public static final String XPATH_HELP_TEXT = "@helpText"; |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
53 |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
365
diff
changeset
|
54 /** The XPath to the output nodes of the state configuration. */ |
209
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
55 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
|
56 |
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
|
57 /** The XPath to the list of facets relative to the output mode it belongs |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
365
diff
changeset
|
58 * to. */ |
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
|
59 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
|
60 |
468
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
61 public static final String XPATH_HELP_URL = "/artifact-database/help-url/text()"; |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
62 |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
63 public static final String HELP_URL = "${help.url}"; |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
64 |
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
|
65 |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
365
diff
changeset
|
66 /** The logger that is used in this class. */ |
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
|
67 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
|
68 |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
69 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 /** The ID of the state. */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 protected String id; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 /** The description of the state. */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 protected String description; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
386
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
76 /** The help text for this state.*/ |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
77 protected String helpText; |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
78 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 /** The data provided by this state. */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 protected Map<String, StateData> data; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
365
diff
changeset
|
82 /** A list of output modes which are available for this state. */ |
209
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
83 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
|
84 |
468
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
85 private static String helpUrl; |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
86 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 |
205
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
88 public AbstractState() { |
209
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
89 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
|
90 } |
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
91 |
468
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
92 public static synchronized final String getHelpUrl() { |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
93 if (helpUrl == null) { |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
94 helpUrl = Config.getStringXPath(XPATH_HELP_URL, HELP_URL); |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
95 } |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
96 return helpUrl; |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
97 } |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
98 |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
99 public static String replaceHelpUrl(String string) { |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
100 return string.replace(HELP_URL, getHelpUrl()); |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
101 } |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
102 |
205
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
103 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 * The default constructor. |
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 * @param id The ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 * @param description The description of the state. |
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 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
|
111 super(); |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
112 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 this.id = id; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 this.description = description; |
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 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
386
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
118 public AbstractState(String id, String description, String helpText) { |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
119 this(id, description); |
468
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
120 this.helpText = replaceHelpUrl(helpText); |
386
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
121 } |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
122 |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
123 |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 * Returns the ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 * @return the ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 public String getID() { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 return id; |
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 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 * Set the ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 * @param id The ID of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 public void setID(String id) { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 this.id = id; |
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 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 * Returns the description of the state. |
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 * @return the description of the state. |
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 public String getDescription() { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 return description; |
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 |
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 * Set the description of the state. |
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 * @param description The description of the state. |
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 public void setDescription(String description) { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 this.description = description; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 } |
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 /** |
386
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
165 * Returns the help text of this state. |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
166 * |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
167 * @return the help text. |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
168 */ |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
169 public String getHelpText() { |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
170 return helpText; |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
171 } |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
172 |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
173 |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
174 /** |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
175 * Set the help text for this state. |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
176 * |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
177 * @param helpText The help text. |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
178 */ |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
179 public void setHelpText(String helpText) { |
468
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
180 this.helpText = replaceHelpUrl(helpText); |
386
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
181 } |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
182 |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
183 |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
184 /** |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 * Returns the data of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 * @return the data of the state. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 public Map<String, StateData> getData() { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 return data; |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 /** |
256
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
195 * Returns a specific data object of the state. |
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
196 * |
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
197 * @param name The name of the data object. |
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
198 * |
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
199 * @return a data object of the state or null if no such data object exists. |
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
200 */ |
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
201 public StateData getData(String name) { |
373
6072f84608c2
Added modifications to last commit (forgot to commit the modified class).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
367
diff
changeset
|
202 if (data != null) { |
6072f84608c2
Added modifications to last commit (forgot to commit the modified class).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
367
diff
changeset
|
203 return data.get(name); |
6072f84608c2
Added modifications to last commit (forgot to commit the modified class).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
367
diff
changeset
|
204 } |
6072f84608c2
Added modifications to last commit (forgot to commit the modified class).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
367
diff
changeset
|
205 |
6072f84608c2
Added modifications to last commit (forgot to commit the modified class).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
367
diff
changeset
|
206 return null; |
256
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
207 } |
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
208 |
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
209 |
55d08706ccf2
Added a getData(String) method to a State to get just a single StateData object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
244
diff
changeset
|
210 /** |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 * 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
|
212 * 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
|
213 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 * @param name The name of the data object. |
400
f367be55dd35
Doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
386
diff
changeset
|
215 * @param data The data object. |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 */ |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 public void addData(String name, StateData data) { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 if (this.data == null) { |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 this.data = new HashMap<String, StateData>(); |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 this.data.put(name, data); |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 /** |
209
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
227 * 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
|
228 * 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
|
229 * |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
230 * @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
|
231 */ |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
232 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
|
233 return outputs; |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
234 } |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
235 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
236 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
237 /** |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
238 * 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
|
239 * |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 * @param config The state configuration node. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 */ |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
242 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
|
243 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
|
244 |
106
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
245 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
|
246 |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
247 description = (String) XMLUtils.xpath( |
ece0fdb07975
Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
248 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
|
249 |
386
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
250 helpText = (String) XMLUtils.xpath( |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
251 config, XPATH_HELP_TEXT, XPathConstants.STRING); |
fd32dc33a24c
Added a method State.getHelpText().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
373
diff
changeset
|
252 |
468
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
253 if (helpUrl != null) { |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
254 helpUrl = replaceHelpUrl(helpUrl); |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
255 } |
402cd5464723
${help.url} in states helpText attributes now evaluates to /artifact-database/help-url/text() from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
425
diff
changeset
|
256 |
209
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
257 setupOutputs(config); |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
258 } |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
259 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
260 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
261 /** |
363
4d3298295a64
Enhanced the State interface with a new method initialize() which might be used to initialize the State based on a model Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
262 * This default implementation does nothing at all. |
365
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
263 * |
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
264 * @param orig |
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
265 * @param owner |
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
266 * @param context |
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
267 * @param callMeta |
363
4d3298295a64
Enhanced the State interface with a new method initialize() which might be used to initialize the State based on a model Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
268 */ |
365
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
269 public void initialize( |
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
270 Artifact orig, |
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
271 Artifact owner, |
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
272 Object context, |
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
273 CallMeta callMeta |
81ae7948bff0
Added the owner Artifact as parameter to State.initialize().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
363
diff
changeset
|
274 ) { |
363
4d3298295a64
Enhanced the State interface with a new method initialize() which might be used to initialize the State based on a model Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
275 // do nothing. |
4d3298295a64
Enhanced the State interface with a new method initialize() which might be used to initialize the State based on a model Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
276 } |
4d3298295a64
Enhanced the State interface with a new method initialize() which might be used to initialize the State based on a model Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
277 |
4d3298295a64
Enhanced the State interface with a new method initialize() which might be used to initialize the State based on a model Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
278 |
4d3298295a64
Enhanced the State interface with a new method initialize() which might be used to initialize the State based on a model Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
279 /** |
209
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
280 * 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
|
281 * 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
|
282 * |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
283 * @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
|
284 */ |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
285 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
|
286 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
|
287 config, |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
288 XPATH_OUTPUT_MODES, |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
289 XPathConstants.NODESET, |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
290 ArtifactNamespaceContext.INSTANCE); |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
291 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
292 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
|
293 return; |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
294 } |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
295 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
296 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
|
297 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
298 for (int i = 0; i < size; i++) { |
425
ad74e1ba88ba
Allow to add Output objects to a state manually
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
400
diff
changeset
|
299 addOutput(buildOutput(outs.item(i))); |
209
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
300 } |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
301 } |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
302 |
425
ad74e1ba88ba
Allow to add Output objects to a state manually
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
400
diff
changeset
|
303 /** |
ad74e1ba88ba
Allow to add Output objects to a state manually
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
400
diff
changeset
|
304 * This methods allows subclasses to manually add outputs |
ad74e1ba88ba
Allow to add Output objects to a state manually
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
400
diff
changeset
|
305 * |
ad74e1ba88ba
Allow to add Output objects to a state manually
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
400
diff
changeset
|
306 * @param out The output to add |
ad74e1ba88ba
Allow to add Output objects to a state manually
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
400
diff
changeset
|
307 */ |
ad74e1ba88ba
Allow to add Output objects to a state manually
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
400
diff
changeset
|
308 protected void addOutput(Output out) { |
ad74e1ba88ba
Allow to add Output objects to a state manually
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
400
diff
changeset
|
309 outputs.add(out); |
ad74e1ba88ba
Allow to add Output objects to a state manually
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
400
diff
changeset
|
310 } |
209
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
311 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
312 /** |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
313 * 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
|
314 * node. |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
315 * |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
316 * @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
|
317 * |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
318 * @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
|
319 */ |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
320 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
|
321 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
|
322 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
|
323 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
324 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
|
325 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
|
326 |
1a3fb29b8b2e
Enhanced the abstract state: the output modes are read now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
205
diff
changeset
|
327 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
|
328 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
|
329 |
290
995fa6994480
Outputs can have a member variable 'type' that should make it easier to distinguish the type of an Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
256
diff
changeset
|
330 String type = XMLUtils.xpathString( |
995fa6994480
Outputs can have a member variable 'type' that should make it easier to distinguish the type of an Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
256
diff
changeset
|
331 out, "@type", ArtifactNamespaceContext.INSTANCE); |
995fa6994480
Outputs can have a member variable 'type' that should make it easier to distinguish the type of an Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
256
diff
changeset
|
332 |
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
|
333 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
|
334 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
|
335 } |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
336 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
337 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
|
338 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
|
339 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
|
340 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
|
341 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
|
342 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
343 if (facets == null || facets.getLength() == 0) { |
290
995fa6994480
Outputs can have a member variable 'type' that should make it easier to distinguish the type of an Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
256
diff
changeset
|
344 return new DefaultOutput(name, desc, mimetype, type); |
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
|
345 } |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
346 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
347 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
|
348 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
349 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
|
350 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
351 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
|
352 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
|
353 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
354 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
|
355 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
|
356 } |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
357 } |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
358 |
290
995fa6994480
Outputs can have a member variable 'type' that should make it easier to distinguish the type of an Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
256
diff
changeset
|
359 return new DefaultOutput(name, desc, mimetype, facetList, type); |
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
|
360 } |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
361 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
362 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
363 /** |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
364 * 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
|
365 * 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
|
366 * |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
367 * @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
|
368 * |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
369 * @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
|
370 */ |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
371 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
|
372 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
|
373 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
|
374 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
375 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
|
376 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
|
377 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
209
diff
changeset
|
378 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
|
379 } |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
380 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
381 |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
382 /** |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
383 * 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
|
384 * concrete subclasses. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
385 * |
244
3d14fe6e05f7
Improved the describe() of a State - a reference to an artifact has been added.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
386 * @param artifact A reference to the artifact this state belongs to. |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
387 * @param document Describe doucment. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
388 * @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
|
389 * @param context The CallContext. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
390 * @param uuid The uuid of an artifact. |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
391 */ |
205
2a9591f76270
Changed the return type of a State's describe() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
392 public abstract Element describe( |
244
3d14fe6e05f7
Improved the describe() of a State - a reference to an artifact has been added.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
393 Artifact artifact, |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
394 Document document, |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
395 Node rootNode, |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
396 CallContext context, |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
397 String uuid |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
398 ); |
327
8a3ddd374dd1
Enhanced the State interface with an endOfLife() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
290
diff
changeset
|
399 |
8a3ddd374dd1
Enhanced the State interface with an endOfLife() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
290
diff
changeset
|
400 |
8a3ddd374dd1
Enhanced the State interface with an endOfLife() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
290
diff
changeset
|
401 @Override |
8a3ddd374dd1
Enhanced the State interface with an endOfLife() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
290
diff
changeset
|
402 public void endOfLife(Artifact artifact, Object context) { |
8a3ddd374dd1
Enhanced the State interface with an endOfLife() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
290
diff
changeset
|
403 // nothing to do here |
8a3ddd374dd1
Enhanced the State interface with an endOfLife() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
290
diff
changeset
|
404 } |
105
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
405 } |
265f150f4f7f
Added an abstract implementation of a State.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
406 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |