comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/HYKFactory.java @ 2148:345a236f7075

Made HYKFactory.Zone Serializable (and thus cachable). flys-artifacts/trunk@3730 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 20 Jan 2012 08:30:07 +0000
parents 923256599afe
children 8c9c40459d8f
comparison
equal deleted inserted replaced
2147:79044646f4eb 2148:345a236f7075
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.List; 4 import java.util.List;
5 5
6 import java.math.BigDecimal; 6 import java.math.BigDecimal;
7
8 import java.io.Serializable;
7 9
8 import net.sf.ehcache.Cache; 10 import net.sf.ehcache.Cache;
9 import net.sf.ehcache.Element; 11 import net.sf.ehcache.Element;
10 12
11 import org.apache.log4j.Logger; 13 import org.apache.log4j.Logger;
108 " and :km between entry.km - cast(distance_vl/1000.0 + 0.001 as big_decimal) and " + 110 " and :km between entry.km - cast(distance_vl/1000.0 + 0.001 as big_decimal) and " +
109 " entry.km + cast(distance_vl/1000.0 + 0.001 as big_decimal)" + 111 " entry.km + cast(distance_vl/1000.0 + 0.001 as big_decimal)" +
110 " order by entry.km asc"); 112 " order by entry.km asc");
111 query.setParameter("hykid", hykid); 113 query.setParameter("hykid", hykid);
112 query.setParameter("km", new BigDecimal(km)); 114 query.setParameter("km", new BigDecimal(km));
113 logger.debug("Big km " + new BigDecimal(km)); 115
114 List<HYKFormation> forms = query.list(); 116 List<HYKFormation> forms = query.list();
115 117
116 List<Zone> zones = new ArrayList<Zone>(); 118 List<Zone> zones = new ArrayList<Zone>();
117 // TODO limit query by one; sensible sorting. 119 // TODO limit query by one; sensible sorting.
118 // Take the first one. 120 // Take the first one.
129 131
130 return zones; 132 return zones;
131 } 133 }
132 134
133 /** Labelled section. */ 135 /** Labelled section. */
134 public static class Zone { 136 public static class Zone implements Serializable {
135 /** Lower end of segment. */ 137 /** Lower end of segment. */
136 protected double from; 138 protected double from;
137 /** Upper end of segment. */ 139 /** Upper end of segment. */
138 protected double to; 140 protected double to;
139 /** The label. */ 141 /** The label. */

http://dive4elements.wald.intevation.org