aheinecke@5061: package de.intevation.flys.model; aheinecke@5061: teichmann@5081: import com.vividsolutions.jts.geom.Geometry; teichmann@5081: teichmann@5081: import de.intevation.flys.model.HWSKind; teichmann@5081: aheinecke@5061: import java.io.Serializable; aheinecke@5091: import java.util.List; aheinecke@5061: aheinecke@5061: import javax.persistence.Column; aheinecke@5061: import javax.persistence.Entity; aheinecke@5098: import javax.persistence.GeneratedValue; aheinecke@5098: import javax.persistence.GenerationType; aheinecke@5061: import javax.persistence.Id; aheinecke@5061: import javax.persistence.JoinColumn; aheinecke@5061: import javax.persistence.OneToOne; aheinecke@5061: import javax.persistence.Table; aheinecke@5098: import javax.persistence.SequenceGenerator; aheinecke@5061: aheinecke@5091: import org.hibernate.Session; aheinecke@5091: import org.hibernate.Query; aheinecke@5064: import org.hibernate.annotations.Type; aheinecke@5061: aheinecke@5091: import de.intevation.flys.backend.SessionHolder; aheinecke@5091: aheinecke@5061: @Entity aheinecke@5061: @Table(name = "hws_lines") aheinecke@5061: public class HWSLine implements Serializable { aheinecke@5061: teichmann@5081: private Integer id; aheinecke@5061: teichmann@5081: private Integer ogrFid; teichmann@5081: private HWSKind kind; teichmann@5081: private FedState fedState; teichmann@5081: private River river; aheinecke@5183: private Integer official; teichmann@5081: private Integer shoreSide; teichmann@5081: private String name; teichmann@5081: private String path; teichmann@5081: private String agency; teichmann@5081: private String range; teichmann@5081: private String source; teichmann@5081: private String status_date; teichmann@5081: private String description; teichmann@5081: private Geometry geom; aheinecke@5061: aheinecke@5061: @Id aheinecke@5098: @SequenceGenerator( aheinecke@5098: name = "SEQUENCE_HWS_LINES_ID_SEQ", aheinecke@5098: sequenceName = "HWS_LINES_ID_SEQ", aheinecke@5098: allocationSize = 1) aheinecke@5098: @GeneratedValue( aheinecke@5098: strategy = GenerationType.SEQUENCE, aheinecke@5098: generator = "SEQUENCE_HWS_LINES_ID_SEQ") aheinecke@5061: @Column(name = "id") aheinecke@5061: public Integer getId() { aheinecke@5061: return id; aheinecke@5061: } aheinecke@5061: aheinecke@5061: public void setId(Integer id) { aheinecke@5061: this.id = id; aheinecke@5061: } aheinecke@5061: aheinecke@5061: @Column(name = "geom") aheinecke@5061: @Type(type = "org.hibernatespatial.GeometryUserType") aheinecke@5061: public Geometry getGeom() { aheinecke@5061: return geom; aheinecke@5061: } aheinecke@5061: aheinecke@5061: aheinecke@5061: public void setGeom(Geometry geom) { aheinecke@5061: this.geom = geom; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** teichmann@5081: * Get ogrFid. aheinecke@5061: * teichmann@5081: * @return ogrFid as Integer. aheinecke@5061: */ aheinecke@5061: @Column(name = "ogr_fid") teichmann@5081: public Integer getOgrFid() { teichmann@5081: return ogrFid; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** teichmann@5081: * Set ogrFid. aheinecke@5061: * teichmann@5081: * @param ogrFid the value to set. aheinecke@5061: */ teichmann@5081: public void setOgrFid(Integer ogrFid) { teichmann@5081: this.ogrFid = ogrFid; aheinecke@5061: } aheinecke@5061: aheinecke@5061: aheinecke@5061: /** aheinecke@5183: * Get official. aheinecke@5061: * aheinecke@5183: * @return official as Integer. aheinecke@5061: */ aheinecke@5183: @Column(name = "official") aheinecke@5183: public Integer getofficial() { aheinecke@5183: return official; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5183: * Set official. aheinecke@5061: * aheinecke@5183: * @param official the value to set. aheinecke@5061: */ aheinecke@5183: public void setofficial(Integer official) { aheinecke@5183: this.official = official; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** teichmann@5081: * Get shoreSide. aheinecke@5061: * teichmann@5081: * @return shoreSide as Integer. aheinecke@5061: */ aheinecke@5061: @Column(name = "shore_side") teichmann@5081: public Integer getShoreSide() { teichmann@5081: return shoreSide; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** teichmann@5081: * Set shoreSide. aheinecke@5061: * teichmann@5081: * @param shoreSide the value to set. aheinecke@5061: */ teichmann@5081: public void setShoreSide(Integer shoreSide) { teichmann@5081: this.shoreSide = shoreSide; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get name. aheinecke@5061: * aheinecke@5061: * @return name as String. aheinecke@5061: */ aheinecke@5061: @Column(name = "name") teichmann@5081: public String getName() { aheinecke@5061: return name; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set name. aheinecke@5061: * aheinecke@5061: * @param name the value to set. aheinecke@5061: */ teichmann@5081: public void setName(String name) { aheinecke@5061: this.name = name; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get path. aheinecke@5061: * aheinecke@5061: * @return path as String. aheinecke@5061: */ aheinecke@5061: @Column(name = "path") teichmann@5081: public String getPath() { aheinecke@5061: return path; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set path. aheinecke@5061: * aheinecke@5061: * @param path the value to set. aheinecke@5061: */ teichmann@5081: public void setPath(String path) { aheinecke@5061: this.path = path; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get agency. aheinecke@5061: * aheinecke@5061: * @return agency as String. aheinecke@5061: */ aheinecke@5061: @Column(name = "agency") teichmann@5081: public String getAgency() { aheinecke@5061: return agency; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set agency. aheinecke@5061: * aheinecke@5061: * @param agency the value to set. aheinecke@5061: */ teichmann@5081: public void setAgency(String agency) { aheinecke@5061: this.agency = agency; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get range. aheinecke@5061: * aheinecke@5061: * @return range as String. aheinecke@5061: */ aheinecke@5061: @Column(name = "range") teichmann@5081: public String getRange() { aheinecke@5061: return range; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set range. aheinecke@5061: * aheinecke@5061: * @param range the value to set. aheinecke@5061: */ teichmann@5081: public void setRange(String range) { aheinecke@5061: this.range = range; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get source. aheinecke@5061: * aheinecke@5061: * @return source as String. aheinecke@5061: */ aheinecke@5061: @Column(name = "source") teichmann@5081: public String getSource() { aheinecke@5061: return source; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set source. aheinecke@5061: * aheinecke@5061: * @param source the value to set. aheinecke@5061: */ teichmann@5081: public void setSource(String source) { aheinecke@5061: this.source = source; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get status_date. aheinecke@5061: * aheinecke@5061: * @return status_date as String. aheinecke@5061: */ aheinecke@5061: @Column(name = "status_date") teichmann@5081: public String getStatusDate() { aheinecke@5061: return status_date; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set status_date. aheinecke@5061: * aheinecke@5061: * @param status_date the value to set. aheinecke@5061: */ teichmann@5081: public void setStatusDate(String status_date) { aheinecke@5061: this.status_date = status_date; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get description. aheinecke@5061: * aheinecke@5061: * @return description as String. aheinecke@5061: */ aheinecke@5061: @Column(name = "description") teichmann@5081: public String getDescription() { aheinecke@5061: return description; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set description. aheinecke@5061: * aheinecke@5061: * @param description the value to set. aheinecke@5061: */ teichmann@5081: public void setDescription(String description) { aheinecke@5061: this.description = description; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get kind. aheinecke@5061: * aheinecke@5061: * @return kind as HWSKind. aheinecke@5061: */ aheinecke@5061: @OneToOne aheinecke@5061: @JoinColumn(name = "kind_id") teichmann@5081: public HWSKind getKind() { aheinecke@5061: return kind; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set kind. aheinecke@5061: * aheinecke@5061: * @param kind the value to set. aheinecke@5061: */ teichmann@5081: public void setKind(HWSKind kind) { aheinecke@5061: this.kind = kind; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get fedState. aheinecke@5061: * aheinecke@5061: * @return fedState as FedState. aheinecke@5061: */ aheinecke@5061: @OneToOne aheinecke@5061: @JoinColumn(name = "fed_state_id") teichmann@5081: public FedState getFedState() { aheinecke@5061: return fedState; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set fedState. aheinecke@5061: * aheinecke@5061: * @param fedState the value to set. aheinecke@5061: */ teichmann@5081: public void setFedState(FedState fedState) { aheinecke@5061: this.fedState = fedState; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Get river. aheinecke@5061: * aheinecke@5061: * @return river as River. aheinecke@5061: */ aheinecke@5061: @OneToOne aheinecke@5061: @JoinColumn(name = "river_id") teichmann@5081: public River getRiver() { aheinecke@5061: return river; aheinecke@5061: } aheinecke@5061: aheinecke@5061: /** aheinecke@5061: * Set river. aheinecke@5061: * aheinecke@5061: * @param river the value to set. aheinecke@5061: */ teichmann@5081: public void setRiver(River river) { aheinecke@5061: this.river = river; aheinecke@5061: } aheinecke@5090: aheinecke@5090: public static List getLines(int riverId, String name) { aheinecke@5090: Session session = SessionHolder.HOLDER.get(); aheinecke@5090: aheinecke@5090: Query query = session.createQuery( aheinecke@5090: "from HWSLine where river.id =:river_id and name=:name"); aheinecke@5090: query.setParameter("river_id", riverId); aheinecke@5090: query.setParameter("name", name); aheinecke@5090: aheinecke@5090: return query.list(); aheinecke@5090: } aheinecke@5061: }