/*
 * 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.fp.persistence.parmas.soli;

import com.fp.dto.hb.HibernateBean;
import com.fp.dto.hb.Log;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 *
 * @author developer2
 */
@Entity(name = "TarmInvoiceHistory")
@Table(name = "TARMINVOICEHISTORY")
public class TarmInvoiceHistory extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log {
    /**
     * HashCode asociado con la Instancia
     */
    @Transient
    private int hashValue = 0;
    /**
     * Version de la Clase
     */
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer pk;
    @Basic(optional = false)
    @Column(name = "usercode")
    private String usercode;
    @Column(name = "registrationdate")
    private Timestamp registrationdate;
    @Column(name = "csolicitud")
    private String csolicitud;
    @Column(name = "solicitudnumber")
    private String solicitudnumber;
    @Column(name = "tramitenumber")
    private String tramitenumber;
    @Column(name = "pathfile")
    private String pathfile;
    @Column(name = "contentfile")
    private String contentfile;
    public TarmInvoiceHistory() {    
    }
    public TarmInvoiceHistory(Integer ppk) {  
        this();
        pk=ppk;
    }
    /**
     * Getters y setters
     */
    public Integer getPk() {
        return pk;
    }

    public void setPk(Integer pk) {
        this.pk = pk;
    }

    public String getUsercode() {
        return usercode;
    }

    public void setUsercode(String usercode) {
        this.usercode = usercode;
    }

    public Timestamp getRegistrationdate() {
        return registrationdate;
    }

    public void setRegistrationdate(Timestamp registrationdate) {
        this.registrationdate = registrationdate;
    }

    public String getCsolicitud() {
        return csolicitud;
    }

    public void setCsolicitud(String csolicitud) {
        this.csolicitud = csolicitud;
    }

    public String getSolicitudnumber() {
        return solicitudnumber;
    }

    public void setSolicitudnumber(String solicitudnumber) {
        this.solicitudnumber = solicitudnumber;
    }

    public String getTramitenumber() {
        return tramitenumber;
    }

    public void setTramitenumber(String tramitenumber) {
        this.tramitenumber = tramitenumber;
    }

    public String getPathfile() {
        return pathfile;
    }

    public void setPathfile(String pathfile) {
        this.pathfile = pathfile;
    }

    public String getContentfile() {
        return contentfile;
    }

    public void setContentfile(String contentfile) {
        this.contentfile = contentfile;
    }
    
    /**
     * Metodo que entrega datos de la tabla dada la clave primaria.
     *
     * @param pEntityManager referencia de la session a obtener datos del bean.
     * @param pKey Caleve primaria del bean.
     * @return TarmArmaPruebas
     */
    public static TarmInvoiceHistory find(EntityManager pEntityManager, Object pKey) throws Exception {
        TarmInvoiceHistory obj = pEntityManager.find(TarmInvoiceHistory.class, pKey);
        return obj;
    }
    
    public boolean equals(Object rhs) {
        if (rhs == null) {
            return false;
        }
        if (!(rhs instanceof TarmInvoiceHistory)) {
            return false;
        }
        TarmInvoiceHistory that = (TarmInvoiceHistory) rhs;
        if (this.getPk() == null || that.getPk() == null) {
            return false;
        }
        return (this.getPk().equals(that.getPk()));
    }
    
    /**
     * Implementacion del metodo hashCode de la la entidad TarmArmaPruebas
     *
     * @return el hashCode la instancia
     */
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pk != null ? pk.hashCode() : 0);
        return hash;
    }
    /**
    public int hashCode() {
        if (this.hashValue == 0) {
            int result = 17;
            if (this.getPk() == null) {
                result = super.hashCode();
            } else {
                result = this.getPk().hashCode();
            }
            this.hashValue = result;
        }
        return this.hashValue;
    }*/
    
    /**
     * Implementacion toString
     */
    public String toString() {
        Field[] fs = this.getClass().getDeclaredFields();
        String data = "";
        for (Field f : fs) {
            try {
                String name = f.getName();
                if (f.getType().getName().compareTo("java.util.Set") == 0) {
                    continue;
                }
                if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) {
                    continue;
                }
                data += name + "=" + f.get(this) + ";";
            } catch (Exception e) {
                continue;
            }
        }
        if (data.compareTo("") == 0) {
            data = super.toString();
        }
        return data;
    }
    
    /**
     * Implementacion de la creacion de un bean en blanco 
     */
    public Object createInstance() {
        TarmInvoiceHistory instance = new TarmInvoiceHistory();
        return instance;
    }

     /**
     * Clona la entidad TarmInvoiceHistory
     *
     * @see com.fp.dto.hb.HibernateBean#cloneMe()
     */
    public Object cloneMe() throws CloneNotSupportedException {
        TarmInvoiceHistory p = (TarmInvoiceHistory) this.clone();
        return p;
    }

}   