Mercurial > dive4elements > river
changeset 8369:a5bd0a5b8efd
Use the CURRENT_KM constant from injectors.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 02 Oct 2014 13:57:50 +0200 |
parents | 3508d625092f |
children | e1ff1263d79a |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/QSectorFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsFacet.java |
diffstat | 3 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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); }
--- 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); }
--- 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() { }