annotate artifacts/src/main/java/org/dive4elements/river/collections/AttributeParser.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents b4faf69ad1d0
children 0a5239a1e46e
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
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import org.apache.log4j.Logger;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 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
19 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
20 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
21 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
22
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3191
diff changeset
23 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
24
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3191
diff changeset
25 import org.dive4elements.artifactdatabase.state.DefaultOutput;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3191
diff changeset
26 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3191
diff changeset
27 import org.dive4elements.artifactdatabase.state.Output;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3191
diff changeset
28 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
29
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3191
diff changeset
30 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
31
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3191
diff changeset
32 import org.dive4elements.river.artifacts.model.ManagedDomFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3191
diff changeset
33 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
34
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
35 /**
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
36 * 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
37 * document.
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
38 */
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public class AttributeParser {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
1624
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
41 /** 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
42 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
43 "/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
44
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
45
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6973
diff changeset
46 private static Logger log = Logger.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
47
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
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
49 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
50
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 protected CollectionAttribute attribute;
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
52
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
6973
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
54 /** 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
55 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
56 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
57 }
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
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
60 public void parse() {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6973
diff changeset
61 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
62
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
63 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
64
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 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
66 attributeDocument,
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 XPATH_ARTIFACT_OUTPUTMODES,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 XPathConstants.NODESET,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 ArtifactNamespaceContext.INSTANCE);
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 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
72
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6973
diff changeset
73 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
74
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 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
76 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
77
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 parseOutput(out);
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 }
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
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
83 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
84 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
85 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
86 }
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 return attribute;
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 }
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
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
92 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
93 return attributeDocument;
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 }
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
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
97 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
98 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
99 }
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
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
102 /**
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
103 * Access all facets.
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
104 * @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
105 */
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
106 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
107 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
108 }
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 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
112 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
113
2779
e57816cf41d5 Replaced another silly "@attribute" XPATH with direct getAttribute() call.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1994
diff changeset
114 if (name.length() == 0) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6973
diff changeset
115 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
116 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
117 }
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 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
120
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 if (o == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6973
diff changeset
122 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
123
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 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
125 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
126 }
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
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
128 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
129 parseItems(out, name);
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
130 }
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
131
3191
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
132 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
133 NodeList children = element.getChildNodes();
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
134 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
135 Node child = children.item(i);
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
136 if (child.getNodeType() == Node.ELEMENT_NODE
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
137 && child.getLocalName().equals(name)) {
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
138 return child;
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
139 }
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 return null;
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
142 }
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
143
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
144
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
145 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
146 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
147
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
148 if (settingsNode == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6973
diff changeset
149 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
150 return;
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
151 }
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 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
154 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
155 }
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
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 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
159 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
160 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
161
3191
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
162 NodeList themes = element.getElementsByTagNameNS(uri, "facet");
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
163
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
164 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
165
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6973
diff changeset
166 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
167
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 638
diff changeset
168 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
169 Element theme = (Element) themes.item(i);
3191
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
170 if (theme.getParentNode() == out) {
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
171 attribute.addFacet(outname, new ManagedDomFacet(theme));
ef0db530c341 Removed some expensive XPath usage.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2779
diff changeset
172 }
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 }
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org