LogEntry.java 2.64 KB
/*
 * Copyright Codecrew Ry
 * 
 * All rights reserved.
 * 
 * This license applies to any software containing a notice placed by the 
 * copyright holder. Such software is herein referred to as the Software. 
 * This license covers modification, distribution and use of the Software. 
 * 
 * Any distribution and use in source and binary forms, with or without 
 * modification is not permitted without explicit written permission from the 
 * copyright owner. 
 * 
 * A non-exclusive royalty-free right is granted to the copyright owner of the 
 * Software to use, modify and distribute all modifications to the Software in 
 * future versions of the Software. 
 * 
 */
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fi.codecrew.moya.model;

import static javax.persistence.TemporalType.TIMESTAMP;

import java.util.Calendar;

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

/**
 * 
 */
@Entity
@Table(name = "event_log")
public class LogEntry extends GenericEntity {

    private static final long serialVersionUID = 1L;

    @ManyToOne
    private LanEvent parentEvent;

    @Column(name = "event_time", nullable = false)
    @Temporal(TIMESTAMP)
    private Calendar time = Calendar.getInstance();

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

    @JoinColumn(name = "event_log_type_id", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private LogEntryType type;

    @JoinColumn(name = "user_id", referencedColumnName = "id")
    @ManyToOne
    private User user;

    public LogEntry() {
    }

    public LogEntry(Calendar eventTime) {
        this.time = eventTime;
    }

    public Calendar getTime() {
        return time;
    }

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

    public String getDescription() {
        return description;
    }

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

    public LogEntryType getType() {
        return type;
    }

    public void setType(LogEntryType eventLogTypesId) {
        this.type = eventLogTypesId;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User usersId) {
        this.user = usersId;
    }

    public void setParentEvent(LanEvent parentEvent) {
        this.parentEvent = parentEvent;
    }

    public LanEvent getParentEvent() {
        return parentEvent;
    }
}