Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java @ 5708:e8469247dc6b
Backend: Reset km index after parsing a file.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Mon, 15 Apr 2013 15:48:58 +0200 |
parents | ae60bb7b8085 |
children |
rev | line source |
---|---|
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.model; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.Serializable; |
1231
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
4 import java.util.List; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import javax.persistence.Column; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import javax.persistence.Entity; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import javax.persistence.Id; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import javax.persistence.JoinColumn; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import javax.persistence.OneToOne; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import javax.persistence.Table; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
5170
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5146
diff
changeset
|
13 import org.hibernate.HibernateException; |
1231
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
14 import org.hibernate.Session; |
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
15 import org.hibernate.Query; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import org.hibernate.annotations.Type; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
5140
18ef819a7c92
Changed river axis from LineString to MultiLineString.
Raimund Renkert <rrenkert@intevation.de>
parents:
4736
diff
changeset
|
18 import com.vividsolutions.jts.geom.MultiLineString; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
1231
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
20 import de.intevation.flys.backend.SessionHolder; |
5146
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
21 import de.intevation.flys.model.AxisKind; |
1231
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
22 |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
2375
61cb16549eb1
Modified the signature of RiverAxis.getRiverAxis() which now returns a list of RiverAxis objects instead of a single instance.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1231
diff
changeset
|
24 /** |
5146
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
25 * A river has one axis that is used for calculation. |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
26 * Additional axes of a river can be used to be painted int maps etc. |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
27 * which one is the main river axis can be determined over the axis kind. |
2375
61cb16549eb1
Modified the signature of RiverAxis.getRiverAxis() which now returns a list of RiverAxis objects instead of a single instance.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1231
diff
changeset
|
28 */ |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 @Entity |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 @Table(name = "river_axes") |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 public class RiverAxis |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 implements Serializable |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 { |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 private Integer id; |
5146
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
35 private AxisKind kind; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 private River river; |
5477
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
37 private String name; |
5140
18ef819a7c92
Changed river axis from LineString to MultiLineString.
Raimund Renkert <rrenkert@intevation.de>
parents:
4736
diff
changeset
|
38 private MultiLineString geom; |
4736
b195fede1c3b
Remove trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3959
diff
changeset
|
39 |
5146
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
40 public static final int KIND_UNKOWN = 0; |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
41 public static final int KIND_CURRENT = 1; |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
42 public static final int KIND_OTHER = 2; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 public RiverAxis() { |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 } |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 @Id |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 @Column(name = "id") |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 public Integer getId() { |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 return id; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 public void setId(Integer id) { |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 this.id = id; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 } |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 @OneToOne |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 @JoinColumn(name = "river_id") |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 public River getRiver() { |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 return river; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 public void setRiver(River river) { |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 this.river = river; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 } |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
5477
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
71 @Column(name = "name") |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
72 public String getName() { |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
73 return name; |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
74 } |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
75 |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
76 |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
77 public void setName(String name) { |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
78 this.name = name; |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
79 } |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
5146
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
81 /** |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
82 * Get kind. |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
83 * |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
84 * @return kind as AxisKind. |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
85 */ |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
86 @OneToOne |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
87 @JoinColumn(name = "kind_id") |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
88 public AxisKind getKind() { |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 return kind; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 } |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 |
5146
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
92 /** |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
93 * Set kind. |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
94 * |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
95 * @param kind the value to set. |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
96 */ |
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
97 public void setKind(AxisKind kind) { |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 this.kind = kind; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 } |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 @Column(name = "geom") |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 @Type(type = "org.hibernatespatial.GeometryUserType") |
5140
18ef819a7c92
Changed river axis from LineString to MultiLineString.
Raimund Renkert <rrenkert@intevation.de>
parents:
4736
diff
changeset
|
104 public MultiLineString getGeom() { |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 return geom; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 } |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 |
5140
18ef819a7c92
Changed river axis from LineString to MultiLineString.
Raimund Renkert <rrenkert@intevation.de>
parents:
4736
diff
changeset
|
109 public void setGeom(MultiLineString geom) { |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 this.geom = geom; |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 } |
1231
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
112 |
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
113 |
5170
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5146
diff
changeset
|
114 public static List<RiverAxis> getRiverAxis(String river) |
5173
14d19313268a
Catch IllegalArgumentException instead of RuntimeException, added logging.
Raimund Renkert <rrenkert@intevation.de>
parents:
5170
diff
changeset
|
115 throws IllegalArgumentException { |
5146
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
116 return getRiverAxis(river, KIND_CURRENT); |
3959
6b1ca6ec4e3c
Added a new method to RiverAxis to query a special kind of river axes (default, official, outsourced).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2375
diff
changeset
|
117 } |
4736
b195fede1c3b
Remove trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3959
diff
changeset
|
118 |
5477
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
119 public static List<RiverAxis> getRiverAxis(String river, String name, int kind) |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
120 throws HibernateException { |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
121 Session session = SessionHolder.HOLDER.get(); |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
122 Query query = session.createQuery( |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
123 "from RiverAxis as ax where river.name =:river" + |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
124 " and kind.id =:kind" + |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
125 " and ax.name=:name"); |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
126 query.setParameter("river", river); |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
127 query.setParameter("kind", kind); |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
128 query.setParameter("name", name); |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
129 |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
130 List<RiverAxis> list = query.list(); |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
131 return list.isEmpty() ? null : list; |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
132 } |
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
133 |
5170
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5146
diff
changeset
|
134 public static List<RiverAxis> getRiverAxis(String river, int kind) |
5181
9d36ddf7dbd3
Change IllegalArgumentException to HibernateException.
Raimund Renkert <rrenkert@intevation.de>
parents:
5173
diff
changeset
|
135 throws HibernateException { |
1231
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
136 Session session = SessionHolder.HOLDER.get(); |
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
137 Query query = session.createQuery( |
5146
d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
Andre Heinecke <aheinecke@intevation.de>
parents:
5140
diff
changeset
|
138 "from RiverAxis where river.name =:river AND kind.id =:kind"); |
1231
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
139 query.setParameter("river", river); |
3959
6b1ca6ec4e3c
Added a new method to RiverAxis to query a special kind of river axes (default, official, outsourced).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2375
diff
changeset
|
140 query.setParameter("kind", kind); |
1231
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
141 |
5181
9d36ddf7dbd3
Change IllegalArgumentException to HibernateException.
Raimund Renkert <rrenkert@intevation.de>
parents:
5173
diff
changeset
|
142 List<RiverAxis> list = query.list(); |
9d36ddf7dbd3
Change IllegalArgumentException to HibernateException.
Raimund Renkert <rrenkert@intevation.de>
parents:
5173
diff
changeset
|
143 return list.isEmpty() ? null : list; |
1231
22eea1c9e907
Added a function in RiverAxis to retrieve the RiverAxis of a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
144 } |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 } |
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |