annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeFinderFactory.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeFinderFactory.java@bd047b71ab37
children 4897a58c8746
rev   line source
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5343
diff changeset
1 package org.dive4elements.river.artifacts.model;
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5343
diff changeset
3 import org.dive4elements.river.artifacts.cache.CacheFactory;
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5343
diff changeset
5 import org.dive4elements.river.backend.SessionHolder;
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5343
diff changeset
7 import org.dive4elements.river.model.River;
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 import java.util.ArrayList;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 import java.util.List;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 import net.sf.ehcache.Cache;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 import net.sf.ehcache.Element;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 import org.apache.log4j.Logger;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 import org.hibernate.SQLQuery;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 import org.hibernate.Session;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 import org.hibernate.type.StandardBasicTypes;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21
5343
61f4d4164a30 Doc, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3421
diff changeset
22 /** Get GaugeFinders. */
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 public class GaugeFinderFactory
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 private static Logger log = Logger.getLogger(GaugeFinderFactory.class);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 public static final String CACHE_NAME = "gauge-finders";
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 public static final String SQL_GAUGES =
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 "SELECT" +
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 " g.id AS gauge_id," +
3421
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3152
diff changeset
32 " g.name AS name," +
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 " r.a AS a," +
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 " r.b AS b " +
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 "FROM gauges g" +
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 " JOIN ranges r ON g.range_id = r.id " +
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 "WHERE" +
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 " g.river_id = :river_id " +
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 "ORDER BY r.a";
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 private static GaugeFinderFactory INSTANCE;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 protected GaugeFinderFactory() {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 public static synchronized GaugeFinderFactory getInstance() {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 if (INSTANCE == null) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 INSTANCE = new GaugeFinderFactory();
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 return INSTANCE;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 public GaugeFinder getGaugeFinder(String riverName) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 River river = RiverFactory.getRiver(riverName);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 return river != null
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 ? getGaugeFinder(river.getId(), river.getKmUp())
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 : null;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 public synchronized GaugeFinder getGaugeFinder(
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 int riverId,
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 boolean isKmUp
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 ) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 Cache cache = CacheFactory.getCache(CACHE_NAME);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 if (cache == null) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 return getUncached(riverId, isKmUp);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 String cacheKey = riverId + "-" + isKmUp;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 Element element = cache.get(cacheKey);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 if (element != null) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 return (GaugeFinder)element.getValue();
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 GaugeFinder finder = getUncached(riverId, isKmUp);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80 if (finder != null) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 cache.put(new Element(cacheKey, finder));
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 return finder;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 protected GaugeFinder loadGauges(
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 Session session,
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 int riverId,
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 boolean isKmUp
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91 ) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 SQLQuery query = session.createSQLQuery(SQL_GAUGES)
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 .addScalar("gauge_id", StandardBasicTypes.INTEGER)
3421
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3152
diff changeset
94 .addScalar("name", StandardBasicTypes.STRING)
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95 .addScalar("a", StandardBasicTypes.DOUBLE)
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 .addScalar("b", StandardBasicTypes.DOUBLE);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 query.setInteger("river_id", riverId);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 List<Object []> list = query.list();
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 if (list.isEmpty()) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103 log.warn("River " + riverId + " has no gauges.");
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 return null;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 List<GaugeRange> gauges = new ArrayList<GaugeRange>();
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 for (Object [] row: list) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110 int gaugeId = (Integer)row[0];
3421
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3152
diff changeset
111 String name = (String) row[1];
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3152
diff changeset
112 double start = (Double) row[2];
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3152
diff changeset
113 double end = (Double) row[3];
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3152
diff changeset
114 GaugeRange gauge = new GaugeRange(start, end, name, gaugeId);
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
115 gauges.add(gauge);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
116 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
117
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118 return new GaugeFinder(gauges, isKmUp);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
121 protected GaugeFinder getUncached(int riverId, boolean isKmUp) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122 Session session = SessionHolder.HOLDER.get();
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124 GaugeFinder finder = loadGauges(session, riverId, isKmUp);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126 if (finder == null
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 || !finder.loadDischargeSectors(session, riverId)) {
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128 return null;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 }
3152
368d1837ce5d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
130
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
131 return finder;
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 }
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org