changeset 3768:00aafe1fedd7

Added getter for characteristic diameter in bed quality access. flys-artifacts/trunk@5473 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 14 Sep 2012 14:14:46 +0000 (2012-09-14)
parents b4ad8dafe584
children 728ecd2afa20
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java
diffstat 2 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 14 13:53:16 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 14 14:14:46 2012 +0000
@@ -1,3 +1,8 @@
+2012-09-14  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java:
+	  Getter for characteristic diameter.
+
 2012-09-14  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java	Fri Sep 14 13:53:16 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java	Fri Sep 14 14:14:46 2012 +0000
@@ -4,15 +4,22 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.log4j.Logger;
+
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.model.DateRange;
 
 
 public class BedQualityAccess extends Access {
 
+    private static final Logger logger = Logger
+        .getLogger(BedQualityAccess.class);
+
     private Double from;
     private Double to;
     private String river;
+    private List<String> bedDiameter;
+    private List<String> bedloadDiameter;
     private List<DateRange> ranges;
 
     public BedQualityAccess(FLYSArtifact artifact) {
@@ -47,6 +54,20 @@
         return ranges;
     }
 
+    public List<String> getBedDiameter() {
+        if (bedDiameter == null) {
+            bedDiameter = extractDiameter(getString("bed_diameter"));
+        }
+        return bedDiameter;
+    }
+
+    public List<String> getBedloadDiameter() {
+        if (bedloadDiameter == null) {
+            bedloadDiameter = extractDiameter(getString("load_diameter"));
+        }
+        return bedloadDiameter;
+    }
+
     private List<DateRange> extractRanges(String dateString) {
         List<DateRange> list = new LinkedList<DateRange>();
         String[] dates = dateString.split(";");
@@ -66,5 +87,17 @@
         }
         return list;
     }
+
+    private List<String> extractDiameter(String value) {
+        List<String> result = new LinkedList<String>();
+        String[] diameter = value.split(";");
+        for (String v : diameter) {
+            logger.debug("diameter: " + v);
+            String[] parts = v.split("\\.");
+            result.add(parts[parts.length - 1]);
+            logger.debug(parts[parts.length-1]);
+        }
+        return result;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
\ No newline at end of file

http://dive4elements.wald.intevation.org