/*
 * 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.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
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.TGENEREPORT")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenereport.findAll", query = "SELECT t FROM Tgenereport t"),
    @NamedQuery(name = "Tgenereport.findByReportcode", query = "SELECT t FROM Tgenereport t WHERE t.tgenereportPK.reportcode = :reportcode"),
    @NamedQuery(name = "Tgenereport.findByModulecode", query = "SELECT t FROM Tgenereport t WHERE t.tgenereportPK.modulecode = :modulecode"),
    @NamedQuery(name = "Tgenereport.findByDescription", query = "SELECT t FROM Tgenereport t WHERE t.description = :description"),
    @NamedQuery(name = "Tgenereport.findByRecordversion", query = "SELECT t FROM Tgenereport t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgenereport.findByReportname", query = "SELECT t FROM Tgenereport t WHERE t.reportname = :reportname"),
    @NamedQuery(name = "Tgenereport.findByPath", query = "SELECT t FROM Tgenereport t WHERE t.path = :path")})
public class Tgenereport implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenereportPK tgenereportPK;
    @Basic(optional = false)
    @Column(name = "DESCRIPTION")
    private String description;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "REPORTNAME")
    private String reportname;
    @Column(name = "PATH")
    private String path;
    @ManyToMany(mappedBy = "tgenereportCollection")
    private Collection<Tgenesubproduct> tgenesubproductCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenereport")
    private Collection<Tgenereportdetail> tgenereportdetailCollection;
    @JoinColumn(name = "MODULECODE", referencedColumnName = "MODULECODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenemodule tgenemodule;

    public Tgenereport() {
    }

    public Tgenereport(TgenereportPK tgenereportPK) {
        this.tgenereportPK = tgenereportPK;
    }

    public Tgenereport(TgenereportPK tgenereportPK, String description) {
        this.tgenereportPK = tgenereportPK;
        this.description = description;
    }

    public Tgenereport(String reportcode, String modulecode) {
        this.tgenereportPK = new TgenereportPK(reportcode, modulecode);
    }

    public TgenereportPK getTgenereportPK() {
        return tgenereportPK;
    }

    public void setTgenereportPK(TgenereportPK tgenereportPK) {
        this.tgenereportPK = tgenereportPK;
    }

    public String getDescription() {
        return description;
    }

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

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public String getReportname() {
        return reportname;
    }

    public void setReportname(String reportname) {
        this.reportname = reportname;
    }

    public String getPath() {
        return path;
    }

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

    @XmlTransient
    public Collection<Tgenesubproduct> getTgenesubproductCollection() {
        return tgenesubproductCollection;
    }

    public void setTgenesubproductCollection(Collection<Tgenesubproduct> tgenesubproductCollection) {
        this.tgenesubproductCollection = tgenesubproductCollection;
    }

    @XmlTransient
    public Collection<Tgenereportdetail> getTgenereportdetailCollection() {
        return tgenereportdetailCollection;
    }

    public void setTgenereportdetailCollection(Collection<Tgenereportdetail> tgenereportdetailCollection) {
        this.tgenereportdetailCollection = tgenereportdetailCollection;
    }

    public Tgenemodule getTgenemodule() {
        return tgenemodule;
    }

    public void setTgenemodule(Tgenemodule tgenemodule) {
        this.tgenemodule = tgenemodule;
    }

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

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