annotate flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeParser.java @ 2751:e50cc06c6c4c

Serve heightmarks and floodprotection in dc conf for duration curves. flys-artifacts/trunk@4486 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 23 May 2012 21:45:52 +0000
parents 3e703d134bbe
children e57816cf41d5
rev   line source
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.collections;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
3 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
4 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
5
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 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
7
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 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
9
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 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
11 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
12 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
13 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
14
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.ArtifactNamespaceContext;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import de.intevation.artifactdatabase.state.DefaultOutput;
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
18 import de.intevation.artifactdatabase.state.Facet;
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import de.intevation.artifactdatabase.state.Output;
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
20 import de.intevation.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
21
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import de.intevation.artifacts.common.utils.XMLUtils;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
24 import de.intevation.flys.artifacts.model.ManagedDomFacet;
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
25 import de.intevation.flys.exports.ChartSettings;
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
27 /**
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
28 * 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
29 * document.
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
30 */
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 public class AttributeParser {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
1624
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
33 /** 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
34 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
35 "/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
36
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
37
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 private static Logger logger = Logger.getLogger(AttributeParser.class);
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
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
41 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
42
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
43 protected CollectionAttribute attribute;
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
44
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 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
47 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
48 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
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
51 public void parse() {
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 logger.debug("AttributeParser.parse");
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
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
54 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
55
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 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
57 attributeDocument,
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 XPATH_ARTIFACT_OUTPUTMODES,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 XPathConstants.NODESET,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 ArtifactNamespaceContext.INSTANCE);
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 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
63
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 logger.debug("Attribute has " + num + " outputs.");
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 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
67 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
68
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 parseOutput(out);
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 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
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
74 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
75 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
76 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
77 }
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
78
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
79 return attribute;
346
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 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
84 return attributeDocument;
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
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
88 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
89 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
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
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
93 /**
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
94 * Access all facets.
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
95 * @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
96 */
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
97 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
98 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
99 }
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
100
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
101
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
102 protected void parseOutput(Node out) {
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
103 String name = XMLUtils.xpathString(
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
104 out, "@name", ArtifactNamespaceContext.INSTANCE);
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
105
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
106 if (name == null || name.length() == 0) {
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 logger.warn("No Output name specified. Cancel parsing!");
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;
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 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
112
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 if (o == 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
114 logger.debug("Create new output: " + 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
115
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 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
117 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
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
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
120 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
121 parseItems(out, name);
1779
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
122 }
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
123
2fe270661b20 Let Output and Attribute Parsers collect Facets during processing.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
124
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
125 protected void parseSettings(Node out, String outname) {
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
126 Node settingsNode = (Node) XMLUtils.xpath(
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
127 out, "settings",
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
128 XPathConstants.NODE,
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
129 null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
130
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
131 if (settingsNode == null) {
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
132 logger.debug("No Settings found for Output '" + outname + "'");
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
133 return;
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
134 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
135
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
136 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
137 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
138 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
139
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
140
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 protected void parseItems(Node out, String outname) {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 NodeList themes = (NodeList) XMLUtils.xpath(
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
143 out, "art:facet",
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 XPathConstants.NODESET,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 ArtifactNamespaceContext.INSTANCE);
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 int num = themes != null ? themes.getLength() : 0;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 logger.debug("Output has " + num + " themes.");
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 638
diff changeset
151 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 638
diff changeset
153 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
154 Element theme = (Element) themes.item(i);
638
9c565eb46f06 Fixed the process of creating and storing the attribute of a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 349
diff changeset
155
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
156 attribute.addFacet(outname, new ManagedDomFacet(theme));
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org