[Dive4elements-commits] [PATCH] Changed data field names in fix analsis to ld_from, ld_to, ld step

Wald Commits scm-commit at wald.intevation.org
Fri Jan 25 11:54:03 CET 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1359111184 -3600
# Node ID acfd48384835fe1e7bcf285af1d70ddc8d648dc6
# Parent  1358d0c8481c9174c1043c728daafc5aba0bd8e7
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.

diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/doc/conf/artifacts/fixanalysis.xml
--- 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">
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAccess.java
--- 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() {
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAnalysisAccess.java
--- 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() {
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixRealizingAccess.java
--- 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() {
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisPeriodsFacet.java
--- 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,
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java
--- 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,
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDerivateFacet.java
--- 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,
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDeviationFacet.java
--- 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,
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java
--- 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,
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java
--- 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,
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixWQCurveFacet.java
--- 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,
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java
--- 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;
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java
--- 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;
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/LocationSelect.java
--- 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.
      */
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java
--- 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();
 
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATExport.java
--- 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();
     }
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java
--- 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());
diff -r 1358d0c8481c -r acfd48384835 flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java
--- 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(": ");
diff -r 1358d0c8481c -r acfd48384835 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java
--- 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);
diff -r 1358d0c8481c -r acfd48384835 flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java
--- 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()]);
diff -r 1358d0c8481c -r acfd48384835 flys-client/src/main/java/de/intevation/flys/client/shared/model/FixAnalysisArtifact.java
--- 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);


More information about the Dive4elements-commits mailing list