[PATCH 1 of 4] Use the CURRENT_KM constant from injectors

Wald Commits scm-commit at wald.intevation.org
Thu Oct 2 14:03:02 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1412251070 -7200
# Node ID a5bd0a5b8efda6b57091f9a9f9563bc4e38864eb
# Parent  3508d625092f350f6d76c23e889c552799914ce8
Use the CURRENT_KM constant from injectors.

diff -r 3508d625092f -r a5bd0a5b8efd artifacts/src/main/java/org/dive4elements/river/artifacts/model/QSectorFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/QSectorFacet.java	Thu Oct 02 09:42:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/QSectorFacet.java	Thu Oct 02 13:57:50 2014 +0200
@@ -18,6 +18,8 @@
 import org.dive4elements.artifactdatabase.state.DefaultFacet;
 import org.dive4elements.artifactdatabase.state.Facet;
 
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
+
 
 /**
  * Facet to access QSector that where added by user.
@@ -58,12 +60,12 @@
     public Object getData(Artifact artifact, CallContext context) {
         QSectorArtifact qsectorArtifact = (QSectorArtifact) artifact;
         if (qsectorArtifact == null || context == null ||
-            context.getContextValue("currentKm") == null) {
+            context.getContextValue(CURRENT_KM) == null) {
             log.error("No artifact, context or currentKm in QSectorFacet");
             return null;
         }
         double currentKm =
-            ((Double)context.getContextValue("currentKm")).doubleValue();
+            ((Double)context.getContextValue(CURRENT_KM)).doubleValue();
         return qsectorArtifact.getQSectors(currentKm, context);
     }
 
diff -r 3508d625092f -r a5bd0a5b8efd artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQFacet.java	Thu Oct 02 09:42:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQFacet.java	Thu Oct 02 13:57:50 2014 +0200
@@ -14,6 +14,7 @@
 import org.dive4elements.artifactdatabase.state.DefaultFacet;
 
 import org.dive4elements.river.artifacts.WQKmsInterpolArtifact;
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
 
 /**
  * Facet to show W|Q Values.
@@ -50,7 +51,7 @@
     public Object getData(Artifact artifact, CallContext context) {
         WQKmsInterpolArtifact interpolData =
             (WQKmsInterpolArtifact) artifact;
-        Double currentKm = (Double)context.getContextValue("currentKm");
+        Double currentKm = (Double)context.getContextValue(CURRENT_KM);
         return interpolData.getWQAtKm(currentKm);
     }
 
diff -r 3508d625092f -r a5bd0a5b8efd artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsFacet.java	Thu Oct 02 09:42:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsFacet.java	Thu Oct 02 13:57:50 2014 +0200
@@ -12,6 +12,7 @@
 import org.dive4elements.river.artifacts.model.DataFacet;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
 
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
 /**
  * Facet to access the current Km from the context safely
  *
@@ -20,7 +21,6 @@
 public class FixingsFacet extends DataFacet {
 
     public static final Double INVALID_KM = Double.valueOf(-1d);
-    public static final String CURRENT_KM = "currentKm";
 
     public FixingsFacet() {
     }


More information about the Dive4Elements-commits mailing list