package com.fp.persistence.pgeneral.safe; import java.sql.Timestamp; import javax.persistence.Column; import java.io.Serializable; import com.fp.dto.hb.HibernateId; import java.lang.reflect.Field; import javax.persistence.Embeddable; import javax.persistence.Transient; import java.sql.Date; /**Clase que hace referencia a la Clave Primaria de TSAFEAUDITINSDEL*/ @Embeddable public class TsafeAuditInsDelKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ /** * HashCode asociado con la Instancia */ @Transient private int hashValue = 0; /** * Version de la Clase */ private static final long serialVersionUID = 1L; @Column(name="CHANGEDATE", nullable=false,updatable=false) /** * Fecha del log, es la fecha en la que se realizo el cambio de una tabla */ private Date changedate; @Column(name="TABLENAME", nullable=false,updatable=false) /** * Nombre de la tabla */ private String tablename; @Column(name="PARTITIONDB", nullable=false,updatable=false) /** * Anio mes de la fecha del cambio, con este dato se particiona la tabla. */ private String partitiondb; @Column(name="REALDATE", nullable=false,updatable=false) /** * Fecha real del cambio */ private Timestamp realdate; /**Contructor por defecto*/ public TsafeAuditInsDelKey(){} /**Contructor de TsafeAuditInsDelKey @param pChangedate Fecha del log, es la fecha en la que se realizo el cambio de una tabla @param pTablename Nombre de la tabla @param pPartitiondb Anio mes de la fecha del cambio, con este dato se particiona la tabla. @param pRealdate Fecha real del cambio */ public TsafeAuditInsDelKey(Date pChangedate,String pTablename,String pPartitiondb,Timestamp pRealdate){ changedate=pChangedate; tablename=pTablename; partitiondb=pPartitiondb; realdate=pRealdate; } /**Obtiene el valor de changedate @return valor de changedate*/ public Date getChangedate(){ return changedate; } /**Fija el valor de changedate @param pChangedate nuevo Valor de changedate*/ public void setChangedate(Date pChangedate){ changedate=pChangedate; } /**Obtiene el valor de tablename @return valor de tablename*/ public String getTablename(){ return tablename; } /**Fija el valor de tablename @param pTablename nuevo Valor de tablename*/ public void setTablename(String pTablename){ tablename=pTablename; } /**Obtiene el valor de partitiondb @return valor de partitiondb*/ public String getPartitiondb(){ return partitiondb; } /**Fija el valor de partitiondb @param pPartitiondb nuevo Valor de partitiondb*/ public void setPartitiondb(String pPartitiondb){ partitiondb=pPartitiondb; } /**Obtiene el valor de realdate @return valor de realdate*/ public Timestamp getRealdate(){ return realdate; } /**Fija el valor de realdate @param pRealdate nuevo Valor de realdate*/ public void setRealdate(Timestamp pRealdate){ realdate=pRealdate; } /**Implementación de la comparación de TsafeAuditInsDelKey @param o Objeto de comparación */ public boolean equals(Object o){ if (o == null)return false; if (! (o instanceof TsafeAuditInsDelKey))return false; TsafeAuditInsDelKey that = (TsafeAuditInsDelKey) o; if (this.getChangedate() == null || that.getChangedate() == null){ return false; } if (! this.getChangedate().equals(that.getChangedate())){ return false; } if (this.getTablename() == null || that.getTablename() == null){ return false; } if (! this.getTablename().equals(that.getTablename())){ return false; } if (this.getPartitiondb() == null || that.getPartitiondb() == null){ return false; } if (! this.getPartitiondb().equals(that.getPartitiondb())){ return false; } if (this.getRealdate() == null || that.getRealdate() == null){ return false; } if (! this.getRealdate().equals(that.getRealdate())){ return false; } return true; } /**Implementación del método hashCode bajo el patrón de Bloch @return hashCode de la instancia TsafeAuditInsDelKey */ public int hashCode(){ if (this.hashValue == 0){ int result = 17; result = result * 37 + (this.getChangedate() == null ? 0 : this.getChangedate().hashCode()); result = result * 37 + (this.getTablename() == null ? 0 : this.getTablename().hashCode()); result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); this.hashValue = result; } return this.hashValue; } public Object cloneMe() throws CloneNotSupportedException { return this.clone(); } /**Implementación 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+="pk."+name+"="+f.get(this)+";"; }catch(Exception e){ continue; } } if(data.compareTo("")==0){ data=super.toString(); } return data; } }