Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java @ 3330:d42249d91f47
Added missing 'name' property and a new function to retrieve CrossSectionTracks.
flys-backend/trunk@4654 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 14 Jun 2012 07:56:26 +0000 |
parents | 8e2fe935ddf1 |
children | 88e3473a3846 |
comparison
equal
deleted
inserted
replaced
3329:cc8fc6b29649 | 3330:d42249d91f47 |
---|---|
25 public class CrossSectionTrack | 25 public class CrossSectionTrack |
26 implements Serializable | 26 implements Serializable |
27 { | 27 { |
28 private Integer id; | 28 private Integer id; |
29 private River river; | 29 private River river; |
30 private String name; | |
30 private LineString geom; | 31 private LineString geom; |
31 private BigDecimal km; | 32 private BigDecimal km; |
32 private BigDecimal z; | 33 private BigDecimal z; |
33 | 34 |
34 public CrossSectionTrack() { | 35 public CrossSectionTrack() { |
54 } | 55 } |
55 | 56 |
56 | 57 |
57 public void setRiver(River river) { | 58 public void setRiver(River river) { |
58 this.river = river; | 59 this.river = river; |
60 } | |
61 | |
62 | |
63 @Column(name = "name") | |
64 public String getName() { | |
65 return name; | |
66 } | |
67 | |
68 | |
69 public void setName(String name) { | |
70 this.name = name; | |
59 } | 71 } |
60 | 72 |
61 | 73 |
62 @Column(name = "geom") | 74 @Column(name = "geom") |
63 @Type(type = "org.hibernatespatial.GeometryUserType") | 75 @Type(type = "org.hibernatespatial.GeometryUserType") |
104 | 116 |
105 return query.list(); | 117 return query.list(); |
106 } | 118 } |
107 | 119 |
108 | 120 |
121 public static List<CrossSectionTrack> getCrossSectionTrack( | |
122 String river, | |
123 String name | |
124 ) { | |
125 Session session = SessionHolder.HOLDER.get(); | |
126 | |
127 Query query = session.createQuery( | |
128 "from CrossSectionTrack as cst " + | |
129 " where river.name =:river" + | |
130 " and cst.name=:name"); | |
131 query.setParameter("river", river); | |
132 query.setParameter("name", name); | |
133 | |
134 return query.list(); | |
135 } | |
136 | |
137 | |
109 /** | 138 /** |
110 * Returns the nearest CrossSectionTrack of <i>river</i> to a given | 139 * Returns the nearest CrossSectionTrack of <i>river</i> to a given |
111 * <i>km</i>. | 140 * <i>km</i>. |
112 * | 141 * |
113 * @param river The name of a river. | 142 * @param river The name of a river. |