comparison backend/src/main/java/org/dive4elements/river/model/uinfo/VegetationType.java @ 9014:201817aa7b1c

Added the missing vegetation import classes
author mschaefer
date Wed, 18 Apr 2018 12:11:39 +0200
parents
children 361de818f76e
comparison
equal deleted inserted replaced
9013:1fec0a06d833 9014:201817aa7b1c
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 }
74 /**
75 * Queries all salix ranks from the database, orders by id
76 */
77 public static List<VegetationType> getTypes() {
78 final Session session = SessionHolder.HOLDER.get();
79 final Query query = session.createQuery("FROM VegetationType ORDER BY id");
80 return new ArrayList<>(query.list());
81 }
82 }

http://dive4elements.wald.intevation.org