changeset 8660:7faf1dad15a6

(issue1755) Do not add empty data facets in BedQuality State
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 02 Apr 2015 18:22:01 +0200
parents af415396d9ca
children befa08182368
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java	Thu Apr 02 17:40:18 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java	Thu Apr 02 18:22:01 2015 +0200
@@ -122,7 +122,19 @@
         }
 
         generateFacets(context, newFacets, results, getID(), hash);
-        generateDataFacets(context, newFacets, access, getID(), hash);
+        List<Facet> candidates = new ArrayList<Facet>();
+        generateDataFacets(context, candidates, access, getID(), hash);
+        /* Do not create empty facets */
+        for (Facet f: candidates) {
+            DataFacet candidate = (DataFacet)f;
+            Object d = candidate.getData((Artifact)artifact, context);
+            if (d != null) {
+                double [][] data = (double[][]) d;
+                if (data.length > 0 && data[0].length > 0) {
+                    newFacets.add(candidate);
+                }
+            }
+        }
         log.debug("Created " + newFacets.size() + " new Facets.");
         facets.addAll(newFacets);
 

http://dive4elements.wald.intevation.org