Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/collections/AttributeParser.java @ 9801:1d7a72a50183 3.2.x tip
Assume Compose V2, consistently
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 23 Nov 2023 10:14:13 +0100 |
parents | 0a5239a1e46e |
children |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3191
diff
changeset
|
9 package org.dive4elements.river.collections; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
1779
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
11 import java.util.List; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import java.util.Map; |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import javax.xml.xpath.XPathConstants; |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
9726 | 16 import org.apache.logging.log4j.Logger; |
17 import org.apache.logging.log4j.LogManager; | |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import org.w3c.dom.Document; |
694
68c6c75a6f7c
Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
638
diff
changeset
|
20 import org.w3c.dom.Element; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import org.w3c.dom.Node; |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import org.w3c.dom.NodeList; |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3191
diff
changeset
|
24 import org.dive4elements.artifacts.ArtifactNamespaceContext; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3191
diff
changeset
|
26 import org.dive4elements.artifactdatabase.state.DefaultOutput; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3191
diff
changeset
|
27 import org.dive4elements.artifactdatabase.state.Facet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3191
diff
changeset
|
28 import org.dive4elements.artifactdatabase.state.Output; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3191
diff
changeset
|
29 import org.dive4elements.artifactdatabase.state.Settings; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3191
diff
changeset
|
31 import org.dive4elements.artifacts.common.utils.XMLUtils; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3191
diff
changeset
|
33 import org.dive4elements.river.artifacts.model.ManagedDomFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3191
diff
changeset
|
34 import org.dive4elements.river.exports.ChartSettings; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
1779
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
36 /** |
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
37 * Access parts of the Attribute parts of a FLYSCollections description |
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
38 * document. |
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
39 */ |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 public class AttributeParser { |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
1624
238145ef67da
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
945
diff
changeset
|
42 /** Constant XPath that points to the outputmodes of an artifact. */ |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 public static final String XPATH_ARTIFACT_OUTPUTMODES = |
638
9c565eb46f06
Fixed the process of creating and storing the attribute of a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
349
diff
changeset
|
44 "/art:attribute/art:outputs/art:output"; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
46 |
9726 | 47 private static Logger log = LogManager.getLogger(AttributeParser.class); |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
50 protected Document attributeDocument; |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
51 |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
52 protected CollectionAttribute attribute; |
1779
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
53 |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
6973 | 55 /** Just store reference to document. */ |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
56 public AttributeParser(Document attributeDocument) { |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
57 this.attributeDocument = attributeDocument; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
61 public void parse() { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6973
diff
changeset
|
62 log.debug("AttributeParser.parse"); |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
64 attribute = new CollectionAttribute(); |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
65 |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 NodeList outs = (NodeList) XMLUtils.xpath( |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
67 attributeDocument, |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 XPATH_ARTIFACT_OUTPUTMODES, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 XPathConstants.NODESET, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 ArtifactNamespaceContext.INSTANCE); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 int num = outs != null ? outs.getLength() : 0; |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6973
diff
changeset
|
74 log.debug("Attribute has " + num + " outputs."); |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 for (int i = 0; i < num; i++) { |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 Node out = outs.item(i); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 parseOutput(out); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
84 public CollectionAttribute getCollectionAttribute() { |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
85 if (attribute == null) { |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
86 parse(); |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
87 } |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
88 |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
89 return attribute; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
93 public Document getAttributeDocument() { |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
94 return attributeDocument; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
98 public Map<String, Output> getOuts() { |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
99 return attribute.getOutputs(); |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 |
1779
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
103 /** |
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
104 * Access all facets. |
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
105 * @return list of all facets. |
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
106 */ |
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
107 public List<Facet> getFacets() { |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
108 return attribute.getFacets(); |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
109 } |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
110 |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
111 |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
112 protected void parseOutput(Node out) { |
2779
e57816cf41d5
Replaced another silly "@attribute" XPATH with direct getAttribute() call.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1994
diff
changeset
|
113 String name = ((Element)out).getAttribute("name"); |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
114 |
2779
e57816cf41d5
Replaced another silly "@attribute" XPATH with direct getAttribute() call.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1994
diff
changeset
|
115 if (name.length() == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6973
diff
changeset
|
116 log.warn("No Output name specified. Cancel parsing!"); |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
117 return; |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
118 } |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
119 |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
120 Output o = attribute.getOutput(name); |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
121 |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
122 if (o == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6973
diff
changeset
|
123 log.debug("Create new output: " + name); |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
124 |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
125 o = new DefaultOutput(name, null, null); |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
126 attribute.addOutput(name, o); |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
127 } |
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
128 |
1994
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
129 parseSettings(out, name); |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1779
diff
changeset
|
130 parseItems(out, name); |
1779
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
131 } |
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
132 |
3191
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
133 private static final Node getChild(Element element, String name) { |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
134 NodeList children = element.getChildNodes(); |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
135 for (int i = 0, N = children.getLength(); i < N; ++i) { |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
136 Node child = children.item(i); |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
137 if (child.getNodeType() == Node.ELEMENT_NODE |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
138 && child.getLocalName().equals(name)) { |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
139 return child; |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
140 } |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
141 } |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
142 return null; |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
143 } |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
144 |
1779
2fe270661b20
Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
145 |
1994
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
146 protected void parseSettings(Node out, String outname) { |
3191
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
147 Node settingsNode = getChild((Element)out, "settings"); |
1994
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
148 |
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
149 if (settingsNode == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6973
diff
changeset
|
150 log.debug("No Settings found for Output '" + outname + "'"); |
1994
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
151 return; |
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
152 } |
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
153 |
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
154 Settings settings = ChartSettings.parse(settingsNode); |
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
155 attribute.setSettings(outname, settings); |
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
156 } |
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
157 |
3e703d134bbe
Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
158 |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 protected void parseItems(Node out, String outname) { |
3191
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
160 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
161 Element element = (Element)out; |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 |
3191
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
163 NodeList themes = element.getElementsByTagNameNS(uri, "facet"); |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
164 |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
165 int num = themes.getLength(); |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6973
diff
changeset
|
167 log.debug("Output has " + num + " themes."); |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 |
694
68c6c75a6f7c
Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
638
diff
changeset
|
169 for (int i = 0; i < num; i++) { |
68c6c75a6f7c
Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
638
diff
changeset
|
170 Element theme = (Element) themes.item(i); |
3191
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
171 if (theme.getParentNode() == out) { |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
172 attribute.addFacet(outname, new ManagedDomFacet(theme)); |
ef0db530c341
Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2779
diff
changeset
|
173 } |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |