Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 646:d299e220d89c
Added support for the 'type' parameter of the collection's out() operation.
flys-artifacts/trunk@2031 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 31 May 2011 14:56:18 +0000 |
parents | ab9b6cae0d0d |
children | 44175d4720f8 |
comparison
equal
deleted
inserted
replaced
645:433f67a076aa | 646:d299e220d89c |
---|---|
121 return doc; | 121 return doc; |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 @Override | 125 @Override |
126 public void out(Document format, OutputStream out, CallContext context) | 126 public void out( |
127 String type, | |
128 Document format, | |
129 OutputStream out, | |
130 CallContext context) | |
127 throws IOException | 131 throws IOException |
128 { | 132 { |
129 log.info("FLYSArtifactCollection.out"); | 133 log.info("FLYSArtifactCollection.out"); |
130 | 134 |
131 String name = XMLUtils.xpathString( | 135 String name = XMLUtils.xpathString( |
132 format, XPATH_OUT_NAME, ArtifactNamespaceContext.INSTANCE); | 136 format, XPATH_OUT_NAME, ArtifactNamespaceContext.INSTANCE); |
133 | 137 |
134 String type = XMLUtils.xpathString( | 138 String subtype = XMLUtils.xpathString( |
135 format, XPATH_OUT_TYPE, ArtifactNamespaceContext.INSTANCE); | 139 format, XPATH_OUT_TYPE, ArtifactNamespaceContext.INSTANCE); |
136 | 140 |
137 log.debug("Output name = " + name); | 141 log.info("-> Output name = " + name); |
138 log.debug("Output type = " + type); | 142 log.info("-> Output type = " + type); |
139 | 143 log.info("-> Output subtype = " + subtype); |
140 OutGenerator generator = getOutGenerator(context, name, type); | 144 |
145 OutGenerator generator = null; | |
146 if (type != null && type.length() > 0) { | |
147 if (type.indexOf("chartinfo") > 0) { | |
148 generator = getOutGenerator(context, type, subtype); | |
149 } | |
150 else { | |
151 generator = getOutGenerator(context, name, subtype); | |
152 } | |
153 } | |
154 else { | |
155 generator = getOutGenerator(context, name, subtype); | |
156 } | |
157 | |
141 if (generator == null) { | 158 if (generator == null) { |
142 log.error("There is no generator specified for output: " + name); | 159 log.error("There is no generator specified for output: " + name); |
143 // TODO throw an exception. | 160 // TODO throw an exception. |
144 | 161 |
145 return; | 162 return; |
148 generator.init(format, out, context); | 165 generator.init(format, out, context); |
149 | 166 |
150 // TODO Determine the correct master artifact here! | 167 // TODO Determine the correct master artifact here! |
151 | 168 |
152 try { | 169 try { |
153 doOut(generator, name, type, getAttribute(context, name), context); | 170 Document attr = getAttribute(context, name); |
171 doOut(generator, name, subtype, attr, context); | |
154 } | 172 } |
155 catch (ArtifactDatabaseException adbe) { | 173 catch (ArtifactDatabaseException adbe) { |
156 log.error(adbe, adbe); | 174 log.error(adbe, adbe); |
157 } | 175 } |
158 } | 176 } |
173 String facet, | 191 String facet, |
174 Document attributes, | 192 Document attributes, |
175 CallContext context) | 193 CallContext context) |
176 throws IOException | 194 throws IOException |
177 { | 195 { |
178 log.debug("FLYSArtifactCollection.doOut: " + outName); | 196 log.info("FLYSArtifactCollection.doOut: " + outName); |
179 | 197 |
180 ThemeList themeList = new ThemeList(attributes); | 198 ThemeList themeList = new ThemeList(attributes); |
181 | 199 |
182 int size = themeList.size(); | 200 int size = themeList.size(); |
183 log.debug("Output will contain " + size + " elements."); | 201 log.debug("Output will contain " + size + " elements."); |