teichmann@5844: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5844: * Software engineering by Intevation GmbH teichmann@5844: * teichmann@5992: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5844: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5992: * documentation coming with Dive4Elements River for details. teichmann@5844: */ teichmann@5844: teichmann@5829: package org.dive4elements.river.model; sascha@167: sascha@167: import java.io.Serializable; sascha@167: mschaefer@9176: import javax.persistence.Column; sascha@171: import javax.persistence.Entity; sascha@171: import javax.persistence.GeneratedValue; mschaefer@9176: import javax.persistence.GenerationType; mschaefer@9176: import javax.persistence.Id; mschaefer@9176: import javax.persistence.JoinColumn; mschaefer@9176: import javax.persistence.OneToOne; sascha@171: import javax.persistence.SequenceGenerator; mschaefer@9176: import javax.persistence.Table; mschaefer@9176: import javax.persistence.Transient; mschaefer@9176: mschaefer@9176: import org.dive4elements.river.model.Attribute.AttributeKey; sascha@171: sascha@171: @Entity sascha@171: @Table(name = "annotations") sascha@167: public class Annotation sascha@167: implements Serializable sascha@167: { sascha@763: private Integer id; sascha@763: private Range range; sascha@763: private Attribute attribute; sascha@763: private Position position; sascha@763: private Edge edge; sascha@763: private AnnotationType type; sascha@167: sascha@167: public Annotation() { sascha@167: } sascha@167: sascha@758: public Annotation( mschaefer@9176: final Range range, mschaefer@9176: final Attribute attribute, mschaefer@9176: final Position position, mschaefer@9176: final Edge edge, mschaefer@9176: final AnnotationType type mschaefer@9176: ) { sascha@188: this.range = range; sascha@188: this.attribute = attribute; sascha@188: this.position = position; sascha@758: this.edge = edge; sascha@763: this.type = type; sascha@188: } sascha@188: sascha@171: @Id sascha@171: @SequenceGenerator( mschaefer@9176: name = "SEQUENCE_ANNOTATIONS_ID_SEQ", mschaefer@9176: sequenceName = "ANNOTATIONS_ID_SEQ", mschaefer@9176: allocationSize = 1) sascha@171: @GeneratedValue( mschaefer@9176: strategy = GenerationType.SEQUENCE, mschaefer@9176: generator = "SEQUENCE_ANNOTATIONS_ID_SEQ") sascha@171: @Column(name = "id") sascha@171: public Integer getId() { mschaefer@9176: return this.id; sascha@171: } sascha@171: mschaefer@9176: public void setId(final Integer id) { sascha@167: this.id = id; sascha@167: } sascha@167: sascha@174: @OneToOne sascha@174: @JoinColumn(name = "range_id") sascha@174: public Range getRange() { mschaefer@9176: return this.range; sascha@174: } sascha@174: mschaefer@9176: public void setRange(final Range range) { sascha@167: this.range = range; sascha@167: } sascha@167: sascha@174: @OneToOne sascha@174: @JoinColumn(name = "attribute_id") sascha@174: public Attribute getAttribute() { mschaefer@9176: return this.attribute; sascha@167: } sascha@167: mschaefer@9176: public void setAttribute(final Attribute attribute) { sascha@167: this.attribute = attribute; sascha@167: } sascha@167: mschaefer@9176: @Transient mschaefer@9176: public AttributeKey getAttributeKey() { mschaefer@9176: return this.getAttribute().getKey(); mschaefer@9176: } mschaefer@9176: sascha@174: @OneToOne sascha@174: @JoinColumn(name = "position_id") sascha@174: public Position getPosition() { mschaefer@9176: return this.position; sascha@167: } sascha@167: mschaefer@9176: public void setPosition(final Position position) { sascha@167: this.position = position; sascha@167: } sascha@758: sascha@758: @OneToOne sascha@758: @JoinColumn(name = "edge_id") sascha@758: public Edge getEdge() { mschaefer@9176: return this.edge; sascha@758: } sascha@758: mschaefer@9176: public void setEdge(final Edge edge) { sascha@758: this.edge = edge; sascha@758: } sascha@763: sascha@763: @OneToOne sascha@763: @JoinColumn(name = "type_id") sascha@763: public AnnotationType getType() { mschaefer@9176: return this.type; sascha@763: } sascha@763: mschaefer@9176: public void setType(final AnnotationType type) { sascha@763: this.type = type; sascha@763: } sascha@167: } sascha@167: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :