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

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

/**
 * 
 */
@Entity
@Table(name = "maps")
@NamedQueries({
        @NamedQuery(name = "EventMap.findAll", query = "SELECT e FROM EventMap e"),
        @NamedQuery(name = "EventMap.findByName", query = "SELECT e FROM EventMap e WHERE e.name = :name") })
public class EventMap extends GenericEventChild {

    /**
     * 
     */
    private static final long serialVersionUID = 3411450245513673619L;

    @Lob
    @Column(name = "map_data")
    private byte[] mapData;

    @Column(name = "map_name")
    private String name;

    @OrderBy("name")
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "map")
    private List<Place> places = new ArrayList<Place>();

    @OneToMany(mappedBy = "eventMap")
    private List<Reader> readers;

    @Column(nullable = false)
    private boolean active = true;

    @Column(name = "notes")
    @Lob
    private String notes;

    public EventMap() {
        super();
    }

    public EventMap(LanEvent event) {
        super(event);
    }

    public String getName() {
        return name;
    }

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

    public List<Place> getPlaces() {
        return places;
    }

    public void setPlaces(List<Place> placeList) {
        this.places = placeList;
    }

    /**
     * @return the readers
     */
    public List<Reader> getReaders() {
        return readers;
    }

    /**
     * @param readers
     *            the readers to set
     */
    public void setReaders(List<Reader> readers) {
        this.readers = readers;
    }

    public void setMapData(byte[] mapData) {
        this.mapData = mapData;
    }

    public byte[] getMapData() {
        return mapData;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public boolean isActive() {
        return active;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public String getNotes() {
        return notes;
    }

}