comparison flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeParser.java @ 945:59ae2a823e73

Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection. flys-artifacts/trunk@2360 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 19 Jul 2011 10:37:57 +0000
parents 68c6c75a6f7c
children 238145ef67da
comparison
equal deleted inserted replaced
944:c256061287d7 945:59ae2a823e73
18 import de.intevation.artifactdatabase.state.Output; 18 import de.intevation.artifactdatabase.state.Output;
19 19
20 import de.intevation.artifacts.common.utils.XMLUtils; 20 import de.intevation.artifacts.common.utils.XMLUtils;
21 21
22 import de.intevation.flys.artifacts.model.ManagedFacet; 22 import de.intevation.flys.artifacts.model.ManagedFacet;
23 import de.intevation.flys.artifacts.model.ManagedDomFacet;
23 24
24 25
25 public class AttributeParser { 26 public class AttributeParser {
26 27
27 /** Constant XPath that points to the outputmodes of an artifact.*/ 28 /** Constant XPath that points to the outputmodes of an artifact.*/
90 } 91 }
91 92
92 93
93 protected void parseItems(Node out, String outname) { 94 protected void parseItems(Node out, String outname) {
94 NodeList themes = (NodeList) XMLUtils.xpath( 95 NodeList themes = (NodeList) XMLUtils.xpath(
95 out, "art:theme", 96 out, "art:facet",
96 XPathConstants.NODESET, 97 XPathConstants.NODESET,
97 ArtifactNamespaceContext.INSTANCE); 98 ArtifactNamespaceContext.INSTANCE);
98 99
99 int num = themes != null ? themes.getLength() : 0; 100 int num = themes != null ? themes.getLength() : 0;
100 101
103 String uri = ArtifactNamespaceContext.NAMESPACE_URI; 104 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
104 105
105 for (int i = 0; i < num; i++) { 106 for (int i = 0; i < num; i++) {
106 Element theme = (Element) themes.item(i); 107 Element theme = (Element) themes.item(i);
107 108
108 String name = theme.getAttributeNS(uri, "facet"); 109 addItem(outname, new ManagedDomFacet(theme));
109 if (name == null || name.length() == 0) {
110 continue;
111 }
112
113 String uuid = theme.getAttributeNS(uri, "artifact");
114 if (uuid == null || uuid.length() == 0) {
115 continue;
116 }
117
118 String pos = theme.getAttributeNS(uri, "pos");
119 if (pos == null || pos.length() == 0) {
120 continue;
121 }
122
123 String index = theme.getAttributeNS(uri, "index");
124 if (index == null || index.length() == 0) {
125 continue;
126 }
127
128 String active = theme.getAttributeNS(uri, "active");
129 if (active == null || active.length() == 0) {
130 continue;
131 }
132
133 String description = theme.getAttributeNS(uri, "description");
134
135 ManagedFacet item = new ManagedFacet(
136 name, Integer.parseInt(index), description, uuid,
137 Integer.parseInt(pos),
138 Integer.parseInt(active));
139
140 addItem(outname, item);
141 } 110 }
142 } 111 }
143 } 112 }
144 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 113 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org