comparison artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java @ 290:995fa6994480

Outputs can have a member variable 'type' that should make it easier to distinguish the type of an Output. artifacts/trunk@2310 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 08 Jul 2011 08:20:59 +0000
parents 55d08706ccf2
children 8a3ddd374dd1
comparison
equal deleted inserted replaced
289:cf2e8cca02b7 290:995fa6994480
238 out, "@description", ArtifactNamespaceContext.INSTANCE); 238 out, "@description", ArtifactNamespaceContext.INSTANCE);
239 239
240 String mimetype = XMLUtils.xpathString( 240 String mimetype = XMLUtils.xpathString(
241 out, "@mime-type", ArtifactNamespaceContext.INSTANCE); 241 out, "@mime-type", ArtifactNamespaceContext.INSTANCE);
242 242
243 String type = XMLUtils.xpathString(
244 out, "@type", ArtifactNamespaceContext.INSTANCE);
245
243 if (name == null) { 246 if (name == null) {
244 return null; 247 return null;
245 } 248 }
246 249
247 NodeList facets = (NodeList) XMLUtils.xpath( 250 NodeList facets = (NodeList) XMLUtils.xpath(
249 XPATH_FACETS, 252 XPATH_FACETS,
250 XPathConstants.NODESET, 253 XPathConstants.NODESET,
251 ArtifactNamespaceContext.INSTANCE); 254 ArtifactNamespaceContext.INSTANCE);
252 255
253 if (facets == null || facets.getLength() == 0) { 256 if (facets == null || facets.getLength() == 0) {
254 return new DefaultOutput(name, desc, mimetype); 257 return new DefaultOutput(name, desc, mimetype, type);
255 } 258 }
256 259
257 int num = facets.getLength(); 260 int num = facets.getLength();
258 261
259 List<Facet> facetList = new ArrayList<Facet>(num); 262 List<Facet> facetList = new ArrayList<Facet>(num);
264 if (facet != null) { 267 if (facet != null) {
265 facetList.add(facet); 268 facetList.add(facet);
266 } 269 }
267 } 270 }
268 271
269 return new DefaultOutput(name, desc, mimetype, facetList); 272 return new DefaultOutput(name, desc, mimetype, facetList, type);
270 } 273 }
271 274
272 275
273 /** 276 /**
274 * A helper method that creates a Facet object based on the <i>facet</i> 277 * A helper method that creates a Facet object based on the <i>facet</i>

http://dive4elements.wald.intevation.org