Mercurial > dive4elements > river
changeset 2868:b6f94c5db89e
Added HydrBoundary and HydrBoundaryPoly and adapted method signatures of Line and Building.
flys-backend/trunk@4382 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 10 May 2012 11:05:25 +0000 |
parents | 6442b30d80ec |
children | e29781310140 |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java flys-backend/src/main/java/de/intevation/flys/model/Building.java flys-backend/src/main/java/de/intevation/flys/model/HydrBoundary.java flys-backend/src/main/java/de/intevation/flys/model/HydrBoundaryPoly.java flys-backend/src/main/java/de/intevation/flys/model/Line.java |
diffstat | 6 files changed, 215 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/ChangeLog Thu May 10 06:01:17 2012 +0000 +++ b/flys-backend/ChangeLog Thu May 10 11:05:25 2012 +0000 @@ -1,3 +1,20 @@ +2012-05-10 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/model/HydrBoundary.java, + src/main/java/de/intevation/flys/model/HydrBoundaryPoly.java: New. + Hydrological boundaries. + + * src/main/java/de/intevation/flys/model/Line.java: Modified signature of + Line.getLines(). It now also takes the name of a line to retrieve more + specific lines. + + * src/main/java/de/intevation/flys/model/Building.java: Modified signature + of Building.getBuildings(). It now also takes the name of a building to + retrieve more specific lines. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered HydrBoundary and HydrBoundaryPoly classes. + 2012-05-10 Ingo Weinzierl <ingo@intevation.de> * contrib/shpimporter/crosssectiontracks.py: Search for 'STATION' field in
--- a/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java Thu May 10 06:01:17 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java Thu May 10 11:05:25 2012 +0000 @@ -52,6 +52,8 @@ import de.intevation.flys.model.Gauge; import de.intevation.flys.model.GrainFraction; import de.intevation.flys.model.Hws; +import de.intevation.flys.model.HydrBoundary; +import de.intevation.flys.model.HydrBoundaryPoly; import de.intevation.flys.model.HYK; import de.intevation.flys.model.HYKEntry; import de.intevation.flys.model.HYKFormation; @@ -267,6 +269,8 @@ cfg.addAnnotatedClass(Gauge.class); cfg.addAnnotatedClass(GrainFraction.class); cfg.addAnnotatedClass(Hws.class); + cfg.addAnnotatedClass(HydrBoundary.class); + cfg.addAnnotatedClass(HydrBoundaryPoly.class); cfg.addAnnotatedClass(HYK.class); cfg.addAnnotatedClass(HYKEntry.class); cfg.addAnnotatedClass(HYKFormation.class);
--- a/flys-backend/src/main/java/de/intevation/flys/model/Building.java Thu May 10 06:01:17 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Building.java Thu May 10 11:05:25 2012 +0000 @@ -80,12 +80,13 @@ } - public static List<Building> getBuildings(int riverId) { + public static List<Building> getBuildings(int riverId, String name) { Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery( - "from Building where river.id =:river_id"); + "from Building where river.id =:river_id and name=:name"); query.setParameter("river_id", riverId); + query.setParameter("name", name); return query.list(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/HydrBoundary.java Thu May 10 11:05:25 2012 +0000 @@ -0,0 +1,94 @@ +package de.intevation.flys.model; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +import org.hibernate.Session; +import org.hibernate.Query; +import org.hibernate.annotations.Type; + +import com.vividsolutions.jts.geom.LineString; + +import de.intevation.flys.backend.SessionHolder; + + +@Entity +@Table(name = "hydr_boundaries") +public class HydrBoundary +implements Serializable +{ + private Integer id; + private String name; + private River river; + private LineString geom; + + public HydrBoundary() { + } + + + @Id + @Column(name = "id") + public Integer getId() { + return id; + } + + + public void setId(Integer id) { + this.id = id; + } + + + @OneToOne + @JoinColumn(name = "river_id") + public River getRiver() { + return river; + } + + + public void setRiver(River river) { + this.river = river; + } + + + @Column(name = "name") + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Column(name = "geom") + @Type(type = "org.hibernatespatial.GeometryUserType") + public LineString getGeom() { + return geom; + } + + + public void setGeom(LineString geom) { + this.geom = geom; + } + + + public static List<HydrBoundary> getHydrBoundaries(int riverId, String name) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from HydrBoundary where river.id =:river_id and name=:name"); + query.setParameter("river_id", riverId); + query.setParameter("name", name); + + return query.list(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/HydrBoundaryPoly.java Thu May 10 11:05:25 2012 +0000 @@ -0,0 +1,94 @@ +package de.intevation.flys.model; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +import org.hibernate.Session; +import org.hibernate.Query; +import org.hibernate.annotations.Type; + +import com.vividsolutions.jts.geom.Geometry; + +import de.intevation.flys.backend.SessionHolder; + + +@Entity +@Table(name = "hydr_boundaries_poly") +public class HydrBoundaryPoly +implements Serializable +{ + private Integer id; + private String name; + private River river; + private Geometry geom; + + public HydrBoundaryPoly() { + } + + + @Id + @Column(name = "id") + public Integer getId() { + return id; + } + + + public void setId(Integer id) { + this.id = id; + } + + + @OneToOne + @JoinColumn(name = "river_id") + public River getRiver() { + return river; + } + + + public void setRiver(River river) { + this.river = river; + } + + + @Column(name = "name") + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Column(name = "geom") + @Type(type = "org.hibernatespatial.GeometryUserType") + public Geometry getGeom() { + return geom; + } + + + public void setGeom(Geometry geom) { + this.geom = geom; + } + + + public static List<HydrBoundaryPoly> getHydrBoundaries(int riverId, String name) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from HydrBoundaryPoly where river.id =:river_id and name=:name"); + query.setParameter("river_id", riverId); + query.setParameter("name", name); + + return query.list(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/model/Line.java Thu May 10 06:01:17 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Line.java Thu May 10 11:05:25 2012 +0000 @@ -94,12 +94,13 @@ } - public static List<Line> getLines(int riverId) { + public static List<Line> getLines(int riverId, String name) { Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery( - "from Line where river.id =:river_id"); + "from Line where river.id =:river_id and name=:name"); query.setParameter("river_id", riverId); + query.setParameter("name", name); return query.list(); }