Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/collections/OutputParser.java @ 705:853dceead0f4
Only generate facets when needed.
flys-artifacts/trunk@2157 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 18 Jun 2011 17:03:17 +0000 |
parents | 68c6c75a6f7c |
children | 9ff7e06bcb77 |
comparison
equal
deleted
inserted
replaced
704:eab5e5089d77 | 705:853dceead0f4 |
---|---|
65 int num = outs != null ? outs.getLength() : 0; | 65 int num = outs != null ? outs.getLength() : 0; |
66 | 66 |
67 logger.debug("Artifact has " + num + " outputs."); | 67 logger.debug("Artifact has " + num + " outputs."); |
68 | 68 |
69 for (int i = 0; i < num; i++) { | 69 for (int i = 0; i < num; i++) { |
70 Node out = outs.item(i); | 70 Element out = (Element)outs.item(i); |
71 | 71 |
72 parseOutput(uuid, out); | 72 parseOutput(uuid, out); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
89 o.addFacet(item); | 89 o.addFacet(item); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 protected void parseOutput(String uuid, Node out) { | 94 protected void parseOutput(String uuid, Element out) { |
95 String name = XMLUtils.xpathString( | 95 |
96 out, "@art:name", ArtifactNamespaceContext.INSTANCE); | 96 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
97 | |
98 String name = out.getAttributeNS(uri, "name"); | |
97 | 99 |
98 if (outs.get(name) == null) { | 100 if (outs.get(name) == null) { |
99 logger.debug("Create new output: " + name); | 101 logger.debug("Create new output: " + name); |
100 newOutput(out, name); | 102 newOutput(out, name); |
101 } | 103 } |
102 | 104 |
103 parseItems(uuid, out, name); | 105 parseItems(uuid, out, name); |
104 } | 106 } |
105 | 107 |
106 | 108 |
107 protected void newOutput(Node out, String name) { | 109 protected void newOutput(Element out, String name) { |
108 String desc = XMLUtils.xpathString( | |
109 out, "@art:description", ArtifactNamespaceContext.INSTANCE); | |
110 | 110 |
111 String mimetype = XMLUtils.xpathString( | 111 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
112 out, "@art:mime-type", ArtifactNamespaceContext.INSTANCE); | 112 |
113 String desc = out.getAttributeNS(uri, "description"); | |
114 String mimetype = out.getAttributeNS(uri, "mime-type"); | |
113 | 115 |
114 Output o = new DefaultOutput(name, desc, mimetype); | 116 Output o = new DefaultOutput(name, desc, mimetype); |
115 | 117 |
116 outs.put(name, o); | 118 outs.put(name, o); |
117 } | 119 } |