changeset 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 7ea428c4aca0
files artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java
diffstat 1 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java	Fri Oct 04 18:21:25 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java	Fri Oct 04 18:33:44 2013 +0200
@@ -1306,11 +1306,8 @@
         FacetFilter facetFilter =
             (FacetFilter)RiverContextFactory.getGlobalContext()
                 .get(RiverContext.FACETFILTER_KEY);
-        if (facetFilter == null) {
-            return false;
-        }
 
-        return true;
+        return facetFilter != null;
     }
 
     /** If a global facet filter and a bounded out are defined
@@ -1342,14 +1339,21 @@
      * @param fs List of facets
      */
     protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) {
-        List<Output> generated = new ArrayList<Output>();
-        log.debug("generateOutputs for Artifact " + getName() + " "
-                + identifier());
-
         boolean debug = log.isDebugEnabled();
 
+        List<Output> generated = new ArrayList<Output>();
+
+        if (debug) {
+            log.debug("generateOutputs for Artifact " + getName() + " "
+                + identifier());
+        }
+
+        boolean useFacetFilter = usesOutputFacetFilter();
+
         for (Output out: list) {
-            log.debug("check facets for output: " + out.getName());
+            if (debug) {
+                log.debug("check facets for output: " + out.getName());
+            }
             String outName = out.getName();
             Output o = new DefaultOutput(
                 outName,
@@ -1372,7 +1376,7 @@
                 /* Match the facets to the output configuration.
                  * This is only done when we are not using the Output
                  * we are bound to to determine the compatible facets. */
-                if (outTypes.contains(type) || usesOutputFacetFilter()) {
+                if (useFacetFilter || outTypes.contains(type)) {
                     if (debug) {
                         log.debug("Add facet " + f);
                     }

http://dive4elements.wald.intevation.org