changeset 4866:acfd48384835

Changed data field names in fix analsis to ld_from, ld_to, ld step. * Changed names in state model. * Changed data fields in artifact. * Use RangeAccess to get location/distance data.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 25 Jan 2013 11:53:04 +0100
parents 1358d0c8481c
children c4973fa23674
files flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAccess.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAnalysisAccess.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixRealizingAccess.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisPeriodsFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDerivateFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDeviationFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixWQCurveFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/LocationSelect.java flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATExport.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java flys-client/src/main/java/de/intevation/flys/client/shared/model/FixAnalysisArtifact.java
diffstat 21 files changed, 49 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Fri Jan 25 11:53:04 2013 +0100
@@ -27,9 +27,9 @@
         <state id="state.fix.location" description="state.fix.location"
             helpText="help.state.fix.location"
             state="de.intevation.flys.artifacts.states.fixation.LocationSelect">
-            <data name="from" type="Double"/>
-            <data name="to" type="Double"/>
-            <data name="step" type="Double"/>
+            <data name="ld_from" type="Double"/>
+            <data name="ld_to" type="Double"/>
+            <data name="ld_step" type="Double"/>
         </state>
 
         <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAccess.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAccess.java	Fri Jan 25 11:53:04 2013 +0100
@@ -1,5 +1,6 @@
 package de.intevation.flys.artifacts.access;
 
+import de.intevation.artifacts.CallContext;
 import de.intevation.flys.artifacts.FLYSArtifact;
 
 import java.util.Arrays;
@@ -7,14 +8,10 @@
 import org.apache.log4j.Logger;
 
 public class FixAccess
-extends      RiverAccess
+extends      RangeAccess
 {
     private static Logger log = Logger.getLogger(FixAccess.class);
 
-    protected Double from;
-    protected Double to;
-    protected Double step;
-
     protected Long start;
     protected Long end;
 
@@ -27,50 +24,8 @@
 
     protected String  function;
 
-    public FixAccess() {
-    }
-
-    public FixAccess(FLYSArtifact artifact) {
-        super(artifact);
-    }
-
-    public Double getFrom() {
-
-        if (from == null) {
-            from = getDouble("from");
-        }
-
-        if (log.isDebugEnabled()) {
-            log.debug("from: '" + from + "'");
-        }
-
-        return from;
-    }
-
-    public Double getTo() {
-
-        if (to == null) {
-            to = getDouble("to");
-        }
-
-        if (log.isDebugEnabled()) {
-            log.debug("to: '" + to + "'");
-        }
-
-        return to;
-    }
-
-    public Double getStep() {
-
-        if (step == null) {
-            step = getDouble("step");
-        }
-
-        if (log.isDebugEnabled()) {
-            log.debug("step: '" + step + "'");
-        }
-
-        return step;
+    public FixAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact, context);
     }
 
     public Long getStart() {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAnalysisAccess.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAnalysisAccess.java	Fri Jan 25 11:53:04 2013 +0100
@@ -1,6 +1,7 @@
 package de.intevation.flys.artifacts.access;
 
 import de.intevation.artifactdatabase.data.StateData;
+import de.intevation.artifacts.CallContext;
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 
@@ -21,11 +22,8 @@
 
     protected double [] qs;
 
-    public FixAnalysisAccess() {
-    }
-
-    public FixAnalysisAccess(FLYSArtifact artifact) {
-        super(artifact);
+    public FixAnalysisAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact, context);
     }
 
     public DateRange getReferencePeriod() {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixRealizingAccess.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixRealizingAccess.java	Fri Jan 25 11:53:04 2013 +0100
@@ -1,5 +1,6 @@
 package de.intevation.flys.artifacts.access;
 
+import de.intevation.artifacts.CallContext;
 import de.intevation.flys.artifacts.FLYSArtifact;
 
 import de.intevation.flys.artifacts.model.Segment;
@@ -17,11 +18,8 @@
 
     protected List<Segment> segments;
 
-    public FixRealizingAccess() {
-    }
-
-    public FixRealizingAccess(FLYSArtifact artifact) {
-        super(artifact);
+    public FixRealizingAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact, context);
     }
 
     public Boolean isQ() {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisPeriodsFacet.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisPeriodsFacet.java	Fri Jan 25 11:53:04 2013 +0100
@@ -61,7 +61,7 @@
 
         if (artifact instanceof FLYSArtifact) {
             FLYSArtifact flys = (FLYSArtifact)artifact;
-            FixAnalysisAccess access = new FixAnalysisAccess(flys);
+            FixAnalysisAccess access = new FixAnalysisAccess(flys, context);
 
             CalculationResult res =
                 (CalculationResult) flys.compute(context,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java	Fri Jan 25 11:53:04 2013 +0100
@@ -61,7 +61,7 @@
 
         if (artifact instanceof FLYSArtifact) {
             FLYSArtifact flys = (FLYSArtifact)artifact;
-            FixAnalysisAccess access = new FixAnalysisAccess(flys);
+            FixAnalysisAccess access = new FixAnalysisAccess(flys, context);
 
             CalculationResult res =
                 (CalculationResult) flys.compute(context,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDerivateFacet.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDerivateFacet.java	Fri Jan 25 11:53:04 2013 +0100
@@ -67,7 +67,7 @@
         }
 
         FLYSArtifact flys = (FLYSArtifact)artifact;
-        FixAnalysisAccess access = new FixAnalysisAccess(flys);
+        FixAnalysisAccess access = new FixAnalysisAccess(flys, context);
 
         CalculationResult res =
             (CalculationResult) flys.compute(context,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDeviationFacet.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDeviationFacet.java	Fri Jan 25 11:53:04 2013 +0100
@@ -59,7 +59,7 @@
         logger.debug("FixDeviationFacet.getData");
         if (artifact instanceof FLYSArtifact) {
             FLYSArtifact flys = (FLYSArtifact)artifact;
-            FixAnalysisAccess access = new FixAnalysisAccess(flys);
+            FixAnalysisAccess access = new FixAnalysisAccess(flys, context);
 
             CalculationResult res =
                 (CalculationResult) flys.compute(context,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java	Fri Jan 25 11:53:04 2013 +0100
@@ -64,7 +64,7 @@
 
         if (artifact instanceof FLYSArtifact) {
             FLYSArtifact flys = (FLYSArtifact)artifact;
-            FixAnalysisAccess access = new FixAnalysisAccess(flys);
+            FixAnalysisAccess access = new FixAnalysisAccess(flys, context);
 
             CalculationResult res =
                 (CalculationResult) flys.compute(context,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java	Fri Jan 25 11:53:04 2013 +0100
@@ -64,7 +64,7 @@
 
         if (artifact instanceof FLYSArtifact) {
             FLYSArtifact flys = (FLYSArtifact)artifact;
-            FixAnalysisAccess access = new FixAnalysisAccess(flys);
+            FixAnalysisAccess access = new FixAnalysisAccess(flys, context);
 
             CalculationResult res =
                 (CalculationResult) flys.compute(context,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixWQCurveFacet.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixWQCurveFacet.java	Fri Jan 25 11:53:04 2013 +0100
@@ -61,7 +61,7 @@
         logger.debug("getData");
         if (artifact instanceof FLYSArtifact) {
             FLYSArtifact flys = (FLYSArtifact)artifact;
-            FixAnalysisAccess access = new FixAnalysisAccess(flys);
+            FixAnalysisAccess access = new FixAnalysisAccess(flys, context);
 
             CalculationResult res =
                 (CalculationResult) flys.compute(context,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java	Fri Jan 25 11:53:04 2013 +0100
@@ -124,7 +124,7 @@
         CalculationResult res;
 
         FixAnalysisAccess access =
-            new FixAnalysisAccess(artifact);
+            new FixAnalysisAccess(artifact, context);
 
         if (old instanceof CalculationResult) {
             res = (CalculationResult)old;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java	Fri Jan 25 11:53:04 2013 +0100
@@ -59,7 +59,7 @@
         CalculationResult res;
 
         FixRealizingAccess access =
-            new FixRealizingAccess(artifact);
+            new FixRealizingAccess(artifact, context);
 
         if (old instanceof CalculationResult) {
             res = (CalculationResult)old;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/LocationSelect.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/LocationSelect.java	Fri Jan 25 11:53:04 2013 +0100
@@ -18,6 +18,13 @@
     /** The logger used in this class. */
     private static Logger logger = Logger.getLogger(LocationSelect.class);
 
+    private static final String LOWER = "ld_from";
+
+    private static final String UPPER = "ld_to";
+
+    private static final String STEP = "ld_step";
+
+
     /**
      * The default constructor that initializes an empty State object.
      */
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java	Fri Jan 25 11:53:04 2013 +0100
@@ -151,7 +151,7 @@
 
     @Override
     protected String getDefaultChartSubtitle() {
-        FixAnalysisAccess access = new FixAnalysisAccess(artifact);
+        FixAnalysisAccess access = new FixAnalysisAccess(artifact, context);
         DateRange dateRange = access.getDateRange();
         DateRange refRange  = access.getReferencePeriod();
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATExport.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATExport.java	Fri Jan 25 11:53:04 2013 +0100
@@ -56,7 +56,7 @@
             logger.debug("No CalculationResult found for AT export.");
             return;
         }
-        FixAccess access = new FixAccess((FLYSArtifact)this.master);
+        FixAccess access = new FixAccess((FLYSArtifact)this.master, context);
         String f = access.getFunction();
         if (f == null || f.length() == 0) {
             logger.debug("No function found for AT export.");
@@ -74,11 +74,12 @@
 
         Writer writer = new OutputStreamWriter(out, DEFAULT_CSV_CHARSET);
 
+        FixAccess access = new FixAccess((FLYSArtifact)this.master, context);
         FixATWriter atWriter = new FixATWriter(this.function, this.parameters);
         NodeList nodes = request.getElementsByTagName("km");
         String km = nodes.item(0).getTextContent();
         double dkm = Double.parseDouble(km);
-        String river = FLYSUtils.getRivername((FLYSArtifact)master);
+        String river = access.getRiver();
         atWriter.write(writer, context.getMeta(), river, dkm);
         writer.close();
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Fri Jan 25 11:53:04 2013 +0100
@@ -110,7 +110,7 @@
 
     @Override
     protected String getDefaultChartSubtitle() {
-        FixAnalysisAccess access = new FixAnalysisAccess(artifact);
+        FixAnalysisAccess access = new FixAnalysisAccess(artifact, context);
         DateRange dateRange = access.getDateRange();
         DateRange refRange  = access.getReferencePeriod();
         return Resources.format(
@@ -226,7 +226,7 @@
         logger.debug("doReferencePeriodsOut()");
 
         if (visible) {
-            FixAnalysisAccess access = new FixAnalysisAccess(artifact);
+            FixAnalysisAccess access = new FixAnalysisAccess(artifact, context);
             DateRange refRange  = access.getReferencePeriod();
 
             RegularTimePeriod start = new Day(refRange.getFrom());
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Fri Jan 25 11:53:04 2013 +0100
@@ -505,7 +505,7 @@
 
     @Override
     protected String getDefaultChartSubtitle() {
-        FixAnalysisAccess access = new FixAnalysisAccess(artifact);
+        FixAnalysisAccess access = new FixAnalysisAccess(artifact, context);
         DateRange dateRange = access.getDateRange();
         DateRange refRange  = access.getReferencePeriod();
 
@@ -537,7 +537,7 @@
         StringBuilder buf = new StringBuilder();
 
         // Add analysis periods as additional subtitle
-        FixAnalysisAccess access = new FixAnalysisAccess(artifact);
+        FixAnalysisAccess access = new FixAnalysisAccess(artifact, context);
         DateRange[] aperiods = access.getAnalysisPeriods();
         buf.append(msg("fix.analysis.periods"));
         buf.append(": ");
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java	Fri Jan 25 11:53:04 2013 +0100
@@ -91,7 +91,7 @@
         if (art instanceof FixAnalysisArtifact) {
             FixAnalysisArtifact fix = (FixAnalysisArtifact) art;
             FixFilter fixFilter = fix.getFilter();
-            String s = fix.getArtifactDescription().getDataValueAsString("step");
+            String s = fix.getArtifactDescription().getDataValueAsString("ld_step");
             try {
                 double ds = Double.parseDouble(s);
                 collectionView.setSteps(ds);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java	Fri Jan 25 11:53:04 2013 +0100
@@ -78,9 +78,9 @@
     public Canvas createOld(DataList dataList) {
         List<Data> items = dataList.getAll();
 
-        Data       f      = getData(items, "from");
-        Data       t      = getData(items, "to");
-        Data       s      = getData(items, "step");
+        Data       f      = getData(items, "ld_from");
+        Data       t      = getData(items, "ld_to");
+        Data       s      = getData(items, "ld_step");
         DataItem[] fItems = f.getItems();
         DataItem[] tItems = t.getItems();
         DataItem[] sItems = s.getItems();
@@ -125,12 +125,12 @@
             String f = Double.valueOf(this.from).toString();
             String t = Double.valueOf(this.to).toString();
             String s = Double.valueOf(this.step).toString();
-            DataItem fi = new DefaultDataItem("from", "from", f);
-            DataItem ti = new DefaultDataItem("to", "to", t);
-            DataItem si = new DefaultDataItem("step", "step", s);
-            data.add(new DefaultData("from", null, null, new DataItem[]{ fi }));
-            data.add(new DefaultData("to", null, null, new DataItem[]{ ti }));
-            data.add(new DefaultData("step", null, null, new DataItem[]{ si }));
+            DataItem fi = new DefaultDataItem("ld_from", "ld_from", f);
+            DataItem ti = new DefaultDataItem("ld_to", "ld_to", t);
+            DataItem si = new DefaultDataItem("ld_step", "ld_step", s);
+            data.add(new DefaultData("ld_from", null, null, new DataItem[]{ fi }));
+            data.add(new DefaultData("ld_to", null, null, new DataItem[]{ ti }));
+            data.add(new DefaultData("ld_step", null, null, new DataItem[]{ si }));
         }
         // what else?
         return data.toArray(new Data[data.size()]);
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/FixAnalysisArtifact.java	Thu Jan 24 16:09:46 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/FixAnalysisArtifact.java	Fri Jan 25 11:53:04 2013 +0100
@@ -60,7 +60,7 @@
             this.filter.setRiver(river);
         }
 
-        String from = artifactDescription.getDataValueAsString("from");
+        String from = artifactDescription.getDataValueAsString("ld_from");
         if (from != null) {
             try {
                 double fkm = Double.parseDouble(from);
@@ -71,7 +71,7 @@
             }
         }
 
-        String to = artifactDescription.getDataValueAsString("to");
+        String to = artifactDescription.getDataValueAsString("ld_to");
         if (to != null) {
             try {
                 double tkm = Double.parseDouble(to);

http://dive4elements.wald.intevation.org