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 TGENEQUERYPROCESS*/
@Embeddable
public class TgeneQueryProcessKey  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="QUERYCODE", nullable=false,updatable=false)

/**
* Codigo de query que se encarga de completar datos de una consulta o lista de valores
*/
private String querycode;

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

/**
* Secuencia del comando
*/
private Integer sequence;

/**Contructor por defecto*/
public TgeneQueryProcessKey(){}
/**Contructor de TgeneQueryProcessKey
@param pQuerycode Codigo de query que se encarga de completar datos de una consulta o lista de valores
@param pSequence Secuencia del comando
*/
public TgeneQueryProcessKey(String pQuerycode,Integer pSequence){
 querycode=pQuerycode;
 sequence=pSequence;
}
/**Obtiene el valor de querycode
@return valor de querycode*/
public String getQuerycode(){
  return querycode;
}
/**Fija el valor de querycode
@param pQuerycode nuevo Valor de querycode*/
public void setQuerycode(String pQuerycode){
  querycode=pQuerycode;
}

/**Obtiene el valor de sequence
@return valor de sequence*/
public Integer getSequence(){
  return sequence;
}
/**Fija el valor de sequence
@param pSequence nuevo Valor de sequence*/
public void setSequence(Integer pSequence){
  sequence=pSequence;
}

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