package com.fitbank.hb.persistence.safe;

import com.fitbank.common.hb.AbstractExpire;
import java.io.Serializable;
import java.lang.reflect.Field;
import com.fitbank.common.hb.ManejaHistory;
import java.sql.Timestamp;

/**Clase que hace referencia a la Clave Primaria de TROLES*/
public class TroleKey  extends AbstractExpire  implements Serializable,Cloneable,ManejaHistory{
/** Nombre de la Tabla TROLES */
public static final String TABLE_NAME = "TROLES";
/** HashCode asociado con la Instancia*/
private int hashValue = 0;
/** Version de la Clase*/
private static final long serialVersionUID = 1L;
/**
* Codigo del idioma
*/
private String cidioma;

/**
* Codigo del rol de usuario por compania
*/
private Integer crol;

/**
* Fecha hasta la que esta vigente la descripcion de un rol
*/
private Timestamp fhasta;

/**Contructor por defecto*/
public TroleKey(){}
/**Contructor de TroleKey
@param pCidioma Codigo del idioma
@param pCrol Codigo del rol de usuario por compania
@param pFhasta Fecha hasta la que esta vigente la descripcion de un rol
*/
public TroleKey(String pCidioma,Integer pCrol,Timestamp pFhasta){
 cidioma=pCidioma;
 crol=pCrol;
 fhasta=pFhasta;
}
public static final String CIDIOMA="CIDIOMA";
/**Obtiene el valor de cidioma
@return valor de cidioma*/
public String getCidioma(){
  return cidioma;
}
/**Fija el valor de cidioma
@param pCidioma nuevo Valor de cidioma*/
public void setCidioma(String pCidioma){
  cidioma=pCidioma;
}

public static final String CROL="CROL";
/**Obtiene el valor de crol
@return valor de crol*/
public Integer getCrol(){
  return crol;
}
/**Fija el valor de crol
@param pCrol nuevo Valor de crol*/
public void setCrol(Integer pCrol){
  crol=pCrol;
}

public static final String FHASTA="FHASTA";
/**Obtiene el valor de fhasta
@return valor de fhasta*/
public Timestamp getFhasta(){
  return fhasta;
}
/**Fija el valor de fhasta
@param pFhasta nuevo Valor de fhasta*/
public void setFhasta(Timestamp pFhasta){
  fhasta=pFhasta;
}

public static final String PK_CIDIOMA="CIDIOMA";
public static final String PK_CROL="CROL";
public static final String PK_FHASTA="FHASTA";
/**Implementaci?n de la comparaci?n de TroleKey
@param o Objeto de comparaci?n
*/
public boolean equals(Object o){
  if (o == null){return false;}
  if (! (o instanceof TroleKey)){return false;}
  TroleKey that = (TroleKey) o;
  if (this.getCidioma() == null || that.getCidioma() == null){
      return false;
  }
  if (! this.getCidioma().equals(that.getCidioma())){
    return false;
  }
  if (this.getCrol() == null || that.getCrol() == null){
      return false;
  }
  if (! this.getCrol().equals(that.getCrol())){
    return false;
  }
  if (this.getFhasta() == null || that.getFhasta() == null){
      return false;
  }
  if (! this.getFhasta().equals(that.getFhasta())){
    return false;
  }
  return true;
}
/**Implementaci?n del m?todo hashCode bajo el patr?n de Bloch
@return hashCode de la instancia TroleKey
*/
public int hashCode(){
  if (this.hashValue == 0){
    int result = 17;
    result = result * 37 + (this.getCidioma() == null ? 0 : this.getCidioma().hashCode());
    result = result * 37 + (this.getCrol() == null ? 0 : this.getCrol().hashCode());
    result = result * 37 + (this.getFhasta() == null ? 0 : this.getFhasta().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;
	}
public Object getId() {
  return null;
}
}
