/*
 * 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.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
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.TBPMRULES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tbpmrules.findAll", query = "SELECT t FROM Tbpmrules t"),
    @NamedQuery(name = "Tbpmrules.findByRulecode", query = "SELECT t FROM Tbpmrules t WHERE t.tbpmrulesPK.rulecode = :rulecode"),
    @NamedQuery(name = "Tbpmrules.findByCompanycode", query = "SELECT t FROM Tbpmrules t WHERE t.tbpmrulesPK.companycode = :companycode"),
    @NamedQuery(name = "Tbpmrules.findByDescription", query = "SELECT t FROM Tbpmrules t WHERE t.description = :description"),
    @NamedQuery(name = "Tbpmrules.findByPackagename", query = "SELECT t FROM Tbpmrules t WHERE t.packagename = :packagename"),
    @NamedQuery(name = "Tbpmrules.findBySnapshot", query = "SELECT t FROM Tbpmrules t WHERE t.snapshot = :snapshot"),
    @NamedQuery(name = "Tbpmrules.findByActive", query = "SELECT t FROM Tbpmrules t WHERE t.active = :active"),
    @NamedQuery(name = "Tbpmrules.findByRefresh", query = "SELECT t FROM Tbpmrules t WHERE t.refresh = :refresh"),
    @NamedQuery(name = "Tbpmrules.findByParametertype", query = "SELECT t FROM Tbpmrules t WHERE t.parametertype = :parametertype"),
    @NamedQuery(name = "Tbpmrules.findByPath", query = "SELECT t FROM Tbpmrules t WHERE t.path = :path"),
    @NamedQuery(name = "Tbpmrules.findByFiletype", query = "SELECT t FROM Tbpmrules t WHERE t.filetype = :filetype")})
public class Tbpmrules implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TbpmrulesPK tbpmrulesPK;
    @Column(name = "DESCRIPTION")
    private String description;
    @Basic(optional = false)
    @Column(name = "PACKAGENAME")
    private String packagename;
    @Column(name = "SNAPSHOT")
    private String snapshot;
    @Column(name = "ACTIVE")
    private String active;
    @Column(name = "REFRESH")
    private String refresh;
    @Column(name = "PARAMETERTYPE")
    private String parametertype;
    @Lob
    @Column(name = "CONTENT")
    private Serializable content;
    @Column(name = "PATH")
    private String path;
    @Column(name = "FILETYPE")
    private String filetype;
    @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecompany tgenecompany;
    @JoinColumn(name = "MESSAGECODE", referencedColumnName = "CODE")
    @ManyToOne
    private Tgenemessagetemplates messagecode;
    @OneToMany(mappedBy = "tbpmrules")
    private Collection<Tbpmactivities> tbpmactivitiesCollection;
    @OneToMany(mappedBy = "tbpmrules1")
    private Collection<Tbpmactivities> tbpmactivitiesCollection1;
    @OneToMany(mappedBy = "tbpmrules")
    private Collection<Tgenetransactionprocess> tgenetransactionprocessCollection;
    @OneToMany(mappedBy = "tbpmrules")
    private Collection<Tbpmprocessinstance> tbpmprocessinstanceCollection;

    public Tbpmrules() {
    }

    public Tbpmrules(TbpmrulesPK tbpmrulesPK) {
        this.tbpmrulesPK = tbpmrulesPK;
    }

    public Tbpmrules(TbpmrulesPK tbpmrulesPK, String packagename) {
        this.tbpmrulesPK = tbpmrulesPK;
        this.packagename = packagename;
    }

    public Tbpmrules(String rulecode, long companycode) {
        this.tbpmrulesPK = new TbpmrulesPK(rulecode, companycode);
    }

    public TbpmrulesPK getTbpmrulesPK() {
        return tbpmrulesPK;
    }

    public void setTbpmrulesPK(TbpmrulesPK tbpmrulesPK) {
        this.tbpmrulesPK = tbpmrulesPK;
    }

    public String getDescription() {
        return description;
    }

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

    public String getPackagename() {
        return packagename;
    }

    public void setPackagename(String packagename) {
        this.packagename = packagename;
    }

    public String getSnapshot() {
        return snapshot;
    }

    public void setSnapshot(String snapshot) {
        this.snapshot = snapshot;
    }

    public String getActive() {
        return active;
    }

    public void setActive(String active) {
        this.active = active;
    }

    public String getRefresh() {
        return refresh;
    }

    public void setRefresh(String refresh) {
        this.refresh = refresh;
    }

    public String getParametertype() {
        return parametertype;
    }

    public void setParametertype(String parametertype) {
        this.parametertype = parametertype;
    }

    public Serializable getContent() {
        return content;
    }

    public void setContent(Serializable content) {
        this.content = content;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getFiletype() {
        return filetype;
    }

    public void setFiletype(String filetype) {
        this.filetype = filetype;
    }

    public Tgenecompany getTgenecompany() {
        return tgenecompany;
    }

    public void setTgenecompany(Tgenecompany tgenecompany) {
        this.tgenecompany = tgenecompany;
    }

    public Tgenemessagetemplates getMessagecode() {
        return messagecode;
    }

    public void setMessagecode(Tgenemessagetemplates messagecode) {
        this.messagecode = messagecode;
    }

    @XmlTransient
    public Collection<Tbpmactivities> getTbpmactivitiesCollection() {
        return tbpmactivitiesCollection;
    }

    public void setTbpmactivitiesCollection(Collection<Tbpmactivities> tbpmactivitiesCollection) {
        this.tbpmactivitiesCollection = tbpmactivitiesCollection;
    }

    @XmlTransient
    public Collection<Tbpmactivities> getTbpmactivitiesCollection1() {
        return tbpmactivitiesCollection1;
    }

    public void setTbpmactivitiesCollection1(Collection<Tbpmactivities> tbpmactivitiesCollection1) {
        this.tbpmactivitiesCollection1 = tbpmactivitiesCollection1;
    }

    @XmlTransient
    public Collection<Tgenetransactionprocess> getTgenetransactionprocessCollection() {
        return tgenetransactionprocessCollection;
    }

    public void setTgenetransactionprocessCollection(Collection<Tgenetransactionprocess> tgenetransactionprocessCollection) {
        this.tgenetransactionprocessCollection = tgenetransactionprocessCollection;
    }

    @XmlTransient
    public Collection<Tbpmprocessinstance> getTbpmprocessinstanceCollection() {
        return tbpmprocessinstanceCollection;
    }

    public void setTbpmprocessinstanceCollection(Collection<Tbpmprocessinstance> tbpmprocessinstanceCollection) {
        this.tbpmprocessinstanceCollection = tbpmprocessinstanceCollection;
    }

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

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