package com.fp.persistence.pgeneral.gene;

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 TGENECONCEPT*/
@Embeddable
public class TgeneConceptKey  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="CONCEPTMODULE", nullable=false,updatable=false)

/**
* Codigo de modulo
*/
private String conceptmodule;

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

/**
* Codigo de concepto
*/
private Integer conceptcode;

/**Contructor por defecto*/
public TgeneConceptKey(){}
/**Contructor de TgeneConceptKey
@param pConceptmodule Codigo de modulo
@param pConceptcode Codigo de concepto
*/
public TgeneConceptKey(String pConceptmodule,Integer pConceptcode){
 conceptmodule=pConceptmodule;
 conceptcode=pConceptcode;
}
/**Obtiene el valor de conceptmodule
@return valor de conceptmodule*/
public String getConceptmodule(){
  return conceptmodule;
}
/**Fija el valor de conceptmodule
@param pConceptmodule nuevo Valor de conceptmodule*/
public void setConceptmodule(String pConceptmodule){
  conceptmodule=pConceptmodule;
}

/**Obtiene el valor de conceptcode
@return valor de conceptcode*/
public Integer getConceptcode(){
  return conceptcode;
}
/**Fija el valor de conceptcode
@param pConceptcode nuevo Valor de conceptcode*/
public void setConceptcode(Integer pConceptcode){
  conceptcode=pConceptcode;
}

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