comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 4403:d4f88fda6ed3

Improve debugging inf FLYSArtifact Improve debugging inf FLYSArtifact when building filter facets.
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 05 Nov 2012 16:02:52 +0100
parents 6b0683f5c530
children e8a4d2fd25cc
comparison
equal deleted inserted replaced
4402:c84630d544a1 4403:d4f88fda6ed3
321 /** 321 /**
322 * Builds filter facets from document. 322 * Builds filter facets from document.
323 * @see filterFacets 323 * @see filterFacets
324 */ 324 */
325 protected Map<String, List<Facet>> buildFilterFacets(Document document) { 325 protected Map<String, List<Facet>> buildFilterFacets(Document document) {
326 if (log.isDebugEnabled()) {
327 log.debug("Building filter factes for artifact " + this.getName());
328 }
326 329
327 NodeList nodes = (NodeList)XMLUtils.xpath( 330 NodeList nodes = (NodeList)XMLUtils.xpath(
328 document, 331 document,
329 XPATH_FILTER, 332 XPATH_FILTER,
330 XPathConstants.NODESET, 333 XPathConstants.NODESET,
337 Map<String, List<Facet>> result = new HashMap<String, List<Facet>>(); 340 Map<String, List<Facet>> result = new HashMap<String, List<Facet>>();
338 341
339 for (int i = 0, N = nodes.getLength(); i < N; ++i) { 342 for (int i = 0, N = nodes.getLength(); i < N; ++i) {
340 Element element = (Element)nodes.item(i); 343 Element element = (Element)nodes.item(i);
341 String oName = element.getAttribute("name"); 344 String oName = element.getAttribute("name");
342 if (oName.length() == 0) { 345 if (oName == null || oName.isEmpty()) {
343 continue; 346 continue;
344 } 347 }
345 348
346 List<Facet> facets = new ArrayList<Facet>(); 349 List<Facet> facets = new ArrayList<Facet>();
347 350
359 index = Integer.parseInt(facetElement.getAttribute("index")); 362 index = Integer.parseInt(facetElement.getAttribute("index"));
360 } 363 }
361 catch (NumberFormatException nfe) { 364 catch (NumberFormatException nfe) {
362 log.warn(nfe); 365 log.warn(nfe);
363 index = 0; 366 index = 0;
367 }
368 if (log.isDebugEnabled()) {
369 log.debug("Creating filter facet " + fName + " with index " + index +
370 " for out " + oName);
364 } 371 }
365 facets.add(new DefaultFacet(index, fName, "")); 372 facets.add(new DefaultFacet(index, fName, ""));
366 } 373 }
367 374
368 if (!facets.isEmpty()) { 375 if (!facets.isEmpty()) {
1127 out.getMimeType(), 1134 out.getMimeType(),
1128 resultFacets); 1135 resultFacets);
1129 filtered.add(nout); 1136 filtered.add(nout);
1130 } 1137 }
1131 } 1138 }
1139 else if (debug) {
1140 log.debug("No filter Factes for Output: " + outName);
1141 }
1132 } 1142 }
1133 1143
1134 if (debug) { 1144 if (debug) {
1135 log.debug("All Facets after filtering = " + filtered.size()); 1145 log.debug("Number of outs after filtering = " + filtered.size());
1136 } 1146 }
1137 1147
1138 return filtered; 1148 return filtered;
1139 } 1149 }
1140 1150

http://dive4elements.wald.intevation.org