/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hu.nir.nmail.ejb.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author attila
 */
@Entity
@Table(name = "user_proces")
@Inheritance(strategy=InheritanceType.JOINED)
@SequenceGenerator(name="USER_PROCES_SEQUENCE", sequenceName="USER_PROCES_ID_SEQ")
public class UserProces implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="USER_PROCES_SEQUENCE")
    private Long id;
    @Column(name = "proces_type", nullable = false)
    private String procesType;
    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable=false)
    @ManyToOne
    private NmailUser userId;

    public UserProces() {
    }

    public UserProces(Long id) {
        this.id = id;
    }

    public UserProces(Long id, String procesType) {
        this.id = id;
        this.procesType = procesType;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProcesType() {
        return procesType;
    }

    public void setProcesType(String procesType) {
        this.procesType = procesType;
    }

    public NmailUser getUserId() {
        return userId;
    }

    public void setUserId(NmailUser userId) {
        this.userId = userId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserProces)) {
            return false;
        }
        UserProces other = (UserProces) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "hu.nir.nmail.ejb.entity.UserProces[id=" + id + "]";
    }

}
