[Dive4elements-commits] [PATCH 2 of 5] River artifacts: Renamed FLYSUtils to RiverUtils

Wald Commits scm-commit at wald.intevation.org
Sun Apr 28 15:29:50 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1367154571 -7200
# Node ID 73da40528cf2f03b56b70ab0552f9d743e784431
# Parent  f2e46a668fe695d8bcfbd79f98cf3882809f14cc
River artifacts: Renamed FLYSUtils to RiverUtils.

diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/AnnotationArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/AnnotationArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/AnnotationArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -36,7 +36,7 @@
 import org.dive4elements.river.artifacts.states.DefaultState;
 import org.dive4elements.river.artifacts.context.FLYSContext;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 /**
  * Artifact to access names of Points Of Interest along a segment of a river.
@@ -207,7 +207,7 @@
     {
         List<String> stateIds = getPreviousStateIds();
 
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
         StateEngine engine      = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/ChartArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/ChartArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/ChartArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -30,7 +30,7 @@
 import org.dive4elements.artifactdatabase.state.StateEngine;
 import org.dive4elements.artifactdatabase.state.Output;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import org.dive4elements.river.artifacts.states.DefaultState;
 import org.dive4elements.river.artifacts.context.FLYSContext;
@@ -89,7 +89,7 @@
     {
         List<String> stateIds = getPreviousStateIds();
 
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
         StateEngine engine      = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/FLYSArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/FLYSArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/FLYSArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -55,7 +55,7 @@
 import org.dive4elements.river.artifacts.model.CalculationMessage;
 import org.dive4elements.river.artifacts.states.DefaultState;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 /**
  * The default FLYS artifact with convenience added.
@@ -139,7 +139,7 @@
     {
         List<String> stateIds = getPreviousStateIds();
 
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
         StateEngine engine      = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
 
@@ -191,7 +191,7 @@
 
         super.setup(identifier, factory, context, callMeta, data);
 
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
 
         List<State> states = getStates(context);
 
@@ -447,7 +447,7 @@
             dumpArtifact();
         }
 
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
 
         StateEngine stateEngine = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
@@ -704,7 +704,7 @@
      * @return list of states.
      */
     protected List<State> getStates(Object context) {
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
         StateEngine engine      = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
         return engine.getStates(getName());
@@ -718,7 +718,7 @@
      * @return state with given ID.
      */
     protected State getState(Object context, String stateID) {
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
         StateEngine engine      = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
         return engine.getState(stateID);
@@ -979,7 +979,7 @@
 
         DefaultState current = (DefaultState) getCurrentState(context);
 
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
         StateEngine engine      = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
 
@@ -1031,7 +1031,7 @@
             log.debug("Determine if the state '" + stateId + "' is reachable.");
         }
 
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
 
         State currentState  = getCurrentState(context);
         StateEngine sEngine = (StateEngine) flysContext.get(
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -36,7 +36,7 @@
 import org.dive4elements.river.model.Gauge;
 import org.dive4elements.river.model.River;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -127,7 +127,7 @@
 
     /** Get the Gauges which came with datacage data-document. */
     public Gauge getGauge() {
-        River river = FLYSUtils.getRiver(this);
+        River river = RiverUtils.getRiver(this);
         return river.determineGaugeByName(getGaugeName());
     }
 
@@ -138,13 +138,13 @@
      */
     public CalculationResult getDischargeCurveData() {
 
-        River river = FLYSUtils.getRiver(this);
+        River river = RiverUtils.getRiver(this);
         if (river == null) {
             return error(new WQKms[0], "no.river.selected");
         }
         /*
         // This one would allow to automatically pick the right Gauge.
-        double [] distance = FLYSUtils.getKmRange(this);
+        double [] distance = RiverUtils.getKmRange(this);
         logger.debug("getDischargeCurveData: get range");
 
         if (distance == null) {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeCurveArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeCurveArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeCurveArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -31,7 +31,7 @@
 import org.dive4elements.river.artifacts.states.StaticState;
 
 import org.dive4elements.river.model.Gauge;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -104,7 +104,7 @@
                         "Gauge official number"),
                     "Long", gaugeref));
 
-        Gauge gauge = FLYSUtils.getReferenceGauge(this);
+        Gauge gauge = RiverUtils.getReferenceGauge(this);
         String gaugename = "";
         Double gaugelocation = null;
         if (gauge != null) {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -41,7 +41,7 @@
 import org.dive4elements.river.artifacts.states.StaticState;
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -283,7 +283,7 @@
      *         invalid parameterization.
      */
     protected Gauge getGauge() {
-        River river = FLYSUtils.getRiver(this);
+        River river = RiverUtils.getRiver(this);
 
         // TODO use helper to get location as double
         String locationStr = getDataAsString("ld_locations");
@@ -321,7 +321,7 @@
     public List<NamedDouble> getMainValuesQ(boolean atGauge) {
         List<NamedDouble> filteredList = new ArrayList<NamedDouble>();
         Gauge gauge = getGauge();
-        WstValueTable interpolator = WstValueTableFactory.getTable(FLYSUtils.getRiver(this));
+        WstValueTable interpolator = WstValueTableFactory.getTable(RiverUtils.getRiver(this));
         Calculation c = new Calculation();
         double w_out[] = {0.0f};
         double q_out[] = {0.0f};
@@ -357,7 +357,7 @@
     public List<NamedDouble> getMainValuesW(boolean atGauge) {
         List<NamedDouble> filteredList = new ArrayList<NamedDouble>();
         Gauge gauge = getGauge();
-        WstValueTable interpolator = WstValueTableFactory.getTable(FLYSUtils.getRiver(this));
+        WstValueTable interpolator = WstValueTableFactory.getTable(RiverUtils.getRiver(this));
         Calculation c = new Calculation();
 
         double gaugeStation = gauge.getStation().doubleValue();
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/MapArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/MapArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/MapArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -22,7 +22,7 @@
 import org.dive4elements.river.artifacts.model.map.WMSDBLayerFacet;
 import org.dive4elements.river.artifacts.states.DefaultState;
 import org.dive4elements.river.model.River;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.MapUtils;
 
 import java.util.List;
@@ -84,7 +84,7 @@
     {
         List<String> stateIds = getPreviousStateIds();
 
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
         StateEngine engine      = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
 
@@ -186,7 +186,7 @@
 
         @Override
         public int getRiverId() {
-            River r = FLYSUtils.getRiver(artifact);
+            River r = RiverUtils.getRiver(artifact);
             int riverId = r.getId();
 
             return riverId;
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/RiverAxisArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/RiverAxisArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/RiverAxisArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -20,7 +20,7 @@
 import org.dive4elements.river.artifacts.model.RiverFactory;
 import org.dive4elements.river.model.River;
 import org.dive4elements.river.model.RiverAxis;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 import java.util.List;
@@ -103,13 +103,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getRiverWMSUrl();
+            return RiverUtils.getRiverWMSUrl();
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -176,7 +176,7 @@
 
         @Override
         protected String getDataString() {
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM river_axes USING SRID " + getSrid();
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -51,7 +51,7 @@
 import org.dive4elements.river.model.River;
 
 import org.dive4elements.river.utils.DoubleUtil;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import gnu.trove.TDoubleArrayList;
 
@@ -209,7 +209,7 @@
                 this.compute(context, ComputeType.ADVANCE, false);
         }
 
-        River river = FLYSUtils.getRiver(this);
+        River river = RiverUtils.getRiver(this);
         if (river == null) {
             return error(new WQKms[0], "no.river.selected");
         }
@@ -312,7 +312,7 @@
     public CalculationResult getDurationCurveData() {
         logger.debug("WINFOArtifact.getDurationCurveData");
 
-        River r = FLYSUtils.getRiver(this);
+        River r = RiverUtils.getRiver(this);
 
         if (r == null) {
             return error(null, "no.river.selected");
@@ -376,7 +376,7 @@
     {
         logger.debug("WINFOArtifact.getComputedDischargeCurveData");
 
-        River r = FLYSUtils.getRiver(this);
+        River r = RiverUtils.getRiver(this);
 
         if (r == null) {
             return error(new WQKms[0], "no.river.selected");
@@ -452,7 +452,7 @@
 
         Calculation5 calc5 = new Calculation5(startKm, endKms);
 
-        River r = FLYSUtils.getRiver(this);
+        River r = RiverUtils.getRiver(this);
         if (r == null) {
             return error(new WW[0], "no.river.found");
         }
@@ -537,13 +537,13 @@
 
 
     public CalculationResult getHistoricalDischargeData() {
-        Gauge  gauge        = FLYSUtils.getReferenceGauge(this);
+        Gauge  gauge        = RiverUtils.getReferenceGauge(this);
         String rawTimerange = getDataAsString("year_range");
         String rawValues    = getDataAsString("historical_values");
         int    mode         = getDataAsInteger("historical_mode");
 
-        long[]   timerange = FLYSUtils.longArrayFromString(rawTimerange);
-        double[] values    = FLYSUtils.doubleArrayFromString(rawValues);
+        long[]   timerange = RiverUtils.longArrayFromString(rawTimerange);
+        double[] values    = RiverUtils.doubleArrayFromString(rawValues);
 
         Calendar start = new GregorianCalendar();
         start.setTimeInMillis(timerange[0]);
@@ -699,7 +699,7 @@
             logger.debug("FLYSArtifact.getQsForWs");
         }
 
-        River r = FLYSUtils.getRiver(this);
+        River r = RiverUtils.getRiver(this);
         if (r == null) {
             logger.warn("no river found");
             return null;
@@ -926,7 +926,7 @@
      * @return the gauge.
      */
     public Gauge getGauge() {
-        return FLYSUtils.getGauge(this);
+        return RiverUtils.getGauge(this);
     }
 
 
@@ -1187,7 +1187,7 @@
      * Returns the WstValueTable of current river.
      */
     public WstValueTable getWstValueTable() {
-        River r = FLYSUtils.getRiver(this);
+        River r = RiverUtils.getRiver(this);
         return WstValueTableFactory.getTable(r);
     }
 }
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSBuildingsArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSBuildingsArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSBuildingsArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -99,13 +99,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -156,7 +156,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM buildings USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSDBArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSDBArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSDBArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -20,7 +20,7 @@
 import org.dive4elements.river.artifacts.model.map.WMSDBLayerFacet;
 import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.states.DefaultState;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.MapUtils;
 
 import java.io.File;
@@ -238,7 +238,7 @@
         public void endOfLife(Artifact owner, Object context) {
             logger.info("Destroy WMSDBState: " + getID());
 
-            String p = FLYSUtils.getXPathString(FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
+            String p = RiverUtils.getXPathString(RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
             File dir = new File(p, owner.identifier());
 
             if (dir != null && dir.exists()) {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFixpointsArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFixpointsArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFixpointsArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -99,13 +99,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -139,7 +139,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM fixpoints USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmapsArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmapsArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmapsArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -99,13 +99,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -141,7 +141,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM floodmaps USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmarksArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmarksArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodmarksArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -98,13 +98,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -150,7 +150,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM flood_marks USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodplainArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodplainArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSFloodplainArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -103,13 +103,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = getRiver();
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -160,7 +160,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM floodplain USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSGaugeLocationArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSGaugeLocationArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSGaugeLocationArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -30,7 +30,7 @@
 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.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -101,13 +101,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -143,7 +143,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM gauge_location USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSLinesArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSLinesArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSLinesArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -115,13 +115,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -156,7 +156,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM hws_lines USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSPointsArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSPointsArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHWSPointsArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -115,13 +115,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -156,7 +156,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM hws_points USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -99,13 +99,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -153,7 +153,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM hydr_boundaries USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryPolyArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryPolyArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSHydrBoundaryPolyArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -99,13 +99,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -185,7 +185,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM hydr_boundaries_poly USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSJettiesArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSJettiesArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSJettiesArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -99,13 +99,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -147,7 +147,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM jetties USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSKmArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSKmArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSKmArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -30,7 +30,7 @@
 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.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -116,13 +116,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -156,7 +156,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM river_axes_km USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSLineArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSLineArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSLineArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -115,13 +115,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -156,7 +156,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM lines USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/WMSQPSArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSQPSArtifact.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WMSQPSArtifact.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 
 
@@ -96,13 +96,13 @@
 
         @Override
         protected String getUrl() {
-            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+            return RiverUtils.getUserWMSUrl(artifact.identifier());
         }
 
         @Override
         protected String getSrid() {
             River river = RiverFactory.getRiver(getRiverId());
-            return FLYSUtils.getRiverSrid(river.getName());
+            return RiverUtils.getRiverSrid(river.getName());
         }
 
         @Override
@@ -161,7 +161,7 @@
         protected String getDataString() {
             String srid = getSrid();
 
-            if (FLYSUtils.isUsingOracle()) {
+            if (RiverUtils.isUsingOracle()) {
                 return "geom FROM cross_section_tracks USING SRID " + srid;
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/access/Access.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/Access.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/Access.java	Sun Apr 28 15:09:31 2013 +0200
@@ -14,7 +14,7 @@
 
 import org.dive4elements.river.artifacts.model.DateRange;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import gnu.trove.TDoubleArrayList;
 import gnu.trove.TLongArrayList;
@@ -108,7 +108,7 @@
             log.warn("missing '" + key +"' value");
             return null;
         }
-        return FLYSUtils.intArrayFromString((String)sd.getValue());
+        return RiverUtils.intArrayFromString((String)sd.getValue());
     }
 
     protected DateRange [] getDateRange(String key) {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedDifferencesAccess.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedDifferencesAccess.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedDifferencesAccess.java	Sun Apr 28 15:09:31 2013 +0200
@@ -14,7 +14,7 @@
 
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.FLYSArtifact;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.StringUtil;
 
 
@@ -47,8 +47,8 @@
             String[] diff1parts = diff1.split(";");
             String[] diff2parts = diff2.split(";");
             logger.debug("creating 2 artifacts." + diff1parts[0] + "; " + diff2parts[0]);
-            artifacts[i][0] = FLYSUtils.getArtifact(diff1parts[0], context);
-            artifacts[i][1] = FLYSUtils.getArtifact(diff2parts[0], context);
+            artifacts[i][0] = RiverUtils.getArtifact(diff1parts[0], context);
+            artifacts[i][1] = RiverUtils.getArtifact(diff2parts[0], context);
         }
         return artifacts;
     }
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/access/GaugeAccess.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/GaugeAccess.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/GaugeAccess.java	Sun Apr 28 15:09:31 2013 +0200
@@ -12,10 +12,10 @@
 
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.FLYSArtifact;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
-/** For the moment, light-weight wrapper around FLYSUtils. */
-// TODO employ 'Caching' like other Accesses, remove usage of FLYSUtils.
+/** For the moment, light-weight wrapper around RiverUtils. */
+// TODO employ 'Caching' like other Accesses, remove usage of RiverUtils.
 public class GaugeAccess
 extends RangeAccess
 {
@@ -27,9 +27,9 @@
 
 
     public String getGaugeName() {
-        return FLYSUtils.getGaugename(this.getArtifact());
+        return RiverUtils.getGaugename(this.getArtifact());
     }
 
-    // TODO there is also getGauges in FLYSUtils...
+    // TODO there is also getGauges in RiverUtils...
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java	Sun Apr 28 15:09:31 2013 +0200
@@ -15,11 +15,11 @@
 import org.dive4elements.river.artifacts.FLYSArtifact;
 import org.dive4elements.river.artifacts.WINFOArtifact;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
-/** For the moment, light-weight wrapper around FLYSUtils. */
-// TODO employ 'Caching' like other Accesses, remove usage of FLYSUtils.
+/** For the moment, light-weight wrapper around RiverUtils. */
+// TODO employ 'Caching' like other Accesses, remove usage of RiverUtils.
 public class RangeAccess
 extends RiverAccess
 {
@@ -195,7 +195,7 @@
 
 
     public double[] getKmFromTo() {
-         return FLYSUtils.getKmFromTo(this.getArtifact());
+         return RiverUtils.getKmFromTo(this.getArtifact());
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/model/AnnotationFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/AnnotationFacet.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/AnnotationFacet.java	Sun Apr 28 15:09:31 2013 +0200
@@ -28,7 +28,7 @@
 import org.dive4elements.artifactdatabase.state.DefaultFacet;
 import org.dive4elements.artifactdatabase.state.Facet;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import org.dive4elements.river.artifacts.FLYSArtifact;
 
@@ -74,7 +74,7 @@
         // TODO issue880: Make annotations available _per type_
         AnnotationArtifact annotationArtifact = (AnnotationArtifact) artifact;
 
-        String riverName = FLYSUtils.getRivername((FLYSArtifact)artifact);
+        String riverName = RiverUtils.getRivername((FLYSArtifact)artifact);
 
         FastAnnotations fas = LocationProvider.getAnnotations(riverName);
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java	Sun Apr 28 15:09:31 2013 +0200
@@ -21,7 +21,7 @@
 
 import org.dive4elements.river.model.Gauge;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import org.apache.log4j.Logger;
 
@@ -56,7 +56,7 @@
 
         String river = flys.getDataAsString("river");
 
-        Gauge gauge = FLYSUtils.getReferenceGauge(flys);
+        Gauge gauge = RiverUtils.getReferenceGauge(flys);
 
         if (river == null || gauge == null) {
             log.warn("Unknown river or gauge");
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java	Sun Apr 28 15:09:31 2013 +0200
@@ -23,7 +23,7 @@
 
 import org.dive4elements.river.model.MeasurementStation;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -64,7 +64,7 @@
         Object[] data =
             (SedimentLoadResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
 
-        List<MeasurementStation> allStations = FLYSUtils.getRiver(flys).getMeasurementStations();
+        List<MeasurementStation> allStations = RiverUtils.getRiver(flys).getMeasurementStations();
         SedimentLoadResult result = data != null && data.length > index ? (SedimentLoadResult)data[index] : null;
         if (result == null) {
             return null;
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/services/FileUploadService.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/FileUploadService.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/FileUploadService.java	Sun Apr 28 15:09:31 2013 +0200
@@ -14,7 +14,7 @@
 import org.dive4elements.artifacts.common.utils.FileTools;
 import org.dive4elements.artifacts.common.utils.XMLUtils;
 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -64,8 +64,8 @@
         byte[] fileData = extractData(data);
         if (fileData != null) {
             try {
-                String shapePath = FLYSUtils.getXPathString(
-                    FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
+                String shapePath = RiverUtils.getXPathString(
+                    RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
 
                 File artifactDir = FileTools.getDirectory(shapePath, uuid);
                 FileOutputStream fos =
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -25,7 +25,7 @@
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -142,7 +142,7 @@
     @Override
     protected double[] getMinMax(Artifact artifact) {
         FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
-        return FLYSUtils.getRiverMinMax(flysArtifact);
+        return RiverUtils.getRiverMinMax(flysArtifact);
     }
 
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputedDischargeCurveState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputedDischargeCurveState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputedDischargeCurveState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -30,7 +30,7 @@
 
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 /**
  * The final state that will be reached after the discharge curve calculation
@@ -77,7 +77,7 @@
                 for (int i = 0; i < wqkms.length; ++i) {
 
                     Object[] args = new Object[] {
-                        FLYSUtils.getRiver(winfo).getName(),
+                        RiverUtils.getRiver(winfo).getName(),
                         // Parse Double to allow i18n.
                         Double.parseDouble(wqkms[i].getName())
                     };
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/DGMSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DGMSelect.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DGMSelect.java	Sun Apr 28 15:09:31 2013 +0200
@@ -23,7 +23,7 @@
 import org.dive4elements.river.model.River;
 
 import org.dive4elements.river.artifacts.FLYSArtifact;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -100,13 +100,13 @@
         double l = dgm.getRange().getA().doubleValue();
         double u = dgm.getRange().getB().doubleValue();
 
-        double[] range = FLYSUtils.getKmFromTo(flys);
+        double[] range = RiverUtils.getKmFromTo(flys);
 
         if (range[0] < l || range[0] > u || range[1] < l || range[1] > u) {
             throw new IllegalArgumentException(ERR_BAD_DGM_RANGE);
         }
 
-        River selectedRiver = FLYSUtils.getRiver(flys);
+        River selectedRiver = RiverUtils.getRiver(flys);
         River dgmRiver      = dgm.getRiver();
 
         if (selectedRiver != dgmRiver) {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/DischargeState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DischargeState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DischargeState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -21,7 +21,7 @@
 import org.dive4elements.river.model.River;
 
 import org.dive4elements.river.artifacts.FLYSArtifact;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 public class DischargeState extends MultiIntArrayState {
@@ -141,7 +141,7 @@
 
     /**
      * Returns all discharge zones for a given river. The river information is
-     * extracted from <i>artifact</i> using FLYSUtils.getRiver().
+     * extracted from <i>artifact</i> using RiverUtils.getRiver().
      *
      * @param artifact Needs to be a FLYSArtifact that stores a rivername.
      *
@@ -153,7 +153,7 @@
     protected List<DischargeZone> getDischargeZones(Artifact artifact)
     throws IllegalArgumentException
     {
-        River river = FLYSUtils.getRiver((FLYSArtifact) artifact);
+        River river = RiverUtils.getRiver((FLYSArtifact) artifact);
 
         if (river == null) {
             throw new IllegalArgumentException("No river found");
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/DurationCurveState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DurationCurveState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DurationCurveState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -32,7 +32,7 @@
 
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -78,7 +78,7 @@
                 RangeAccess rangeAccess = new RangeAccess(winfo, context);
                 // Create an i18ed name for a (w or q) duration curve facet.
                 Object[] args = new Object[] {
-                    FLYSUtils.getRiver(winfo).getName(),
+                    RiverUtils.getRiver(winfo).getName(),
                     rangeAccess.getLocations()[0]
                 };
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/EnterLocationState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/EnterLocationState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/EnterLocationState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -10,7 +10,7 @@
 
 import org.dive4elements.river.artifacts.FLYSArtifact;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -28,7 +28,7 @@
     /** Allow from min km of river. */
     @Override
     protected Object getLower(FLYSArtifact flys) {
-        double[] lowerUpper = FLYSUtils.getRiverMinMax(flys);
+        double[] lowerUpper = RiverUtils.getRiverMinMax(flys);
 
         return lowerUpper != null
             ? lowerUpper[0]
@@ -39,7 +39,7 @@
     /** Allow to max km of river. */
     @Override
     protected Object getUpper(FLYSArtifact flys) {
-        double[] lowerUpper = FLYSUtils.getRiverMinMax(flys);
+        double[] lowerUpper = RiverUtils.getRiverMinMax(flys);
 
         return lowerUpper != null
             ? lowerUpper[1]
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -75,7 +75,7 @@
 import org.dive4elements.river.model.RiverAxis;
 
 import org.dive4elements.river.utils.ArtifactMapfileGenerator;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 import org.dive4elements.river.utils.MapfileGenerator;
 
@@ -275,8 +275,8 @@
      * @return the directory for WSPLEN data.
      */
     protected File getDirectory(FLYSArtifact artifact) {
-        String shapePath = FLYSUtils.getXPathString(
-            FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
+        String shapePath = RiverUtils.getXPathString(
+            RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
 
         File artifactDir = FileTools.getDirectory(
             shapePath, artifact.identifier());
@@ -290,8 +290,8 @@
      * results of WSPLGEN are stored. Should be called in endOfLife().
      */
     protected void removeDirectory(FLYSArtifact artifact) {
-        String shapePath = FLYSUtils.getXPathString(
-            FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
+        String shapePath = RiverUtils.getXPathString(
+            RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
 
         File artifactDir = new File(shapePath, artifact.identifier());
 
@@ -555,7 +555,7 @@
     ) {
         String river   = artifact.getDataAsString("river");
         String geoJSON = artifact.getDataAsString("uesk.barriers");
-        String srid    = FLYSUtils.getRiverDGMSrid(river);
+        String srid    = RiverUtils.getRiverDGMSrid(river);
         String srs     = "EPSG:" + srid;
 
         if (geoJSON == null || geoJSON.length() == 0) {
@@ -766,7 +766,7 @@
 
     protected void setAxis(FLYSArtifact artifact, File dir, WSPLGENJob job) {
         String river = artifact.getDataAsString("river");
-        String srid    = FLYSUtils.getRiverDGMSrid(river);
+        String srid    = RiverUtils.getRiverDGMSrid(river);
         String srs     = "EPSG:" + srid;
 
         List<RiverAxis> axes = null;
@@ -812,7 +812,7 @@
 
     protected void setPro(FLYSArtifact artifact, File dir, WSPLGENJob job) {
         String river = artifact.getDataAsString("river");
-        String srid    = FLYSUtils.getRiverDGMSrid(river);
+        String srid    = RiverUtils.getRiverDGMSrid(river);
         String srs     = "EPSG:" + srid;
 
         List<CrossSectionTrack> cst =
@@ -894,7 +894,7 @@
         }
 
         String river = artifact.getDataAsString("river");
-        String srid  = FLYSUtils.getRiverDGMSrid(river);
+        String srid  = RiverUtils.getRiverDGMSrid(river);
         String srs   = "EPSG:" + srid;
 
         Floodplain plain = Floodplain.getFloodplain(river);
@@ -942,7 +942,7 @@
         catch (NumberFormatException nfe) { /* do nothing */ }
 
         FLYSArtifact src = otherArtifact != null
-            ? FLYSUtils.getArtifact(otherArtifact, cc)
+            ? RiverUtils.getArtifact(otherArtifact, cc)
             : flys;
 
         logger.debug("Use waterlevel provided by Artifact: " + src.identifier());
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeTimerangeState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeTimerangeState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeTimerangeState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -19,7 +19,7 @@
 import org.dive4elements.river.artifacts.FLYSArtifact;
 import org.dive4elements.river.backend.SessionHolder;
 import org.dive4elements.river.model.Gauge;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -34,7 +34,7 @@
 
     /** Get 'min' and 'max'times of gauge time intervals. */
     protected long[] getLowerUpper(FLYSArtifact flys) {
-        Gauge gauge = FLYSUtils.getReferenceGauge(flys);
+        Gauge gauge = RiverUtils.getReferenceGauge(flys);
 
         if (gauge == null) {
             logger.warn("No reference gauge specified!");
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/HWSBarriersState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/HWSBarriersState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/HWSBarriersState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -51,7 +51,7 @@
 import org.dive4elements.river.artifacts.model.map.HWSFactory;
 
 import org.dive4elements.river.utils.ArtifactMapfileGenerator;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 import org.dive4elements.river.utils.MapfileGenerator;
 
@@ -328,8 +328,8 @@
      */
     // FIXME: I've seen this code somewhere else...
     protected void removeDirectory(FLYSArtifact artifact) {
-        String shapePath = FLYSUtils.getXPathString(
-            FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
+        String shapePath = RiverUtils.getXPathString(
+            RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
 
         File artifactDir = new File(shapePath, artifact.identifier());
 
@@ -354,8 +354,8 @@
      * @return the directory for WSPLEN data.
      */
     protected File getDirectory(FLYSArtifact artifact) {
-        String shapePath = FLYSUtils.getXPathString(
-            FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
+        String shapePath = RiverUtils.getXPathString(
+            RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
 
         File artifactDir = FileTools.getDirectory(
             shapePath, artifact.identifier());
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/MultiIntArrayState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/MultiIntArrayState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/MultiIntArrayState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -20,7 +20,7 @@
 
 import org.dive4elements.river.artifacts.FLYSArtifact;
 import org.dive4elements.river.artifacts.resources.Resources;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -74,7 +74,7 @@
         creator.addAttr(data, "label",
             Resources.getMsg(cc.getMeta(), name, name), true);
 
-        int[] values = FLYSUtils.intArrayFromString(value);
+        int[] values = RiverUtils.intArrayFromString(value);
 
         for (int val: values) {
             try {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/ReferenceGaugeState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ReferenceGaugeState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ReferenceGaugeState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -22,7 +22,7 @@
 import org.dive4elements.river.model.River;
 
 import org.dive4elements.river.artifacts.FLYSArtifact;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -40,7 +40,7 @@
         String      name,
         CallContext context)
     {
-        River       river   = FLYSUtils.getRiver((FLYSArtifact) artifact);
+        River       river   = RiverUtils.getRiver((FLYSArtifact) artifact);
         List<Gauge> gauges  = river.getGauges();
         Collections.sort(gauges);
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/ScenarioSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ScenarioSelect.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ScenarioSelect.java	Sun Apr 28 15:09:31 2013 +0200
@@ -17,7 +17,7 @@
 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
 import org.dive4elements.river.artifacts.FLYSArtifact;
 import org.dive4elements.river.artifacts.resources.Resources;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import java.io.File;
 
@@ -124,8 +124,8 @@
      */
     // FIXME: I've seen this code somewhere else...
     protected void removeDirectory(FLYSArtifact artifact) {
-        String shapePath = FLYSUtils.getXPathString(
-            FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
+        String shapePath = RiverUtils.getXPathString(
+            RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
 
         File artifactDir = new File(shapePath, artifact.identifier());
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/SoundingsSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/SoundingsSelect.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/SoundingsSelect.java	Sun Apr 28 15:09:31 2013 +0200
@@ -23,7 +23,7 @@
 import org.dive4elements.river.model.River;
 
 import org.dive4elements.river.artifacts.FLYSArtifact;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 public class SoundingsSelect extends MultiStringArrayState {
@@ -59,7 +59,7 @@
                 "Invalid parameter for state: '" + parameterName + "'");
         }
 
-        River river = FLYSUtils.getRiver((FLYSArtifact) artifact);
+        River river = RiverUtils.getRiver((FLYSArtifact) artifact);
         double lo = ((FLYSArtifact) artifact).getDataAsDouble("ld_from");
         double hi = ((FLYSArtifact) artifact).getDataAsDouble("ld_to");
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -34,7 +34,7 @@
 import org.dive4elements.river.artifacts.model.WKms;
 import org.dive4elements.river.artifacts.model.WQKms;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.StringUtil;
 
 
@@ -86,7 +86,7 @@
 
         if (name.startsWith("staticwkms")) {
             StaticWKmsArtifact staticWKms =
-                (StaticWKmsArtifact) FLYSUtils.getArtifact(
+                (StaticWKmsArtifact) RiverUtils.getArtifact(
                     uuid,
                     context);
             logger.debug("WDifferencesState obtain data from StaticWKms");
@@ -96,7 +96,7 @@
             return wkms;
         }
 
-        WINFOArtifact flys = (WINFOArtifact) FLYSUtils.getArtifact(
+        WINFOArtifact flys = (WINFOArtifact) RiverUtils.getArtifact(
             uuid,
             context);
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQAdapted.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQAdapted.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQAdapted.java	Sun Apr 28 15:09:31 2013 +0200
@@ -36,7 +36,7 @@
 
 import org.dive4elements.river.artifacts.model.RangeWithValues;
 import org.dive4elements.river.artifacts.model.WstFactory;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -140,9 +140,9 @@
         RangeAccess rangeAccess = new RangeAccess(flysArtifact, context);
         double[]    dist   = rangeAccess.getKmRange();
         // TODO use Access to get River and gauges.
-        River       river  = FLYSUtils.getRiver(flysArtifact);
+        River       river  = RiverUtils.getRiver(flysArtifact);
         Wst         wst    = WstFactory.getWst(river);
-        List<Gauge> gauges = FLYSUtils.getGauges(flysArtifact);
+        List<Gauge> gauges = RiverUtils.getGauges(flysArtifact);
 
         int num = gauges != null ? gauges.size() : 0;
 
@@ -335,7 +335,7 @@
             throw new IllegalArgumentException("error_missing_wq_data");
         }
 
-        List<Gauge> gauges = FLYSUtils.getGauges((FLYSArtifact) artifact);
+        List<Gauge> gauges = RiverUtils.getGauges((FLYSArtifact) artifact);
 
         for (Gauge gauge: gauges) {
             Range range  = gauge.getRange();
@@ -365,8 +365,8 @@
             throw new IllegalArgumentException("error_missing_wq_data");
         }
 
-        List<Gauge> gauges = FLYSUtils.getGauges(flys);
-        River        river = FLYSUtils.getRiver(flys);
+        List<Gauge> gauges = RiverUtils.getGauges(flys);
+        River        river = RiverUtils.getRiver(flys);
         Wst            wst = WstFactory.getWst(river);
 
         for (Gauge gauge: gauges) {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQSelect.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQSelect.java	Sun Apr 28 15:09:31 2013 +0200
@@ -36,7 +36,7 @@
 import org.dive4elements.river.artifacts.model.WstValueTable;
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -188,7 +188,7 @@
                 double v = Double.parseDouble(value.trim());
 
                 String tmp = nf.format(v);
-                String mv  = FLYSUtils.getNamedMainValue(gauge, v);
+                String mv  = RiverUtils.getNamedMainValue(gauge, v);
 
                 if (mv != null && mv.length() > 0) {
                     tmp = mv + ": " + tmp;
@@ -458,7 +458,7 @@
 
         WINFOArtifact flysArtifact = (WINFOArtifact) artifact;
 
-        River river = FLYSUtils.getRiver(flysArtifact);
+        River river = RiverUtils.getRiver(flysArtifact);
         Gauge gauge = flysArtifact.getGauge();
         Wst   wst   = WstFactory.getWst(river);
 
@@ -588,19 +588,19 @@
 
         all.sort();
 
-        FLYSUtils.WQ_MODE mode = FLYSUtils.getWQMode(flys);
+        RiverUtils.WQ_MODE mode = RiverUtils.getWQMode(flys);
 
         logger.debug("WQ Mode: " + mode);
 
         double[] minmax = null;
 
-        if (mode == FLYSUtils.WQ_MODE.WGAUGE) {
+        if (mode == RiverUtils.WQ_MODE.WGAUGE) {
             minmax = determineMinMaxW(artifact);
         }
-        else if (mode == FLYSUtils.WQ_MODE.QGAUGE) {
+        else if (mode == RiverUtils.WQ_MODE.QGAUGE) {
             minmax = determineMinMaxQAtGauge(artifact);
         }
-        else if (mode == FLYSUtils.WQ_MODE.QFREE) {
+        else if (mode == RiverUtils.WQ_MODE.QFREE) {
             minmax = determineMinMaxQ(artifact);
         }
         else {
@@ -623,7 +623,7 @@
         logger.debug("WQSelect.validateRange");
 
         WINFOArtifact     flys = (WINFOArtifact) artifact;
-        FLYSUtils.WQ_MODE mode = FLYSUtils.getWQMode(flys);
+        RiverUtils.WQ_MODE mode = RiverUtils.getWQMode(flys);
 
         if (mode == null) {
             throw new IllegalArgumentException("error_feed_invalid_wq_mode");
@@ -646,16 +646,16 @@
             double to   = Double.parseDouble(toStr);
             double step = Double.parseDouble(stepStr);
 
-            if (mode == FLYSUtils.WQ_MODE.WGAUGE) {
+            if (mode == RiverUtils.WQ_MODE.WGAUGE) {
                 return validateGaugeW(artifact, from, to, step);
             }
-            else if (mode == FLYSUtils.WQ_MODE.QGAUGE) {
+            else if (mode == RiverUtils.WQ_MODE.QGAUGE) {
                 return validateGaugeQ(artifact, from, to, step);
             }
-            else if (mode == FLYSUtils.WQ_MODE.QFREE) {
+            else if (mode == RiverUtils.WQ_MODE.QFREE) {
                 return validateFreeQ(artifact, from, to, step);
             }
-            else if (mode == FLYSUtils.WQ_MODE.WFREE) {
+            else if (mode == RiverUtils.WQ_MODE.WFREE) {
                 return validateFreeW(artifact, from, to, step);
             }
             else {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -25,7 +25,7 @@
 import org.dive4elements.river.artifacts.model.WQKms;
 import org.dive4elements.river.artifacts.model.extreme.ExtremeResult;
 import org.dive4elements.river.artifacts.resources.Resources;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.StringUtil;
 
 
@@ -123,7 +123,7 @@
     public static String[] getLabels(CallContext cc, String value) {
         String[] parts = value.split(SPLIT_CHAR);
 
-        FLYSArtifact artifact = FLYSUtils.getArtifact(parts[0], cc);
+        FLYSArtifact artifact = RiverUtils.getArtifact(parts[0], cc);
 
         CalculationResult rawData = (CalculationResult) artifact.compute(
             cc,
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java	Sun Apr 28 15:09:31 2013 +0200
@@ -25,7 +25,7 @@
 import org.dive4elements.river.artifacts.model.ReportFacet;
 import org.dive4elements.river.artifacts.model.WQKms;
 import org.dive4elements.river.artifacts.model.WaterlevelFacet;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 /** State in which a waterlevel has been calculated. */
 public class WaterlevelState
@@ -73,8 +73,8 @@
         for (int i = 0; i < wqkms.length; i++) {
             String name = wqkms[i].getName();
 
-            String nameW = FLYSUtils.createWspWTitle(winfo, cc, name);
-            String nameQ = FLYSUtils.createWspQTitle(winfo, cc, name);
+            String nameW = RiverUtils.createWspWTitle(winfo, cc, name);
+            String nameQ = RiverUtils.createWspQTitle(winfo, cc, name);
 
             // Hotfix for theme names. Themes with the same name cause problems
             // aggregating chart legend items.
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeQInput.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeQInput.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeQInput.java	Sun Apr 28 15:09:31 2013 +0200
@@ -30,7 +30,7 @@
 /*
 import org.dive4elements.river.model.Gauge;
 import org.dive4elements.river.model.Wst;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 */
 import org.dive4elements.river.artifacts.model.Range;
 import org.dive4elements.river.model.River;
@@ -192,8 +192,8 @@
             throw new IllegalArgumentException("error_missing_wq_data");
         }
 
-        List<Gauge> gauges = FLYSUtils.getGauges(flys);
-        River        river = FLYSUtils.getRiver(flys);
+        List<Gauge> gauges = RiverUtils.getGauges(flys);
+        River        river = RiverUtils.getRiver(flys);
         Wst            wst = WstFactory.getWst(river);
 
         for (Gauge gauge: gauges) {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/EventSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/EventSelect.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/EventSelect.java	Sun Apr 28 15:09:31 2013 +0200
@@ -20,7 +20,7 @@
 
 import org.dive4elements.river.artifacts.states.DefaultState;
 import org.dive4elements.river.artifacts.FLYSArtifact;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import org.dive4elements.river.artifacts.model.FixingsOverview;
 import org.dive4elements.river.artifacts.model.FixingsOverviewFactory;
@@ -57,13 +57,13 @@
         String         value,
         String         type
     ) {
-        int[] array = FLYSUtils.intArrayFromString(value);
+        int[] array = RiverUtils.intArrayFromString(value);
 
         Element dataElement = creator.create("data");
         creator.addAttr(dataElement, "name", name, true);
         creator.addAttr(dataElement, "type", type, true);
 
-        String river = FLYSUtils.getRiver(flys).getName();
+        String river = RiverUtils.getRiver(flys).getName();
 
         FixingsOverview overview = FixingsOverviewFactory.getOverview(river);
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/LocationSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/LocationSelect.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/LocationSelect.java	Sun Apr 28 15:09:31 2013 +0200
@@ -12,7 +12,7 @@
 
 import org.dive4elements.artifacts.Artifact;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import org.dive4elements.river.artifacts.FLYSArtifact;
 import org.dive4elements.river.artifacts.states.RangeState;
@@ -47,7 +47,7 @@
     @Override
     protected double[] getMinMax(Artifact artifact) {
         FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
-        return FLYSUtils.getRiverMinMax(flysArtifact);
+        return RiverUtils.getRiverMinMax(flysArtifact);
     }
 
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/collections/FLYSArtifactCollection.java
--- a/artifacts/src/main/java/org/dive4elements/river/collections/FLYSArtifactCollection.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/collections/FLYSArtifactCollection.java	Sun Apr 28 15:09:31 2013 +0200
@@ -41,7 +41,7 @@
 import org.dive4elements.river.artifacts.context.FLYSContext;
 import org.dive4elements.river.exports.OutGenerator;
 import org.dive4elements.river.exports.OutputHelper;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 /**
  * Collection of artifacts, can do outs, describe.
@@ -476,7 +476,7 @@
         AttributeParser  aParser,
         String[]         uuids)
     {
-        FLYSContext flysContext = FLYSUtils.getFlysContext(context);
+        FLYSContext flysContext = RiverUtils.getFlysContext(context);
         StateEngine engine = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java	Sun Apr 28 15:09:31 2013 +0200
@@ -30,7 +30,7 @@
 import org.dive4elements.river.model.Gauge;
 import org.dive4elements.river.model.River;
 import org.dive4elements.river.model.TimeInterval;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.artifacts.access.RangeAccess;
 
 public class ATExporter
@@ -94,7 +94,7 @@
             throw new IOException(iae);
         }
 
-        River river = FLYSUtils.getRiver(master);
+        River river = RiverUtils.getRiver(master);
         RangeAccess rangeAccess = new RangeAccess(master, context);
         double[] kms = rangeAccess.getLocations();
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -34,7 +34,7 @@
 import org.dive4elements.river.themes.LineStyle;
 import org.dive4elements.river.themes.TextStyle;
 import org.dive4elements.river.themes.ThemeAccess;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.ThemeUtil;
 
 import java.awt.BasicStroke;
@@ -1424,7 +1424,7 @@
     protected String getRiverName() {
         FLYSArtifact flys = (FLYSArtifact) master;
 
-        River river = FLYSUtils.getRiver(flys);
+        River river = RiverUtils.getRiver(flys);
         return (river != null) ? river.getName() : "";
     }
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java	Sun Apr 28 15:09:31 2013 +0200
@@ -43,7 +43,7 @@
 import org.dive4elements.river.artifacts.model.WKmsJRDataSource;
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.Formatter;
 
 
@@ -126,7 +126,7 @@
     protected void writeCSVHeader(CSVWriter writer) {
         logger.debug("ComputedDischargeCurveExporter.writeCSVHeader");
 
-        String unit = FLYSUtils.getRiver((FLYSArtifact) master).getWstUnit().getName();
+        String unit = RiverUtils.getRiver((FLYSArtifact) master).getWstUnit().getName();
 
         writer.writeNext(new String[] {
             msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { unit }),
@@ -196,7 +196,7 @@
 
         FLYSArtifact flys = (FLYSArtifact) master;
 
-        source.addMetaData ("river", FLYSUtils.getRivername(flys));
+        source.addMetaData ("river", RiverUtils.getRivername(flys));
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -20,7 +20,7 @@
 import org.dive4elements.river.jfree.StickyAxisAnnotation;
 import org.dive4elements.river.jfree.StyledXYSeries;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -87,7 +87,7 @@
     protected String getDefaultYAxisLabel(int pos) {
         FLYSArtifact flys = (FLYSArtifact) master;
 
-        String unit = FLYSUtils.getRiver(flys).getWstUnit().getName();
+        String unit = RiverUtils.getRiver(flys).getWstUnit().getName();
 
         return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT, new Object[] { unit });
     }
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -37,7 +37,7 @@
 import org.dive4elements.river.themes.LineStyle;
 import org.dive4elements.river.themes.TextStyle;
 import org.dive4elements.river.themes.ThemeAccess;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.Formatter;
 import org.dive4elements.river.utils.ThemeUtil;
 
@@ -244,7 +244,7 @@
     protected String getDefaultYAxisLabel(int pos) {
         FLYSArtifact flys = (FLYSArtifact) master;
 
-        String unit = FLYSUtils.getRiver(flys).getWstUnit().getName();
+        String unit = RiverUtils.getRiver(flys).getWstUnit().getName();
 
         return msg(I18N_YAXIS_LABEL,
                    I18N_YAXIS_LABEL_DEFAULT,
@@ -359,7 +359,7 @@
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             FLYSArtifact flys = (FLYSArtifact) master;
 
-            String unit = FLYSUtils.getRiver(flys).getWstUnit().getName();
+            String unit = RiverUtils.getRiver(flys).getWstUnit().getName();
 
             String labelAdd = "W=" + nf.format(lines.points[1][0]) + unit;
             if (series.getLabel().length() == 0) {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -17,7 +17,7 @@
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.model.Gauge;
 import org.dive4elements.river.model.River;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import org.apache.log4j.Logger;
 import org.jfree.chart.axis.ValueAxis;
@@ -172,7 +172,7 @@
 
         String gaugeName = wqkms.getName();
 
-        River river = FLYSUtils.getRiver(artifact);
+        River river = RiverUtils.getRiver(artifact);
 
         if (river == null) {
             logger.debug("no river found");
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/DurationCurveExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DurationCurveExporter.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DurationCurveExporter.java	Sun Apr 28 15:09:31 2013 +0200
@@ -41,7 +41,7 @@
 import org.dive4elements.river.artifacts.model.WKmsJRDataSource;
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.Formatter;
 
 
@@ -220,7 +220,7 @@
 
         FLYSArtifact flys = (FLYSArtifact) master;
 
-        source.addMetaData ("river", FLYSUtils.getRivername(flys));
+        source.addMetaData ("river", RiverUtils.getRivername(flys));
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java	Sun Apr 28 15:09:31 2013 +0200
@@ -24,7 +24,7 @@
 import org.dive4elements.river.artifacts.FLYSArtifact;
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.FlowVelocityData;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.Formatter;
 
 
@@ -120,7 +120,7 @@
                     valF.format(data.getVTotal(i)),
                     valF.format(data.getTauMain(i)),
                     qF.format(data.getQ(i)) + "=" + data.getZone(),
-                    FLYSUtils.getLocationDescription(flys, data.getKM(i)),
+                    RiverUtils.getLocationDescription(flys, data.getKM(i)),
                 });
             }
         }
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -33,7 +33,7 @@
 import org.dive4elements.river.jfree.RiverAnnotation;
 import org.dive4elements.river.jfree.StyledXYSeries;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -147,7 +147,7 @@
         return msg(
             I18N_XAXIS_LABEL,
             I18N_XAXIS_LABEL_DEFAULT,
-            new Object[] { FLYSUtils.getRiver(flys).getName() });
+            new Object[] { RiverUtils.getRiver(flys).getName() });
     }
 
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveExporter.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveExporter.java	Sun Apr 28 15:09:31 2013 +0200
@@ -41,7 +41,7 @@
 import org.dive4elements.river.artifacts.model.WQTimerange;
 import org.dive4elements.river.artifacts.model.WQTJRDataSource;
 import org.dive4elements.river.artifacts.resources.Resources;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.Formatter;
 
 
@@ -210,7 +210,7 @@
 
         FLYSArtifact flys = (FLYSArtifact) master;
 
-        source.addMetaData ("river", FLYSUtils.getRivername(flys));
+        source.addMetaData ("river", RiverUtils.getRivername(flys));
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
@@ -252,7 +252,7 @@
 
 
     public String getReferenceGaugename() {
-        return FLYSUtils.getReferenceGaugeName((FLYSArtifact) master);
+        return RiverUtils.getReferenceGaugeName((FLYSArtifact) master);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -27,7 +27,7 @@
 import org.dive4elements.river.artifacts.model.Timerange;
 import org.dive4elements.river.artifacts.model.WQTimerange;
 import org.dive4elements.river.jfree.StyledTimeSeries;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -87,7 +87,7 @@
         Timerange evalTime = new HistoricalDischargeAccess(flys)
             .getEvaluationTimerange();
 
-        Object[] args = new Object[] { FLYSUtils.getReferenceGaugeName(flys),
+        Object[] args = new Object[] { RiverUtils.getReferenceGaugeName(flys),
             evalTime.getStart(), evalTime.getEnd() };
 
         return msg(I18N_CHART_SUBTITLE, "", args);
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeWQCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeWQCurveGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeWQCurveGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -22,7 +22,7 @@
 import org.dive4elements.river.jfree.RiverAnnotation;
 import org.dive4elements.river.jfree.StyledValueMarker;
 import org.dive4elements.river.jfree.StyledXYSeries;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 
 /**
@@ -83,7 +83,7 @@
         Timerange evalTime = new HistoricalDischargeAccess(flys)
             .getEvaluationTimerange();
 
-        Object[] args = new Object[] { FLYSUtils.getReferenceGaugeName(flys),
+        Object[] args = new Object[] { RiverUtils.getReferenceGaugeName(flys),
             evalTime.getStart(), evalTime.getEnd() };
 
         return msg(I18N_CHART_SUBTITLE, "", args);
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -21,7 +21,7 @@
 import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.utils.DataUtil;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.apache.log4j.Logger;
 import org.jfree.chart.axis.NumberAxis;
 import org.jfree.chart.axis.ValueAxis;
@@ -208,7 +208,7 @@
         return msg(
             I18N_XAXIS_LABEL,
             I18N_XAXIS_LABEL_DEFAULT,
-            new Object[] { FLYSUtils.getRiver(flys).getName() });
+            new Object[] { RiverUtils.getRiver(flys).getName() });
     }
 
 
@@ -236,7 +236,7 @@
     protected String getWAxisLabel() {
         FLYSArtifact flys = (FLYSArtifact) master;
 
-        String unit = FLYSUtils.getRiver(flys).getWstUnit().getName();
+        String unit = RiverUtils.getRiver(flys).getWstUnit().getName();
 
         return msg(
             I18N_YAXIS_LABEL,
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java	Sun Apr 28 15:09:31 2013 +0200
@@ -24,7 +24,7 @@
 import org.dive4elements.river.artifacts.FLYSArtifact;
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.MiddleBedHeightData;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.Formatter;
 
 
@@ -139,7 +139,7 @@
                         gapF.format(data.getDataGap(i)) + "%",
                         soundF.format(data.getSoundingWidth(i)),
                         widthF.format(data.getWidth(i)),
-                        FLYSUtils.getLocationDescription(flys, data.getKM(i)),
+                        RiverUtils.getLocationDescription(flys, data.getKM(i)),
                     });
                 }
                 else {
@@ -151,7 +151,7 @@
                         "",
                         "",
                         "",
-                        FLYSUtils.getLocationDescription(flys, data.getKM(i)),
+                        RiverUtils.getLocationDescription(flys, data.getKM(i)),
                     });
                 }
 
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -18,7 +18,7 @@
 import org.dive4elements.river.exports.process.WOutProcessor;
 import org.dive4elements.river.jfree.RiverAnnotation;
 import org.dive4elements.river.jfree.StyledXYSeries;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
@@ -116,7 +116,7 @@
         return msg(
             I18N_XAXIS_LABEL,
             I18N_XAXIS_LABEL_DEFAULT,
-            new Object[] { FLYSUtils.getRiver(flys).getName() });
+            new Object[] { RiverUtils.getRiver(flys).getName() });
     }
 
 
@@ -129,7 +129,7 @@
         }
         else if (index == YAXIS.W.idx) {
            FLYSArtifact flys = (FLYSArtifact) master;
-           String unit = FLYSUtils.getRiver(flys).getWstUnit().getName();
+           String unit = RiverUtils.getRiver(flys).getWstUnit().getName();
 
            label = msg(
                 I18N_W_YAXIS_LABEL,
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/ReferenceCurveExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ReferenceCurveExporter.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ReferenceCurveExporter.java	Sun Apr 28 15:09:31 2013 +0200
@@ -24,7 +24,7 @@
 
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 
 import java.io.IOException;
 import java.io.OutputStream;
@@ -232,10 +232,10 @@
         StepCSVWriter stepWriter = new StepCSVWriter();
         stepWriter.setCSVWriter(writer);
 
-        String startLocationDescription = FLYSUtils.getLocationDescription(
+        String startLocationDescription = RiverUtils.getLocationDescription(
             flys, ww.getStartKm());
 
-        String endLocationDescription = FLYSUtils.getLocationDescription(
+        String endLocationDescription = RiverUtils.getLocationDescription(
             flys, ww.getEndKm());
 
         for (int i = 0; i < size; i ++) {
@@ -322,7 +322,7 @@
 
         WINFOArtifact flys = (WINFOArtifact) master;
 
-        source.addMetaData ("river", FLYSUtils.getRivername(flys));
+        source.addMetaData ("river", RiverUtils.getRivername(flys));
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
@@ -345,10 +345,10 @@
 
         FLYSArtifact flys = (FLYSArtifact) master;
 
-        String startLocationDescription = FLYSUtils.getLocationDescription(
+        String startLocationDescription = RiverUtils.getLocationDescription(
             flys, ww.getStartKm());
 
-        String endLocationDescription = FLYSUtils.getLocationDescription(
+        String endLocationDescription = RiverUtils.getLocationDescription(
             flys, ww.getEndKm());
 
         for (int i = 0; i < size; i ++) {
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesExporter.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesExporter.java	Sun Apr 28 15:09:31 2013 +0200
@@ -41,7 +41,7 @@
 import org.dive4elements.river.artifacts.model.WKmsJRDataSource;
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.Formatter;
 
 /**
@@ -232,14 +232,14 @@
 
         WINFOArtifact flys = (WINFOArtifact) master;
 
-        source.addMetaData ("river", FLYSUtils.getRivername(flys));
+        source.addMetaData ("river", RiverUtils.getRivername(flys));
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
 
         source.addMetaData("date", df.format(new Date()));
 
-        String differences = FLYSUtils.getWDifferences(flys, context);
+        String differences = RiverUtils.getWDifferences(flys, context);
         source.addMetaData("differences", differences);
 
         source.addMetaData("calculation", Resources.getMsg(
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java	Sun Apr 28 15:09:31 2013 +0200
@@ -53,8 +53,8 @@
 import org.dive4elements.river.artifacts.model.WQKmsResult;
 import org.dive4elements.river.artifacts.resources.Resources;
 
-import org.dive4elements.river.utils.FLYSUtils;
-import org.dive4elements.river.utils.FLYSUtils.WQ_MODE;
+import org.dive4elements.river.utils.RiverUtils;
+import org.dive4elements.river.utils.RiverUtils.WQ_MODE;
 import org.dive4elements.river.utils.Formatter;
 
 /**
@@ -211,10 +211,10 @@
             try {
                 double v = Double.valueOf(raw);
 
-                String nmv = FLYSUtils.getNamedMainValue(winfo, v);
+                String nmv = RiverUtils.getNamedMainValue(winfo, v);
 
                 if (nmv != null && nmv.length() > 0) {
-                    nmv  = FLYSUtils.stripNamedMainValue(nmv);
+                    nmv  = RiverUtils.stripNamedMainValue(nmv);
                     nmv += "=" + String.valueOf(v);
                     logger.debug("Set named main value '" + nmv + "'");
 
@@ -237,7 +237,7 @@
 
         logger.debug("Name of WQKms = '" + name + "'");
 
-        WQ_MODE wqmode = FLYSUtils.getWQMode(winfo);
+        WQ_MODE wqmode = RiverUtils.getWQMode(winfo);
 
         if (wqmode == WQ_MODE.WFREE || wqmode == WQ_MODE.QGAUGE) {
             return localizeWQKms(winfo, wqkms);
@@ -245,10 +245,10 @@
 
         Double v = wqkms.getRawValue();
 
-        String nmv = FLYSUtils.getNamedMainValue(winfo, v);
+        String nmv = RiverUtils.getNamedMainValue(winfo, v);
 
         if (nmv != null && nmv.length() > 0) {
-            nmv = FLYSUtils.stripNamedMainValue(nmv);
+            nmv = RiverUtils.stripNamedMainValue(nmv);
             logger.debug("Set named main value '" + nmv + "'");
 
             return nmv;
@@ -263,7 +263,7 @@
      * format.
      */
     protected String localizeWQKms(WINFOArtifact winfo, WQKms wqkms) {
-        WQ_MODE wqmode   = FLYSUtils.getWQMode(winfo);
+        WQ_MODE wqmode   = RiverUtils.getWQMode(winfo);
         Double  rawValue = wqkms.getRawValue();
 
         if (rawValue == null) {
@@ -285,11 +285,11 @@
     protected void writeCSVData(CSVWriter writer) {
         logger.info("WaterlevelExporter.writeData");
 
-        WQ_MODE mode    = FLYSUtils.getWQMode((FLYSArtifact)master);
+        WQ_MODE mode    = RiverUtils.getWQMode((FLYSArtifact)master);
         boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE;
         boolean isQ     = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE;
-        FLYSUtils.WQ_INPUT input
-            = FLYSUtils.getWQInputMode((FLYSArtifact)master);
+        RiverUtils.WQ_INPUT input
+            = RiverUtils.getWQInputMode((FLYSArtifact)master);
 
         writeCSVMeta(writer);
         writeCSVHeader(writer, atGauge, isQ);
@@ -305,7 +305,7 @@
     protected void writeCSVMeta(CSVWriter writer) {
         logger.info("WaterlevelExporter.writeCSVMeta");
 
-        // TODO use Access instead of FLYSUtils
+        // TODO use Access instead of RiverUtils
 
         CallMeta meta = context.getMeta();
 
@@ -316,7 +316,7 @@
                 meta,
                 CSV_META_RESULT,
                 CSV_META_RESULT,
-                new Object[] { FLYSUtils.getRivername(flys) })
+                new Object[] { RiverUtils.getRivername(flys) })
         });
 
         Locale locale = Resources.getLocale(meta);
@@ -343,7 +343,7 @@
                 meta,
                 CSV_META_RIVER,
                 CSV_META_RIVER,
-                new Object[] { FLYSUtils.getRivername(flys) })
+                new Object[] { RiverUtils.getRivername(flys) })
         });
 
         RangeAccess rangeAccess = new RangeAccess(flys, null);
@@ -361,24 +361,24 @@
                 meta,
                 CSV_META_GAUGE,
                 CSV_META_GAUGE,
-                new Object[] { FLYSUtils.getGaugename(flys) })
+                new Object[] { RiverUtils.getGaugename(flys) })
         });
 
-        FLYSUtils.WQ_MODE wq = FLYSUtils.getWQMode(flys);
-        if (wq == FLYSUtils.WQ_MODE.QFREE || wq == FLYSUtils.WQ_MODE.QGAUGE) {
-            double[] qs  = FLYSUtils.getQs(flys);
-            FLYSUtils.WQ_INPUT input = FLYSUtils.getWQInputMode(flys);
+        RiverUtils.WQ_MODE wq = RiverUtils.getWQMode(flys);
+        if (wq == RiverUtils.WQ_MODE.QFREE || wq == RiverUtils.WQ_MODE.QGAUGE) {
+            double[] qs  = RiverUtils.getQs(flys);
+            RiverUtils.WQ_INPUT input = RiverUtils.getWQInputMode(flys);
 
             String data = "";
 
-            if ((input == FLYSUtils.WQ_INPUT.ADAPTED ||
-                input == FLYSUtils.WQ_INPUT.RANGE) &&
+            if ((input == RiverUtils.WQ_INPUT.ADAPTED ||
+                input == RiverUtils.WQ_INPUT.RANGE) &&
                 qs != null && qs.length > 0)
             {
                 data = String.valueOf(qs[0]);
                 data += " - " + String.valueOf(qs[qs.length-1]);
             }
-            else if (input == FLYSUtils.WQ_INPUT.SINGLE && qs != null){
+            else if (input == RiverUtils.WQ_INPUT.SINGLE && qs != null){
                 data = String.valueOf(qs[0]);
                 for (int i = 1; i < qs.length; i++) {
                     data += ", " + String.valueOf(qs[i]);
@@ -397,7 +397,7 @@
             });
         }
         else {
-            double[] ws = FLYSUtils.getWs(flys);
+            double[] ws = RiverUtils.getWs(flys);
 
             String lower = "";
             String upper = "";
@@ -434,7 +434,7 @@
     ) {
         logger.info("WaterlevelExporter.writeCSVHeader");
 
-        String unit = FLYSUtils.getRiver((FLYSArtifact) master).getWstUnit().getName();
+        String unit = RiverUtils.getRiver((FLYSArtifact) master).getWstUnit().getName();
 
         if (atGauge) {
             writer.writeNext(new String[] {
@@ -489,7 +489,7 @@
            kmf.format(wqkm[2]),
            wf.format(wqkm[0]),
            qf.format(wqkm[1]),
-           FLYSUtils.getLocationDescription(flys, wqkm[2])
+           RiverUtils.getLocationDescription(flys, wqkm[2])
        });
     }
 
@@ -506,7 +506,7 @@
             wf.format(wqkm[0]),
             qf.format(wqkm[1]),
             wOrQDesc,
-            FLYSUtils.getLocationDescription(flys, wqkm[2]),
+            RiverUtils.getLocationDescription(flys, wqkm[2]),
             gaugeName
         });
     }
@@ -536,8 +536,8 @@
         double[] result = new double[3];
 
         FLYSArtifact flys       = (FLYSArtifact) master;
-        List<Gauge>  gauges     = FLYSUtils.getGauges(flys);
-        Gauge        gauge      = FLYSUtils.getGauge(flys);
+        List<Gauge>  gauges     = RiverUtils.getGauges(flys);
+        Gauge        gauge      = RiverUtils.getGauge(flys);
         String       gaugeName  = gauge.getName();
         String       desc       = "";
         String       notinrange = msg(
@@ -551,7 +551,7 @@
             desc = getCSVRowTitle((WINFOArtifact)flys, wqkms);
         }
         else if (!isQ) {
-            Double value = FLYSUtils.getValueFromWQ(wqkms);
+            Double value = RiverUtils.getValueFromWQ(wqkms);
             desc         = value != null
                 ? Formatter.getWaterlevelW(context).format(value) : null;
         }
@@ -564,7 +564,7 @@
         if (flys instanceof WINFOArtifact) {
             if (wqkms != null && wqkms.getRawValue() != null) {
                 WINFOArtifact winfo = (WINFOArtifact) flys;
-                colDesc = FLYSUtils.getNamedMainValue(winfo, wqkms.getRawValue());
+                colDesc = RiverUtils.getNamedMainValue(winfo, wqkms.getRawValue());
             }
         }
         else if (flys instanceof FixationArtifact) {
@@ -743,7 +743,7 @@
     protected WKmsJRDataSource createJRData() {
         WKmsJRDataSource source = new WKmsJRDataSource();
 
-        WQ_MODE mode    = FLYSUtils.getWQMode((FLYSArtifact)master);
+        WQ_MODE mode    = RiverUtils.getWQMode((FLYSArtifact)master);
         boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE;
         boolean isQ     = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE;
 
@@ -761,7 +761,7 @@
 
         FLYSArtifact flys = (FLYSArtifact) master;
 
-        source.addMetaData ("river", FLYSUtils.getRivername(flys));
+        source.addMetaData ("river", RiverUtils.getRivername(flys));
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
@@ -772,7 +772,7 @@
         double[] kms = rangeAccess.getKmRange();
         source.addMetaData("range", kms[0] + " - " + kms[kms.length-1]);
 
-        source.addMetaData("gauge", FLYSUtils.getGaugename(flys));
+        source.addMetaData("gauge", RiverUtils.getGaugename(flys));
 
         source.addMetaData("calculation", Resources.getMsg(
                                             locale,
@@ -801,7 +801,7 @@
         double[] result = new double[3];
 
         FLYSArtifact flys       = (FLYSArtifact) master;
-        Gauge        gauge      = FLYSUtils.getGauge(flys);
+        Gauge        gauge      = RiverUtils.getGauge(flys);
         String       gaugeName  = gauge.getName();
         String       desc       = "";
         String       notinrange = msg(
@@ -815,7 +815,7 @@
             desc = getCSVRowTitle((WINFOArtifact)flys, wqkms);
         }
         else if (!isQ) {
-            Double value = FLYSUtils.getValueFromWQ(wqkms);
+            Double value = RiverUtils.getValueFromWQ(wqkms);
             desc         = value != null
                 ? Formatter.getWaterlevelW(context).format(value) : null;
         }
@@ -831,7 +831,7 @@
                     wf.format(result[0]),
                     qf.format(result[1]),
                     desc,
-                    FLYSUtils.getLocationDescription(flys, result[2]),
+                    RiverUtils.getLocationDescription(flys, result[2]),
                     result[2] >= a && result[2] <= b
                         ? gaugeName
                         : notinrange
@@ -843,7 +843,7 @@
                     wf.format(result[0]),
                     qf.format(result[1]),
                     desc,
-                    FLYSUtils.getLocationDescription(flys, result[2]),
+                    RiverUtils.getLocationDescription(flys, result[2]),
                     result[2] >= a && result[2] <= b
                         ? gaugeName
                         : notinrange
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -52,7 +52,7 @@
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.model.Gauge;
 import org.dive4elements.river.model.River;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.ThemeUtil;
 
 /**
@@ -445,7 +445,7 @@
 
         String gaugeName = wqkms.getName();
 
-        River river = FLYSUtils.getRiver(artifact);
+        River river = RiverUtils.getRiver(artifact);
 
         if (river == null) {
             logger.debug("no river found");
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -34,17 +34,17 @@
 
     @Override
     protected String getVelocityLogfile() {
-        return FLYSUtils.getXPathString(FLYSUtils.XPATH_FLOODMAP_VELOCITY_LOGFILE);
+        return RiverUtils.getXPathString(RiverUtils.XPATH_FLOODMAP_VELOCITY_LOGFILE);
     }
 
     @Override
     protected String getMapserverTemplatePath() {
-        return FLYSUtils.getXPathString(FLYSUtils.XPATH_FLOODMAP_MAPSERVER_TEMPLATE_PATH);
+        return RiverUtils.getXPathString(RiverUtils.XPATH_FLOODMAP_MAPSERVER_TEMPLATE_PATH);
     }
 
     @Override
     public String getMapserverUrl() {
-        return FLYSUtils.getXPathString(FLYSUtils.XPATH_FLOODMAP_MAPSERVER_URL);
+        return RiverUtils.getXPathString(RiverUtils.XPATH_FLOODMAP_MAPSERVER_URL);
     }
 
     /**
@@ -88,7 +88,7 @@
         layerinfo.setStyle(style);
         RiverAccess access = new RiverAccess(flys);
         String river = access.getRiver();
-        layerinfo.setSrid(FLYSUtils.getRiverDGMSrid(river));
+        layerinfo.setSrid(RiverUtils.getRiverDGMSrid(river));
 
         String name = MS_LAYER_PREFIX + wms.getName();
 
@@ -337,12 +337,12 @@
 
         @Override
         protected String getMapfilePath() {
-            return FLYSUtils.getXPathString(FLYSUtils.XPATH_FLOODMAP_MAPFILE_PATH);
+            return RiverUtils.getXPathString(RiverUtils.XPATH_FLOODMAP_MAPFILE_PATH);
         }
 
         @Override
         protected String getMapfileTemplate() {
-            return FLYSUtils.getXPathString(FLYSUtils.XPATH_FLOODMAP_MAPFILE_TEMPLATE);
+            return RiverUtils.getXPathString(RiverUtils.XPATH_FLOODMAP_MAPFILE_TEMPLATE);
         }
 
 }
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/utils/FLYSUtils.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/FLYSUtils.java	Sun Apr 28 15:04:44 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,929 +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.utils;
-
-import org.dive4elements.artifactdatabase.state.State;
-import org.dive4elements.artifacts.Artifact;
-import org.dive4elements.artifacts.CallContext;
-import org.dive4elements.artifacts.common.utils.Config;
-import org.dive4elements.artifacts.common.utils.XMLUtils;
-import org.dive4elements.river.artifacts.FLYSArtifact;
-import org.dive4elements.river.artifacts.StaticWKmsArtifact;
-import org.dive4elements.river.artifacts.WINFOArtifact;
-import org.dive4elements.river.artifacts.access.RangeAccess;
-import org.dive4elements.river.artifacts.context.FLYSContext;
-import org.dive4elements.river.artifacts.model.LocationProvider;
-import org.dive4elements.river.artifacts.model.RiverFactory;
-import org.dive4elements.river.artifacts.model.WKms;
-import org.dive4elements.river.artifacts.model.WQ;
-import org.dive4elements.river.artifacts.model.WQKms;
-import org.dive4elements.river.artifacts.states.WDifferencesState;
-import org.dive4elements.river.artifacts.states.WaterlevelSelectState;
-import org.dive4elements.river.backend.SessionFactoryProvider;
-import org.dive4elements.river.model.Gauge;
-import org.dive4elements.river.model.MainValue;
-import org.dive4elements.river.model.River;
-
-import gnu.trove.TDoubleArrayList;
-import gnu.trove.TIntArrayList;
-import gnu.trove.TLongArrayList;
-
-import java.text.NumberFormat;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.xpath.XPathConstants;
-
-import org.apache.log4j.Logger;
-import org.hibernate.SessionFactory;
-import org.hibernate.impl.SessionFactoryImpl;
-import org.w3c.dom.Document;
-
-
-/**
- * Static helper methods to e.g. access FLYSArtifacts data.
- *
- * @deprecated Don't use FLYSUtils to get data from an {@link Artifact} anymore.
- * Instead use and/or create a {@link Access} class hierarchy.
- **/
- at Deprecated
-public class FLYSUtils {
-
-    /** The logger that is used in this utility. */
-    private static Logger logger = Logger.getLogger(FLYSUtils.class);
-
-    /**
-     * An enum that represents the 5 possible WQ modes in FLYS. The 5 values are
-     * <i>QFREE</i> <i>QGAUGE</i> <i>WGAUGE</i> <i>WFREE</i> and <i>NONE</i>.
-     */
-    public static enum WQ_MODE { QFREE, QGAUGE, WFREE, WGAUGE, NONE };
-
-    /**
-     * An enum that represents the 4 possible WQ input modes in FLYS. The 4
-     * values are
-     * <i>ADAPTED</i> <i>SINGLE</i> <i>RANGE</i> and <i>NONE</i>.
-     */
-    public static enum WQ_INPUT { ADAPTED, SINGLE, RANGE, NONE };
-
-    public static final Pattern NUMBERS_PATTERN =
-        Pattern.compile("\\D*(\\d++.\\d*)\\D*");
-
-    public static final String XPATH_FLOODMAP_RIVER_PROJECTION =
-        "/artifact-database/floodmap/river[@name=$name]/srid/@value";
-
-    public static final String XPATH_FLOODMAP_DGM_PROJECTION =
-        "/artifact-database/floodmap/river[@name=$name]/dgm-srid/@value";
-
-    public static final String XPATH_FLOODMAP_SHAPEFILE_DIR =
-        "/artifact-database/floodmap/shapefile-path/@value";
-
-    public static final String XPATH_FLOODMAP_VELOCITY_LOGFILE =
-        "/artifact-database/floodmap/velocity/logfile/@path";
-
-    public static final String XPATH_FLOODMAP_MAPSERVER_URL =
-        "/artifact-database/floodmap/mapserver/server/@path";
-
-    public static final String XPATH_RIVERMAP_MAPSERVER_URL =
-            "/artifact-database/rivermap/mapserver/server/@path";
-
-    public static final String XPATH_FLOODMAP_MAPFILE_PATH =
-        "/artifact-database/floodmap/mapserver/mapfile/@path";
-
-    public static final String XPATH_FLOODMAP_MAPFILE_TEMPLATE =
-        "/artifact-database/floodmap/mapserver/map-template/@path";
-
-    public static final String XPATH_FLOODMAP_MAPSERVER_TEMPLATE_PATH =
-        "/artifact-database/floodmap/mapserver/templates/@path";
-
-
-    private FLYSUtils() {
-    }
-
-
-    /**
-     * Pulls Artifact with given UUID fromm database.
-     * @return FLYSArtifact with given UUID or null (in case of errors).
-     */
-    public static FLYSArtifact getArtifact(String uuid, CallContext context) {
-        try {
-            Artifact artifact = context.getDatabase().getRawArtifact(uuid);
-
-            if (artifact == null) {
-                logger.error("Artifact '" + uuid + "' does not exist.");
-                return null;
-            }
-
-            if (!(artifact instanceof FLYSArtifact)) {
-                logger.error("Artifact '" +uuid+ "' is no valid FLYSArtifact.");
-                return null;
-            }
-
-            return (FLYSArtifact) artifact;
-        }
-        // TODO: catch more selective
-        catch (Exception e) {
-            logger.error("Cannot get FLYSArtifact " + uuid
-                + " from database (" + e.getMessage() + ").");
-            return null;
-        }
-    }
-
-
-    /**
-     * Returns the FLYSContext from context object.
-     *
-     * @param context The CallContext or the FLYSContext.
-     *
-     * @return the FLYSContext.
-     */
-    public static FLYSContext getFlysContext(Object context) {
-        return context instanceof FLYSContext
-            ? (FLYSContext) context
-            : (FLYSContext) ((CallContext) context).globalContext();
-    }
-
-
-    /**
-     * Convinience function to retrieve an XPath as string with replaced config
-     * directory.
-     *
-     * @param xpath The XPath expression.
-     *
-     * @return a string with replaced config directory.
-     */
-    public static String getXPathString(String xpath) {
-        String tmp = Config.getStringXPath(xpath);
-        tmp        = Config.replaceConfigDir(tmp);
-
-        return tmp;
-    }
-
-
-    public static boolean isUsingOracle() {
-        SessionFactory sf = SessionFactoryProvider.getSessionFactory();
-
-        String d = SessionFactoryProvider.getDriver((SessionFactoryImpl) sf);
-
-        return d != null ? d.indexOf("Oracle") >= 0 : false;
-    }
-
-
-    /**
-     * This method returns an WQ_MODE enum which is based on the parameters
-     * stored in <i>flys</i> Artifact. If there is no <i>wq_isq</i> parameter
-     * existing, WQ_MODE.NONE is returned.
-     *
-     * @param flys The FLYSArtifact that stores wq mode relevant parameters.
-     *
-     * @return an enum WQ_MODE.
-     */
-    public static WQ_MODE getWQMode(FLYSArtifact flys) {
-        if (flys == null) {
-            return WQ_MODE.NONE;
-        }
-
-        String values = flys.getDataAsString("wq_values");
-        Boolean isQ   = flys.getDataAsBoolean("wq_isq");
-
-        if (values != null) {
-            return isQ ? WQ_MODE.QGAUGE : WQ_MODE.WGAUGE;
-        }
-
-        Boolean isFree = flys.getDataAsBoolean("wq_isfree");
-
-        if (isQ != null && isQ) {
-            return isFree ? WQ_MODE.QFREE : WQ_MODE.QGAUGE;
-        }
-        else if (isQ != null && !isQ) {
-            return isFree ? WQ_MODE.WFREE : WQ_MODE.WGAUGE;
-        }
-        else {
-            return WQ_MODE.NONE;
-        }
-    }
-
-
-    public static WQ_INPUT getWQInputMode(FLYSArtifact flys) {
-        if (flys == null) {
-            return WQ_INPUT.NONE;
-        }
-
-        Boolean selection = flys.getDataAsBoolean("wq_isrange");
-        String adapted = flys.getDataAsString("wq_values");
-
-        if(adapted != null && adapted.length() > 0) {
-            return WQ_INPUT.ADAPTED;
-        }
-
-        if (selection != null && selection) {
-            return WQ_INPUT.RANGE;
-        }
-        else {
-            return WQ_INPUT.SINGLE;
-        }
-    }
-
-
-    /**
-     * Get bounds for river of artifact.
-     * @param flysArtifact artifact which has a "river" data.
-     * @return double array. min is at[0], max at[1]. null if given artifact is null
-     */
-    public static double[] getRiverMinMax(FLYSArtifact flysArtifact) {
-        if (flysArtifact == null) {
-            return null;
-        }
-
-        String riverName = flysArtifact.getDataAsString("river");
-
-        if (riverName == null) {
-            riverName = "";
-        }
-
-        logger.debug("Search for the min/max distances of '" + riverName + "'");
-
-        River river = RiverFactory.getRiver(riverName);
-
-        return river != null
-            ? river.determineMinMaxDistance()
-            : null;
-    }
-
-
-    public static double[] getKmFromTo(FLYSArtifact flys) {
-        String strFrom = flys.getDataAsString("ld_from");
-        String strTo   = flys.getDataAsString("ld_to");
-
-        if (strFrom == null) {
-            strFrom = flys.getDataAsString("from");
-        }
-
-        if (strTo == null) {
-            strTo = flys.getDataAsString("to");
-        }
-
-        if (strFrom == null || strTo == null) {
-            return null;
-        }
-
-        try {
-            return new double[] {
-                Double.parseDouble(strFrom),
-                Double.parseDouble(strTo) };
-        }
-        catch (NumberFormatException nfe) {
-            return null;
-        }
-    }
-
-
-    /**
-     * Return sorted array of locations at which stuff was calculated
-     * (from ld_locations data), null if not parameterized this way.
-     */
-    // TODO moved to RangeAccess. Resolve remaining calls.
-    private static double[] getLocations(FLYSArtifact flys) {
-        String locationStr = flys.getDataAsString("ld_locations");
-
-        if (locationStr == null || locationStr.length() == 0) {
-            if (flys instanceof WINFOArtifact) {
-                WINFOArtifact winfo = (WINFOArtifact) flys;
-                if (winfo.getReferenceStartKm() != null && winfo.getReferenceEndKms() != null) {
-                    return new double[]
-                        {
-                            winfo.getReferenceStartKm().doubleValue(),
-                            winfo.getReferenceEndKms()[0]
-                        };
-                }
-            }
-            return null;
-        }
-
-        String[] tmp               = locationStr.split(" ");
-        TDoubleArrayList locations = new TDoubleArrayList();
-
-        for (String l: tmp) {
-            try {
-                locations.add(Double.parseDouble(l));
-            }
-            catch (NumberFormatException nfe) {
-                logger.debug(nfe.getLocalizedMessage(), nfe);
-            }
-        }
-
-        locations.sort();
-
-        return locations.toNativeArray();
-    }
-
-
-    /**
-     * Returns the Qs for a given FLYSArtifact. This method currently accepts
-     * only instances of WINFOArtifact.
-     *
-     * @param flys A FLYSArtifact.
-     *
-     * @return the Qs.
-     */
-    public static double[] getQs(FLYSArtifact flys) {
-        // XXX this is not nice!
-        if (flys instanceof WINFOArtifact) {
-            return ((WINFOArtifact) flys).getQs();
-        }
-
-        logger.warn("This method currently supports WINFOArtifact only!");
-
-        return null;
-    }
-
-
-    /**
-     * Returns the Ws for a given FLYSArtifact. This method currently accepts
-     * only instances of WINFOArtifact.
-     *
-     * @param flys A FLYSArtifact.
-     *
-     * @return the Ws.
-     */
-    public static double[] getWs(FLYSArtifact flys) {
-        // XXX this is not nice!
-        if (flys instanceof WINFOArtifact) {
-            return ((WINFOArtifact) flys).getWs();
-        }
-
-        logger.warn("This method currently supports WINFOArtifact only!");
-
-        return null;
-    }
-
-
-    /**
-     * Returns the selected River object based on the 'river' data that might
-     * have been inserted by the user.
-     *
-     * @return the selected River or null if no river has been chosen yet.
-     */
-    public static River getRiver(FLYSArtifact flys) {
-        String sRiver = getRivername(flys);
-
-        return (sRiver != null)
-            ? RiverFactory.getRiver(sRiver)
-            : null;
-    }
-
-
-    /**
-     * Returns the name of the river specified in the given <i>flys</i>
-     * Artifact.
-     *
-     * @param flys The FLYSArtifact that stores a river relevant information.
-     *
-     * @return the name of the specified river or null.
-     */
-    public static String getRivername(FLYSArtifact flys) {
-        return flys != null ? flys.getDataAsString("river") : null;
-    }
-
-
-    /**
-     * Extracts the SRID defined in the global configuration for the river
-     * specified in <i>artifact</i>.
-     *
-     * @param artifact The FLYSArtifact that stores the name of the river.
-     *
-     * @return the SRID as string (e.g. "31466").
-     */
-    public static String getRiverSrid(FLYSArtifact artifact) {
-        String river = artifact.getDataAsString("river");
-
-        if (river == null || river.length() == 0) {
-            return null;
-        }
-
-        return getRiverSrid(river);
-    }
-
-
-    public static String getRiverSrid(String rivername) {
-        Map<String, String> variables = new HashMap<String, String>(1);
-        variables.put("name", rivername);
-
-        Document cfg = Config.getConfig();
-
-        return (String) XMLUtils.xpath(
-            cfg,
-            XPATH_FLOODMAP_RIVER_PROJECTION,
-            XPathConstants.STRING,
-            null,
-            variables);
-    }
-
-    public static String getRiverDGMSrid(String rivername) {
-        Map<String, String> variables = new HashMap<String, String>(1);
-        variables.put("name", rivername);
-
-        Document cfg = Config.getConfig();
-
-        String dgm = (String) XMLUtils.xpath(
-            cfg,
-            XPATH_FLOODMAP_DGM_PROJECTION,
-            XPathConstants.STRING,
-            null,
-            variables);
-        if (logger.isDebugEnabled()) {
-            logger.debug("Use EPSG:" + dgm + " for DGM");
-        }
-        return dgm;
-    }
-
-    /**
-     * Return the (first) Gauge corresponding to the given location(s) of
-     * the artifact.
-     * @param flys the artifact in question.
-     * @return (First) gauge of locations of river of artifact.
-     */
-    public static Gauge getGauge(FLYSArtifact flys) {
-        River river = getRiver(flys);
-
-        if (river == null) {
-            logger.debug("no river found");
-            return null;
-        }
-
-        RangeAccess rangeAccess = new RangeAccess(flys, null);
-        double[] dist = rangeAccess.getKmRange();
-
-        if (dist == null) {
-            logger.debug("no range found");
-            return null;
-        }
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("Determine gauge for:");
-            logger.debug("... river: " + river.getName());
-            logger.debug("... distance: " + dist[0] + " - " + dist[1]);
-        }
-
-        Gauge gauge = river.determineGauge(dist[0], dist[1]);
-
-        String name = gauge != null ? gauge.getName() : "'n/a";
-        logger.debug("Found gauge: " + name);
-
-        return gauge;
-    }
-
-
-    public static String getGaugename(FLYSArtifact flys) {
-        Gauge gauge = getGauge(flys);
-
-        return gauge != null ? gauge.getName() : null;
-    }
-
-
-    public static Gauge getReferenceGauge(FLYSArtifact flys) {
-        Long officialNumber = flys.getDataAsLong("reference_gauge");
-
-        return officialNumber != null
-            ? Gauge.getGaugeByOfficialNumber(officialNumber)
-            : null;
-    }
-
-
-    public static String getReferenceGaugeName(FLYSArtifact flys) {
-        Gauge refGauge = getReferenceGauge(flys);
-
-        return refGauge != null
-            ? refGauge.getName()
-            : "-- not found --";
-    }
-
-
-    public static Double getValueFromWQ(WQ wq) {
-        if (wq == null) {
-            return null;
-        }
-
-        Matcher m = NUMBERS_PATTERN.matcher(wq.getName());
-
-        if (m.matches()) {
-            logger.debug("Found a number.");
-
-            String raw = m.group(1);
-
-            try {
-                return Double.valueOf(raw);
-            }
-            catch (NumberFormatException nfe) {
-            }
-        }
-
-        return null;
-    }
-
-
-    /** Creates human-readable name for a wsp (waterlevel/longitudinal section).
-     * @param name will be split at '='s.
-     */
-    public static String createWspWTitle(
-        WINFOArtifact winfo,
-        CallContext   cc,
-        String        name
-    ) {
-        String[] parts = name.split("=");
-
-        NumberFormat nf = Formatter.getWaterlevelW(cc);
-
-        String namedMainValue = null;
-
-        boolean isQ    = winfo.isQ();
-        boolean isFree = winfo.isFreeQ();
-
-        double v;
-
-        try {
-            v = Double.valueOf(parts[1]);
-
-            namedMainValue = getNamedMainValue(winfo.getGauge(), v);
-        }
-        catch (NumberFormatException nfe) {
-            logger.warn("Cannot parse Double of: '" + parts[1] + "'");
-            return name;
-        }
-
-        String prefix = null;
-
-        if (isQ && !isFree && namedMainValue != null) {
-            return "W (" + namedMainValue + ")";
-        }
-
-        if (isQ) {
-            prefix = "Q=";
-        }
-
-        return prefix == null
-            ? "W(" + nf.format(v) + ")"
-            : "W(" + prefix + nf.format(v) + ")";
-    }
-
-
-    public static String createWspQTitle(
-        WINFOArtifact winfo,
-        CallContext   cc,
-        String        name
-    ) {
-        String[] parts = name.split("=");
-
-        NumberFormat nf = Formatter.getWaterlevelQ(cc);
-
-        String namedMainValue = null;
-
-        boolean isQ    = winfo.isQ();
-        boolean isFree = winfo.isFreeQ();
-
-        double v;
-
-        try {
-            v = Double.valueOf(parts[1]);
-
-            namedMainValue = getNamedMainValue(winfo.getGauge(), v);
-        }
-        catch (NumberFormatException nfe) {
-            logger.warn("Cannot parse Double of: '" + parts[1] + "'");
-            return name;
-        }
-
-        String prefix = null;
-
-        if (isQ && !isFree && namedMainValue != null) {
-            return namedMainValue;
-        }
-
-        if (!isQ) {
-            prefix = "W=";
-        }
-
-        return prefix == null
-            ? "Q(" + nf.format(v) + ")"
-            : "Q(" + prefix + nf.format(v) + ")";
-    }
-
-
-    /**
-     * Returns the named main value if a Q was selected and if this Q fits to a
-     * named main value. Otherwise, this function returns null.
-     *
-     * @param winfo The WINFO Artifact.
-     * @param value The Q (or W) value.
-     *
-     * @return a named main value or null.
-     */
-    public static String getNamedMainValue(WINFOArtifact winfo, double value) {
-        WQ_MODE wqmode = getWQMode(winfo);
-
-        if (wqmode != WQ_MODE.QGAUGE) {
-            return null;
-        }
-        else {
-            return getNamedMainValue(winfo.getGauge(), value);
-        }
-    }
-
-
-    public static String getNamedMainValue(Gauge gauge, double value) {
-        List<MainValue> mainValues = gauge.getMainValues();
-        logger.debug("Search named main value for: " + value);
-
-        for (MainValue mv: mainValues) {
-            if (mv.getValue().doubleValue() == value) {
-                logger.debug("Found named main value: " + mv.getMainValue().getName());
-                return mv.getMainValue().getName();
-            }
-        }
-
-        logger.debug("Did not find a named main value for: " + value);
-        return null;
-    }
-
-
-    /**
-     *
-     * @param nmv A string that represents a named main value.
-     *
-     * @throws NullPointerException if nmv is null.
-     */
-    public static String stripNamedMainValue(String nmv) {
-        int startIndex = nmv.indexOf("(");
-        int endIndex   = nmv.indexOf(")");
-
-        if (startIndex > 0 && endIndex > 0 && startIndex < endIndex) {
-            return nmv.substring(0, startIndex);
-        }
-
-        return nmv;
-    }
-
-
-    /**
-     * Returns the URL of user mapfile for the owner of Artifact
-     * <i>artifactId</i>.
-     *
-     * @param artifactId The UUID of an artifact.
-     *
-     * @return the URL of the user wms.
-     */
-    public static String getUserWMSUrl(String artifactId) {
-        String url = getXPathString(XPATH_FLOODMAP_MAPSERVER_URL);
-        url = url.endsWith("/") ? url + "user-wms" : url + "/" + "user-wms";
-
-        return url;
-    }
-
-
-    public static String getRiverWMSUrl() {
-        String url = getXPathString(XPATH_RIVERMAP_MAPSERVER_URL);
-        url = url.endsWith("/") ? url + "river-wms" : url + "/" + "river-wms";
-
-        return url;
-    }
-
-
-    /**
-     * This method returns the description for a given <i>km</i> for a specific
-     * river. The river is provided by the FLYSArtifact <i>flys</i>.
-     *
-     * @param flys The FLYSArtifact that provides a river.
-     * @param km The kilometer.
-     *
-     * @return the description for <i>km</i> or an empty string if no
-     * description was found.
-     */
-    public static String getLocationDescription(FLYSArtifact flys, double km) {
-        String river = getRivername(flys);
-
-        if (river == null) {
-            return "";
-        }
-
-        return LocationProvider.getLocation(river, km);
-    }
-
-
-    /**
-     * This method returns the differences for a w-differences calculation.
-     *
-     * @param winfo The WINFOArtifact.
-     * @param context The context.
-     *
-     * @return The differences as string separated by semicolon and linebreak.
-     */
-    public static String getWDifferences(
-        WINFOArtifact winfo,
-        CallContext context)
-    {
-        State state = winfo.getCurrentState(context);
-        if(state instanceof WDifferencesState) {
-            String diffids = winfo.getDataAsString("diffids");
-            String datas[] = diffids.split("#");
-
-            // Validate the Data-Strings.
-            for (String s: datas) {
-                if (!WaterlevelSelectState.isValueValid(s)) {
-                    return "";
-                }
-            }
-
-            if (datas.length < 2) {
-                return "";
-            }
-
-            String diffs = "";
-            for(int i = 0; i < datas.length; i+=2) {
-                // e.g.:
-                // 42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;1
-                WKms minuendWKms = getWKms(StringUtil.unbracket(datas[i+0]),
-                    context);
-                WKms subtrahendWKms = getWKms(StringUtil.unbracket(datas[i+1]),
-                    context);
-                if (minuendWKms != null && subtrahendWKms != null) {
-                    diffs += StringUtil.wWrap(minuendWKms.getName())
-                        + " - " + StringUtil.wWrap(subtrahendWKms.getName());
-                }
-                diffs += ";\n";
-            }
-            return diffs;
-        }
-        else {
-            logger.warn("Not a valid state for differences.");
-            return "";
-        }
-    }
-
-
-    protected static WKms getWKms(String mingle, CallContext context) {
-        String[] def  = mingle.split(";");
-        String   uuid = def[0];
-        String   name = def[1];
-        int      idx  = Integer.parseInt(def[2]);
-
-        if (name.startsWith("staticwkms")) {
-            StaticWKmsArtifact staticWKms =
-                (StaticWKmsArtifact) FLYSUtils.getArtifact(
-                    uuid,
-                    context);
-            WKms wkms = staticWKms.getWKms(idx);
-            if (wkms == null)
-                logger.error("No WKms from artifact.");
-            return wkms;
-        }
-
-        WINFOArtifact flys = (WINFOArtifact) FLYSUtils.getArtifact(
-            uuid,
-            context);
-
-        if (flys == null) {
-            logger.warn("One of the artifacts (1) for diff calculation could not be loaded");
-            return null;
-        }
-        else{
-            WQKms[] wqkms = (WQKms[]) flys.getWaterlevelData().
-                                              getData();
-            if (wqkms == null)
-            logger.warn("not  waterlevels in artifact");
-            else if (wqkms.length < idx)
-            logger.warn("not enough waterlevels in artifact");
-            return wqkms[idx];
-        }
-    }
-
-
-    /**
-     * This method transform a string into an int array. Therefore, the string
-     * <i>raw</i> must consist of int values separated by a <i>';'</i>.
-     *
-     * @param raw The raw integer array as string separated by a ';'.
-     *
-     * @return an array of int values.
-     */
-    public static int[] intArrayFromString(String raw) {
-        String[] splitted = raw != null ? raw.split(";") : null;
-
-        if (splitted == null || splitted.length == 0) {
-            logger.warn("No integer values found in '" + raw + "'");
-            return new int[0];
-        }
-
-        TIntArrayList integers = new TIntArrayList(splitted.length);
-
-        for (String value: splitted) {
-            try {
-                integers.add(Integer.parseInt(value));
-            }
-            catch (NumberFormatException nfe) {
-                logger.warn("Parsing integer failed: " + nfe);
-            }
-        }
-
-        return integers.toNativeArray();
-    }
-
-
-    /**
-     * This method transform a string into a long array. Therefore, the string
-     * <i>raw</i> must consist of int values separated by a <i>';'</i>.
-     *
-     * @param raw The raw long array as string separated by a ';'.
-     *
-     * @return an array of int values.
-     */
-    public static long[] longArrayFromString(String raw) {
-        String[] splitted = raw != null ? raw.split(";") : null;
-
-        if (splitted == null || splitted.length == 0) {
-            logger.warn("No long values found in '" + raw + "'");
-            return new long[0];
-        }
-
-        TLongArrayList longs = new TLongArrayList(splitted.length);
-
-        for (String value: splitted) {
-            try {
-                longs.add(Long.valueOf(value));
-            }
-            catch (NumberFormatException nfe) {
-                logger.warn("Parsing long failed: " + nfe);
-            }
-        }
-
-        return longs.toNativeArray();
-    }
-
-
-    /**
-     * This method transform a string into an double array. Therefore, the
-     * string <i>raw</i> must consist of double values separated by a
-     * <i>';'</i>.
-     *
-     * @param raw The raw double array as string separated by a ';'.
-     *
-     * @return an array of double values.
-     */
-    public static double[] doubleArrayFromString(String raw) {
-        String[] splitted = raw != null ? raw.split(";") : null;
-
-        if (splitted == null || splitted.length == 0) {
-            logger.warn("No double values found in '" + raw + "'");
-            return new double[0];
-        }
-
-        TDoubleArrayList doubles = new TDoubleArrayList(splitted.length);
-
-        for (String value: splitted) {
-            try {
-                doubles.add(Double.valueOf(value));
-            }
-            catch (NumberFormatException nfe) {
-                logger.warn("Parsing double failed: " + nfe);
-            }
-        }
-
-        return doubles.toNativeArray();
-    }
-
-
-    /**
-     * Returns the gauges that match the selected kilometer range.
-     *
-     * @param flys the flys artifact.
-     *
-     * @return the gauges based on the selected kilometer range (null if
-     *         none/no range set).
-     */
-    public static List<Gauge> getGauges(FLYSArtifact flys) {
-
-        River river = getRiver(flys);
-        if (river == null) {
-            logger.debug("getGauges: no river!");
-            return null;
-        }
-
-        RangeAccess rangeAccess = new RangeAccess(flys, null);
-        double[] dist = rangeAccess.getKmRange();
-        if (dist == null) {
-            logger.debug("getGauges: no dist!");
-            return null;
-        }
-        logger.debug("getGauges: " + dist[0] + " - " + dist[1]);
-
-        return river.determineGauges(dist[0], dist[1]);
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/utils/MapUtils.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/MapUtils.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/MapUtils.java	Sun Apr 28 15:09:31 2013 +0200
@@ -63,7 +63,7 @@
 
         String connection = null;
 
-        if (FLYSUtils.isUsingOracle()) {
+        if (RiverUtils.isUsingOracle()) {
             if (groups < 4) {
                 logger.warn("Could only partially parse connection string.");
                 return null;
@@ -150,6 +150,6 @@
     }
 
     public static String getConnectionType() {
-        return FLYSUtils.isUsingOracle() ? "oraclespatial" : "postgis";
+        return RiverUtils.isUsingOracle() ? "oraclespatial" : "postgis";
     }
 }
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/utils/MapfileGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/MapfileGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/MapfileGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -215,8 +215,8 @@
             throws FileNotFoundException, IOException
     {
         if (shapefileDirectory == null) {
-            String path = FLYSUtils.getXPathString(
-                FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
+            String path = RiverUtils.getXPathString(
+                RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
 
             if (path != null) {
                 shapefileDirectory = new File(path);
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/utils/RiverMapfileGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/RiverMapfileGenerator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/RiverMapfileGenerator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -119,7 +119,7 @@
         layerInfo.setExtent(extend);
         layerInfo.setType("line");
         // FIXME: Use templates for that
-        if (FLYSUtils.isUsingOracle()) {
+        if (RiverUtils.isUsingOracle()) {
             layerInfo.setData("geom FROM river_axes USING SRID " + srid);
         } else {
             layerInfo.setData("geom FROM river_axes");
@@ -144,26 +144,26 @@
 
     @Override
     protected String getVelocityLogfile() {
-        return FLYSUtils.getXPathString(XPATH_RIVERMAP_VELOCITY_LOGFILE);
+        return RiverUtils.getXPathString(XPATH_RIVERMAP_VELOCITY_LOGFILE);
     }
 
     @Override
     protected String getMapserverTemplatePath() {
-        return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH);
+        return RiverUtils.getXPathString(XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH);
     }
 
     @Override
     public String getMapserverUrl() {
-        return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPSERVER_URL);
+        return RiverUtils.getXPathString(XPATH_RIVERMAP_MAPSERVER_URL);
     }
 
     @Override
     protected String getMapfilePath() {
-        return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPFILE_PATH);
+        return RiverUtils.getXPathString(XPATH_RIVERMAP_MAPFILE_PATH);
     }
 
     @Override
     protected String getMapfileTemplate() {
-        return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPFILE_TEMPLATE);
+        return RiverUtils.getXPathString(XPATH_RIVERMAP_MAPFILE_TEMPLATE);
     }
 }
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java	Sun Apr 28 15:09:31 2013 +0200
@@ -0,0 +1,929 @@
+/* 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.utils;
+
+import org.dive4elements.artifactdatabase.state.State;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.common.utils.Config;
+import org.dive4elements.artifacts.common.utils.XMLUtils;
+import org.dive4elements.river.artifacts.FLYSArtifact;
+import org.dive4elements.river.artifacts.StaticWKmsArtifact;
+import org.dive4elements.river.artifacts.WINFOArtifact;
+import org.dive4elements.river.artifacts.access.RangeAccess;
+import org.dive4elements.river.artifacts.context.FLYSContext;
+import org.dive4elements.river.artifacts.model.LocationProvider;
+import org.dive4elements.river.artifacts.model.RiverFactory;
+import org.dive4elements.river.artifacts.model.WKms;
+import org.dive4elements.river.artifacts.model.WQ;
+import org.dive4elements.river.artifacts.model.WQKms;
+import org.dive4elements.river.artifacts.states.WDifferencesState;
+import org.dive4elements.river.artifacts.states.WaterlevelSelectState;
+import org.dive4elements.river.backend.SessionFactoryProvider;
+import org.dive4elements.river.model.Gauge;
+import org.dive4elements.river.model.MainValue;
+import org.dive4elements.river.model.River;
+
+import gnu.trove.TDoubleArrayList;
+import gnu.trove.TIntArrayList;
+import gnu.trove.TLongArrayList;
+
+import java.text.NumberFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.xpath.XPathConstants;
+
+import org.apache.log4j.Logger;
+import org.hibernate.SessionFactory;
+import org.hibernate.impl.SessionFactoryImpl;
+import org.w3c.dom.Document;
+
+
+/**
+ * Static helper methods to e.g. access FLYSArtifacts data.
+ *
+ * @deprecated Don't use RiverUtils to get data from an {@link Artifact} anymore.
+ * Instead use and/or create a {@link Access} class hierarchy.
+ **/
+ at Deprecated
+public class RiverUtils {
+
+    /** The logger that is used in this utility. */
+    private static Logger logger = Logger.getLogger(RiverUtils.class);
+
+    /**
+     * An enum that represents the 5 possible WQ modes in FLYS. The 5 values are
+     * <i>QFREE</i> <i>QGAUGE</i> <i>WGAUGE</i> <i>WFREE</i> and <i>NONE</i>.
+     */
+    public static enum WQ_MODE { QFREE, QGAUGE, WFREE, WGAUGE, NONE };
+
+    /**
+     * An enum that represents the 4 possible WQ input modes in FLYS. The 4
+     * values are
+     * <i>ADAPTED</i> <i>SINGLE</i> <i>RANGE</i> and <i>NONE</i>.
+     */
+    public static enum WQ_INPUT { ADAPTED, SINGLE, RANGE, NONE };
+
+    public static final Pattern NUMBERS_PATTERN =
+        Pattern.compile("\\D*(\\d++.\\d*)\\D*");
+
+    public static final String XPATH_FLOODMAP_RIVER_PROJECTION =
+        "/artifact-database/floodmap/river[@name=$name]/srid/@value";
+
+    public static final String XPATH_FLOODMAP_DGM_PROJECTION =
+        "/artifact-database/floodmap/river[@name=$name]/dgm-srid/@value";
+
+    public static final String XPATH_FLOODMAP_SHAPEFILE_DIR =
+        "/artifact-database/floodmap/shapefile-path/@value";
+
+    public static final String XPATH_FLOODMAP_VELOCITY_LOGFILE =
+        "/artifact-database/floodmap/velocity/logfile/@path";
+
+    public static final String XPATH_FLOODMAP_MAPSERVER_URL =
+        "/artifact-database/floodmap/mapserver/server/@path";
+
+    public static final String XPATH_RIVERMAP_MAPSERVER_URL =
+            "/artifact-database/rivermap/mapserver/server/@path";
+
+    public static final String XPATH_FLOODMAP_MAPFILE_PATH =
+        "/artifact-database/floodmap/mapserver/mapfile/@path";
+
+    public static final String XPATH_FLOODMAP_MAPFILE_TEMPLATE =
+        "/artifact-database/floodmap/mapserver/map-template/@path";
+
+    public static final String XPATH_FLOODMAP_MAPSERVER_TEMPLATE_PATH =
+        "/artifact-database/floodmap/mapserver/templates/@path";
+
+
+    private RiverUtils() {
+    }
+
+
+    /**
+     * Pulls Artifact with given UUID fromm database.
+     * @return FLYSArtifact with given UUID or null (in case of errors).
+     */
+    public static FLYSArtifact getArtifact(String uuid, CallContext context) {
+        try {
+            Artifact artifact = context.getDatabase().getRawArtifact(uuid);
+
+            if (artifact == null) {
+                logger.error("Artifact '" + uuid + "' does not exist.");
+                return null;
+            }
+
+            if (!(artifact instanceof FLYSArtifact)) {
+                logger.error("Artifact '" +uuid+ "' is no valid FLYSArtifact.");
+                return null;
+            }
+
+            return (FLYSArtifact) artifact;
+        }
+        // TODO: catch more selective
+        catch (Exception e) {
+            logger.error("Cannot get FLYSArtifact " + uuid
+                + " from database (" + e.getMessage() + ").");
+            return null;
+        }
+    }
+
+
+    /**
+     * Returns the FLYSContext from context object.
+     *
+     * @param context The CallContext or the FLYSContext.
+     *
+     * @return the FLYSContext.
+     */
+    public static FLYSContext getFlysContext(Object context) {
+        return context instanceof FLYSContext
+            ? (FLYSContext) context
+            : (FLYSContext) ((CallContext) context).globalContext();
+    }
+
+
+    /**
+     * Convinience function to retrieve an XPath as string with replaced config
+     * directory.
+     *
+     * @param xpath The XPath expression.
+     *
+     * @return a string with replaced config directory.
+     */
+    public static String getXPathString(String xpath) {
+        String tmp = Config.getStringXPath(xpath);
+        tmp        = Config.replaceConfigDir(tmp);
+
+        return tmp;
+    }
+
+
+    public static boolean isUsingOracle() {
+        SessionFactory sf = SessionFactoryProvider.getSessionFactory();
+
+        String d = SessionFactoryProvider.getDriver((SessionFactoryImpl) sf);
+
+        return d != null ? d.indexOf("Oracle") >= 0 : false;
+    }
+
+
+    /**
+     * This method returns an WQ_MODE enum which is based on the parameters
+     * stored in <i>flys</i> Artifact. If there is no <i>wq_isq</i> parameter
+     * existing, WQ_MODE.NONE is returned.
+     *
+     * @param flys The FLYSArtifact that stores wq mode relevant parameters.
+     *
+     * @return an enum WQ_MODE.
+     */
+    public static WQ_MODE getWQMode(FLYSArtifact flys) {
+        if (flys == null) {
+            return WQ_MODE.NONE;
+        }
+
+        String values = flys.getDataAsString("wq_values");
+        Boolean isQ   = flys.getDataAsBoolean("wq_isq");
+
+        if (values != null) {
+            return isQ ? WQ_MODE.QGAUGE : WQ_MODE.WGAUGE;
+        }
+
+        Boolean isFree = flys.getDataAsBoolean("wq_isfree");
+
+        if (isQ != null && isQ) {
+            return isFree ? WQ_MODE.QFREE : WQ_MODE.QGAUGE;
+        }
+        else if (isQ != null && !isQ) {
+            return isFree ? WQ_MODE.WFREE : WQ_MODE.WGAUGE;
+        }
+        else {
+            return WQ_MODE.NONE;
+        }
+    }
+
+
+    public static WQ_INPUT getWQInputMode(FLYSArtifact flys) {
+        if (flys == null) {
+            return WQ_INPUT.NONE;
+        }
+
+        Boolean selection = flys.getDataAsBoolean("wq_isrange");
+        String adapted = flys.getDataAsString("wq_values");
+
+        if(adapted != null && adapted.length() > 0) {
+            return WQ_INPUT.ADAPTED;
+        }
+
+        if (selection != null && selection) {
+            return WQ_INPUT.RANGE;
+        }
+        else {
+            return WQ_INPUT.SINGLE;
+        }
+    }
+
+
+    /**
+     * Get bounds for river of artifact.
+     * @param flysArtifact artifact which has a "river" data.
+     * @return double array. min is at[0], max at[1]. null if given artifact is null
+     */
+    public static double[] getRiverMinMax(FLYSArtifact flysArtifact) {
+        if (flysArtifact == null) {
+            return null;
+        }
+
+        String riverName = flysArtifact.getDataAsString("river");
+
+        if (riverName == null) {
+            riverName = "";
+        }
+
+        logger.debug("Search for the min/max distances of '" + riverName + "'");
+
+        River river = RiverFactory.getRiver(riverName);
+
+        return river != null
+            ? river.determineMinMaxDistance()
+            : null;
+    }
+
+
+    public static double[] getKmFromTo(FLYSArtifact flys) {
+        String strFrom = flys.getDataAsString("ld_from");
+        String strTo   = flys.getDataAsString("ld_to");
+
+        if (strFrom == null) {
+            strFrom = flys.getDataAsString("from");
+        }
+
+        if (strTo == null) {
+            strTo = flys.getDataAsString("to");
+        }
+
+        if (strFrom == null || strTo == null) {
+            return null;
+        }
+
+        try {
+            return new double[] {
+                Double.parseDouble(strFrom),
+                Double.parseDouble(strTo) };
+        }
+        catch (NumberFormatException nfe) {
+            return null;
+        }
+    }
+
+
+    /**
+     * Return sorted array of locations at which stuff was calculated
+     * (from ld_locations data), null if not parameterized this way.
+     */
+    // TODO moved to RangeAccess. Resolve remaining calls.
+    private static double[] getLocations(FLYSArtifact flys) {
+        String locationStr = flys.getDataAsString("ld_locations");
+
+        if (locationStr == null || locationStr.length() == 0) {
+            if (flys instanceof WINFOArtifact) {
+                WINFOArtifact winfo = (WINFOArtifact) flys;
+                if (winfo.getReferenceStartKm() != null && winfo.getReferenceEndKms() != null) {
+                    return new double[]
+                        {
+                            winfo.getReferenceStartKm().doubleValue(),
+                            winfo.getReferenceEndKms()[0]
+                        };
+                }
+            }
+            return null;
+        }
+
+        String[] tmp               = locationStr.split(" ");
+        TDoubleArrayList locations = new TDoubleArrayList();
+
+        for (String l: tmp) {
+            try {
+                locations.add(Double.parseDouble(l));
+            }
+            catch (NumberFormatException nfe) {
+                logger.debug(nfe.getLocalizedMessage(), nfe);
+            }
+        }
+
+        locations.sort();
+
+        return locations.toNativeArray();
+    }
+
+
+    /**
+     * Returns the Qs for a given FLYSArtifact. This method currently accepts
+     * only instances of WINFOArtifact.
+     *
+     * @param flys A FLYSArtifact.
+     *
+     * @return the Qs.
+     */
+    public static double[] getQs(FLYSArtifact flys) {
+        // XXX this is not nice!
+        if (flys instanceof WINFOArtifact) {
+            return ((WINFOArtifact) flys).getQs();
+        }
+
+        logger.warn("This method currently supports WINFOArtifact only!");
+
+        return null;
+    }
+
+
+    /**
+     * Returns the Ws for a given FLYSArtifact. This method currently accepts
+     * only instances of WINFOArtifact.
+     *
+     * @param flys A FLYSArtifact.
+     *
+     * @return the Ws.
+     */
+    public static double[] getWs(FLYSArtifact flys) {
+        // XXX this is not nice!
+        if (flys instanceof WINFOArtifact) {
+            return ((WINFOArtifact) flys).getWs();
+        }
+
+        logger.warn("This method currently supports WINFOArtifact only!");
+
+        return null;
+    }
+
+
+    /**
+     * Returns the selected River object based on the 'river' data that might
+     * have been inserted by the user.
+     *
+     * @return the selected River or null if no river has been chosen yet.
+     */
+    public static River getRiver(FLYSArtifact flys) {
+        String sRiver = getRivername(flys);
+
+        return (sRiver != null)
+            ? RiverFactory.getRiver(sRiver)
+            : null;
+    }
+
+
+    /**
+     * Returns the name of the river specified in the given <i>flys</i>
+     * Artifact.
+     *
+     * @param flys The FLYSArtifact that stores a river relevant information.
+     *
+     * @return the name of the specified river or null.
+     */
+    public static String getRivername(FLYSArtifact flys) {
+        return flys != null ? flys.getDataAsString("river") : null;
+    }
+
+
+    /**
+     * Extracts the SRID defined in the global configuration for the river
+     * specified in <i>artifact</i>.
+     *
+     * @param artifact The FLYSArtifact that stores the name of the river.
+     *
+     * @return the SRID as string (e.g. "31466").
+     */
+    public static String getRiverSrid(FLYSArtifact artifact) {
+        String river = artifact.getDataAsString("river");
+
+        if (river == null || river.length() == 0) {
+            return null;
+        }
+
+        return getRiverSrid(river);
+    }
+
+
+    public static String getRiverSrid(String rivername) {
+        Map<String, String> variables = new HashMap<String, String>(1);
+        variables.put("name", rivername);
+
+        Document cfg = Config.getConfig();
+
+        return (String) XMLUtils.xpath(
+            cfg,
+            XPATH_FLOODMAP_RIVER_PROJECTION,
+            XPathConstants.STRING,
+            null,
+            variables);
+    }
+
+    public static String getRiverDGMSrid(String rivername) {
+        Map<String, String> variables = new HashMap<String, String>(1);
+        variables.put("name", rivername);
+
+        Document cfg = Config.getConfig();
+
+        String dgm = (String) XMLUtils.xpath(
+            cfg,
+            XPATH_FLOODMAP_DGM_PROJECTION,
+            XPathConstants.STRING,
+            null,
+            variables);
+        if (logger.isDebugEnabled()) {
+            logger.debug("Use EPSG:" + dgm + " for DGM");
+        }
+        return dgm;
+    }
+
+    /**
+     * Return the (first) Gauge corresponding to the given location(s) of
+     * the artifact.
+     * @param flys the artifact in question.
+     * @return (First) gauge of locations of river of artifact.
+     */
+    public static Gauge getGauge(FLYSArtifact flys) {
+        River river = getRiver(flys);
+
+        if (river == null) {
+            logger.debug("no river found");
+            return null;
+        }
+
+        RangeAccess rangeAccess = new RangeAccess(flys, null);
+        double[] dist = rangeAccess.getKmRange();
+
+        if (dist == null) {
+            logger.debug("no range found");
+            return null;
+        }
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("Determine gauge for:");
+            logger.debug("... river: " + river.getName());
+            logger.debug("... distance: " + dist[0] + " - " + dist[1]);
+        }
+
+        Gauge gauge = river.determineGauge(dist[0], dist[1]);
+
+        String name = gauge != null ? gauge.getName() : "'n/a";
+        logger.debug("Found gauge: " + name);
+
+        return gauge;
+    }
+
+
+    public static String getGaugename(FLYSArtifact flys) {
+        Gauge gauge = getGauge(flys);
+
+        return gauge != null ? gauge.getName() : null;
+    }
+
+
+    public static Gauge getReferenceGauge(FLYSArtifact flys) {
+        Long officialNumber = flys.getDataAsLong("reference_gauge");
+
+        return officialNumber != null
+            ? Gauge.getGaugeByOfficialNumber(officialNumber)
+            : null;
+    }
+
+
+    public static String getReferenceGaugeName(FLYSArtifact flys) {
+        Gauge refGauge = getReferenceGauge(flys);
+
+        return refGauge != null
+            ? refGauge.getName()
+            : "-- not found --";
+    }
+
+
+    public static Double getValueFromWQ(WQ wq) {
+        if (wq == null) {
+            return null;
+        }
+
+        Matcher m = NUMBERS_PATTERN.matcher(wq.getName());
+
+        if (m.matches()) {
+            logger.debug("Found a number.");
+
+            String raw = m.group(1);
+
+            try {
+                return Double.valueOf(raw);
+            }
+            catch (NumberFormatException nfe) {
+            }
+        }
+
+        return null;
+    }
+
+
+    /** Creates human-readable name for a wsp (waterlevel/longitudinal section).
+     * @param name will be split at '='s.
+     */
+    public static String createWspWTitle(
+        WINFOArtifact winfo,
+        CallContext   cc,
+        String        name
+    ) {
+        String[] parts = name.split("=");
+
+        NumberFormat nf = Formatter.getWaterlevelW(cc);
+
+        String namedMainValue = null;
+
+        boolean isQ    = winfo.isQ();
+        boolean isFree = winfo.isFreeQ();
+
+        double v;
+
+        try {
+            v = Double.valueOf(parts[1]);
+
+            namedMainValue = getNamedMainValue(winfo.getGauge(), v);
+        }
+        catch (NumberFormatException nfe) {
+            logger.warn("Cannot parse Double of: '" + parts[1] + "'");
+            return name;
+        }
+
+        String prefix = null;
+
+        if (isQ && !isFree && namedMainValue != null) {
+            return "W (" + namedMainValue + ")";
+        }
+
+        if (isQ) {
+            prefix = "Q=";
+        }
+
+        return prefix == null
+            ? "W(" + nf.format(v) + ")"
+            : "W(" + prefix + nf.format(v) + ")";
+    }
+
+
+    public static String createWspQTitle(
+        WINFOArtifact winfo,
+        CallContext   cc,
+        String        name
+    ) {
+        String[] parts = name.split("=");
+
+        NumberFormat nf = Formatter.getWaterlevelQ(cc);
+
+        String namedMainValue = null;
+
+        boolean isQ    = winfo.isQ();
+        boolean isFree = winfo.isFreeQ();
+
+        double v;
+
+        try {
+            v = Double.valueOf(parts[1]);
+
+            namedMainValue = getNamedMainValue(winfo.getGauge(), v);
+        }
+        catch (NumberFormatException nfe) {
+            logger.warn("Cannot parse Double of: '" + parts[1] + "'");
+            return name;
+        }
+
+        String prefix = null;
+
+        if (isQ && !isFree && namedMainValue != null) {
+            return namedMainValue;
+        }
+
+        if (!isQ) {
+            prefix = "W=";
+        }
+
+        return prefix == null
+            ? "Q(" + nf.format(v) + ")"
+            : "Q(" + prefix + nf.format(v) + ")";
+    }
+
+
+    /**
+     * Returns the named main value if a Q was selected and if this Q fits to a
+     * named main value. Otherwise, this function returns null.
+     *
+     * @param winfo The WINFO Artifact.
+     * @param value The Q (or W) value.
+     *
+     * @return a named main value or null.
+     */
+    public static String getNamedMainValue(WINFOArtifact winfo, double value) {
+        WQ_MODE wqmode = getWQMode(winfo);
+
+        if (wqmode != WQ_MODE.QGAUGE) {
+            return null;
+        }
+        else {
+            return getNamedMainValue(winfo.getGauge(), value);
+        }
+    }
+
+
+    public static String getNamedMainValue(Gauge gauge, double value) {
+        List<MainValue> mainValues = gauge.getMainValues();
+        logger.debug("Search named main value for: " + value);
+
+        for (MainValue mv: mainValues) {
+            if (mv.getValue().doubleValue() == value) {
+                logger.debug("Found named main value: " + mv.getMainValue().getName());
+                return mv.getMainValue().getName();
+            }
+        }
+
+        logger.debug("Did not find a named main value for: " + value);
+        return null;
+    }
+
+
+    /**
+     *
+     * @param nmv A string that represents a named main value.
+     *
+     * @throws NullPointerException if nmv is null.
+     */
+    public static String stripNamedMainValue(String nmv) {
+        int startIndex = nmv.indexOf("(");
+        int endIndex   = nmv.indexOf(")");
+
+        if (startIndex > 0 && endIndex > 0 && startIndex < endIndex) {
+            return nmv.substring(0, startIndex);
+        }
+
+        return nmv;
+    }
+
+
+    /**
+     * Returns the URL of user mapfile for the owner of Artifact
+     * <i>artifactId</i>.
+     *
+     * @param artifactId The UUID of an artifact.
+     *
+     * @return the URL of the user wms.
+     */
+    public static String getUserWMSUrl(String artifactId) {
+        String url = getXPathString(XPATH_FLOODMAP_MAPSERVER_URL);
+        url = url.endsWith("/") ? url + "user-wms" : url + "/" + "user-wms";
+
+        return url;
+    }
+
+
+    public static String getRiverWMSUrl() {
+        String url = getXPathString(XPATH_RIVERMAP_MAPSERVER_URL);
+        url = url.endsWith("/") ? url + "river-wms" : url + "/" + "river-wms";
+
+        return url;
+    }
+
+
+    /**
+     * This method returns the description for a given <i>km</i> for a specific
+     * river. The river is provided by the FLYSArtifact <i>flys</i>.
+     *
+     * @param flys The FLYSArtifact that provides a river.
+     * @param km The kilometer.
+     *
+     * @return the description for <i>km</i> or an empty string if no
+     * description was found.
+     */
+    public static String getLocationDescription(FLYSArtifact flys, double km) {
+        String river = getRivername(flys);
+
+        if (river == null) {
+            return "";
+        }
+
+        return LocationProvider.getLocation(river, km);
+    }
+
+
+    /**
+     * This method returns the differences for a w-differences calculation.
+     *
+     * @param winfo The WINFOArtifact.
+     * @param context The context.
+     *
+     * @return The differences as string separated by semicolon and linebreak.
+     */
+    public static String getWDifferences(
+        WINFOArtifact winfo,
+        CallContext context)
+    {
+        State state = winfo.getCurrentState(context);
+        if(state instanceof WDifferencesState) {
+            String diffids = winfo.getDataAsString("diffids");
+            String datas[] = diffids.split("#");
+
+            // Validate the Data-Strings.
+            for (String s: datas) {
+                if (!WaterlevelSelectState.isValueValid(s)) {
+                    return "";
+                }
+            }
+
+            if (datas.length < 2) {
+                return "";
+            }
+
+            String diffs = "";
+            for(int i = 0; i < datas.length; i+=2) {
+                // e.g.:
+                // 42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;1
+                WKms minuendWKms = getWKms(StringUtil.unbracket(datas[i+0]),
+                    context);
+                WKms subtrahendWKms = getWKms(StringUtil.unbracket(datas[i+1]),
+                    context);
+                if (minuendWKms != null && subtrahendWKms != null) {
+                    diffs += StringUtil.wWrap(minuendWKms.getName())
+                        + " - " + StringUtil.wWrap(subtrahendWKms.getName());
+                }
+                diffs += ";\n";
+            }
+            return diffs;
+        }
+        else {
+            logger.warn("Not a valid state for differences.");
+            return "";
+        }
+    }
+
+
+    protected static WKms getWKms(String mingle, CallContext context) {
+        String[] def  = mingle.split(";");
+        String   uuid = def[0];
+        String   name = def[1];
+        int      idx  = Integer.parseInt(def[2]);
+
+        if (name.startsWith("staticwkms")) {
+            StaticWKmsArtifact staticWKms =
+                (StaticWKmsArtifact) RiverUtils.getArtifact(
+                    uuid,
+                    context);
+            WKms wkms = staticWKms.getWKms(idx);
+            if (wkms == null)
+                logger.error("No WKms from artifact.");
+            return wkms;
+        }
+
+        WINFOArtifact flys = (WINFOArtifact) RiverUtils.getArtifact(
+            uuid,
+            context);
+
+        if (flys == null) {
+            logger.warn("One of the artifacts (1) for diff calculation could not be loaded");
+            return null;
+        }
+        else{
+            WQKms[] wqkms = (WQKms[]) flys.getWaterlevelData().
+                                              getData();
+            if (wqkms == null)
+            logger.warn("not  waterlevels in artifact");
+            else if (wqkms.length < idx)
+            logger.warn("not enough waterlevels in artifact");
+            return wqkms[idx];
+        }
+    }
+
+
+    /**
+     * This method transform a string into an int array. Therefore, the string
+     * <i>raw</i> must consist of int values separated by a <i>';'</i>.
+     *
+     * @param raw The raw integer array as string separated by a ';'.
+     *
+     * @return an array of int values.
+     */
+    public static int[] intArrayFromString(String raw) {
+        String[] splitted = raw != null ? raw.split(";") : null;
+
+        if (splitted == null || splitted.length == 0) {
+            logger.warn("No integer values found in '" + raw + "'");
+            return new int[0];
+        }
+
+        TIntArrayList integers = new TIntArrayList(splitted.length);
+
+        for (String value: splitted) {
+            try {
+                integers.add(Integer.parseInt(value));
+            }
+            catch (NumberFormatException nfe) {
+                logger.warn("Parsing integer failed: " + nfe);
+            }
+        }
+
+        return integers.toNativeArray();
+    }
+
+
+    /**
+     * This method transform a string into a long array. Therefore, the string
+     * <i>raw</i> must consist of int values separated by a <i>';'</i>.
+     *
+     * @param raw The raw long array as string separated by a ';'.
+     *
+     * @return an array of int values.
+     */
+    public static long[] longArrayFromString(String raw) {
+        String[] splitted = raw != null ? raw.split(";") : null;
+
+        if (splitted == null || splitted.length == 0) {
+            logger.warn("No long values found in '" + raw + "'");
+            return new long[0];
+        }
+
+        TLongArrayList longs = new TLongArrayList(splitted.length);
+
+        for (String value: splitted) {
+            try {
+                longs.add(Long.valueOf(value));
+            }
+            catch (NumberFormatException nfe) {
+                logger.warn("Parsing long failed: " + nfe);
+            }
+        }
+
+        return longs.toNativeArray();
+    }
+
+
+    /**
+     * This method transform a string into an double array. Therefore, the
+     * string <i>raw</i> must consist of double values separated by a
+     * <i>';'</i>.
+     *
+     * @param raw The raw double array as string separated by a ';'.
+     *
+     * @return an array of double values.
+     */
+    public static double[] doubleArrayFromString(String raw) {
+        String[] splitted = raw != null ? raw.split(";") : null;
+
+        if (splitted == null || splitted.length == 0) {
+            logger.warn("No double values found in '" + raw + "'");
+            return new double[0];
+        }
+
+        TDoubleArrayList doubles = new TDoubleArrayList(splitted.length);
+
+        for (String value: splitted) {
+            try {
+                doubles.add(Double.valueOf(value));
+            }
+            catch (NumberFormatException nfe) {
+                logger.warn("Parsing double failed: " + nfe);
+            }
+        }
+
+        return doubles.toNativeArray();
+    }
+
+
+    /**
+     * Returns the gauges that match the selected kilometer range.
+     *
+     * @param flys the flys artifact.
+     *
+     * @return the gauges based on the selected kilometer range (null if
+     *         none/no range set).
+     */
+    public static List<Gauge> getGauges(FLYSArtifact flys) {
+
+        River river = getRiver(flys);
+        if (river == null) {
+            logger.debug("getGauges: no river!");
+            return null;
+        }
+
+        RangeAccess rangeAccess = new RangeAccess(flys, null);
+        double[] dist = rangeAccess.getKmRange();
+        if (dist == null) {
+            logger.debug("getGauges: no dist!");
+            return null;
+        }
+        logger.debug("getGauges: " + dist[0] + " - " + dist[1]);
+
+        return river.determineGauges(dist[0], dist[1]);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r f2e46a668fe6 -r 73da40528cf2 artifacts/src/main/java/org/dive4elements/river/wsplgen/FacetCreator.java
--- a/artifacts/src/main/java/org/dive4elements/river/wsplgen/FacetCreator.java	Sun Apr 28 15:04:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/wsplgen/FacetCreator.java	Sun Apr 28 15:09:31 2013 +0200
@@ -25,7 +25,7 @@
 import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
 import org.dive4elements.river.model.CrossSectionTrack;
-import org.dive4elements.river.utils.FLYSUtils;
+import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.GeometryUtils;
 import org.dive4elements.river.utils.MapfileGenerator;
 
@@ -69,17 +69,17 @@
         this.stateId    = sId;
     }
 
-    // TODO We have FLYSUtils and will have RiverAccess to do this
+    // TODO We have RiverUtils and will have RiverAccess to do this
     protected String getRiver() {
         return artifact.getDataAsString("river");
     }
 
     protected String getUrl() {
-        return FLYSUtils.getUserWMSUrl(artifact.identifier());
+        return RiverUtils.getUserWMSUrl(artifact.identifier());
     }
 
     protected String getSrid() {
-        return FLYSUtils.getRiverSrid(artifact);
+        return RiverUtils.getRiverSrid(artifact);
     }
 
     protected Envelope getWSPLGENBounds() {


More information about the Dive4elements-commits mailing list