Mercurial > dive4elements > river
view 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 |
line wrap: on
line source
/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.model.uinfo; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import org.dive4elements.river.backend.SessionHolder; import org.hibernate.Query; import org.hibernate.Session; /** * Hibernate binding for the DB table vegetation_type * * @author Matthias Schäfer * */ @Entity @Table(name = "vegetation_type") public class VegetationType implements Serializable { /***** FIELDS *****/ private static final long serialVersionUID = -845317173014273709L; private Integer id; private String name; /***** CONSTRUCTORS *****/ public VegetationType() { } public VegetationType(final String name) { this.name = name; } /***** METHODS *****/ @Id @Column(name = "id") public Integer getId() { return this.id; } public void setId(final Integer id) { this.id = id; } @Column(name = "name") public String getName() { return this.name; } public void setName(final String name) { this.name = name; } /** * Queries all vegetation types from the database, ordered by id */ public static List<VegetationType> getTypes() { final Session session = SessionHolder.HOLDER.get(); final Query query = session.createQuery("FROM VegetationType ORDER BY id"); return new ArrayList<>(query.list()); } }