/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.qsoft.rs.sincoar.model;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TGENEMESSAGETEMPLATES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenemessagetemplates.findAll", query = "SELECT t FROM Tgenemessagetemplates t"),
    @NamedQuery(name = "Tgenemessagetemplates.findByCode", query = "SELECT t FROM Tgenemessagetemplates t WHERE t.code = :code"),
    @NamedQuery(name = "Tgenemessagetemplates.findByRecordversion", query = "SELECT t FROM Tgenemessagetemplates t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgenemessagetemplates.findByDescription", query = "SELECT t FROM Tgenemessagetemplates t WHERE t.description = :description")})
public class Tgenemessagetemplates implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CODE")
    private Short code;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "DESCRIPTION")
    private String description;
    @OneToMany(mappedBy = "messagecode")
    private Collection<Tbpmrules> tbpmrulesCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenemessagetemplates")
    private Collection<Tgenemessagetemplatesdesc> tgenemessagetemplatesdescCollection;

    public Tgenemessagetemplates() {
    }

    public Tgenemessagetemplates(Short code) {
        this.code = code;
    }

    public Short getCode() {
        return code;
    }

    public void setCode(Short code) {
        this.code = code;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

    public void setRecordversion(BigInteger recordversion) {
        this.recordversion = recordversion;
    }

    public String getDescription() {
        return description;
    }

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

    @XmlTransient
    public Collection<Tbpmrules> getTbpmrulesCollection() {
        return tbpmrulesCollection;
    }

    public void setTbpmrulesCollection(Collection<Tbpmrules> tbpmrulesCollection) {
        this.tbpmrulesCollection = tbpmrulesCollection;
    }

    @XmlTransient
    public Collection<Tgenemessagetemplatesdesc> getTgenemessagetemplatesdescCollection() {
        return tgenemessagetemplatesdescCollection;
    }

    public void setTgenemessagetemplatesdescCollection(Collection<Tgenemessagetemplatesdesc> tgenemessagetemplatesdescCollection) {
        this.tgenemessagetemplatesdescCollection = tgenemessagetemplatesdescCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (code != null ? code.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 Tgenemessagetemplates)) {
            return false;
        }
        Tgenemessagetemplates other = (Tgenemessagetemplates) object;
        if ((this.code == null && other.code != null) || (this.code != null && !this.code.equals(other.code))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.qsoft.rs.sincoar.model.Tgenemessagetemplates[ code=" + code + " ]";
    }
    
}
