Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/model/uinfo/VegetationType.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 | 201817aa7b1c |
children | 9b8ba3b83a15 |
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.Id; | |
20 import javax.persistence.Table; | |
21 | |
22 import org.dive4elements.river.backend.SessionHolder; | |
23 import org.hibernate.Query; | |
24 import org.hibernate.Session; | |
25 | |
26 /** | |
27 * Hibernate binding for the DB table vegetation_type | |
28 * | |
29 * @author Matthias Schäfer | |
30 * | |
31 */ | |
32 @Entity | |
33 @Table(name = "vegetation_type") | |
34 public class VegetationType implements Serializable { | |
35 | |
36 /***** FIELDS *****/ | |
37 | |
38 private static final long serialVersionUID = -845317173014273709L; | |
39 | |
40 private Integer id; | |
41 | |
42 private String name; | |
43 | |
44 | |
45 /***** CONSTRUCTORS *****/ | |
46 | |
47 public VegetationType() { | |
48 } | |
49 | |
50 public VegetationType(final String name) { | |
51 this.name = name; | |
52 } | |
53 | |
54 /***** METHODS *****/ | |
55 | |
56 @Id | |
57 @Column(name = "id") | |
58 public Integer getId() { | |
59 return this.id; | |
60 } | |
61 | |
62 public void setId(final Integer id) { | |
63 this.id = id; | |
64 } | |
65 | |
66 @Column(name = "name") | |
67 public String getName() { | |
68 return this.name; | |
69 } | |
70 | |
71 public void setName(final String name) { | |
72 this.name = name; | |
73 } | |
9401
361de818f76e
Added color fields to the vegetation zone database table and importer, max days field changed from exclusive to inclusive
mschaefer
parents:
9014
diff
changeset
|
74 |
9014 | 75 /** |
9401
361de818f76e
Added color fields to the vegetation zone database table and importer, max days field changed from exclusive to inclusive
mschaefer
parents:
9014
diff
changeset
|
76 * Queries all vegetation types from the database, ordered by id |
9014 | 77 */ |
78 public static List<VegetationType> getTypes() { | |
79 final Session session = SessionHolder.HOLDER.get(); | |
80 final Query query = session.createQuery("FROM VegetationType ORDER BY id"); | |
81 return new ArrayList<>(query.list()); | |
82 } | |
83 } |