Mercurial > dive4elements > river
diff backend/src/main/java/org/dive4elements/river/model/sinfo/InfrastructureValue.java @ 8971:50416a0df385
Importer for the Schifffahrt (S-INFO) and Oekologie (U-INFO) files
author | mschaefer |
---|---|
date | Tue, 03 Apr 2018 10:18:30 +0200 |
parents | |
children | a165cd63099f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/backend/src/main/java/org/dive4elements/river/model/sinfo/InfrastructureValue.java Tue Apr 03 10:18:30 2018 +0200 @@ -0,0 +1,124 @@ +/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.model.sinfo; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +import org.dive4elements.river.model.Attribute; + + +/** + * Hibernate binding for the DB table infrastructure_values + * + * @author Matthias Schäfer + * + */ +@Entity +@Table(name = "infrastructure_values") +public class InfrastructureValue implements Serializable { + + /***** FIELDS *****/ + + private static final long serialVersionUID = -3887269325288851829L; + + private Integer id; + + private Infrastructure infrastructure; + + private Double station; + + private Attribute attribute; + + private Double height; + + + /***** CONSTRUCTORS *****/ + + public InfrastructureValue() { + } + + public InfrastructureValue(final Infrastructure infrastructure, final Double station, final Attribute attribute, final Double height) { + this.infrastructure = infrastructure; + this.station = station; + this.attribute = attribute; + this.height = height; + } + + /** + * Parameter constructor with primitive double km and height + */ + public InfrastructureValue(final Infrastructure infrastructure, final double km, final Attribute attribute, final double height) { + this(infrastructure, Double.valueOf(km), attribute, Double.valueOf(height)); + } + + + /***** METHODS *****/ + + @Id + @SequenceGenerator(name = "SEQUENCE_INFRASTRUCTURE_VALUE_ID_SEQ", sequenceName = "INFRASTRUCTURE_VALUES_ID_SEQ", allocationSize = 1) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQUENCE_INFRASTRUCTURE_VALUE_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return this.id; + } + + public void setId(final Integer id) { + this.id = id; + } + + @OneToOne + @JoinColumn(name = "infrastructure_id") + public Infrastructure getInfrastructure() { + return this.infrastructure; + } + + public void setInfrastructure(final Infrastructure infrastructure) { + this.infrastructure = infrastructure; + } + + @Column(name = "station") + public Double getStation() { + return this.station; + } + + public void setStation(final Double station) { + this.station = station; + } + + @OneToOne + @JoinColumn(name = "attribute_id") + public Attribute getAttribute() { + return this.attribute; + } + + public void setAttribute(final Attribute attribute) { + this.attribute = attribute; + } + + @Column(name = "height") + public Double getHeight() { + return this.height; + } + + public void setHeight(final Double height) { + this.height = height; + } +}