changeset 714:2f25ca828efd

Only generate 'outs' if they have facets. flys-artifacts/trunk@2180 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 21 Jun 2011 16:22:28 +0000
parents dc3a8c45349b
children 9665d6a48f7b
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/exports/ChartExportHelper.java
diffstat 3 files changed, 26 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jun 21 14:33:00 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jun 21 16:22:28 2011 +0000
@@ -1,3 +1,11 @@
+2011-06-21  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java:
+	  Only generate 'outs' if they have facets.
+
+	* src/main/java/de/intevation/flys/exports/ChartExportHelper.java:
+	  'boolean ? true : false' <=> 'boolean'
+
 2011-06-21  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Tue Jun 21 14:33:00 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Tue Jun 21 16:22:28 2011 +0000
@@ -212,9 +212,10 @@
                         List<Output> generated = generateOutputs(list, fs);
 
                         logger.debug("Found " + fs.size() + " current facets.");
-
-                        ProtocolUtils.appendOutputModes(
-                            creator, outs, generated);
+                        if (!generated.isEmpty()) {
+                            ProtocolUtils.appendOutputModes(
+                                creator, outs, generated);
+                        }
                     }
                     else {
                         logger.debug("No facets found for the current state.");
@@ -232,6 +233,8 @@
     protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) {
         List<Output> generated = new ArrayList<Output>();
 
+        boolean debug = logger.isDebugEnabled();
+
         for (Output out: list) {
             Output o = new DefaultOutput(
                 out.getName(),
@@ -241,18 +244,27 @@
             Set<String> outTypes = new HashSet<String>();
 
             for (Facet f: out.getFacets()) {
-                outTypes.add(f.getName());
+                if (outTypes.add(f.getName()) && debug) {
+                    logger.debug("configured facet " + f);
+                }
             }
 
+            boolean facetAdded = false;
             for (Facet f: fs) {
                 String type = f.getName();
 
                 if (outTypes.contains(type)) {
+                    if (debug) {
+                        logger.debug("Add facet " + f);
+                    }
+                    facetAdded = true;
                     o.addFacet(f);
                 }
             }
 
-            generated.add(o);
+            if (facetAdded) {
+                generated.add(o);
+            }
         }
 
         return generated;
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartExportHelper.java	Tue Jun 21 14:33:00 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartExportHelper.java	Tue Jun 21 16:22:28 2011 +0000
@@ -177,7 +177,7 @@
         int chartWidth  = (Integer) context.getContextValue("chart.width");
         int chartHeight = (Integer) context.getContextValue("chart.height");
 
-        boolean landscape = chartWidth > chartHeight ? true : false;
+        boolean landscape = chartWidth > chartHeight;
 
         float width  = 0;
         float height = 0;

http://dive4elements.wald.intevation.org