package com.fp.persistence.pgeneral.product.rate;

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;

/**Clase que hace referencia a la Clave Primaria de TGENEBASERATE*/
@Embeddable
public class TgeneBaseRateKey  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="BASERATECATALOG", nullable=false,updatable=false)

/**
* Codigo de catalogo  de tasas base, BCE tasa banco central
*/
private String baseratecatalog;

@Column(name="BASERATECATALOGCODE", nullable=false,updatable=false)

/**
* Codigo de tabla de catalogo BASERATE
*/
private String baseratecatalogcode;

@Column(name="CURRENCYCODE", nullable=false,updatable=false)

/**
* Codigo de moneda
*/
private String currencycode;

/**Contructor por defecto*/
public TgeneBaseRateKey(){}
/**Contructor de TgeneBaseRateKey
@param pBaseratecatalog Codigo de catalogo  de tasas base, BCE tasa banco central
@param pBaseratecatalogcode Codigo de tabla de catalogo BASERATE
@param pCurrencycode Codigo de moneda
*/
public TgeneBaseRateKey(String pBaseratecatalog,String pBaseratecatalogcode,String pCurrencycode){
 baseratecatalog=pBaseratecatalog;
 baseratecatalogcode=pBaseratecatalogcode;
 currencycode=pCurrencycode;
}
/**Obtiene el valor de baseratecatalog
@return valor de baseratecatalog*/
public String getBaseratecatalog(){
  return baseratecatalog;
}
/**Fija el valor de baseratecatalog
@param pBaseratecatalog nuevo Valor de baseratecatalog*/
public void setBaseratecatalog(String pBaseratecatalog){
  baseratecatalog=pBaseratecatalog;
}

/**Obtiene el valor de baseratecatalogcode
@return valor de baseratecatalogcode*/
public String getBaseratecatalogcode(){
  return baseratecatalogcode;
}
/**Fija el valor de baseratecatalogcode
@param pBaseratecatalogcode nuevo Valor de baseratecatalogcode*/
public void setBaseratecatalogcode(String pBaseratecatalogcode){
  baseratecatalogcode=pBaseratecatalogcode;
}

/**Obtiene el valor de currencycode
@return valor de currencycode*/
public String getCurrencycode(){
  return currencycode;
}
/**Fija el valor de currencycode
@param pCurrencycode nuevo Valor de currencycode*/
public void setCurrencycode(String pCurrencycode){
  currencycode=pCurrencycode;
}

/**Implementacion de la comparacion de TgeneBaseRateKey
@param o Objeto de comparacion
*/
public boolean equals(Object o){
  if (o == null)return false;
  if (! (o instanceof TgeneBaseRateKey))return false;
  TgeneBaseRateKey that = (TgeneBaseRateKey) o;
  if (this.getBaseratecatalog() == null || that.getBaseratecatalog() == null){
      return false;
  }
  if (! this.getBaseratecatalog().equals(that.getBaseratecatalog())){
    return false;
  }
  if (this.getBaseratecatalogcode() == null || that.getBaseratecatalogcode() == null){
      return false;
  }
  if (! this.getBaseratecatalogcode().equals(that.getBaseratecatalogcode())){
    return false;
  }
  if (this.getCurrencycode() == null || that.getCurrencycode() == null){
      return false;
  }
  if (! this.getCurrencycode().equals(that.getCurrencycode())){
    return false;
  }
  return true;
}
/**Implementacion del metodo hashCode bajo el patron de Bloch
@return hashCode de la instancia TgeneBaseRateKey
*/
public int hashCode(){
  if (this.hashValue == 0){
    int result = 17;
    result = result * 37 + (this.getBaseratecatalog() == null ? 0 : this.getBaseratecatalog().hashCode());
    result = result * 37 + (this.getBaseratecatalogcode() == null ? 0 : this.getBaseratecatalogcode().hashCode());
    result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode());
    this.hashValue = result;
  }
  return this.hashValue;
}
public Object cloneMe() throws CloneNotSupportedException {
  return this.clone();
}
/**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+="pk."+name+"="+f.get(this)+";";
	 }catch(Exception e){
		 continue;
	 }
		}
		if(data.compareTo("")==0){
		data=super.toString();
		}
	return data;
	}
}
