comparison 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
comparison
equal deleted inserted replaced
9175:34dc0163ad2d 9176:1614cb14308f
8 8
9 package org.dive4elements.river.model; 9 package org.dive4elements.river.model;
10 10
11 import java.io.Serializable; 11 import java.io.Serializable;
12 12
13 import javax.persistence.Column;
13 import javax.persistence.Entity; 14 import javax.persistence.Entity;
15 import javax.persistence.GeneratedValue;
16 import javax.persistence.GenerationType;
14 import javax.persistence.Id; 17 import javax.persistence.Id;
18 import javax.persistence.JoinColumn;
19 import javax.persistence.OneToOne;
20 import javax.persistence.SequenceGenerator;
15 import javax.persistence.Table; 21 import javax.persistence.Table;
16 import javax.persistence.GeneratedValue; 22 import javax.persistence.Transient;
17 import javax.persistence.Column; 23
18 import javax.persistence.SequenceGenerator; 24 import org.dive4elements.river.model.Attribute.AttributeKey;
19 import javax.persistence.GenerationType;
20 import javax.persistence.OneToOne;
21 import javax.persistence.JoinColumn;
22 25
23 @Entity 26 @Entity
24 @Table(name = "annotations") 27 @Table(name = "annotations")
25 public class Annotation 28 public class Annotation
26 implements Serializable 29 implements Serializable
34 37
35 public Annotation() { 38 public Annotation() {
36 } 39 }
37 40
38 public Annotation( 41 public Annotation(
39 Range range, 42 final Range range,
40 Attribute attribute, 43 final Attribute attribute,
41 Position position, 44 final Position position,
42 Edge edge, 45 final Edge edge,
43 AnnotationType type 46 final AnnotationType type
44 ) { 47 ) {
45 this.range = range; 48 this.range = range;
46 this.attribute = attribute; 49 this.attribute = attribute;
47 this.position = position; 50 this.position = position;
48 this.edge = edge; 51 this.edge = edge;
49 this.type = type; 52 this.type = type;
50 } 53 }
51 54
52 @Id 55 @Id
53 @SequenceGenerator( 56 @SequenceGenerator(
54 name = "SEQUENCE_ANNOTATIONS_ID_SEQ", 57 name = "SEQUENCE_ANNOTATIONS_ID_SEQ",
55 sequenceName = "ANNOTATIONS_ID_SEQ", 58 sequenceName = "ANNOTATIONS_ID_SEQ",
56 allocationSize = 1) 59 allocationSize = 1)
57 @GeneratedValue( 60 @GeneratedValue(
58 strategy = GenerationType.SEQUENCE, 61 strategy = GenerationType.SEQUENCE,
59 generator = "SEQUENCE_ANNOTATIONS_ID_SEQ") 62 generator = "SEQUENCE_ANNOTATIONS_ID_SEQ")
60 @Column(name = "id") 63 @Column(name = "id")
61 public Integer getId() { 64 public Integer getId() {
62 return id; 65 return this.id;
63 } 66 }
64 67
65 public void setId(Integer id) { 68 public void setId(final Integer id) {
66 this.id = id; 69 this.id = id;
67 } 70 }
68 71
69 @OneToOne 72 @OneToOne
70 @JoinColumn(name = "range_id") 73 @JoinColumn(name = "range_id")
71 public Range getRange() { 74 public Range getRange() {
72 return range; 75 return this.range;
73 } 76 }
74 77
75 public void setRange(Range range) { 78 public void setRange(final Range range) {
76 this.range = range; 79 this.range = range;
77 } 80 }
78 81
79 @OneToOne 82 @OneToOne
80 @JoinColumn(name = "attribute_id") 83 @JoinColumn(name = "attribute_id")
81 public Attribute getAttribute() { 84 public Attribute getAttribute() {
82 return attribute; 85 return this.attribute;
83 } 86 }
84 87
85 public void setAttribute(Attribute attribute) { 88 public void setAttribute(final Attribute attribute) {
86 this.attribute = attribute; 89 this.attribute = attribute;
90 }
91
92 @Transient
93 public AttributeKey getAttributeKey() {
94 return this.getAttribute().getKey();
87 } 95 }
88 96
89 @OneToOne 97 @OneToOne
90 @JoinColumn(name = "position_id") 98 @JoinColumn(name = "position_id")
91 public Position getPosition() { 99 public Position getPosition() {
92 return position; 100 return this.position;
93 } 101 }
94 102
95 public void setPosition(Position position) { 103 public void setPosition(final Position position) {
96 this.position = position; 104 this.position = position;
97 } 105 }
98 106
99 @OneToOne 107 @OneToOne
100 @JoinColumn(name = "edge_id") 108 @JoinColumn(name = "edge_id")
101 public Edge getEdge() { 109 public Edge getEdge() {
102 return edge; 110 return this.edge;
103 } 111 }
104 112
105 public void setEdge(Edge edge) { 113 public void setEdge(final Edge edge) {
106 this.edge = edge; 114 this.edge = edge;
107 } 115 }
108 116
109 @OneToOne 117 @OneToOne
110 @JoinColumn(name = "type_id") 118 @JoinColumn(name = "type_id")
111 public AnnotationType getType() { 119 public AnnotationType getType() {
112 return type; 120 return this.type;
113 } 121 }
114 122
115 public void setType(AnnotationType type) { 123 public void setType(final AnnotationType type) {
116 this.type = type; 124 this.type = type;
117 } 125 }
118 } 126 }
119 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 127 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org