[PATCH 4 of 4] Only filter the facets for unbound outs

Wald Commits scm-commit at wald.intevation.org
Thu Sep 26 19:15:47 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1380215717 -7200
# Node ID 12248d9eb326472adc2a8824989dc4a52197f7cc
# Parent  336d7690b38c70d5d32314120cd6a757258a4de9
Only filter the facets for unbound outs

diff -r 336d7690b38c -r 12248d9eb326 artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java	Thu Sep 26 19:14:37 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java	Thu Sep 26 19:15:17 2013 +0200
@@ -1305,8 +1305,9 @@
 
         for (Output out: list) {
             log.debug("check facets for output: " + out.getName());
+            String outName = out.getName();
             Output o = new DefaultOutput(
-                out.getName(),
+                outName,
                 out.getDescription(),
                 out.getMimeType(),
                 out.getType());
@@ -1323,7 +1324,14 @@
             for (Facet f: fs) {
                 String type = f.getName();
 
-                if (outTypes.contains(type)) {
+                /* Match the facets to the output configuration.
+                 * This is only done when we are not already bound to an out.
+                 * If we are bound we come from the datacage so the user has
+                 * explicitly requested our nice and shiny facets. And who
+                 * are we to deny them to him. */
+                if (outTypes.contains(type) ||
+                        (boundToOut != null &&
+                         boundToOut.equals(outName))) {
                     if (debug) {
                         log.debug("Add facet " + f);
                     }
diff -r 336d7690b38c -r 12248d9eb326 artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java
--- a/artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java	Thu Sep 26 19:14:37 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java	Thu Sep 26 19:15:17 2013 +0200
@@ -195,7 +195,11 @@
                 logger.debug("Try to add Facet: " + facet.getName());
             }
 
-            if (!compatibleFacets.contains(facet.getName())) {
+            String bondage = facet.getBoundToOut();
+            if (bondage != null && bondage.equals(outputName)) {
+                logger.debug("Adding bound facet regardless of compatibility: " +
+                    facet.getName());
+            } else if (!compatibleFacets.contains(facet.getName())) {
                 logger.debug("Have incompatible facet, skip: " + facet.getName());
                 continue;
             } else if (facet.getBoundToOut() != null &&


More information about the Dive4elements-commits mailing list