view 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
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 salix ranks from the database, orders 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());
    }
}

http://dive4elements.wald.intevation.org