FoodWave.java 2.61 KB
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fi.insomnia.bortal.model;

import java.util.Calendar;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;

/**
 * 
 */
@Entity
@Table(name = "food_waves")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class FoodWave extends GenericEntity {

    private static final long serialVersionUID = 9221716203467295049L;

    @Column(name = "wave_name", nullable = false)
    private String name;

    @Lob
    @Column(name = "wave_description")
    private String description;

    @Column(name = "wave_time")
    @Temporal(TemporalType.TIMESTAMP)
    private Calendar time;

    @Column(name = "wave_closed", nullable = false, columnDefinition = "boolean default false")
    private boolean closed = false;

    @OneToMany(mappedBy = "foodWave")
    private List<AccountEvent> accountEvents;

    @ManyToOne
    @JoinColumn(name = "template_id", referencedColumnName = "id", nullable = false)
    private FoodWaveTemplate template;

    public FoodWave() {
        super();
    }

    public FoodWave(String waveName, boolean waveClosed) {
        super();
        this.name = waveName;
        this.closed = waveClosed;
    }

    public String getName() {
        return name;
    }

    public void setName(String waveName) {
        this.name = waveName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String waveDescription) {
        this.description = waveDescription;
    }

    public Calendar getTime() {
        return time;
    }

    public void setTime(Calendar waveTime) {
        this.time = waveTime;
    }

    public boolean getClosed() {
        return closed;
    }

    public void setClosed(boolean waveClosed) {
        this.closed = waveClosed;
    }

    public List<AccountEvent> getAccountEvents() {
        return accountEvents;
    }

    public void setAccountEvents(List<AccountEvent> accountEventList) {
        this.accountEvents = accountEventList;
    }

    public void setTemplate(FoodWaveTemplate template) {
        this.template = template;
    }

    public FoodWaveTemplate getTemplate() {
        return template;
    }

}