LogEventSeverityType.java

/*
 * +====================================================================+
 * |         Copyright (C) 2015 Rochester Institute of Technology,      |
 * |            103 Lomb Memorial Drive, Rochester, NY - 14623          |
 * |                        All Rights Reserved.                        |
 * +====================================================================+
 *   FILENAME
 *    LogEventSeverityType.java
 *
 *   AUTHOR
 *    @author Khanh Ho (kchisd at rit.edu)
 *
 * =====================================================================
 */

package edu.rit.coopeval.model;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Collection;

@Entity
@Table(name = "LOGEVENTSEVERITYTYPE")
public class LogEventSeverityType {

    private long logEventSeverityTypeId;
    private String name;
    private Timestamp createDate;
    private String createBy;
    private Timestamp modDate;
    private String modBy;
    private Collection<LogEvent> logEventsByLogEventSeverityTypeId;

    @Id
    @Column(name = "LOGEVENTSEVERITYTYPEID", nullable = false, insertable = true, updatable = true, precision = 0)
    public long getLogEventSeverityTypeId() {
        return logEventSeverityTypeId;
    }

    public void setLogEventSeverityTypeId(long logEventSeverityTypeId) {
        this.logEventSeverityTypeId = logEventSeverityTypeId;
    }

    @Basic
    @Column(name = "NAME", nullable = true, insertable = true, updatable = true, length = 64)
    public String getName() {
        return name;
    }

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

    @Basic
    @Column(name = "CREATEDATE", nullable = true, insertable = true, updatable = true)
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Column(name = "CREATEBY", nullable = true, insertable = true, updatable = true, length = 15)
    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    @Basic
    @Column(name = "MODDATE", nullable = true, insertable = true, updatable = true)
    public Timestamp getModDate() {
        return modDate;
    }

    public void setModDate(Timestamp modDate) {
        this.modDate = modDate;
    }

    @Basic
    @Column(name = "MODBY", nullable = true, insertable = true, updatable = true, length = 15)
    public String getModBy() {
        return modBy;
    }

    public void setModBy(String modBy) {
        this.modBy = modBy;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        LogEventSeverityType that = (LogEventSeverityType) o;

        if (logEventSeverityTypeId != that.logEventSeverityTypeId) {
            return false;
        }
        if (createBy != null ? !createBy.equals(that.createBy) : that.createBy != null) {
            return false;
        }
        if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) {
            return false;
        }
        if (modBy != null ? !modBy.equals(that.modBy) : that.modBy != null) {
            return false;
        }
        if (modDate != null ? !modDate.equals(that.modDate) : that.modDate != null) {
            return false;
        }
        if (name != null ? !name.equals(that.name) : that.name != null) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (logEventSeverityTypeId ^ (logEventSeverityTypeId >>> 32));
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + (createBy != null ? createBy.hashCode() : 0);
        result = 31 * result + (modDate != null ? modDate.hashCode() : 0);
        result = 31 * result + (modBy != null ? modBy.hashCode() : 0);
        return result;
    }

    @OneToMany(mappedBy = "logEventSeverityTypeByLogEventSeverityTypeId")
    public Collection<LogEvent> getLogEventsByLogEventSeverityTypeId() {
        return logEventsByLogEventSeverityTypeId;
    }

    public void setLogEventsByLogEventSeverityTypeId(Collection<LogEvent> logEventsByLogEventSeverityTypeId) {
        this.logEventsByLogEventSeverityTypeId = logEventsByLogEventSeverityTypeId;
    }
}