Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java @ 7245:965dbf2d4c44
Code simplification + moved code out of inner loop.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 04 Oct 2013 18:33:44 +0200 |
parents | 737dd43e32d6 |
children | 60a5fc522ec4 |
comparison
equal
deleted
inserted
replaced
7244:737dd43e32d6 | 7245:965dbf2d4c44 |
---|---|
1304 } | 1304 } |
1305 | 1305 |
1306 FacetFilter facetFilter = | 1306 FacetFilter facetFilter = |
1307 (FacetFilter)RiverContextFactory.getGlobalContext() | 1307 (FacetFilter)RiverContextFactory.getGlobalContext() |
1308 .get(RiverContext.FACETFILTER_KEY); | 1308 .get(RiverContext.FACETFILTER_KEY); |
1309 if (facetFilter == null) { | 1309 |
1310 return false; | 1310 return facetFilter != null; |
1311 } | |
1312 | |
1313 return true; | |
1314 } | 1311 } |
1315 | 1312 |
1316 /** If a global facet filter and a bounded out are defined | 1313 /** If a global facet filter and a bounded out are defined |
1317 * use them to eliminate unwished facets. | 1314 * use them to eliminate unwished facets. |
1318 */ | 1315 */ |
1340 * | 1337 * |
1341 * @param list List of outputs | 1338 * @param list List of outputs |
1342 * @param fs List of facets | 1339 * @param fs List of facets |
1343 */ | 1340 */ |
1344 protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) { | 1341 protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) { |
1342 boolean debug = log.isDebugEnabled(); | |
1343 | |
1345 List<Output> generated = new ArrayList<Output>(); | 1344 List<Output> generated = new ArrayList<Output>(); |
1346 log.debug("generateOutputs for Artifact " + getName() + " " | 1345 |
1346 if (debug) { | |
1347 log.debug("generateOutputs for Artifact " + getName() + " " | |
1347 + identifier()); | 1348 + identifier()); |
1348 | 1349 } |
1349 boolean debug = log.isDebugEnabled(); | 1350 |
1351 boolean useFacetFilter = usesOutputFacetFilter(); | |
1350 | 1352 |
1351 for (Output out: list) { | 1353 for (Output out: list) { |
1352 log.debug("check facets for output: " + out.getName()); | 1354 if (debug) { |
1355 log.debug("check facets for output: " + out.getName()); | |
1356 } | |
1353 String outName = out.getName(); | 1357 String outName = out.getName(); |
1354 Output o = new DefaultOutput( | 1358 Output o = new DefaultOutput( |
1355 outName, | 1359 outName, |
1356 out.getDescription(), | 1360 out.getDescription(), |
1357 out.getMimeType(), | 1361 out.getMimeType(), |
1370 String type = f.getName(); | 1374 String type = f.getName(); |
1371 | 1375 |
1372 /* Match the facets to the output configuration. | 1376 /* Match the facets to the output configuration. |
1373 * This is only done when we are not using the Output | 1377 * This is only done when we are not using the Output |
1374 * we are bound to to determine the compatible facets. */ | 1378 * we are bound to to determine the compatible facets. */ |
1375 if (outTypes.contains(type) || usesOutputFacetFilter()) { | 1379 if (useFacetFilter || outTypes.contains(type)) { |
1376 if (debug) { | 1380 if (debug) { |
1377 log.debug("Add facet " + f); | 1381 log.debug("Add facet " + f); |
1378 } | 1382 } |
1379 facetAdded = true; | 1383 facetAdded = true; |
1380 o.addFacet(f); | 1384 o.addFacet(f); |