[PATCH] Global facet filtering with bound to out: The DiagramAttributes implements the FacetFilter and not the Generators

Wald Commits scm-commit at wald.intevation.org
Wed Oct 2 23:12:06 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1380748319 -7200
# Node ID 3f141505077b434b39ce6b320c5afcb418e6fb24
# Parent  744df5a03337a27bb335fc485e37c8bdc9ffc049
Global facet filtering with bound to out: The DiagramAttributes implements the FacetFilter and not the Generators.

diff -r 744df5a03337 -r 3f141505077b artifacts/src/main/java/org/dive4elements/river/exports/GeneratorLookup.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/GeneratorLookup.java	Wed Oct 02 19:24:43 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/GeneratorLookup.java	Wed Oct 02 23:11:59 2013 +0200
@@ -11,15 +11,12 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.log4j.Logger;
 import org.dive4elements.river.utils.Pair;
 import org.dive4elements.river.artifacts.D4EArtifact.FacetFilter;
 
 public class GeneratorLookup
 implements   FacetFilter
 {
-    private static Logger log = Logger.getLogger(GeneratorLookup.class);
-
     private Map<String, Pair<Class<OutGenerator>, Object>> generators;
 
     public GeneratorLookup() {
@@ -48,21 +45,10 @@
             return true;
         }
 
-        try {
-            Class<OutGenerator> clazz = pair.getA();
-            OutGenerator generator = clazz.newInstance();
-
-            return generator instanceof FacetFilter
-                ? ((FacetFilter)generator).accept(outName, facetName)
-                : true;
-        }
-        catch (InstantiationException ie) {
-            log.error(ie, ie);
-        }
-        catch (IllegalAccessException iae) {
-            log.error(iae, iae);
-        }
-        return true;
+        Object ff = pair.getB();
+        return ff instanceof FacetFilter
+            ? ((FacetFilter)ff).accept(outName, facetName)
+            : true;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :


More information about the Dive4elements-commits mailing list