# HG changeset patch # User Felix Wolfsteller # Date 1358785568 -3600 # Node ID a3dc382bc1caa1a271bfa0372dba997e18a58b46 # Parent f8217f1fef2eca1f2d9236e9db54e2f670b3dbd6 BedHeightAccess, FlowVelocityAccess, SedimentLoadAccess: Inherit from RangeAccess. Update callers. diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedHeightAccess.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedHeightAccess.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedHeightAccess.java Mon Jan 21 17:26:08 2013 +0100 @@ -2,6 +2,8 @@ import java.util.List; +import de.intevation.artifacts.CallContext; + import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.model.minfo.BedHeight; import de.intevation.flys.artifacts.model.minfo.BedHeightFactory; @@ -14,38 +16,31 @@ import org.apache.log4j.Logger; -public class BedHeightAccess extends Access { +public class BedHeightAccess +extends RangeAccess +{ private static final Logger logger = Logger.getLogger(BedHeightAccess.class); private int[] singleIDs; private int[] epochIDs; - private Double lowerKM; - private Double upperKM; - private String time; - public BedHeightAccess(FLYSArtifact artifact) { - super(artifact); + public BedHeightAccess(FLYSArtifact artifact, CallContext context) { + super(artifact, context); } public Double getLowerKM() { - if (lowerKM == null) { - lowerKM = getDouble("ld_from"); - } - - return lowerKM; + // TODO update callers + return getFrom(); } public Double getUpperKM() { - if (upperKM == null) { - upperKM = getDouble("ld_to"); - } - - return upperKM; + // TODO update callers + return getTo(); } diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java Mon Jan 21 17:26:08 2013 +0100 @@ -1,20 +1,20 @@ package de.intevation.flys.artifacts.access; +import de.intevation.artifacts.CallContext; + import de.intevation.flys.artifacts.FLYSArtifact; /** Access to data that deals with flow velocity stuff. */ -public class FlowVelocityAccess extends RiverAccess { +public class FlowVelocityAccess +extends RangeAccess +{ private int[] mainChannels; private int[] totalChannels; - private Double lowerKM; - private Double upperKM; - - - public FlowVelocityAccess(FLYSArtifact artifact) { - super(artifact); + public FlowVelocityAccess(FLYSArtifact artifact, CallContext context) { + super(artifact, context); } @@ -37,20 +37,14 @@ public Double getLowerKM() { - if (lowerKM == null) { - lowerKM = getDouble("ld_from"); - } - - return lowerKM; + // TODO update callers to getFrom + return getFrom(); } public Double getUpperKM() { - if (upperKM == null) { - upperKM = getDouble("ld_to"); - } - - return upperKM; + // TODO update callers to getTo + return getTo(); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SedimentLoadAccess.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SedimentLoadAccess.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SedimentLoadAccess.java Mon Jan 21 17:26:08 2013 +0100 @@ -4,41 +4,34 @@ import org.apache.log4j.Logger; +import de.intevation.artifacts.CallContext; + import de.intevation.flys.artifacts.FLYSArtifact; public class SedimentLoadAccess -extends RiverAccess +extends RangeAccess { private static final Logger logger = Logger.getLogger(BedHeightAccess.class); private int[] singleIDs; private int[] epochIDs; - private Double lowerKM; - private Double upperKM; - private String time; private String unit; - public SedimentLoadAccess(FLYSArtifact artifact) { - super(artifact); + public SedimentLoadAccess(FLYSArtifact artifact, CallContext context) { + super(artifact, context); } public Double getLowerKM() { - if (lowerKM == null) { - lowerKM = getDouble("ld_from"); - } - - return lowerKM; + // TODO update callers + return getFrom(); } public Double getUpperKM() { - if (upperKM == null) { - upperKM = getDouble("ld_to"); - } - - return upperKM; + // TODO update callers + return getTo(); } public String getYearEpoch() { diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFacet.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFacet.java Mon Jan 21 17:26:08 2013 +0100 @@ -30,7 +30,7 @@ */ @Override public Object getData(Artifact artifact, CallContext context) { - BedHeightAccess access = new BedHeightAccess((FLYSArtifact)artifact); + BedHeightAccess access = new BedHeightAccess((FLYSArtifact)artifact, context); if (type.equals("singlevalues")) { return access.getSingleValues(); } diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java Mon Jan 21 17:26:08 2013 +0100 @@ -62,7 +62,7 @@ List newFacets = new ArrayList(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact); + FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MiddleBedHeight.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MiddleBedHeight.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MiddleBedHeight.java Mon Jan 21 17:26:08 2013 +0100 @@ -38,7 +38,7 @@ List newFacets = new ArrayList(); - BedHeightAccess access = new BedHeightAccess(artifact); + BedHeightAccess access = new BedHeightAccess(artifact, context); CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferenceSelect.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferenceSelect.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferenceSelect.java Mon Jan 21 17:26:08 2013 +0100 @@ -55,7 +55,7 @@ CallContext context) { Element[] elements = new Element[1]; - BedHeightAccess bha = new BedHeightAccess((FLYSArtifact)artifact); + BedHeightAccess bha = new BedHeightAccess((FLYSArtifact)artifact, context); String time = bha.getYearEpoch(); elements[0] = createItem( ec, diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java Mon Jan 21 17:26:08 2013 +0100 @@ -47,7 +47,7 @@ List newFacets = new ArrayList(); - SedimentLoadAccess access = new SedimentLoadAccess(artifact); + SedimentLoadAccess access = new SedimentLoadAccess(artifact, context); CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old : new SedimentLoadCalculation().calculate(access); diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Mon Jan 21 17:26:08 2013 +0100 @@ -219,13 +219,13 @@ } else if (getXBounds(0) == null && getDomainAxisRange() == null) { FLYSArtifact artifact = (FLYSArtifact)artifactAndFacet.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact); + FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); context.putContextValue("startkm", access.getLowerKM()); context.putContextValue("endkm", access.getUpperKM()); } else if (getXBounds(0) == null && getDomainAxisRange() != null){ FLYSArtifact artifact = (FLYSArtifact)artifactAndFacet.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact); + FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM()); Bounds bounds = calculateZoom(b, getDomainAxisRange()); diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java Mon Jan 21 17:26:08 2013 +0100 @@ -98,13 +98,13 @@ } else if (getXBounds(0) == null && getDomainAxisRange() == null) { FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact); + FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); context.putContextValue("startkm", access.getLowerKM()); context.putContextValue("endkm", access.getUpperKM()); } else if (getXBounds(0) == null && getDomainAxisRange() != null){ FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact); + FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM()); Bounds bounds = calculateZoom(b, getDomainAxisRange()); diff -r f8217f1fef2e -r a3dc382bc1ca flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java Mon Jan 21 17:11:10 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java Mon Jan 21 17:26:08 2013 +0100 @@ -166,7 +166,7 @@ protected String getDefaultYAxisLabel(int pos) { String label = "default"; if (pos == YAXIS.L.idx) { - SedimentLoadAccess access = new SedimentLoadAccess(artifact); + SedimentLoadAccess access = new SedimentLoadAccess(artifact, context); if (access.getUnit().equals("m3_per_a")) { label = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2); }