annotate 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
rev   line source
9014
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
2 * Software engineering by
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
3 * Björnsen Beratende Ingenieure GmbH
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
5 *
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
6 * This file is Free Software under the GNU AGPL (>=v3)
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
8 * documentation coming with Dive4Elements River for details.
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
9 */
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
10
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
11 package org.dive4elements.river.model.uinfo;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
12
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
13 import java.io.Serializable;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
14 import java.util.ArrayList;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
15 import java.util.List;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
16
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
17 import javax.persistence.Column;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
18 import javax.persistence.Entity;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
19 import javax.persistence.Id;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
20 import javax.persistence.Table;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
21
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
22 import org.dive4elements.river.backend.SessionHolder;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
23 import org.hibernate.Query;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
24 import org.hibernate.Session;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
25
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
26 /**
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
27 * Hibernate binding for the DB table vegetation_type
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
28 *
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
29 * @author Matthias Schäfer
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
30 *
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
31 */
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
32 @Entity
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
33 @Table(name = "vegetation_type")
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
34 public class VegetationType implements Serializable {
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
35
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
36 /***** FIELDS *****/
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
37
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
38 private static final long serialVersionUID = -845317173014273709L;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
39
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
40 private Integer id;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
41
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
42 private String name;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
43
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
44
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
45 /***** CONSTRUCTORS *****/
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
46
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
47 public VegetationType() {
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
48 }
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
49
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
50 public VegetationType(final String name) {
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
51 this.name = name;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
52 }
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
53
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
54 /***** METHODS *****/
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
55
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
56 @Id
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
57 @Column(name = "id")
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
58 public Integer getId() {
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
59 return this.id;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
60 }
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
61
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
62 public void setId(final Integer id) {
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
63 this.id = id;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
64 }
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
65
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
66 @Column(name = "name")
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
67 public String getName() {
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
68 return this.name;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
69 }
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
70
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
71 public void setName(final String name) {
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
72 this.name = name;
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
73 }
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
74 /**
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
75 * Queries all salix ranks from the database, orders by id
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
76 */
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
77 public static List<VegetationType> getTypes() {
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
78 final Session session = SessionHolder.HOLDER.get();
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
79 final Query query = session.createQuery("FROM VegetationType ORDER BY id");
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
80 return new ArrayList<>(query.list());
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
81 }
201817aa7b1c Added the missing vegetation import classes
mschaefer
parents:
diff changeset
82 }

http://dive4elements.wald.intevation.org