Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/model/uinfo/Vegetation.java @ 9401:361de818f76e
Added color fields to the vegetation zone database table and importer, max days field changed from exclusive to inclusive
author | mschaefer |
---|---|
date | Tue, 14 Aug 2018 14:02:26 +0200 |
parents | 4c5eeaff554c |
children |
rev | line source |
---|---|
9014 | 1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 | |
11 package org.dive4elements.river.model.uinfo; | |
12 | |
13 import java.io.Serializable; | |
14 import java.util.ArrayList; | |
15 import java.util.List; | |
16 | |
17 import javax.persistence.Column; | |
18 import javax.persistence.Entity; | |
19 import javax.persistence.GeneratedValue; | |
20 import javax.persistence.GenerationType; | |
21 import javax.persistence.Id; | |
22 import javax.persistence.JoinColumn; | |
23 import javax.persistence.OneToMany; | |
24 import javax.persistence.OneToOne; | |
25 import javax.persistence.SequenceGenerator; | |
26 import javax.persistence.Table; | |
27 | |
28 import org.dive4elements.river.model.River; | |
29 | |
30 /** | |
31 * Hibernate binding for the DB table vegetation | |
32 * | |
33 * @author Matthias Schäfer | |
34 * | |
35 */ | |
36 | |
37 @Entity | |
38 @Table(name = "vegetation") | |
39 public class Vegetation implements Serializable { | |
40 | |
41 /***** FIELDS *****/ | |
42 | |
43 private static final long serialVersionUID = -2264657956270172835L; | |
44 | |
45 private Integer id; | |
46 | |
47 private River river; | |
48 | |
49 private String filename; | |
50 | |
51 private String name; | |
52 | |
9038
4c5eeaff554c
Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents:
9014
diff
changeset
|
53 private String notes; |
9014 | 54 |
55 private List<VegetationZone> values; | |
56 | |
57 | |
58 /***** CONSTRUCTORS *****/ | |
59 | |
60 public Vegetation() { | |
61 } | |
62 | |
63 | |
9038
4c5eeaff554c
Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents:
9014
diff
changeset
|
64 public Vegetation(final River river, final String filename, final String name, final String notes) { |
9014 | 65 this.river = river; |
66 this.filename = filename; | |
67 this.name = name; | |
9038
4c5eeaff554c
Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents:
9014
diff
changeset
|
68 this.notes = notes; |
9014 | 69 this.values = new ArrayList<>(); |
70 } | |
71 | |
9401
361de818f76e
Added color fields to the vegetation zone database table and importer, max days field changed from exclusive to inclusive
mschaefer
parents:
9038
diff
changeset
|
72 |
9014 | 73 /***** METHODS *****/ |
74 | |
75 @Id | |
76 @SequenceGenerator(name = "SEQUENCE_VEGETATION_ID_SEQ", sequenceName = "VEGETATION_ID_SEQ", allocationSize = 1) | |
77 @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQUENCE_VEGETATION_ID_SEQ") | |
78 @Column(name = "id") | |
79 public Integer getId() { | |
80 return this.id; | |
81 } | |
82 | |
83 public void setId(final Integer id) { | |
84 this.id = id; | |
85 } | |
86 | |
87 @OneToOne | |
88 @JoinColumn(name = "river_id") | |
89 public River getRiver() { | |
90 return this.river; | |
91 } | |
92 | |
93 public void setRiver(final River river) { | |
94 this.river = river; | |
95 } | |
96 | |
97 @Column(name = "filename") | |
98 public String getFilename() { | |
99 return this.filename; | |
100 } | |
101 | |
102 public void setFilename(final String filename) { | |
103 this.filename = filename; | |
104 } | |
105 | |
106 @Column(name = "name") | |
107 public String getName() { | |
108 return this.name; | |
109 } | |
110 | |
111 public void setName(final String name) { | |
112 this.name = name; | |
113 } | |
114 | |
9038
4c5eeaff554c
Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents:
9014
diff
changeset
|
115 @Column(name = "notes") |
4c5eeaff554c
Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents:
9014
diff
changeset
|
116 public String getNotes() { |
4c5eeaff554c
Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents:
9014
diff
changeset
|
117 return this.notes; |
9014 | 118 } |
119 | |
9038
4c5eeaff554c
Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents:
9014
diff
changeset
|
120 public void setNotes(final String notes) { |
4c5eeaff554c
Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents:
9014
diff
changeset
|
121 this.notes = notes; |
9014 | 122 } |
123 | |
124 @OneToMany | |
125 @JoinColumn(name = "vegetation_id") | |
126 public List<VegetationZone> getValues() { | |
127 return this.values; | |
128 } | |
129 | |
130 public void setValues(final List<VegetationZone> values) { | |
131 this.values = values; | |
132 } | |
133 | |
134 public void addValue(final VegetationZone value) { | |
135 this.values.add(value); | |
136 } | |
137 } |