ingo@2799: package de.intevation.flys.model; ingo@2799: ingo@2799: import java.io.Serializable; ingo@2799: import java.math.BigDecimal; ingo@2799: import java.util.List; ingo@2799: ingo@2799: import javax.persistence.Column; ingo@2799: import javax.persistence.Entity; ingo@2799: import javax.persistence.Id; ingo@2799: import javax.persistence.JoinColumn; ingo@2799: import javax.persistence.OneToOne; ingo@2799: import javax.persistence.Table; ingo@2799: ingo@2799: import org.hibernate.Session; ingo@2799: import org.hibernate.Query; ingo@2799: import org.hibernate.annotations.Type; ingo@2799: ingo@2802: import com.vividsolutions.jts.geom.Geometry; ingo@2799: import com.vividsolutions.jts.geom.MultiPolygon; ingo@2799: ingo@2799: import de.intevation.flys.backend.SessionHolder; ingo@2799: ingo@2799: ingo@2799: @Entity ingo@2799: @Table(name = "floodmaps") ingo@2799: public class Floodmaps ingo@2799: implements Serializable ingo@2799: { ingo@2799: private Integer id; ingo@2799: private River river; ingo@2799: private String name; ingo@2799: private Integer kind; ingo@2799: private Integer count; ingo@2799: private BigDecimal diff; ingo@2799: private BigDecimal area; ingo@2799: private BigDecimal perimeter; ingo@2802: private Geometry geom; ingo@2799: ingo@2799: public Floodmaps() { ingo@2799: } ingo@2799: ingo@2799: ingo@2799: @Id ingo@2799: @Column(name = "id") ingo@2799: public Integer getId() { ingo@2799: return id; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: public void setId(Integer id) { ingo@2799: this.id = id; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: @OneToOne ingo@2799: @JoinColumn(name = "river_id") ingo@2799: public River getRiver() { ingo@2799: return river; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: public void setRiver(River river) { ingo@2799: this.river = river; ingo@2799: } ingo@2799: ingo@2799: ingo@2802: @Column(name = "name") ingo@2799: public String getName() { ingo@2799: return name; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: public void setName(String name) { ingo@2799: this.name = name; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: @Column(name = "kind") ingo@2799: public Integer getKind() { ingo@2799: return kind; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: public void setKind(Integer kind) { ingo@2799: this.kind = kind; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: @Column(name = "count") ingo@2799: public Integer getCount() { ingo@2799: return count; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: public void setCount(Integer count) { ingo@2799: this.count = count; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: @Column(name = "diff") ingo@2799: public BigDecimal getDiff() { ingo@2799: return diff; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: public void setDiff(BigDecimal diff) { ingo@2799: this.diff = diff; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: @Column(name = "area") ingo@2799: public BigDecimal getArea() { ingo@2799: return area; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: public void setArea(BigDecimal area) { ingo@2799: this.area = area; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: @Column(name = "perimeter") ingo@2799: public BigDecimal getPerimeter() { ingo@2799: return perimeter; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: public void setPerimeter(BigDecimal perimeter) { ingo@2799: this.perimeter = perimeter; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: @Column(name = "geom") ingo@2799: @Type(type = "org.hibernatespatial.GeometryUserType") ingo@2802: public Geometry getGeom() { ingo@2799: return geom; ingo@2799: } ingo@2799: ingo@2799: ingo@2802: public void setGeom(Geometry geom) { ingo@2799: this.geom = geom; ingo@2799: } ingo@2799: ingo@2799: ingo@2799: public static List getFloodmaps(int riverId, String name) { ingo@2799: Session session = SessionHolder.HOLDER.get(); ingo@2799: ingo@2799: Query query = session.createQuery( ingo@2799: "from Floodmaps where river.id =:river_id AND name =:name"); ingo@2799: query.setParameter("river_id", riverId); ingo@2799: query.setParameter("name", name); ingo@2799: ingo@2799: return query.list(); ingo@2799: } ingo@2799: } ingo@2799: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :