/*
 * 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.Entity;
import javax.persistence.Id;
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.TGENECIIU")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgeneciiu.findAll", query = "SELECT t FROM Tgeneciiu t"),
    @NamedQuery(name = "Tgeneciiu.findByCiiucode", query = "SELECT t FROM Tgeneciiu t WHERE t.ciiucode = :ciiucode"),
    @NamedQuery(name = "Tgeneciiu.findByDescription", query = "SELECT t FROM Tgeneciiu t WHERE t.description = :description"),
    @NamedQuery(name = "Tgeneciiu.findByLastnode", query = "SELECT t FROM Tgeneciiu t WHERE t.lastnode = :lastnode"),
    @NamedQuery(name = "Tgeneciiu.findByLevelcode", query = "SELECT t FROM Tgeneciiu t WHERE t.levelcode = :levelcode")})
public class Tgeneciiu implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CIIUCODE")
    private String ciiucode;
    @Column(name = "DESCRIPTION")
    private String description;
    @Column(name = "LASTNODE")
    private String lastnode;
    @Column(name = "LEVELCODE")
    private Short levelcode;
    @OneToMany(mappedBy = "parentcode")
    private Collection<Tgeneciiu> tgeneciiuCollection;
    @JoinColumn(name = "PARENTCODE", referencedColumnName = "CIIUCODE")
    @ManyToOne
    private Tgeneciiu parentcode;
    @OneToMany(mappedBy = "ciiucode")
    private Collection<Tgeneactivity> tgeneactivityCollection;

    public Tgeneciiu() {
    }

    public Tgeneciiu(String ciiucode) {
        this.ciiucode = ciiucode;
    }

    public String getCiiucode() {
        return ciiucode;
    }

    public void setCiiucode(String ciiucode) {
        this.ciiucode = ciiucode;
    }

    public String getDescription() {
        return description;
    }

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

    public String getLastnode() {
        return lastnode;
    }

    public void setLastnode(String lastnode) {
        this.lastnode = lastnode;
    }

    public Short getLevelcode() {
        return levelcode;
    }

    public void setLevelcode(Short levelcode) {
        this.levelcode = levelcode;
    }

    @XmlTransient
    public Collection<Tgeneciiu> getTgeneciiuCollection() {
        return tgeneciiuCollection;
    }

    public void setTgeneciiuCollection(Collection<Tgeneciiu> tgeneciiuCollection) {
        this.tgeneciiuCollection = tgeneciiuCollection;
    }

    public Tgeneciiu getParentcode() {
        return parentcode;
    }

    public void setParentcode(Tgeneciiu parentcode) {
        this.parentcode = parentcode;
    }

    @XmlTransient
    public Collection<Tgeneactivity> getTgeneactivityCollection() {
        return tgeneactivityCollection;
    }

    public void setTgeneactivityCollection(Collection<Tgeneactivity> tgeneactivityCollection) {
        this.tgeneactivityCollection = tgeneactivityCollection;
    }

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

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