changeset 7853:57bd0a586a9b

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 30 Apr 2014 15:29:50 +0200
parents 6e346ef4446f (diff) c023f19a7720 (current diff)
children 8c6ed23ce315 f4dffc7d1d60
files artifacts/doc/conf/artifacts/minfo.xml artifacts/doc/conf/conf.xml artifacts/doc/conf/meta-data.xml artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java
diffstat 60 files changed, 1194 insertions(+), 326 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/minfo.xml	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/doc/conf/artifacts/minfo.xml	Wed Apr 30 15:29:50 2014 +0200
@@ -411,6 +411,7 @@
                         <facet name="bed_longitudinal_section.manualpoints" />
                         <facet name="bed_longitudinal_section.bedload_diameter"/>
                         <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
+                        <facet name="porosity" description="facet.porosity"/>
                     </facets>
                 </outputmode>
                 <outputmode name="bed_quality_export" description="output.bed_quality_export" type="export">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/doc/conf/artifacts/porosity.xml	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<artifact name="porosity">
+    <load-facets>
+        <facet name="porosity" class="org.dive4elements.river.artifacts.model.minfo.PorosityFacet"/>
+    </load-facets>
+    <states>
+        <state id="state.porosity.datacage"
+               description="state.porosity.datacage"
+               state="org.dive4elements.river.artifacts.states.DefaultState">
+        </state>
+    </states>
+</artifact>
--- a/artifacts/doc/conf/conf.xml	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/doc/conf/conf.xml	Wed Apr 30 15:29:50 2014 +0200
@@ -12,6 +12,7 @@
     <!ENTITY sqrelation-defaults SYSTEM "sqrelation-diagram-defaults.xml">
     <!ENTITY zoom-scales SYSTEM "zoom-scales.xml">
     <!ENTITY modules SYSTEM "modules.xml">
+    <!ENTITY porosity-artifact  SYSTEM "artifacts/porosity.xml">
 ]>
 <artifact-database>
     <export-secret>YOUR_SECRET</export-secret>
@@ -152,6 +153,9 @@
             <artifact-factory name="sedimentyield" description="Factory to create an artifact to show Sediment Yield values."
                 ttl="3600000"
                 artifact="org.dive4elements.river.artifacts.SedimentYieldArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+            <artifact-factory name="porosity" description="Factory to create an artifact to show porosity values."
+                ttl="3600000"
+                artifact="org.dive4elements.river.artifacts.D4EArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory</artifact-factory>
         </artifact-factories>
 
         <user-factory name="default" description="Factory to create new users">org.dive4elements.artifactdatabase.DefaultUserFactory</user-factory>
@@ -279,6 +283,7 @@
         <artifact name="gaugedischargecurve" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/gaugedischargecurve.xml" />
         <artifact name="qsector" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/qsector.xml" />
         <artifact name="staticsqrelation" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/sqrelation.xml" />
+        &porosity-artifact;
     </artifacts>
 
     &modules;
--- a/artifacts/doc/conf/meta-data.xml	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Wed Apr 30 15:29:50 2014 +0200
@@ -1304,6 +1304,7 @@
           <dc:call-macro name="minfo-heights"/>
           <dc:call-macro name="sounding-width"/>
           <dc:call-macro name="morph_width"/>
+          <dc:call-macro name="porosities"/>
           <flow_velocities>
             <dc:call-macro name="flow_velocity_measurements"/>
             <dc:call-macro name="flow_velocity_models"/>
@@ -1325,6 +1326,34 @@
       <dc:call-macro name="sediment-load"/>
     </dc:macro>
 
+    <dc:macro name="porosities">
+      <porosities>
+      <dc:context>
+        <dc:statement>
+            SELECT DISTINCT
+                p.id          AS pid,
+                p.description AS description,
+                d.lower        AS depth_lower,
+                d.upper        AS depth_upper
+            FROM     porosity p
+                JOIN depths d ON p.depth_id = d.id
+                JOIN porosity_values pv on pv.porosity_id = p.id
+            WHERE   p.river_id = ${river_id}
+            GROUP BY p.id, p.description, d.upper, d.lower
+            ORDER BY depth_lower, depth_upper
+        </dc:statement>
+        <dc:if test="dc:has-result()">
+          <dc:for-each>
+                  <porosity description="{$depth_lower}-{$depth_upper} cm"
+                   factory="porosity"
+                   target_out="{$out}"
+                   info="{$description}"
+                   ids="{$pid}" />
+          </dc:for-each>
+        </dc:if>
+      </dc:context>
+      </porosities>
+    </dc:macro>
 
     <dc:macro name="densities">
       <densities>
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/AnnotationArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/AnnotationArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -83,7 +83,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("AnnotationArtifact.setup");
         String filter = StaticD4EArtifact.getDatacageIDValue(data);
@@ -91,7 +92,7 @@
         if (splits.length > 1) {
             addStringData("nameFilter", splits[1]);
         }
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/AreaArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/AreaArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -76,11 +76,12 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.info("AreaArtifact.setup");
 
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
 
         // TODO yet unused.
         String ids = getDatacageIDValue(data);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -74,7 +74,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("BedHeightsArtifact.setup");
 
@@ -132,7 +133,7 @@
                 addFacets(STATIC_STATE_NAME, facets);
             }
         }
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
     @Override
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/ChartArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/ChartArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -49,7 +49,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callmeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("ChartArtifact.setup");
         this.identifier = identifier;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -110,11 +110,12 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.info("CrossSectionArtifact.setup");
 
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
 
         String ids = getDatacageIDValue(data);
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -39,6 +39,7 @@
 import org.dive4elements.artifactdatabase.state.Output;
 import org.dive4elements.artifactdatabase.state.State;
 import org.dive4elements.artifactdatabase.state.StateEngine;
+import org.dive4elements.artifactdatabase.state.StaticFacet;
 import org.dive4elements.artifactdatabase.transition.TransitionEngine;
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.ArtifactDatabase;
@@ -64,7 +65,7 @@
  *
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public abstract class D4EArtifact extends DefaultArtifact {
+public class D4EArtifact extends DefaultArtifact {
 
     /** The logger that is used in this artifact. */
     private static Logger log = Logger.getLogger(D4EArtifact.class);
@@ -103,9 +104,6 @@
     /** The identifiers of previous states on a stack. */
     protected List<String> previousStateIds;
 
-    /** The name of the artifact. */
-    protected String name;
-
     /** The data that have been inserted into this artifact. */
     private Map<String, StateData> data;
 
@@ -175,16 +173,6 @@
 
 
     /**
-     * Returns the name of the concrete artifact.
-     *
-     * @return the name of the concrete artifact.
-     */
-    public String getName() {
-        return name;
-    }
-
-
-    /**
      * Initialize the artifact and insert new data if <code>data</code> contains
      * information necessary for this artifact.
      *
@@ -199,11 +187,12 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     facets)
     {
         log.debug("Setup this artifact with the uuid: " + identifier);
 
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, facets);
 
         RiverContext flysContext = RiverUtils.getFlysContext(context);
 
@@ -221,11 +210,36 @@
 
         handleInitModel(data, context, callMeta);
 
+        buildStaticFacets(data, facets, callMeta);
+
         filterFacets = buildFilterFacets(data);
 
         extractOut(data);
     }
 
+    protected void buildStaticFacets(
+        Document data,
+        List<Class> facets,
+        CallMeta callMeta)
+    {
+        List<Facet> staticFacets = new ArrayList<Facet>();
+        String currentState = getCurrentStateId();
+        for (int i = 0; i < facets.size(); i++) {
+            try {
+                StaticFacet facet = (StaticFacet)facets.get(i).newInstance();
+                facet.setup(this, data, callMeta);
+                staticFacets.add(facet);
+            }
+            catch (InstantiationException ie) {
+                log.error(ie.getLocalizedMessage(), ie);
+            }
+            catch (IllegalAccessException iae) {
+                log.error(iae.getLocalizedMessage(), iae);
+            }
+        }
+        this.facets.put(currentState, staticFacets);
+    }
+
     protected void handleInitModel(Document data, Object context, CallMeta callMeta) {
         RiverContext flysContext = RiverUtils.getFlysContext(context);
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/ExternalWMSArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/ExternalWMSArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -46,11 +46,12 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.info("ExternalWMSArtifact.setup");
 
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
 
         String ids = getDatacageIDValue(data);
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/FlowVelocityMeasurementArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/FlowVelocityMeasurementArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -112,7 +112,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("FlowVelocityMeasurementArtifact.setup");
 
@@ -168,7 +169,7 @@
         }
 
         spawnState();
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/FlowVelocityModelArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/FlowVelocityModelArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -141,7 +141,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("FlowVelocityModelArtifact.setup");
 
@@ -201,7 +202,7 @@
         }
 
         spawnState();
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -77,7 +77,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("GaugeDischargeArtifact.setup");
         String ids = StaticD4EArtifact.getDatacageIDValue(data);
@@ -90,7 +91,7 @@
         if (splitIds.length > 2) {
             facetWishName = splitIds[2];
         }
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeCurveArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeCurveArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -81,7 +81,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callmeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("GaugeDischargeCurveArtifact.setup");
 
@@ -169,7 +170,7 @@
 
         addFacets(STATIC_STATE_NAME, fs);
 
-        super.setup(identifier, factory, context, callmeta, data);
+        super.setup(identifier, factory, context, callmeta, data, loadFacets);
     }
 
     @Override
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/HYKArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/HYKArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -64,7 +64,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.info("HYKArtifact.setup");
 
@@ -74,7 +75,7 @@
 
         addStringData(HYK_ID, ids);
 
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -107,7 +107,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("MainValuesArtifact.setup");
         state = new StaticState(STATIC_STATE_NAME);
@@ -117,7 +118,7 @@
         List<Facet> fs = new ArrayList<Facet>();
         addFacets(state.getID(), fs);
         spawnState();
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
         String restriction = getDatacageIDValue(data);
         logger.debug("mainvalue restriction " + restriction);
         boolean restricted = restriction.endsWith("q") || restriction.endsWith("w");
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/ManualPointsArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/ManualPointsArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -58,10 +58,11 @@
             ArtifactFactory factory,
             Object          context,
             CallMeta        callMeta,
-            Document        data)
+            Document        data,
+            List<Class>     loadFacets)
     {
         logger.debug("ManualPointsArtifact.setup");
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
         initialize(null, context, callMeta);
     }
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/MapArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/MapArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -43,7 +43,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callmeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("MapArtifact.setup");
         this.identifier = identifier;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/QSectorArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/QSectorArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -64,10 +64,11 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("QSectorArtifact.setup");
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
         initialize(null, context, callMeta);
     }
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/RiverAxisArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/RiverAxisArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -39,20 +39,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("RiverAxisArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/SQRelationArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/SQRelationArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -54,8 +54,9 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callmeta,
-        Document        data
-    ) {
+        Document        data,
+        List<Class>     loadFacets)
+    {
         logger.debug("SQRelationArtifact.setup()");
 
         String code = getDatacageIDValue(data);
@@ -65,7 +66,7 @@
         if (code != null && !code.isEmpty()) {
             /* Case that we were instantiated from the datacage */
             addStringData("ids", code);
-            super.setup(identifier, factory, context, callmeta, data);
+            super.setup(identifier, factory, context, callmeta, data, loadFacets);
             return;
         }
 
@@ -92,7 +93,7 @@
                 Resources.getMsg(callmeta, "static.sq.station", "Station"),
                 "String",
                 station));
-        super.setup(identifier, factory, context, callmeta, data);
+        super.setup(identifier, factory, context, callmeta, data, loadFacets);
         // When we are in this case we did not come from the datacage
         // e.g. had an ID string set. So we also did not have a template
         // set and initialize is not called. So we have to do this ourself.
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentDensityArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentDensityArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -118,7 +118,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("SedimentDensityArtifact.setup");
 
@@ -151,7 +152,7 @@
         }
 
         spawnState();
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -126,7 +126,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("SedimentYieldArtifact.setup");
 
@@ -240,7 +241,7 @@
         }
 
         spawnState();
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticD4EArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticD4EArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -135,10 +135,11 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("StaticD4EArtifact.setup");
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticMorphWidthArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticMorphWidthArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -64,7 +64,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("setup");
 
@@ -87,7 +88,7 @@
 
                 addFacets(STATIC_STATE_NAME, facets);
         }
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
     @Override
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticWKmsArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticWKmsArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -103,7 +103,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("StaticWKmsArtifact.setup");
 
@@ -179,7 +180,7 @@
         }
 
         spawnState();
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticWQKmsArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticWQKmsArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -96,7 +96,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("StaticWQKmsArtifact.setup");
 
@@ -125,7 +126,7 @@
         }
 
         // Do this AFTER we have set the col_pos etc.
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSBuildingsArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSBuildingsArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -42,20 +42,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSBuildingsArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSDBArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSDBArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -41,11 +41,12 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("WMSDBArtifact.setup");
 
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
 
         String ids = getDatacageIDValue(data);
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFixpointsArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFixpointsArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSFixpointsArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmapsArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmapsArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSFloodmapsArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmarksArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmarksArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSFloodmarksArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodplainArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodplainArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSFloodplainArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSGaugeLocationArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSGaugeLocationArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,16 +10,11 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 import com.vividsolutions.jts.geom.Geometry;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.State;
@@ -27,7 +22,6 @@
 import org.dive4elements.river.model.River;
 import org.dive4elements.river.model.GaugeLocation;
 
-import org.dive4elements.river.artifacts.WMSDBArtifact.WMSDBState;
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
 import org.dive4elements.river.utils.RiverUtils;
@@ -44,20 +38,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSGaugeLocationArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSLinesArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSLinesArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSHWSLinesArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSPointsArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSPointsArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSHWSPointsArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSHydrBoundaryArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryPolyArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryPolyArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSHydrBoundaryArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSJettiesArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSJettiesArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSJettiesArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSKmArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSKmArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -48,11 +48,12 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("WMSKmArtifact.setup");
 
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSLineArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSLineArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSLineArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSQPSArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSQPSArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -10,15 +10,10 @@
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.geom.Envelope;
 
-import org.dive4elements.artifacts.ArtifactFactory;
-import org.dive4elements.artifacts.CallMeta;
-
 import org.dive4elements.artifactdatabase.state.DefaultOutput;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifactdatabase.state.State;
@@ -42,20 +37,6 @@
 
 
     @Override
-    public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
-    {
-        logger.debug("WMSQPSArtifact.setup");
-
-        super.setup(identifier, factory, context, callMeta, data);
-    }
-
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WQKmsInterpolArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WQKmsInterpolArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -92,7 +92,8 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
         logger.debug("WQKmsInterpolArtifact.setup");
 
@@ -157,7 +158,7 @@
         }
 
         spawnState();
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WaterlevelArtifact.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WaterlevelArtifact.java	Wed Apr 30 15:29:50 2014 +0200
@@ -64,9 +64,10 @@
         ArtifactFactory factory,
         Object          context,
         CallMeta        callMeta,
-        Document        data)
+        Document        data,
+        List<Class>     loadFacets)
     {
-        super.setup(identifier, factory, context, callMeta, data);
+        super.setup(identifier, factory, context, callMeta, data, loadFacets);
         // For w_differences, also allow q-facets.
         if(filterFacets != null) {
             List<Facet> list = new ArrayList<Facet>();
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java	Wed Apr 30 15:29:50 2014 +0200
@@ -332,6 +332,7 @@
     String BED_DIAMETER_DATA_TOP                 = "bed_longitudinal_section.bed_diameter_data_top";
     String BED_DIAMETER_DATA_SUB                 = "bed_longitudinal_section.bed_diameter_data_sub";
     String BEDLOAD_DIAMETER_DATA                 = "bed_longitudinal_section.bedload_diameter_data";
+    String POROSITY                              = "porosity";
 
     String BED_DIFFERENCE_YEAR                   = "bedheight_difference.year";
     String BED_DIFFERENCE_YEAR_FILTERED          = "bedheight_difference.year.filtered";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticPorosityCacheKey.java	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,37 @@
+/* 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;
+
+
+public class StaticPorosityCacheKey
+{
+   public static final String CACHE_NAME = "porosity-table-static";
+
+    private int porosity_id;
+
+    public StaticPorosityCacheKey(
+        int porosity_id
+    ) {
+        this.porosity_id = porosity_id;
+    }
+
+    @Override
+    public int hashCode() {
+        return (String.valueOf(porosity_id)).hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (!(other instanceof StaticPorosityCacheKey)) {
+            return false;
+        }
+        StaticPorosityCacheKey o = (StaticPorosityCacheKey) other;
+        return this.porosity_id == o.porosity_id;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/Porosity.java	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,56 @@
+/* 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 java.util.HashMap;
+import java.util.Map;
+
+
+public class Porosity
+{
+
+    private Map<Double, Double> pairs;
+
+
+    public Porosity() {
+        pairs = new HashMap<Double, Double>();
+    }
+
+    public void add(double station, double porosity) {
+        this.pairs.put(station, porosity);
+    }
+
+    public Map<Double, Double> getAll() {
+        return this.pairs;
+    }
+
+    public double[][] getAsArray() {
+        double [][] array = new double[2][pairs.size()];
+        Double[] kms = pairs.keySet().toArray(new Double[pairs.size()]);
+        Double[] porosity = pairs.values().toArray(new Double[pairs.size()]);
+        int realIndex = 0;
+        for (int i = 0; i < kms.length; i++) {
+            if (kms[i] == null || porosity[i] == null) {
+                continue;
+            }
+            array[0][realIndex] = kms[i];
+            array[1][realIndex] = porosity[i];
+            realIndex++;
+        }
+        return array;
+    }
+
+
+    public Double getWidth(double station) {
+        if (this.pairs.containsKey(station)) {
+            return this.pairs.get(station);
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/PorosityFacet.java	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,89 @@
+/* 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.artifactdatabase.state.StaticFacet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.CallMeta;
+import org.dive4elements.artifacts.common.utils.XMLUtils;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.resources.Resources;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+import org.w3c.dom.Document;
+
+
+public class PorosityFacet
+extends DataFacet
+implements   FacetTypes, StaticFacet
+{
+    private static Logger logger = Logger.getLogger(PorosityFacet.class);
+
+    private static final String NAME = "porosity";
+
+    public PorosityFacet() {
+    }
+
+    public PorosityFacet(String facetName, String description) {
+        super(facetName, description);
+    }
+
+    public PorosityFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+        String porosity_id = flys.getDataAsString("porosity_id");
+
+        Porosity porosity =
+            PorosityFactory.getPorosity(Integer.valueOf(porosity_id));
+
+        return porosity;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        PorosityFacet copy = new PorosityFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+
+    @Override
+    public void setup(Artifact artifact, Document data, CallMeta callMeta) {
+        logger.debug("setup");
+
+        if (logger.isDebugEnabled()) {
+            logger.debug(XMLUtils.toString(data));
+        }
+
+        String code = D4EArtifact.getDatacageIDValue(data);
+
+        if (code != null) {
+            this.name = NAME;
+            this.description = Resources.getMsg(
+                callMeta,
+                "facet.porosity",
+                "Porosity");
+            D4EArtifact d4e = (D4EArtifact) artifact;
+            d4e.addStringData("porosity_id", code);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/PorosityFactory.java	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,95 @@
+/* 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 java.util.List;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+
+import org.apache.log4j.Logger;
+import org.hibernate.SQLQuery;
+import org.hibernate.Session;
+import org.hibernate.type.StandardBasicTypes;
+
+import org.dive4elements.river.artifacts.cache.CacheFactory;
+import org.dive4elements.river.artifacts.model.StaticMorphoWidthCacheKey;
+import org.dive4elements.river.artifacts.model.StaticPorosityCacheKey;
+import org.dive4elements.river.backend.SessionHolder;
+
+
+public class PorosityFactory
+{
+    /** Private logger to use here. */
+    private static Logger log = Logger.getLogger(PorosityFactory.class);
+
+    public static final String SQL_SELECT =
+        "SELECT pv.station AS station, pv.porosity AS porosity " +
+        "   FROM porosity p" +
+        "       JOIN porosity_values pv on pv.porosity_id = p.id" +
+        "   WHERE p.id = :porosity_id";
+
+    private PorosityFactory() {
+    }
+
+
+    /**
+     * Get WKms for given column and wst_id, caring about the cache.
+     */
+    public static Porosity getPorosity(int porosity_id) {
+        log.debug("PorosityFactory.getPorosity");
+        Cache cache = CacheFactory.getCache(StaticPorosityCacheKey.CACHE_NAME);
+
+        StaticPorosityCacheKey cacheKey;
+
+        if (cache != null) {
+            cacheKey = new StaticPorosityCacheKey(porosity_id);
+            Element element = cache.get(cacheKey);
+            if (element != null) {
+                log.debug("Got static porosity values from cache");
+                return (Porosity)element.getValue();
+            }
+        }
+        else {
+            cacheKey = null;
+        }
+
+        Porosity values = getPorosityUncached(porosity_id);
+
+        if (values != null && cacheKey != null) {
+            log.debug("Store static porosity values in cache.");
+            Element element = new Element(cacheKey, values);
+            cache.put(element);
+        }
+        return values;
+    }
+
+    private static Porosity getPorosityUncached(int porosity_id) {
+        if (log.isDebugEnabled()) {
+            log.debug("PorosityFactory.getPorosityUncached");
+        }
+
+        Session session = SessionHolder.HOLDER.get();
+        SQLQuery sqlQuery = session.createSQLQuery(SQL_SELECT)
+                .addScalar("station", StandardBasicTypes.DOUBLE)
+                .addScalar("porosity", StandardBasicTypes.DOUBLE);
+        sqlQuery.setInteger("porosity_id", porosity_id);
+        List<Object []> results = sqlQuery.list();
+
+        Porosity porosities = new Porosity();
+        for (Object [] row: results) {
+            log.debug("got station: " + (Double)row[0]);
+            porosities.add(
+                (Double) row[0],
+                (Double) row[1]);
+        }
+        return porosities;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Wed Apr 30 15:29:50 2014 +0200
@@ -20,6 +20,7 @@
 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 {
 
@@ -48,6 +49,8 @@
             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);
             return;
@@ -60,7 +63,8 @@
     @Override
     public boolean canHandle(String facettype) {
         return facettype.equals(FacetTypes.BED_QUALITY_POROSITY_TOPLAYER) ||
-            facettype.equals(FacetTypes.BED_QUALITY_POROSITY_SUBLAYER);
+            facettype.equals(FacetTypes.BED_QUALITY_POROSITY_SUBLAYER) ||
+            facettype.equals(FacetTypes.POROSITY);
     }
 
     @Override
--- a/backend/doc/schema/postgresql-minfo.sql	Fri Apr 25 15:46:06 2014 +0200
+++ b/backend/doc/schema/postgresql-minfo.sql	Wed Apr 30 15:29:50 2014 +0200
@@ -147,6 +147,35 @@
 );
 
 
+CREATE SEQUENCE POROSITY_ID_SEQ;
+
+CREATE TABLE porosity (
+    id               int NOT NULL,
+    river_id         int NOT NULL,
+    depth_id         int NOT NULL,
+    description      VARCHAR(256),
+    time_interval_id int NOT NULL,
+    PRIMARY KEY(id),
+    CONSTRAINT fk_p_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
+    CONSTRAINT fk_p_depth_id FOREIGN KEY (depth_id) REFERENCES depths(id),
+    CONSTRAINT fk_p_time_interval_id FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id)
+);
+
+
+CREATE SEQUENCE POROSITY_VALUES_ID_SEQ;
+
+CREATE TABLE porosity_values (
+    id                  int NOT NULL,
+    porosity_id         int NOT NULL,
+    station             NUMERIC NOT NULL,
+    shore_offset        NUMERIC,
+    porosity            NUMERIC NOT NULL,
+    description         VARCHAR(256),
+    PRIMARY KEY(id),
+    CONSTRAINT fk_pv_porosity_id FOREIGN KEY(porosity_id) REFERENCES porosity(id) ON DELETE CASCADE
+);
+
+
 CREATE SEQUENCE MORPHOLOGIC_WIDTH_ID_SEQ;
 
 CREATE TABLE morphologic_width (
--- a/backend/src/main/java/org/dive4elements/river/backend/FLYSCredentials.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/backend/FLYSCredentials.java	Wed Apr 30 15:29:50 2014 +0200
@@ -64,6 +64,8 @@
 import org.dive4elements.river.model.MorphologicalWidth;
 import org.dive4elements.river.model.MorphologicalWidthValue;
 import org.dive4elements.river.model.NamedMainValue;
+import org.dive4elements.river.model.Porosity;
+import org.dive4elements.river.model.PorosityValue;
 import org.dive4elements.river.model.Position;
 import org.dive4elements.river.model.Range;
 import org.dive4elements.river.model.River;
@@ -192,6 +194,8 @@
         River.class,
         RiverAxis.class,
         RiverAxisKm.class,
+        Porosity.class,
+        PorosityValue.class,
         SectieKind.class,
         SobekKind.class,
         SedimentDensity.class,
--- a/backend/src/main/java/org/dive4elements/river/importer/Config.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/Config.java	Wed Apr 30 15:29:50 2014 +0200
@@ -79,6 +79,9 @@
     public static final String SKIP_SEDIMENT_DENSITY =
         "flys.backend.importer.skip.sediment.density";
 
+    public static final String SKIP_POROSITY =
+        "flys.backend.importer.skip.porosity";
+
     public static final String SKIP_MORPHOLOGICAL_WIDTH =
         "flys.backend.importer.skip.morphological.width";
 
@@ -219,6 +222,10 @@
         return getFlag(SKIP_SEDIMENT_DENSITY);
     }
 
+    public boolean skipPorosity() {
+        return getFlag(SKIP_POROSITY);
+    }
+
     public boolean skipMorphologicalWidth() {
         return getFlag(SKIP_MORPHOLOGICAL_WIDTH);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportPorosity.java	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,112 @@
+/* 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.importer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.hibernate.Query;
+import org.hibernate.Session;
+
+import org.dive4elements.river.model.River;
+import org.dive4elements.river.model.Porosity;
+import org.dive4elements.river.model.TimeInterval;
+
+
+public class ImportPorosity {
+
+    private static Logger log = Logger.getLogger(ImportPorosity.class);
+
+    protected Porosity peer;
+
+    protected ImportDepth depth;
+
+    protected String description;
+
+    protected ImportTimeInterval timeInterval;
+
+    protected List<ImportPorosityValue> values;
+
+    public ImportPorosity(String description) {
+        this.description = description;
+        this.values = new ArrayList<ImportPorosityValue>();
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDepth(ImportDepth depth) {
+        this.depth = depth;
+    }
+
+    public void setTimeInterval(ImportTimeInterval importTimeInterval) {
+        this.timeInterval = importTimeInterval;
+    }
+
+    public void addValue(ImportPorosityValue value) {
+        values.add(value);
+    }
+
+    public void storeDependencies(River river) {
+        log.info("store dependencies");
+
+        if (depth != null) {
+            depth.storeDependencies();
+        }
+
+        Porosity peer = getPeer(river);
+
+        if (peer != null) {
+            log.info("store porosity values.");
+            for (ImportPorosityValue value : values) {
+                value.storeDependencies(peer);
+            }
+        }
+    }
+
+    public Porosity getPeer(River river) {
+        log.info("get peer");
+
+        if (depth == null) {
+            log.warn("cannot store porosity '" + description
+                + "': no depth");
+            return null;
+        }
+
+        if (peer == null) {
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
+
+            Query query = session.createQuery("from Porosity where "
+                + "   river=:river and " + "   depth=:depth");
+
+            query.setParameter("river", river);
+            query.setParameter("depth", depth.getPeer());
+
+            List<Porosity> porosity = query.list();
+
+            if (porosity.isEmpty()) {
+                log.debug("Create new Porosity DB instance.");
+
+                peer = new Porosity(river, depth.getPeer(),
+                    description, timeInterval.getPeer());
+
+                session.save(peer);
+            }
+            else {
+                peer = porosity.get(0);
+            }
+        }
+
+        return peer;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportPorosityValue.java	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,102 @@
+/* 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.importer;
+
+import java.math.BigDecimal;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.hibernate.Session;
+import org.hibernate.Query;
+
+import org.dive4elements.river.model.Porosity;
+import org.dive4elements.river.model.PorosityValue;
+
+
+public class ImportPorosityValue {
+
+    private static final Logger log =
+        Logger.getLogger(ImportPorosityValue.class);
+
+
+    protected PorosityValue peer;
+
+    protected BigDecimal station;
+
+    protected BigDecimal shoreOffset;
+
+    protected BigDecimal porosity;
+
+    protected String description;
+
+
+    public ImportPorosityValue(
+        BigDecimal station,
+        BigDecimal shoreOffset,
+        BigDecimal porosity,
+        String     description
+    ) {
+        this.station     = station;
+        this.shoreOffset = shoreOffset;
+        this.porosity    = porosity;
+        this.description = description;
+    }
+
+
+    public void storeDependencies(Porosity porosity) {
+        log.info("store dependencies");
+
+        getPeer(porosity);
+    }
+
+
+    public PorosityValue getPeer(Porosity porosity) {
+        log.info("get peer");
+
+        if (peer == null) {
+            Session session = ImporterSession.getInstance().getDatabaseSession();
+
+            Query query = session.createQuery(
+                "from PorosityValue where " +
+                "   porosity=:porosity and " +
+                "   station=:station and " +
+                "   shoreOffset=:shoreOffset and " +
+                "   porosityValue=:poros and " +
+                "   description=:description");
+
+            query.setParameter("porosity", porosity);
+            query.setParameter("station", station);
+            query.setParameter("shoreOffset", shoreOffset);
+            query.setParameter("poros", this.porosity);
+            query.setParameter("description", description);
+
+            List<PorosityValue> values = query.list();
+            if (values.isEmpty()) {
+                log.debug("Create new PorosityValue DB instance.");
+
+                peer = new PorosityValue(
+                    porosity,
+                    station,
+                    shoreOffset,
+                    this.porosity,
+                    description);
+
+                session.save(peer);
+            }
+            else {
+                peer = values.get(0);
+            }
+        }
+
+        return peer;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Fri Apr 25 15:46:06 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Wed Apr 30 15:29:50 2014 +0200
@@ -27,6 +27,7 @@
 import org.dive4elements.river.importer.parsers.OfficialLinesConfigParser;
 import org.dive4elements.river.importer.parsers.PRFParser;
 import org.dive4elements.river.importer.parsers.PegelGltParser;
+import org.dive4elements.river.importer.parsers.PorosityParser;
 import org.dive4elements.river.importer.parsers.SQRelationParser;
 import org.dive4elements.river.importer.parsers.SedimentDensityParser;
 import org.dive4elements.river.importer.parsers.SedimentYieldParser;
@@ -96,6 +97,8 @@
 
     public static final String SEDIMENT_DENSITY_DIR = "Sedimentdichte";
 
+    public static final String POROSITY_DIR = "Porositaet";
+
     public static final String MORPHOLOGICAL_WIDTH_DIR = "morphologische_Breite";
 
     public static final String FLOW_VELOCITY_DIR = "Geschwindigkeit_Schubspannung";
@@ -164,6 +167,8 @@
 
     protected List<ImportSedimentDensity> sedimentDensities;
 
+    protected List<ImportPorosity> porosities;
+
     protected List<ImportMorphWidth> morphologicalWidths;
 
     protected List<ImportFlowVelocityModel> flowVelocityModels;
@@ -282,6 +287,7 @@
         waterlevelDifferences     = new ArrayList<ImportWst>();
         floodProtection           = new ArrayList<ImportWst>();
         sedimentDensities         = new ArrayList<ImportSedimentDensity>();
+        porosities                = new ArrayList<ImportPorosity>();
         morphologicalWidths       = new ArrayList<ImportMorphWidth>();
         flowVelocityModels        = new ArrayList<ImportFlowVelocityModel>();
         flowVelocityMeasurements  = new ArrayList<ImportFlowVelocityMeasurement>();
@@ -375,6 +381,7 @@
         parseFloodProtection();
         parseBedHeight();
         parseSedimentDensity();
+        parsePorosity();
         parseMorphologicalWidth();
         parseFlowVelocity();
         parseSedimentYield();
@@ -492,6 +499,34 @@
         log.info("Parsed " + sedimentDensities.size() + " sediment densities.");
     }
 
+    protected void parsePorosity() throws IOException {
+        if (Config.INSTANCE.skipPorosity()) {
+            log.info("skip parsing porosity.");
+            return;
+        }
+
+        log.debug("Parse porosity");
+
+        File minfoDir = getMinfoDir();
+        File porosity = new File(minfoDir, POROSITY_DIR);
+
+        File[] files = porosity.listFiles();
+
+        if (files == null) {
+            log.warn("Cannot read directory '" + porosity + "'");
+            return;
+        }
+
+        PorosityParser parser = new PorosityParser();
+
+        for (File file: files) {
+            parser.parse(file);
+        }
+
+        porosities = parser.getPorosities();
+
+        log.info("Parsed " + porosities.size() + " porosities.");
+    }
 
     protected void parseMorphologicalWidth() throws IOException {
         if (Config.INSTANCE.skipMorphologicalWidth()) {
@@ -1250,6 +1285,7 @@
         storeFloodProtection();
         storeBedHeight();
         storeSedimentDensity();
+        storePorosity();
         storeMorphologicalWidth();
         storeFlowVelocity();
         storeSedimentYield();
@@ -1471,6 +1507,22 @@
         }
     }
 
+    public void storePorosity() {
+        if (!Config.INSTANCE.skipPorosity()) {
+            log.info("store porosity");
+
+            River river = getPeer();
+
+            for (ImportPorosity porosity: porosities) {
+                String desc = porosity.getDescription();
+
+                log.debug("name: " + desc);
+
+                porosity.storeDependencies(river);
+            }
+        }
+    }
+
     public void storeMorphologicalWidth() {
         if (!Config.INSTANCE.skipMorphologicalWidth()) {
             log.info("store morphological width");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/PorosityParser.java	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,201 @@
+/* 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.importer.parsers;
+
+import org.dive4elements.river.importer.ImportDepth;
+import org.dive4elements.river.importer.ImportPorosity;
+import org.dive4elements.river.importer.ImportPorosityValue;
+import org.dive4elements.river.importer.ImportSedimentDensity;
+import org.dive4elements.river.importer.ImportSedimentDensityValue;
+import org.dive4elements.river.importer.ImportTimeInterval;
+
+import java.io.File;
+import java.io.IOException;
+
+import java.math.BigDecimal;
+
+import java.text.NumberFormat;
+import java.text.ParseException;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.log4j.Logger;
+
+public class PorosityParser extends LineParser {
+
+    private static final Logger log =
+        Logger.getLogger(PorosityParser.class);
+
+    public static final NumberFormat nf =
+        NumberFormat.getInstance(DEFAULT_LOCALE);
+
+    public static final Pattern META_DEPTH =
+        Pattern.compile("^Tiefe: (\\w++)-(\\w++)( (\\w++))?.*");
+
+    public static final Pattern META_TIMEINTERVAL =
+        Pattern.compile("^Zeitraum: (\\d{4})-(\\d{4}).*");
+
+    protected List<ImportPorosity> porosities;
+
+    protected ImportPorosity current;
+
+    protected String currentDescription;
+
+    public PorosityParser() {
+        porosities = new ArrayList<ImportPorosity>();
+    }
+
+
+    @Override
+    public void parse(File file) throws IOException {
+        currentDescription = file.getName();
+
+        super.parse(file);
+    }
+
+
+    @Override
+    protected void reset() {
+        current = new ImportPorosity(currentDescription);
+    }
+
+
+    @Override
+    protected void finish() {
+        if (current != null) {
+            porosities.add(current);
+        }
+    }
+
+
+    @Override
+    protected void handleLine(int lineNum, String line) {
+        if (line.startsWith(START_META_CHAR)) {
+            handleMetaLine(stripMetaLine(line));
+        }
+        else {
+            handleDataLine(line);
+        }
+    }
+
+
+    protected void handleMetaLine(String line) {
+        if (handleMetaDepth(line)) {
+            return;
+        }
+        if (handleMetaTimeInterval(line)) {
+            return;
+        }
+        log.warn("Unknown meta line: '" + line + "'");
+    }
+
+    protected boolean handleMetaTimeInterval(String line) {
+        Matcher m = META_TIMEINTERVAL.matcher(line);
+
+        if (m.matches()) {
+            String lo = m.group(1);
+            String up = m.group(2);
+
+            log.debug("Found time interval: " + lo + " - " + up);
+
+            try {
+                int lower = Integer.valueOf(lo);
+                int upper = Integer.valueOf(up);
+
+                Date fromYear = LineParser.getStartDateFromYear(lower);
+                Date toYear   = LineParser.getEndDateFromYear(upper);
+
+                current.setTimeInterval(new ImportTimeInterval(fromYear, toYear));
+            }
+            catch (NumberFormatException e) {
+                log.warn("PP: could not parse timeinterval", e);
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+    protected boolean handleMetaDepth(String line) {
+        Matcher m = META_DEPTH.matcher(line);
+
+        if (m.matches()) {
+            String lo   = m.group(1);
+            String up   = m.group(2);
+
+            log.info("Found porosity depth: " + lo + " - " + up + " cm");
+
+            try {
+                ImportDepth depth = new ImportDepth(
+                    new BigDecimal(nf.parse(lo).doubleValue()),
+                    new BigDecimal(nf.parse(up).doubleValue())
+                );
+
+                current.setDepth(depth);
+
+                return true;
+            }
+            catch (ParseException pe) {
+                log.warn("Unparseable numbers in: '" + line + "'");
+            }
+        }
+        else {
+            log.debug("Meta line doesn't contain depth information: " + line);
+        }
+
+        return false;
+    }
+
+    protected void handleDataLine(String line) {
+        String[] vals = line.split(SEPERATOR_CHAR);
+        log.debug("handle line: " + line);
+
+        if (vals == null || vals.length < 3) {
+            log.warn("skip invalid data line: '" + line + "'");
+            return;
+        }
+
+        BigDecimal km = null;
+        BigDecimal shoreOffset = null;
+        BigDecimal porosity = null;
+        try {
+            km          = new BigDecimal(nf.parse(vals[0]).doubleValue());
+            porosity     = new BigDecimal(nf.parse(vals[2]).doubleValue());
+            if (!vals[1].isEmpty()) {
+                shoreOffset = new BigDecimal(nf.parse(vals[1]).doubleValue());
+            }
+        }
+        catch (ParseException pe) {
+            log.warn("Unparseable numbers in '" + line + "'");
+        }
+
+        if (km == null || porosity == null) {
+            log.warn("PP: No km nor porosity given. Skip line");
+            return;
+        }
+        log.debug("add new value.");
+        current.addValue(new ImportPorosityValue(
+            km,
+            shoreOffset,
+            porosity,
+            currentDescription));
+    }
+
+
+    public List<ImportPorosity> getPorosities() {
+        return porosities;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/src/main/java/org/dive4elements/river/model/Porosity.java	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,128 @@
+/* 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.model;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.GenerationType;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.OneToMany;
+
+
+@Entity
+@Table(name = "porosity")
+public class Porosity implements Serializable {
+
+    private Integer id;
+
+    private River river;
+
+    private Depth depth;
+
+    private List<PorosityValue> values;
+
+    private String description;
+
+    private TimeInterval timeInterval;
+
+    public Porosity() {
+    }
+
+
+    public Porosity(
+        River river,
+        Depth depth,
+        String desc,
+        TimeInterval timeInterval
+    ) {
+        this.river       = river;
+        this.depth       = depth;
+        this.description = desc;
+        this.timeInterval = timeInterval;
+    }
+
+    @Id
+    @SequenceGenerator(
+        name           = "SEQUENCE_POROSITY_ID_SEQ",
+        sequenceName   = "POROSITY_ID_SEQ",
+        allocationSize = 1)
+    @GeneratedValue(
+        strategy  = GenerationType.SEQUENCE,
+        generator = "SEQUENCE_POROSITY_ID_SEQ")
+    @Column(name = "id")
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "river_id" )
+    public River getRiver() {
+        return river;
+    }
+
+    public void setRiver(River river) {
+        this.river = river;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "depth_id")
+    public Depth getDepth() {
+        return depth;
+    }
+
+    public void setDepth(Depth depth) {
+        this.depth = depth;
+    }
+
+    @Column(name = "description")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "time_interval_id")
+    public TimeInterval getTimeInterval() {
+        return timeInterval;
+    }
+
+    public void setTimeInterval(TimeInterval timeInterval) {
+        this.timeInterval = timeInterval;
+    }
+
+    @OneToMany
+    @JoinColumn(name="porosity_id")
+    public List<PorosityValue> getValues() {
+        return values;
+    }
+
+    public void setValues(List<PorosityValue> values) {
+        this.values = values;
+    }
+
+    public void addValue(PorosityValue value) {
+        this.values.add(value);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/src/main/java/org/dive4elements/river/model/PorosityValue.java	Wed Apr 30 15:29:50 2014 +0200
@@ -0,0 +1,121 @@
+/* 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.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.GenerationType;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+
+
+@Entity
+@Table(name = "porosity_values")
+public class PorosityValue implements Serializable {
+
+    private Integer id;
+
+    private Porosity porosity;
+
+    private BigDecimal station;
+    private BigDecimal shoreOffset;
+    private BigDecimal porosityValue;
+
+    private String description;
+
+
+    public PorosityValue() {
+    }
+
+
+    public PorosityValue(
+        Porosity        porosity,
+        BigDecimal      station,
+        BigDecimal      shoreOffset,
+        BigDecimal      porosityValue,
+        String          desc
+    ) {
+        this.porosity        = porosity;
+        this.station         = station;
+        this.shoreOffset     = shoreOffset;
+        this.porosityValue   = porosityValue;
+        this.description     = desc;
+    }
+
+    @Id
+    @SequenceGenerator(
+        name           = "SEQUENCE_POROSITY_VALUES_ID_SEQ",
+        sequenceName   = "POROSITY_VALUES_ID_SEQ",
+        allocationSize = 1)
+    @GeneratedValue(
+        strategy  = GenerationType.SEQUENCE,
+        generator = "SEQUENCE_POROSITY_VALUES_ID_SEQ")
+    @Column(name = "id")
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "porosity_id")
+    public Porosity getPorosity() {
+        return porosity;
+    }
+
+    public void setPorosity(Porosity porosity) {
+        this.porosity = porosity;
+    }
+
+    @Column(name = "station")
+    public BigDecimal getStation() {
+        return station;
+    }
+
+    public void setStation(BigDecimal station) {
+        this.station = station;
+    }
+
+    @Column(name = "shore_offset")
+    public BigDecimal getShoreOffset() {
+        return shoreOffset;
+    }
+
+    public void setShoreOffset(BigDecimal shoreOffset) {
+        this.shoreOffset = shoreOffset;
+    }
+
+    @Column(name = "porosity")
+    public BigDecimal getPorosityValue() {
+        return porosityValue;
+    }
+
+    public void setPorosityValue(BigDecimal porosityValue) {
+        this.porosityValue = porosityValue;
+    }
+
+    @Column(name = "description")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org