view backend/src/main/java/org/dive4elements/river/model/Annotation.java @ 9176:1614cb14308f

Work on calculations for S-Info flood duration workflow
author mschaefer
date Mon, 25 Jun 2018 19:21:11 +0200
parents 4c3ccf2b0304
children
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * 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;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.dive4elements.river.model.Attribute.AttributeKey;

@Entity
@Table(name = "annotations")
public class Annotation
implements   Serializable
{
    private Integer        id;
    private Range          range;
    private Attribute      attribute;
    private Position       position;
    private Edge           edge;
    private AnnotationType type;

    public Annotation() {
    }

    public Annotation(
            final Range          range,
            final Attribute      attribute,
            final Position       position,
            final Edge           edge,
            final AnnotationType type
            ) {
        this.range     = range;
        this.attribute = attribute;
        this.position  = position;
        this.edge      = edge;
        this.type      = type;
    }

    @Id
    @SequenceGenerator(
            name           = "SEQUENCE_ANNOTATIONS_ID_SEQ",
            sequenceName   = "ANNOTATIONS_ID_SEQ",
            allocationSize = 1)
    @GeneratedValue(
            strategy  = GenerationType.SEQUENCE,
            generator = "SEQUENCE_ANNOTATIONS_ID_SEQ")
    @Column(name = "id")
    public Integer getId() {
        return this.id;
    }

    public void setId(final Integer id) {
        this.id = id;
    }

    @OneToOne
    @JoinColumn(name = "range_id")
    public Range getRange() {
        return this.range;
    }

    public void setRange(final Range range) {
        this.range = range;
    }

    @OneToOne
    @JoinColumn(name = "attribute_id")
    public Attribute getAttribute() {
        return this.attribute;
    }

    public void setAttribute(final Attribute attribute) {
        this.attribute = attribute;
    }

    @Transient
    public AttributeKey getAttributeKey() {
        return this.getAttribute().getKey();
    }

    @OneToOne
    @JoinColumn(name = "position_id")
    public Position getPosition() {
        return this.position;
    }

    public void setPosition(final Position position) {
        this.position = position;
    }

    @OneToOne
    @JoinColumn(name = "edge_id")
    public Edge getEdge() {
        return this.edge;
    }

    public void setEdge(final Edge edge) {
        this.edge = edge;
    }

    @OneToOne
    @JoinColumn(name = "type_id")
    public AnnotationType getType() {
        return this.type;
    }

    public void setType(final AnnotationType type) {
        this.type = type;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org