/*
 * 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.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.TGENEMENULEVEL")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenemenulevel.findAll", query = "SELECT t FROM Tgenemenulevel t"),
    @NamedQuery(name = "Tgenemenulevel.findByMenucode", query = "SELECT t FROM Tgenemenulevel t WHERE t.tgenemenulevelPK.menucode = :menucode"),
    @NamedQuery(name = "Tgenemenulevel.findByLevelcode", query = "SELECT t FROM Tgenemenulevel t WHERE t.tgenemenulevelPK.levelcode = :levelcode"),
    @NamedQuery(name = "Tgenemenulevel.findByPresentationorder", query = "SELECT t FROM Tgenemenulevel t WHERE t.presentationorder = :presentationorder"),
    @NamedQuery(name = "Tgenemenulevel.findByHavesublevel", query = "SELECT t FROM Tgenemenulevel t WHERE t.havesublevel = :havesublevel")})
public class Tgenemenulevel implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenemenulevelPK tgenemenulevelPK;
    @Column(name = "PRESENTATIONORDER")
    private Short presentationorder;
    @Column(name = "HAVESUBLEVEL")
    private String havesublevel;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenemenulevel")
    private Collection<Tgenemenuleveldesc> tgenemenuleveldescCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenemenulevel")
    private Collection<Tgenemenusublevel> tgenemenusublevelCollection;
    @JoinColumn(name = "MENUCODE", referencedColumnName = "MENUCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenemenu tgenemenu;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenemenulevel")
    private Collection<Tgenemenuleveltran> tgenemenuleveltranCollection;

    public Tgenemenulevel() {
    }

    public Tgenemenulevel(TgenemenulevelPK tgenemenulevelPK) {
        this.tgenemenulevelPK = tgenemenulevelPK;
    }

    public Tgenemenulevel(int menucode, int levelcode) {
        this.tgenemenulevelPK = new TgenemenulevelPK(menucode, levelcode);
    }

    public TgenemenulevelPK getTgenemenulevelPK() {
        return tgenemenulevelPK;
    }

    public void setTgenemenulevelPK(TgenemenulevelPK tgenemenulevelPK) {
        this.tgenemenulevelPK = tgenemenulevelPK;
    }

    public Short getPresentationorder() {
        return presentationorder;
    }

    public void setPresentationorder(Short presentationorder) {
        this.presentationorder = presentationorder;
    }

    public String getHavesublevel() {
        return havesublevel;
    }

    public void setHavesublevel(String havesublevel) {
        this.havesublevel = havesublevel;
    }

    @XmlTransient
    public Collection<Tgenemenuleveldesc> getTgenemenuleveldescCollection() {
        return tgenemenuleveldescCollection;
    }

    public void setTgenemenuleveldescCollection(Collection<Tgenemenuleveldesc> tgenemenuleveldescCollection) {
        this.tgenemenuleveldescCollection = tgenemenuleveldescCollection;
    }

    @XmlTransient
    public Collection<Tgenemenusublevel> getTgenemenusublevelCollection() {
        return tgenemenusublevelCollection;
    }

    public void setTgenemenusublevelCollection(Collection<Tgenemenusublevel> tgenemenusublevelCollection) {
        this.tgenemenusublevelCollection = tgenemenusublevelCollection;
    }

    public Tgenemenu getTgenemenu() {
        return tgenemenu;
    }

    public void setTgenemenu(Tgenemenu tgenemenu) {
        this.tgenemenu = tgenemenu;
    }

    @XmlTransient
    public Collection<Tgenemenuleveltran> getTgenemenuleveltranCollection() {
        return tgenemenuleveltranCollection;
    }

    public void setTgenemenuleveltranCollection(Collection<Tgenemenuleveltran> tgenemenuleveltranCollection) {
        this.tgenemenuleveltranCollection = tgenemenuleveltranCollection;
    }

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

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