changeset 7987:98ca61cb58fb facet-metadata

Split bed quality facets and updated processors and state.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 02 Jul 2014 09:31:14 +0200
parents b0cee7dfd6fe
children 5acaf44062b5
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDensityFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDensitySubFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDensityTopFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterDataFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterSubFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterTopFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedPorosityFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedPorositySubFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedPorosityTopFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/PorosityFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java
diffstat 17 files changed, 478 insertions(+), 276 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDensityFacet.java	Wed Jul 02 09:29:39 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU AGPL (>=v3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out the
- * documentation coming with Dive4Elements River for details.
- */
-
-package org.dive4elements.river.artifacts.model.minfo;
-
-import org.apache.log4j.Logger;
-
-import org.dive4elements.artifactdatabase.state.Facet;
-import org.dive4elements.artifacts.Artifact;
-import org.dive4elements.artifacts.CallContext;
-import org.dive4elements.river.artifacts.D4EArtifact;
-import org.dive4elements.river.artifacts.model.CalculationResult;
-import org.dive4elements.river.artifacts.model.DataFacet;
-import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
-
-
-/**
- * Facet for serving bed density data.
- *
- * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
- */
-public class BedDensityFacet extends DataFacet {
-
-    private static final long serialVersionUID = 1L;
-
-    private static Logger logger = Logger.getLogger(BedDensityFacet.class);
-
-    public BedDensityFacet() {
-    }
-
-    public BedDensityFacet(int idx, String name, String description,
-        ComputeType type, String stateId, String hash) {
-        super(idx, name, description, type, hash, stateId);
-        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
-        this.metaData.put("Y", "chart.bedquality.yaxis.label.density");
-    }
-
-    public Object getData(Artifact artifact, CallContext context) {
-        logger.debug("Get data for bed density at index: " + index);
-
-        D4EArtifact flys = (D4EArtifact) artifact;
-
-        CalculationResult res = (CalculationResult) flys.compute(context, hash,
-            stateId, type, false);
-
-        int ndx = index >> 8;
-        Object[] data =
-            ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS
-
-        int ndy = index & 255;
-        return data != null && data.length > ndy ? data[ndy] : null;
-    }
-
-    /** Copy deeply. */
-    @Override
-    public Facet deepCopy() {
-        BedDensityFacet copy = new BedDensityFacet();
-        copy.set(this);
-        copy.type = type;
-        copy.hash = hash;
-        copy.stateId = stateId;
-        return copy;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDensitySubFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet for serving bed density data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedDensitySubFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedDensitySubFacet.class);
+
+    public BedDensitySubFacet() {
+    }
+
+    public BedDensitySubFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.density");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+        BedParametersResult[] data =
+            ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS
+
+        int ndy = index & 255;
+        if (data != null && data.length > ndy) {
+            BedParametersResult result = data[ndy];
+            return result.getDensitySubData();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDensitySubFacet copy = new BedDensitySubFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDensityTopFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet for serving bed density data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedDensityTopFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedDensityTopFacet.class);
+
+    public BedDensityTopFacet() {
+    }
+
+    public BedDensityTopFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.density");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+        BedParametersResult[] data =
+            ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS
+
+        int ndy = index & 255;
+        if (data != null && data.length > ndy) {
+            BedParametersResult result = data[ndy];
+            return result.getDensityCapData();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDensityTopFacet copy = new BedDensityTopFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterDataFacet.java	Wed Jul 02 09:29:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterDataFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -79,7 +79,7 @@
             }
         }
         BedDiameterData bdd = new BedDiameterData(diameter, kms, data);
-        return bdd;
+        return bdd.getDiameterData();
     }
 
     /** Copy deeply. */
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterFacet.java	Wed Jul 02 09:29:39 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU AGPL (>=v3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out the
- * documentation coming with Dive4Elements River for details.
- */
-
-package org.dive4elements.river.artifacts.model.minfo;
-
-import org.apache.log4j.Logger;
-
-import org.dive4elements.artifactdatabase.state.Facet;
-import org.dive4elements.artifacts.Artifact;
-import org.dive4elements.artifacts.CallContext;
-import org.dive4elements.river.artifacts.D4EArtifact;
-import org.dive4elements.river.artifacts.model.CalculationResult;
-import org.dive4elements.river.artifacts.model.DataFacet;
-import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
-
-
-/**
- * Facet for serving bed diameter data.
- *
- * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
- */
-public class BedDiameterFacet extends DataFacet {
-
-    private static final long serialVersionUID = 1L;
-
-    private static Logger logger = Logger.getLogger(BedDiameterFacet.class);
-
-    public BedDiameterFacet() {
-    }
-
-    public BedDiameterFacet(int idx, String name, String description,
-        ComputeType type, String stateId, String hash) {
-        super(idx, name, description, type, hash, stateId);
-        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
-        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
-    }
-
-    public Object getData(Artifact artifact, CallContext context) {
-        logger.debug("Get data for bed diameter at index: " + index);
-
-        D4EArtifact flys = (D4EArtifact) artifact;
-
-        CalculationResult res = (CalculationResult) flys.compute(context, hash,
-            stateId, type, false);
-
-        int ndx = index >> 8;
-        Object[] data = ((BedQualityResult[]) res.getData())[ndx].getBedResults(); // TODO CAST TO SPECIFIC CLASS
-
-        int ndy = index & 255;
-        return data != null && data.length > ndy ? data[ndy] : null;
-    }
-
-    /** Copy deeply. */
-    @Override
-    public Facet deepCopy() {
-        BedDiameterFacet copy = new BedDiameterFacet();
-        copy.set(this);
-        copy.type = type;
-        copy.hash = hash;
-        copy.stateId = stateId;
-        return copy;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterSubFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet for serving bed diameter data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedDiameterSubFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedDiameterSubFacet.class);
+
+    public BedDiameterSubFacet() {
+    }
+
+    public BedDiameterSubFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed diameter at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+        Object[] raw =
+            ((BedQualityResult[]) res.getData())[ndx].getBedResults();
+
+        int ndy = index & 255;
+        if (raw != null && raw.length > ndy) {
+            BedDiameterResult data = (BedDiameterResult)raw[ndy];
+            return data.getDiameterSubData();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiameterSubFacet copy = new BedDiameterSubFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterTopFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -0,0 +1,73 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet for serving bed diameter data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedDiameterTopFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedDiameterTopFacet.class);
+
+    public BedDiameterTopFacet() {
+    }
+
+    public BedDiameterTopFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed diameter at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+        Object[] raw = ((BedQualityResult[]) res.getData())[ndx].getBedResults(); // TODO CAST TO SPECIFIC CLASS
+
+        int ndy = index & 255;
+        if (raw != null && raw.length > ndy) {
+            BedDiameterResult data = (BedDiameterResult)raw[ndy];
+            return data.getDiameterCapData();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiameterTopFacet copy = new BedDiameterTopFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedPorosityFacet.java	Wed Jul 02 09:29:39 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU AGPL (>=v3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out the
- * documentation coming with Dive4Elements River for details.
- */
-
-package org.dive4elements.river.artifacts.model.minfo;
-
-import org.apache.log4j.Logger;
-
-import org.dive4elements.artifactdatabase.state.Facet;
-import org.dive4elements.artifacts.Artifact;
-import org.dive4elements.artifacts.CallContext;
-import org.dive4elements.river.artifacts.D4EArtifact;
-import org.dive4elements.river.artifacts.model.CalculationResult;
-import org.dive4elements.river.artifacts.model.DataFacet;
-import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
-
-
-/**
- * Facet for serving bed porosity data.
- *
- * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
- */
-public class BedPorosityFacet extends DataFacet {
-
-    private static final long serialVersionUID = 1L;
-
-    private static Logger logger = Logger.getLogger(BedPorosityFacet.class);
-
-    public BedPorosityFacet() {
-    }
-
-    public BedPorosityFacet(int idx, String name, String description,
-        ComputeType type, String stateId, String hash) {
-        super(idx, name, description, type, hash, stateId);
-        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
-        this.metaData.put("Y", "chart.bedquality.yaxis.label.porosity");
-    }
-
-    public Object getData(Artifact artifact, CallContext context) {
-        logger.debug("Get data for bed porosity at index: " + index);
-
-        D4EArtifact flys = (D4EArtifact) artifact;
-
-        CalculationResult res = (CalculationResult) flys.compute(context, hash,
-            stateId, type, false);
-
-        int ndx = index >> 8;
-        Object[] data = ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS
-
-        int ndy = index & 255;
-        return data != null && data.length > ndy ? data[ndy] : null;
-    }
-
-    /** Copy deeply. */
-    @Override
-    public Facet deepCopy() {
-        BedPorosityFacet copy = new BedPorosityFacet();
-        copy.set(this);
-        copy.type = type;
-        copy.hash = hash;
-        copy.stateId = stateId;
-        return copy;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedPorositySubFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -0,0 +1,73 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet for serving bed porosity data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedPorositySubFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedPorositySubFacet.class);
+
+    public BedPorositySubFacet() {
+    }
+
+    public BedPorositySubFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.porosity");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed porosity at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+        Object[] raw = ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS
+
+        int ndy = index & 255;
+        if (raw != null && raw.length > ndy) {
+            BedParametersResult data = (BedParametersResult)raw[ndy];
+            return data.getPorositySubData();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedPorositySubFacet copy = new BedPorositySubFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedPorosityTopFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -0,0 +1,73 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet for serving bed porosity data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedPorosityTopFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedPorosityTopFacet.class);
+
+    public BedPorosityTopFacet() {
+    }
+
+    public BedPorosityTopFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.porosity");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed porosity at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+        Object[] raw = ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS
+
+        int ndy = index & 255;
+        if (raw != null && raw.length > ndy) {
+            BedParametersResult data = (BedParametersResult)raw[ndy];
+            return data.getPorosityCapData();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedPorosityTopFacet copy = new BedPorosityTopFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java	Wed Jul 02 09:29:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -73,7 +73,7 @@
             data.add(m.getDiameter(diameter)*1000);
         }
         BedDiameterData bdd = new BedDiameterData(diameter, kms, data);
-        return bdd;
+        return bdd.getDiameterData();
     }
 
     /** Copy deeply. */
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterFacet.java	Wed Jul 02 09:29:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -50,11 +50,15 @@
             stateId, type, false);
 
         int ndx = index >> 8;
-        Object[] data =
+        Object[] raw =
             ((BedQualityResult[]) res.getData())[ndx].getBedloadResults(); // TODO CAST TO SPECIFIC CLASS
 
         int ndy = index & 255;
-        return data != null && data.length > ndy ? data[ndy] : null;
+        if (raw != null && raw.length > ndy) {
+            BedloadDiameterResult data = (BedloadDiameterResult)raw[ndy];
+            return data.getDiameterData();
+        }
+        return null;
     }
 
     /** Copy deeply. */
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/PorosityFacet.java	Wed Jul 02 09:29:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/PorosityFacet.java	Wed Jul 02 09:31:14 2014 +0200
@@ -54,7 +54,7 @@
         Porosity porosity =
             PorosityFactory.getPorosity(Integer.valueOf(porosity_id));
 
-        return porosity;
+        return porosity.getAsArray();
     }
 
     /** Copy deeply. */
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java	Wed Jul 02 09:29:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java	Wed Jul 02 09:31:14 2014 +0200
@@ -25,12 +25,15 @@
 import org.dive4elements.river.artifacts.model.DataFacet;
 import org.dive4elements.river.artifacts.model.DateRange;
 import org.dive4elements.river.artifacts.model.FacetTypes;
-import org.dive4elements.river.artifacts.model.minfo.BedDensityFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDensityTopFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDensitySubFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiameterTopFacet;
 import org.dive4elements.river.artifacts.model.minfo.BedDiameterDataFacet;
-import org.dive4elements.river.artifacts.model.minfo.BedDiameterFacet;
 import org.dive4elements.river.artifacts.model.minfo.BedDiameterResult;
+import org.dive4elements.river.artifacts.model.minfo.BedDiameterSubFacet;
 import org.dive4elements.river.artifacts.model.minfo.BedParametersResult;
-import org.dive4elements.river.artifacts.model.minfo.BedPorosityFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedPorositySubFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedPorosityTopFacet;
 import org.dive4elements.river.artifacts.model.minfo.BedQualityCalculation;
 import org.dive4elements.river.artifacts.model.minfo.BedQualityDiameterResult;
 import org.dive4elements.river.artifacts.model.minfo.BedQualityResult;
@@ -257,7 +260,7 @@
             DateRange range = result.getDateRange();
             BedDiameterResult[] bedDiameter = result.getBedResults();
             for (int j = 0; j < bedDiameter.length; j++) {
-                newFacets.add(new BedDiameterFacet((idx << 8) + j,
+                newFacets.add(new BedDiameterTopFacet((idx << 8) + j,
                     BED_QUALITY_BED_DIAMETER_TOPLAYER,
                     createDiameterTopLayerDescription(
                         meta,
@@ -265,7 +268,7 @@
                         range),
                     ComputeType.ADVANCE, stateId, hash));
 
-                newFacets.add(new BedDiameterFacet((idx << 8) +j,
+                newFacets.add(new BedDiameterSubFacet((idx << 8) +j,
                     BED_QUALITY_BED_DIAMETER_SUBLAYER,
                     createDiameterSubLayerDescription(
                         meta,
@@ -288,7 +291,7 @@
             if (bedDiameter.length > 0) {
                 BedParametersResult[] bedParameters = result.getParameters();
                 for (int j = 0; j < bedParameters.length; j++) {
-                    newFacets.add(new BedPorosityFacet((idx << 8) + j,
+                    newFacets.add(new BedPorosityTopFacet((idx << 8) + j,
                         BED_QUALITY_POROSITY_TOPLAYER,
                         createPorosityTopLayerDescription(
                             meta,
@@ -296,7 +299,7 @@
                             range),
                         ComputeType.ADVANCE, stateId, hash));
 
-                    newFacets.add(new BedPorosityFacet((idx << 8) + j,
+                    newFacets.add(new BedPorositySubFacet((idx << 8) + j,
                         BED_QUALITY_POROSITY_SUBLAYER,
                         createPorositySubLayerDescription(
                             meta,
@@ -304,7 +307,7 @@
                             range),
                         ComputeType.ADVANCE, stateId, hash));
 
-                    newFacets.add(new BedDensityFacet((idx << 8) + j,
+                    newFacets.add(new BedDensityTopFacet((idx << 8) + j,
                         BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER,
                         createDensityTopLayerDescription(
                             meta,
@@ -312,7 +315,7 @@
                             range),
                         ComputeType.ADVANCE, stateId, hash));
 
-                    newFacets.add(new BedDensityFacet((idx << 8) + j,
+                    newFacets.add(new BedDensitySubFacet((idx << 8) + j,
                         BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER,
                         createDensitySubLayerDescription(
                             meta,
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Wed Jul 02 09:29:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Wed Jul 02 09:31:14 2014 +0200
@@ -11,8 +11,6 @@
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.jfree.data.xy.XYSeries;
-
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -21,8 +19,6 @@
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.themes.ThemeDocument;
 
-import org.dive4elements.river.artifacts.model.minfo.BedParametersResult;
-
 public class BedQualityDensityProcessor extends DefaultProcessor {
 
     private final static Logger logger =
@@ -43,22 +39,18 @@
         CallContext context = generator.getCallContext();
         StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
                 theme);
-        Object data = bundle.getData(context);
         Map<String, String> metaData = bundle.getFacet().getMetaData();
         series.putMetaData(metaData, bundle.getArtifact(), context);
         yAxisLabel = metaData.get("Y");
-        String facetName = bundle.getFacetName();
-        double [][] points;
 
-        if (facetName.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER)) {
-            points = ((BedParametersResult) data).getDensityCapData();
-        } else if (facetName.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER)) {
-            points = ((BedParametersResult) data).getDensitySubData();
-        } else {
-            logger.error("Unknown facet name: " + facetName);
+        Object data = bundle.getData(context);
+        if (!(data instanceof double[][])) {
+            logger.error("Unknown data type: " + data.getClass().getName());
             return;
         }
-        StyledSeriesBuilder.addPoints(series, points, true);
+
+        double[][] values = (double[][])data;
+        StyledSeriesBuilder.addPoints(series, values, true);
 
         generator.addAxisSeries(series, axisName, visible);
     }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Wed Jul 02 09:29:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Wed Jul 02 09:31:14 2014 +0200
@@ -8,12 +8,9 @@
 
 package org.dive4elements.river.exports.process;
 
-import java.awt.Dialog.ModalExclusionType;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.jfree.data.xy.XYSeries;
-
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -22,10 +19,6 @@
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.themes.ThemeDocument;
 
-import org.dive4elements.river.artifacts.model.minfo.BedDiameterData;
-import org.dive4elements.river.artifacts.model.minfo.BedDiameterResult;
-import org.dive4elements.river.artifacts.model.minfo.BedloadDiameterResult;
-
 public class BedQualityDiameterProcessor extends DefaultProcessor {
 
     private final static Logger logger =
@@ -50,24 +43,12 @@
         series.putMetaData(metaData, bundle.getArtifact(), context);
         yAxisLabel = metaData.get("Y");
         Object data = bundle.getData(context);
-        String facetName = bundle.getFacetName();
-        double [][] points;
-
-        if (facetName.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_TOPLAYER)) {
-            points = ((BedDiameterResult) data).getDiameterCapData();
-        } else if (facetName.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_SUBLAYER)) {
-            points = ((BedDiameterResult) data).getDiameterSubData();
-        } else if (facetName.equals(FacetTypes.BED_QUALITY_BEDLOAD_DIAMETER)) {
-            points = ((BedloadDiameterResult) data).getDiameterData();
-        } else if (facetName.equals(FacetTypes.BED_DIAMETER_DATA_TOP) ||
-                 facetName.equals(FacetTypes.BED_DIAMETER_DATA_SUB) ||
-                 facetName.equals(FacetTypes.BEDLOAD_DIAMETER_DATA)) {
-            points = ((BedDiameterData) data).getDiameterData();
-        } else {
-            logger.error("Unknown facet name: " + facetName);
+        if (!(data instanceof double[][])) {
+            logger.error("Unknown data type: " + data.getClass().getName());
             return;
         }
-        StyledSeriesBuilder.addPoints(series, points, true);
+        double[][] values = (double[][])data;
+        StyledSeriesBuilder.addPoints(series, values, true);
 
         generator.addAxisSeries(series, axisName, visible);
     }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Wed Jul 02 09:29:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Wed Jul 02 09:31:14 2014 +0200
@@ -11,8 +11,6 @@
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.jfree.data.xy.XYSeries;
-
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -21,9 +19,6 @@
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.themes.ThemeDocument;
 
-import org.dive4elements.river.artifacts.model.minfo.BedParametersResult;
-import org.dive4elements.river.artifacts.model.minfo.Porosity;
-
 public class BedQualityPorosityProcessor extends DefaultProcessor {
 
     private final static Logger logger =
@@ -48,21 +43,15 @@
                 theme);
         series.putMetaData(metaData, bundle.getArtifact(), context);
         yAxisLabel = metaData.get("Y");
-        Object data = bundle.getData(context);
-        String facetName = bundle.getFacetName();
-        double [][] points;
 
-        if (facetName.equals(FacetTypes.BED_QUALITY_POROSITY_TOPLAYER)) {
-            points = ((BedParametersResult) data).getPorosityCapData();
-        } else if (facetName.equals(FacetTypes.BED_QUALITY_POROSITY_SUBLAYER)) {
-            points = ((BedParametersResult) data).getPorositySubData();
-        } else if (facetName.equals(FacetTypes.POROSITY)) {
-            points = ((Porosity)data).getAsArray();
-        } else {
-            logger.error("Unknown facet name: " + facetName);
+        Object raw = bundle.getData(context);
+        if (!(raw instanceof double[][])) {
+            logger.error("Unknown data type: " + raw.getClass().getName());
             return;
         }
-        StyledSeriesBuilder.addPoints(series, points, true);
+
+        double[][] values = (double[][])raw;
+        StyledSeriesBuilder.addPoints(series, values, true);
 
         generator.addAxisSeries(series, axisName, visible);
     }

http://dive4elements.wald.intevation.org