# HG changeset patch # User Andre Heinecke # Date 1427991721 -7200 # Node ID 7faf1dad15a6509197e5b7b80e8b526bb6296ac0 # Parent af415396d9cad17b7fbbfc1541df51eef90bf96d (issue1755) Do not add empty data facets in BedQuality State diff -r af415396d9ca -r 7faf1dad15a6 artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java --- 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 candidates = new ArrayList(); + 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);