changeset 3207:babb0798d548

Removed dead code. flys-artifacts/trunk@4826 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 28 Jun 2012 14:50:14 +0000
parents e11dbf8baf69
children 90c4ce100ce1
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixationArtifactAccess.java
diffstat 1 files changed, 18 insertions(+), 169 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixationArtifactAccess.java	Thu Jun 28 14:20:31 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixationArtifactAccess.java	Thu Jun 28 14:50:14 2012 +0000
@@ -17,11 +17,10 @@
 import org.apache.log4j.Logger;
 
 public class FixationArtifactAccess
+extends      Access
 {
     private static Logger log = Logger.getLogger(FixationArtifactAccess.class);
 
-    protected FLYSArtifact artifact;
-
     protected String river;
 
     protected String calculationMode;
@@ -51,21 +50,12 @@
     }
 
     public FixationArtifactAccess(FLYSArtifact artifact) {
-        this.artifact = artifact;
-    }
-
-    public FLYSArtifact getArtifact() {
-        return artifact;
+        super(artifact);
     }
 
     public String getRiver() {
         if (river == null) {
-            StateData sd = artifact.getData("river");
-            if (sd == null) {
-                log.warn("missing 'river' value");
-                return null;
-            }
-            river = (String)sd.getValue();
+            river = getString("river");
         }
         if (log.isDebugEnabled()) {
             log.debug("river: '" + river + "'");
@@ -75,12 +65,7 @@
 
     public String getCalculationMode() {
         if (calculationMode == null) {
-            StateData sd = artifact.getData("calculation.mode");
-            if (sd == null) {
-                log.warn("missing 'calculation.mode' value");
-                return null;
-            }
-            calculationMode = (String)sd.getValue();
+            calculationMode = getString("calculation.mode");
         }
 
         if (log.isDebugEnabled()) {
@@ -92,17 +77,7 @@
     public Double getFrom() {
 
         if (from == null) {
-            StateData sd = artifact.getData("from");
-            if (sd == null) {
-                log.warn("missing 'from' value");
-                return null;
-            }
-            try {
-                from = Double.valueOf((String)sd.getValue());
-            }
-            catch (NumberFormatException nfe) {
-                log.warn("from '" + sd.getValue() + "' is not numeric.");
-            }
+            from = getDouble("from");
         }
 
         if (log.isDebugEnabled()) {
@@ -115,17 +90,7 @@
     public Double getTo() {
 
         if (to == null) {
-            StateData sd = artifact.getData("to");
-            if (sd == null) {
-                log.warn("missing 'to' value");
-                return null;
-            }
-            try {
-                to = Double.valueOf((String)sd.getValue());
-            }
-            catch (NumberFormatException nfe) {
-                log.warn("to '" + sd.getValue() + "' is not numeric.");
-            }
+            to = getDouble("to");
         }
 
         if (log.isDebugEnabled()) {
@@ -138,17 +103,7 @@
     public Double getStep() {
 
         if (step == null) {
-            StateData sd = artifact.getData("step");
-            if (sd == null) {
-                log.warn("missing 'step' value");
-                return null;
-            }
-            try {
-                step = Double.valueOf((String)sd.getValue());
-            }
-            catch (NumberFormatException nfe) {
-                log.warn("step '" + sd.getValue() + "' is not numeric.");
-            }
+            step = getDouble("step");
         }
 
         if (log.isDebugEnabled()) {
@@ -161,17 +116,7 @@
     public Long getStart() {
 
         if (start == null) {
-            StateData sd = artifact.getData("start");
-            if (sd == null) {
-                log.warn("missing 'start' value");
-                return null;
-            }
-            try {
-                start = Long.valueOf((String)sd.getValue());
-            }
-            catch (NumberFormatException nfe) {
-                log.warn("start '" + sd.getValue() + "' is not an integer.");
-            }
+            start = getLong("start");
         }
 
         if (log.isDebugEnabled()) {
@@ -184,17 +129,7 @@
     public Long getEnd() {
 
         if (end == null) {
-            StateData sd = artifact.getData("end");
-            if (sd == null) {
-                log.warn("missing 'end' value");
-                return null;
-            }
-            try {
-                end = Long.valueOf((String)sd.getValue());
-            }
-            catch (NumberFormatException nfe) {
-                log.warn("end '" + sd.getValue() + "' is not an integer.");
-            }
+            end = getLong("end");
         }
 
         if (log.isDebugEnabled()) {
@@ -207,17 +142,7 @@
     public Integer getQSectorStart() {
 
         if (qSectorStart == null) {
-            StateData sd = artifact.getData("q1");
-            if (sd == null) {
-                log.warn("missing 'q1' value");
-                return null;
-            }
-            try {
-                qSectorStart = Integer.valueOf((String)sd.getValue());
-            }
-            catch (NumberFormatException nfe) {
-                log.warn("q1 '" + sd.getValue() + "' is not an integer.");
-            }
+            qSectorStart = getInteger("q1");
         }
 
         return qSectorStart;
@@ -226,17 +151,7 @@
     public Integer getQSectorEnd() {
 
         if (qSectorEnd == null) {
-            StateData sd = artifact.getData("q2");
-            if (sd == null) {
-                log.warn("missing 'q2' value");
-                return null;
-            }
-            try {
-                qSectorEnd = Integer.valueOf((String)sd.getValue());
-            }
-            catch (NumberFormatException nfe) {
-                log.warn("q2 '" + sd.getValue() + "' is not an integer.");
-            }
+            qSectorEnd = getInteger("q2");
         }
 
         return qSectorEnd;
@@ -244,12 +159,7 @@
 
     public int [] getEvents() {
         if (events == null) {
-            StateData sd = artifact.getData("events");
-            if (sd == null) {
-                log.warn("missing 'events' value");
-                return null;
-            }
-            events = FLYSUtils.intArrayFromString((String)sd.getValue());
+            events = getIntArray("events");
         }
         return events;
     }
@@ -284,44 +194,7 @@
 
     public DateRange [] getAnalysisPeriods() {
         if (analysisPeriods == null) {
-            StateData sd = artifact.getData("ana_data");
-
-            if (sd == null) {
-                log.warn("missing 'ana_data'");
-                return null;
-            }
-
-            String data = (String)sd.getValue();
-            String[] pairs = data.split("\\s*;\\s*");
-
-            ArrayList<DateRange> aPs = new ArrayList<DateRange>(pairs.length);
-
-            for (int i = 0; i < pairs.length; i++) {
-                String[] fromTo = pairs[i].split("\\s*,\\s*");
-                if (fromTo.length >= 2) {
-                    try {
-                        Date from = new Date(Long.parseLong(fromTo[0]));
-                        Date to   = new Date(Long.parseLong(fromTo[1]));
-                        DateRange aP = new DateRange(from, to);
-                        if (!aPs.contains(aP)) {
-                            aPs.add(aP);
-                        }
-                    }
-                    catch (NumberFormatException nfe) {
-                        log.warn("ana_data contains no long values.", nfe);
-                    }
-                }
-            }
-
-            analysisPeriods = aPs.toArray(new DateRange[aPs.size()]);
-        }
-
-        if (log.isDebugEnabled()) {
-            for (int i = 0; i < analysisPeriods.length; ++i) {
-                DateRange ap = analysisPeriods[i];
-                log.debug("analysis period " +
-                    ap.getFrom() + " - " + ap.getTo());
-            }
+            analysisPeriods = getDateRange("ana_date");
         }
 
         return analysisPeriods;
@@ -329,24 +202,14 @@
 
     public Boolean getPreprocessing() {
         if (preprocessing == null) {
-            StateData sd = artifact.getData("preprocessing");
-            if (sd == null) {
-                log.warn("missing 'preprocessing'");
-                return null;
-            }
-            preprocessing = Boolean.valueOf((String)sd.getValue());
+            preprocessing = getBoolean("preprocessing");
         }
         return preprocessing;
     }
 
     public String getFunction() {
         if (function == null) {
-            StateData sd = artifact.getData("function");
-            if (sd == null) {
-                log.warn("missing 'function'");
-                return null;
-            }
-            function = (String)sd.getValue();
+            function = getString("function");
         }
         if (log.isDebugEnabled()) {
             log.debug("function: " + function);
@@ -356,24 +219,10 @@
 
     public double [] getQs() {
         if (qs == null) {
-            StateData sd = artifact.getData("qs");
-            if (sd == null) {
-                log.warn("missing 'qs'");
-                return null;
-            }
-            String [] parts = ((String)sd.getValue()).split("[\\s;]");
-            TDoubleArrayList list = new TDoubleArrayList(parts.length);
-            for (String part: parts) {
-                try {
-                    list.add(Double.parseDouble(part));
-                }
-                catch (NumberFormatException nfe) {
-                    log.warn("'" + part + "' is not numeric.");
-                }
-            }
-            qs = list.toNativeArray();
+            qs = getDoubleArray("qs");
         }
-        if (log.isDebugEnabled()) {
+
+        if (log.isDebugEnabled() && qs != null) {
             log.debug("qs: " + Arrays.toString(qs));
         }
         return qs;

http://dive4elements.wald.intevation.org