Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/model/Jetty.java @ 5622:b28a6d05e969
Add a new mechanism in mapfish print call to add arbitary data maps
Data properties are identified by starting with mapfish-data
and they are then split in info value pairs where info
can be the description of the information and value the value
of the information to be transported in the data map.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 09 Apr 2013 19:04:32 +0200 |
parents | b582df0c7b00 |
children |
rev | line source |
---|---|
5437
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.model; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
2 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
3 import java.io.Serializable; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
5 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
6 import javax.persistence.Column; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
7 import javax.persistence.Entity; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
8 import javax.persistence.Id; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
9 import javax.persistence.JoinColumn; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
10 import javax.persistence.OneToOne; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
11 import javax.persistence.Table; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
12 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 import com.vividsolutions.jts.geom.Geometry; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
15 import org.hibernate.Session; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 import org.hibernate.Query; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 import org.hibernate.annotations.Type; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
18 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.backend.SessionHolder; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
20 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
21 @Entity |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
22 @Table(name = "jetties") |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
23 public class Jetty |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
24 implements Serializable |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
25 { |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
26 private Integer id; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
27 private River river; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
28 private Geometry geom; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
29 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
30 public Jetty() { |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
31 } |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
32 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
33 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
34 @Id |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
35 @Column(name = "id") |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
36 public Integer getId() { |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
37 return id; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
38 } |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
39 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
40 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
41 public void setId(Integer id) { |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
42 this.id = id; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
43 } |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
44 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
45 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
46 @OneToOne |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
47 @JoinColumn(name = "river_id") |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
48 public River getRiver() { |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
49 return river; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
50 } |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
51 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
52 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
53 public void setRiver(River river) { |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
54 this.river = river; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
55 } |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
56 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
57 @Column(name = "geom") |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
58 @Type(type = "org.hibernatespatial.GeometryUserType") |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
59 public Geometry getGeom() { |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
60 return geom; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
61 } |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
62 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
63 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
64 public void setGeom(Geometry geom) { |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
65 this.geom = geom; |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
66 } |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
67 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
68 public static List<Jetty> getJetties(int riverId, int kindId) { |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
69 Session session = SessionHolder.HOLDER.get(); |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
70 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
71 Query query = session.createQuery( |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
72 "from Jetty where river.id =:river_id and kind_id=:kind_id"); |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
73 query.setParameter("kind_id", kindId); |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
74 query.setParameter("river_id", riverId); |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
75 |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
76 return query.list(); |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
77 } |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
78 } |
b582df0c7b00
Add Jetties to floodmap
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
79 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |