diff artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedHeightAccess.java @ 7357:9d3e44ab25f2

Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now. Idea is that Artifact and Access are lightweight. Access access the 'data' ('parameterization') attached to artifact, not the data delivered by means of artifact and its parameterization.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 16 Oct 2013 10:42:45 +0200
parents 534850c9fabc
children 793dfb2f4b7b
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedHeightAccess.java	Wed Oct 16 10:33:09 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedHeightAccess.java	Wed Oct 16 10:42:45 2013 +0200
@@ -11,11 +11,7 @@
 import java.util.List;
 
 import org.dive4elements.river.artifacts.D4EArtifact;
-import org.dive4elements.river.artifacts.model.minfo.BedHeight;
-import org.dive4elements.river.artifacts.model.minfo.BedHeightFactory;
 import org.dive4elements.river.artifacts.states.SoundingsSelect;
-import org.dive4elements.river.model.BedHeightSingle;
-import org.dive4elements.river.model.BedHeightSingleValue;
 
 import gnu.trove.TIntArrayList;
 
@@ -33,8 +29,12 @@
 
     private String yearEpoch;
 
+    private String type;
+
     private Integer heightId;
 
+    private Integer time;
+
     public BedHeightAccess(D4EArtifact artifact) {
         super(artifact);
     }
@@ -91,11 +91,11 @@
     }
 
 
-    public String getYearEpoch() {
-        if (yearEpoch == null) {
-            yearEpoch =  getString("ye_select");
+    public String getType() {
+        if (type == null) {
+            type = getString("type");
         }
-        return yearEpoch;
+        return type;
     }
 
     public String getYearEpoch() {
@@ -138,30 +138,18 @@
         return epochIDs;
     }
 
-    /**
-     * Return the {@link BedHeight} at the height_id and time of the artifact
-     * @return {@link BedHeight}
-     */
-    public BedHeight getHeight() {
-        logger.debug("getHeight");
-        return BedHeightFactory.getHeight(
-            artifact.getDataAsString("type"),
-            Integer.parseInt(artifact.getDataAsString("height_id")),
-            Integer.parseInt(artifact.getDataAsString("time")));
+    public Integer getHeightId() {
+        if (heightId == null) {
+            heightId = getInteger("height_id");
+        }
+        return heightId;
     }
 
-    /**
-     * Return a {@link List} of {@link BedHeightSingleValue}s
-     * at the range of the artifact
-     * @return List of {@link BedHeightSingleValue}s
-     */
-    public List<BedHeightSingleValue> getSingleValues() {
-        logger.debug("getSingleValues");
-        BedHeightSingle single = BedHeightSingle.getBedHeightSingleById(
-                artifact.getDataAsInteger("height_id"));
-        return BedHeightSingleValue.getBedHeightSingleValues(single,
-                getFrom(),
-                getTo());
+    public Integer getTime() {
+        if (time == null) {
+            time = getInteger("time");
+        }
+        return time;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org