maia/.svn/pristine/12/129a2c9ddeb12e8a78ebafc5c00...

208 lines
5.8 KiB
Plaintext
Executable File
Raw Permalink Blame History

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 TSAFEAUDIT*/
@Embeddable
public class TsafeAuditKey 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="COLUMNNAME", nullable=false,updatable=false)
/**
* Nombre del campo que se modifico
*/
private String columnname;
@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 TsafeAuditKey(){}
/**Contructor de TsafeAuditKey
@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 pColumnname Nombre del campo que se modifico
@param pPartitiondb Anio mes de la fecha del cambio, con este dato se particiona la tabla.
@param pRealdate Fecha real del cambio
*/
public TsafeAuditKey(Date pChangedate,String pTablename,String pColumnname,String pPartitiondb,Timestamp pRealdate){
changedate=pChangedate;
tablename=pTablename;
columnname=pColumnname;
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 columnname
@return valor de columnname*/
public String getColumnname(){
return columnname;
}
/**Fija el valor de columnname
@param pColumnname nuevo Valor de columnname*/
public void setColumnname(String pColumnname){
columnname=pColumnname;
}
/**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<63>n de la comparaci<63>n de TsafeAuditKey
@param o Objeto de comparaci<63>n
*/
public boolean equals(Object o){
if (o == null)return false;
if (! (o instanceof TsafeAuditKey))return false;
TsafeAuditKey that = (TsafeAuditKey) 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.getColumnname() == null || that.getColumnname() == null){
return false;
}
if (! this.getColumnname().equals(that.getColumnname())){
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<63>n del m<>todo hashCode bajo el patr<74>n de Bloch
@return hashCode de la instancia TsafeAuditKey
*/
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.getColumnname() == null ? 0 : this.getColumnname().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<63>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;
}
}