EmployerUser.java

/*
 * +====================================================================+
 * |         Copyright (C) 2015 Rochester Institute of Technology,      |
 * |            103 Lomb Memorial Drive, Rochester, NY - 14623          |
 * |                        All Rights Reserved.                        |
 * +====================================================================+
 *   FILENAME
 *    EmployerUser.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;

/**
 * Created by mhickson on 2/15/15.
 */
@Entity
@Table(name = "EMPLOYERUSER", schema = "COOPEVAL_OWNER")
public class EmployerUser {

    private String employerUserId;
    private String employerEmail;
    private String employerFirstName;
    private String employerLastName;
    private String companyName;
    private String passwordHash;
    private Timestamp passwordLastChanged;
    private Timestamp createDate;
    private String createBy;
    private Timestamp modDate;
    private String modBy;
    private Collection<Evaluation> evaluationsByEmployerUserId;

    @Id
    @Column(name = "EMPLOYERUSERID", nullable = false, insertable = true, updatable = true, length = 64)
    public String getEmployerUserId() {
        return employerUserId;
    }

    public void setEmployerUserId(String employerUserId) {
        this.employerUserId = employerUserId;
    }

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

    public void setEmployerEmail(String employerEmail) {
        this.employerEmail = employerEmail;
    }

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

    public void setEmployerFirstName(String employerFirstName) {
        this.employerFirstName = employerFirstName;
    }

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

    public void setEmployerLastName(String employerLastName) {
        this.employerLastName = employerLastName;
    }

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

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    @Basic
    @Column(name = "PASSWORDHASH", nullable = true, insertable = true, updatable = true, length = 128)
    public String getPasswordHash() {
        return passwordHash;
    }

    public void setPasswordHash(String passwordHash) {
        this.passwordHash = passwordHash;
    }

    @Basic
    @Column(name = "PASSWORDLASTCHANGED", nullable = true, insertable = true, updatable = true)
    public Timestamp getPasswordLastChanged() {
        return passwordLastChanged;
    }

    public void setPasswordLastChanged(Timestamp passwordLastChanged) {
        this.passwordLastChanged = passwordLastChanged;
    }

    @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;
        }

        EmployerUser that = (EmployerUser) o;

        if (employerUserId != null ? !employerUserId.equals(that.employerUserId) : that.employerUserId != null) {
            return false;
        }
        if (companyName != null ? !companyName.equals(that.companyName) : that.companyName != null) {
            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 (employerEmail != null ? !employerEmail.equals(that.employerEmail) : that.employerEmail != null) {
            return false;
        }
        if (employerFirstName != null ? !employerFirstName.equals(
            that.employerFirstName) : that.employerFirstName != 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 (passwordHash != null ? !passwordHash.equals(that.passwordHash) : that.passwordHash != null) {
            return false;
        }
        if (passwordLastChanged != null ? !passwordLastChanged.equals(
            that.passwordLastChanged) : that.passwordLastChanged != null) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (employerUserId != null ? employerUserId.hashCode() : 0);
        ;
        result = 31 * result + (employerEmail != null ? employerEmail.hashCode() : 0);
        result = 31 * result + (employerFirstName != null ? employerFirstName.hashCode() : 0);
        result = 31 * result + (companyName != null ? companyName.hashCode() : 0);
        result = 31 * result + (passwordHash != null ? passwordHash.hashCode() : 0);
        result = 31 * result + (passwordLastChanged != null ? passwordLastChanged.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;
    }
}