Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/CrossSectionFactory.java @ 6317:294742a49c1c
Add gauge validity information to dischargecurve exporter
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 12 Jun 2013 18:09:18 +0200 |
parents | af13ceeba52a |
children | de62db0f2035 |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
9 package org.dive4elements.river.artifacts.model; |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import java.util.List; |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
1965
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
13 import net.sf.ehcache.Cache; |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
14 import net.sf.ehcache.Element; |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
15 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
16 import org.dive4elements.river.backend.SessionHolder; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
17 import org.dive4elements.river.model.CrossSection; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
18 import org.dive4elements.river.model.River; |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
20 import org.dive4elements.river.artifacts.cache.CacheFactory; |
1965
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
21 |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 import org.hibernate.Session; |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 import org.hibernate.Query; |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
1965
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
25 |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 /** |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 * Get Cross Sections. |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 */ |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 public class CrossSectionFactory { |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 |
1965
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
31 protected final static String CACHE_NAME = "cross_sections"; |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
32 |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
33 // TODO use caching consistently, streamline acces. |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 /** |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 * Get CrossSections for an instantiated River. |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 * |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 * @param river river object. |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 * |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 * @return List of Cross Sections of river. |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 */ |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 public static List<CrossSection> getCrossSections(River river) { |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 return getCrossSections(river.getName()); |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 } |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 /** |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 * Get Cross Sections for a river by name. |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 * |
3269
b2ea89a665bc
Fix issues in 'documentation'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2791
diff
changeset
|
49 * @param riverName name of the river of interest. |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 * |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 * @return List of Cross Sections of river. |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 */ |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 public static List<CrossSection> getCrossSections(String riverName) { |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 Session session = SessionHolder.HOLDER.get(); |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 Query query = session.createQuery( |
2142
ef337d9fa5ea
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2039
diff
changeset
|
56 "from CrossSection where river.name = :rivername"); |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 query.setParameter("rivername", riverName); |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 return query.list(); |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 } |
1965
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
60 |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
61 |
2039
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
62 /** |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
63 * True if the given section is the "newest" for that river. |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
64 * @param section Given section |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
65 * @return true if the section has the most advanced end of its validity interval |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
66 * or the most advanced start of its validity interval. |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
67 */ |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
68 public static boolean isNewest(CrossSection section) { |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
69 Session session = SessionHolder.HOLDER.get(); |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
70 Query query = session.createQuery( |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
71 "from CrossSection where river.id = :riverid " |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
72 + " order by timeInterval.stopTime desc, timeInterval.startTime desc"); |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
73 query.setParameter("riverid", section.getRiver().getId()); |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
74 |
2791
c9815016a3bb
Merged revisions 4536 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2142
diff
changeset
|
75 List result = query.list(); |
c9815016a3bb
Merged revisions 4536 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2142
diff
changeset
|
76 |
c9815016a3bb
Merged revisions 4536 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2142
diff
changeset
|
77 if (result == null || result.isEmpty()) { |
c9815016a3bb
Merged revisions 4536 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2142
diff
changeset
|
78 return true; |
c9815016a3bb
Merged revisions 4536 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2142
diff
changeset
|
79 } |
c9815016a3bb
Merged revisions 4536 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2142
diff
changeset
|
80 else { |
c9815016a3bb
Merged revisions 4536 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2142
diff
changeset
|
81 CrossSection cs = (CrossSection) result.get(0); |
c9815016a3bb
Merged revisions 4536 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2142
diff
changeset
|
82 return section.getId().equals(cs.getId()); |
c9815016a3bb
Merged revisions 4536 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2142
diff
changeset
|
83 } |
2039
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
84 } |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
85 |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
86 |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
87 /** |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
88 * Get a specific CrossSection from db. |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
89 * @param id The dbid of the cross-section to load. |
f7e2a84a6d88
Added function to check whether a CrossSection is the 'newest' for its river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1965
diff
changeset
|
90 */ |
1965
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
91 public static CrossSection getCrossSection(int id) { |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
92 Cache cache = CacheFactory.getCache(CACHE_NAME); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
93 if (cache != null) { |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
94 Element element = cache.get(Integer.valueOf(id)); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
95 if (element != null) { |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
96 return (CrossSection) element.getValue(); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
97 } |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
98 } |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
99 |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
100 CrossSection section = getCrossSectionUncached(id); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
101 if (cache != null) { |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
102 Element element = new Element(Integer.valueOf(id), section); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
103 cache.put(element); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
104 } |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
105 |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
106 return section; |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
107 } |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
108 |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
109 |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
110 /** Get specific CrossSection from database. */ |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
111 protected static CrossSection getCrossSectionUncached(int id) { |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
112 Session session = SessionHolder.HOLDER.get(); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
113 Query query = session.createQuery( |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
114 "from CrossSection where id=:id"); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
115 query.setParameter("id", id); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
116 List<CrossSection> list = query.list(); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
117 return list.isEmpty() ? null : list.get(0); |
e71615d95afb
Added method to CrossSectionFactory to get single CrossSection, employ cache.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1962
diff
changeset
|
118 } |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 } |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |