/*
 * 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.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
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.TBPMGROUPS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tbpmgroups.findAll", query = "SELECT t FROM Tbpmgroups t"),
    @NamedQuery(name = "Tbpmgroups.findByGroupcode", query = "SELECT t FROM Tbpmgroups t WHERE t.tbpmgroupsPK.groupcode = :groupcode"),
    @NamedQuery(name = "Tbpmgroups.findByCompanycode", query = "SELECT t FROM Tbpmgroups t WHERE t.tbpmgroupsPK.companycode = :companycode"),
    @NamedQuery(name = "Tbpmgroups.findByDescription", query = "SELECT t FROM Tbpmgroups t WHERE t.description = :description"),
    @NamedQuery(name = "Tbpmgroups.findByEmail", query = "SELECT t FROM Tbpmgroups t WHERE t.email = :email"),
    @NamedQuery(name = "Tbpmgroups.findByRecordversion", query = "SELECT t FROM Tbpmgroups t WHERE t.recordversion = :recordversion")})
public class Tbpmgroups implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TbpmgroupsPK tbpmgroupsPK;
    @Column(name = "DESCRIPTION")
    private String description;
    @Column(name = "EMAIL")
    private String email;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tbpmgroups")
    private Collection<Tbpmgroupsusers> tbpmgroupsusersCollection;
    @OneToMany(mappedBy = "tbpmgroups")
    private Collection<Tbpmactivities> tbpmactivitiesCollection;
    @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecompany tgenecompany;

    public Tbpmgroups() {
    }

    public Tbpmgroups(TbpmgroupsPK tbpmgroupsPK) {
        this.tbpmgroupsPK = tbpmgroupsPK;
    }

    public Tbpmgroups(String groupcode, long companycode) {
        this.tbpmgroupsPK = new TbpmgroupsPK(groupcode, companycode);
    }

    public TbpmgroupsPK getTbpmgroupsPK() {
        return tbpmgroupsPK;
    }

    public void setTbpmgroupsPK(TbpmgroupsPK tbpmgroupsPK) {
        this.tbpmgroupsPK = tbpmgroupsPK;
    }

    public String getDescription() {
        return description;
    }

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

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    @XmlTransient
    public Collection<Tbpmgroupsusers> getTbpmgroupsusersCollection() {
        return tbpmgroupsusersCollection;
    }

    public void setTbpmgroupsusersCollection(Collection<Tbpmgroupsusers> tbpmgroupsusersCollection) {
        this.tbpmgroupsusersCollection = tbpmgroupsusersCollection;
    }

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

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

    public Tgenecompany getTgenecompany() {
        return tgenecompany;
    }

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

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

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