changeset 7228:3f141505077b

Global facet filtering with bound to out: The DiagramAttributes implements the FacetFilter and not the Generators.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 02 Oct 2013 23:11:59 +0200
parents 744df5a03337
children 873af92dc672
files artifacts/src/main/java/org/dive4elements/river/exports/GeneratorLookup.java
diffstat 1 files changed, 4 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- 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 :

http://dive4elements.wald.intevation.org