Mercurial > dive4elements > river
diff backend/src/main/java/org/dive4elements/river/model/Annotation.java @ 9176:1614cb14308f
Work on calculations for S-Info flood duration workflow
author | mschaefer |
---|---|
date | Mon, 25 Jun 2018 19:21:11 +0200 |
parents | 4c3ccf2b0304 |
children |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/model/Annotation.java Mon Jun 25 17:58:11 2018 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/Annotation.java Mon Jun 25 19:21:11 2018 +0200 @@ -10,15 +10,18 @@ import java.io.Serializable; +import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; import javax.persistence.GeneratedValue; -import javax.persistence.Column; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; import javax.persistence.SequenceGenerator; -import javax.persistence.GenerationType; -import javax.persistence.OneToOne; -import javax.persistence.JoinColumn; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.dive4elements.river.model.Attribute.AttributeKey; @Entity @Table(name = "annotations") @@ -36,12 +39,12 @@ } public Annotation( - Range range, - Attribute attribute, - Position position, - Edge edge, - AnnotationType type - ) { + final Range range, + final Attribute attribute, + final Position position, + final Edge edge, + final AnnotationType type + ) { this.range = range; this.attribute = attribute; this.position = position; @@ -51,68 +54,73 @@ @Id @SequenceGenerator( - name = "SEQUENCE_ANNOTATIONS_ID_SEQ", - sequenceName = "ANNOTATIONS_ID_SEQ", - allocationSize = 1) + name = "SEQUENCE_ANNOTATIONS_ID_SEQ", + sequenceName = "ANNOTATIONS_ID_SEQ", + allocationSize = 1) @GeneratedValue( - strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_ANNOTATIONS_ID_SEQ") + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_ANNOTATIONS_ID_SEQ") @Column(name = "id") public Integer getId() { - return id; + return this.id; } - public void setId(Integer id) { + public void setId(final Integer id) { this.id = id; } @OneToOne @JoinColumn(name = "range_id") public Range getRange() { - return range; + return this.range; } - public void setRange(Range range) { + public void setRange(final Range range) { this.range = range; } @OneToOne @JoinColumn(name = "attribute_id") public Attribute getAttribute() { - return attribute; + return this.attribute; } - public void setAttribute(Attribute attribute) { + public void setAttribute(final Attribute attribute) { this.attribute = attribute; } + @Transient + public AttributeKey getAttributeKey() { + return this.getAttribute().getKey(); + } + @OneToOne @JoinColumn(name = "position_id") public Position getPosition() { - return position; + return this.position; } - public void setPosition(Position position) { + public void setPosition(final Position position) { this.position = position; } @OneToOne @JoinColumn(name = "edge_id") public Edge getEdge() { - return edge; + return this.edge; } - public void setEdge(Edge edge) { + public void setEdge(final Edge edge) { this.edge = edge; } @OneToOne @JoinColumn(name = "type_id") public AnnotationType getType() { - return type; + return this.type; } - public void setType(AnnotationType type) { + public void setType(final AnnotationType type) { this.type = type; } }