package com.fitbank.hb.persistence.uci;

import java.io.Serializable;
import java.sql.Date;
import java.lang.reflect.Field;
import java.sql.Timestamp;

/**Clase que hace referencia a la Clave Primaria de TLOGMENSAJES*/
public class TmessagelogKey    implements Serializable,Cloneable{
/**
* HashCode asociado con la Instancia
*/
private volatile int hashValue = 0;
/**
* Version de la Clase
*/
private static final long serialVersionUID = 1L;
/**
* Numero de mensaje de FIT
*/
private String numeromensaje;

/**
* Fecha real de la transaccion
*/
private Timestamp freal;

/**
* Codigo del canal en el que se origina la transaccion
*/
private String ccanal;

/**
* Fecha contable de la transaccion
*/
private Date fcontable;

/**Contructor por defecto*/
public TmessagelogKey(){}
/**Contructor de TmessagelogKey
@param pNumeromensaje Numero de mensaje de FIT
@param pFreal Fecha real de la transaccion
@param pCcanal Codigo del canal en el que se origina la transaccion
@param pFcontable Fecha contable de la transaccion
*/
public TmessagelogKey(String pNumeromensaje,Timestamp pFreal,String pCcanal,Date pFcontable){
 numeromensaje=pNumeromensaje;
 freal=pFreal;
 ccanal=pCcanal;
 fcontable=pFcontable;
}
/**Obtiene el valor de numeromensaje
@return valor de numeromensaje*/
public String getNumeromensaje(){
  return numeromensaje;
}
/**Fija el valor de numeromensaje
@param pNumeromensaje nuevo Valor de numeromensaje*/
public void setNumeromensaje(String pNumeromensaje){
  numeromensaje=pNumeromensaje;
}

/**Obtiene el valor de freal
@return valor de freal*/
public Timestamp getFreal(){
  return freal;
}
/**Fija el valor de freal
@param pFreal nuevo Valor de freal*/
public void setFreal(Timestamp pFreal){
  freal=pFreal;
}

/**Obtiene el valor de ccanal
@return valor de ccanal*/
public String getCcanal(){
  return ccanal;
}
/**Fija el valor de ccanal
@param pCcanal nuevo Valor de ccanal*/
public void setCcanal(String pCcanal){
  ccanal=pCcanal;
}

/**Obtiene el valor de fcontable
@return valor de fcontable*/
public Date getFcontable(){
  return fcontable;
}
/**Fija el valor de fcontable
@param pFcontable nuevo Valor de fcontable*/
public void setFcontable(Date pFcontable){
  fcontable=pFcontable;
}

/**Implementación de la comparación de TmessagelogKey
@param o Objeto de comparación
*/
public boolean equals(Object o){
  if (o == null)return false;
  if (! (o instanceof TmessagelogKey))return false;
  TmessagelogKey that = (TmessagelogKey) o;
  if (this.getNumeromensaje() == null || that.getNumeromensaje() == null){
      return false;
  }
  if (! this.getNumeromensaje().equals(that.getNumeromensaje())){
    return false;
  }
  if (this.getFreal() == null || that.getFreal() == null){
      return false;
  }
  if (! this.getFreal().equals(that.getFreal())){
    return false;
  }
  if (this.getCcanal() == null || that.getCcanal() == null){
      return false;
  }
  if (! this.getCcanal().equals(that.getCcanal())){
    return false;
  }
  if (this.getFcontable() == null || that.getFcontable() == null){
      return false;
  }
  if (! this.getFcontable().equals(that.getFcontable())){
    return false;
  }
  return true;
}
/**Implementación del método hashCode bajo el patrón de Bloch
@return hashCode de la instancia TmessagelogKey
*/
public int hashCode(){
  if (this.hashValue == 0){
    int result = 17;
    result = result * 37 + (this.getNumeromensaje() == null ? 0 : this.getNumeromensaje().hashCode());
    result = result * 37 + (this.getFreal() == null ? 0 : this.getFreal().hashCode());
    result = result * 37 + (this.getCcanal() == null ? 0 : this.getCcanal().hashCode());
    result = result * 37 + (this.getFcontable() == null ? 0 : this.getFcontable().hashCode());
    this.hashValue = result;
  }
  return this.hashValue;
}
public Object cloneMe() throws Exception {
  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(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;
	}
}
