/*
 * 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.TARMREQUISITOPORTIPOTRAMITE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tarmrequisitoportipotramite.findAll", query = "SELECT t FROM Tarmrequisitoportipotramite t"),
    @NamedQuery(name = "Tarmrequisitoportipotramite.findByCrequisito", query = "SELECT t FROM Tarmrequisitoportipotramite t WHERE t.tarmrequisitoportipotramitePK.crequisito = :crequisito"),
    @NamedQuery(name = "Tarmrequisitoportipotramite.findByCtramite", query = "SELECT t FROM Tarmrequisitoportipotramite t WHERE t.tarmrequisitoportipotramitePK.ctramite = :ctramite"),
    @NamedQuery(name = "Tarmrequisitoportipotramite.findByDepositoportramite", query = "SELECT t FROM Tarmrequisitoportipotramite t WHERE t.depositoportramite = :depositoportramite"),
    @NamedQuery(name = "Tarmrequisitoportipotramite.findByDepositoporcustodio", query = "SELECT t FROM Tarmrequisitoportipotramite t WHERE t.depositoporcustodio = :depositoporcustodio"),
    @NamedQuery(name = "Tarmrequisitoportipotramite.findByActive", query = "SELECT t FROM Tarmrequisitoportipotramite t WHERE t.active = :active")})
public class Tarmrequisitoportipotramite implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TarmrequisitoportipotramitePK tarmrequisitoportipotramitePK;
    @Column(name = "DEPOSITOPORTRAMITE")
    private String depositoportramite;
    @Column(name = "DEPOSITOPORCUSTODIO")
    private String depositoporcustodio;
    @Column(name = "ACTIVE")
    private String active;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tarmrequisitoportipotramite")
    private Collection<Tarmsolicitudrequisitos> tarmsolicitudrequisitosCollection;
    @JoinColumn(name = "CREQUISITO", referencedColumnName = "CREQUISITO", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tarmrequisito tarmrequisito;
    @JoinColumn(name = "CTRAMITE", referencedColumnName = "CTRAMITE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tarmtramite tarmtramite;

    public Tarmrequisitoportipotramite() {
    }

    public Tarmrequisitoportipotramite(TarmrequisitoportipotramitePK tarmrequisitoportipotramitePK) {
        this.tarmrequisitoportipotramitePK = tarmrequisitoportipotramitePK;
    }

    public Tarmrequisitoportipotramite(String crequisito, long ctramite) {
        this.tarmrequisitoportipotramitePK = new TarmrequisitoportipotramitePK(crequisito, ctramite);
    }

    public TarmrequisitoportipotramitePK getTarmrequisitoportipotramitePK() {
        return tarmrequisitoportipotramitePK;
    }

    public void setTarmrequisitoportipotramitePK(TarmrequisitoportipotramitePK tarmrequisitoportipotramitePK) {
        this.tarmrequisitoportipotramitePK = tarmrequisitoportipotramitePK;
    }

    public String getDepositoportramite() {
        return depositoportramite;
    }

    public void setDepositoportramite(String depositoportramite) {
        this.depositoportramite = depositoportramite;
    }

    public String getDepositoporcustodio() {
        return depositoporcustodio;
    }

    public void setDepositoporcustodio(String depositoporcustodio) {
        this.depositoporcustodio = depositoporcustodio;
    }

    public String getActive() {
        return active;
    }

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

    @XmlTransient
    public Collection<Tarmsolicitudrequisitos> getTarmsolicitudrequisitosCollection() {
        return tarmsolicitudrequisitosCollection;
    }

    public void setTarmsolicitudrequisitosCollection(Collection<Tarmsolicitudrequisitos> tarmsolicitudrequisitosCollection) {
        this.tarmsolicitudrequisitosCollection = tarmsolicitudrequisitosCollection;
    }

    public Tarmrequisito getTarmrequisito() {
        return tarmrequisito;
    }

    public void setTarmrequisito(Tarmrequisito tarmrequisito) {
        this.tarmrequisito = tarmrequisito;
    }

    public Tarmtramite getTarmtramite() {
        return tarmtramite;
    }

    public void setTarmtramite(Tarmtramite tarmtramite) {
        this.tarmtramite = tarmtramite;
    }

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

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