package com.fp.persistence.pgeneral.score;

import java.sql.Timestamp;
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 TGENEACCOUNTSCOREJOURNAL*/
@Embeddable
public class TgeneAccountScoreJournalKey  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="JOURNALID", nullable=false,updatable=false)

/**
* Numero de movimiento 
*/
private String journalid;

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

/**
* Particion yyyymm   anio mas mes de la fecha contable hasta
*/
private String partitiondb;

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

/**
* Fecha real
*/
private Timestamp realdate;

/**Contructor por defecto*/
public TgeneAccountScoreJournalKey(){}
/**Contructor de TgeneAccountScoreJournalKey
@param pJournalid Numero de movimiento 
@param pPartitiondb Particion yyyymm   anio mas mes de la fecha contable hasta
@param pRealdate Fecha real
*/
public TgeneAccountScoreJournalKey(String pJournalid,String pPartitiondb,Timestamp pRealdate){
 journalid=pJournalid;
 partitiondb=pPartitiondb;
 realdate=pRealdate;
}
/**Obtiene el valor de journalid
@return valor de journalid*/
public String getJournalid(){
  return journalid;
}
/**Fija el valor de journalid
@param pJournalid nuevo Valor de journalid*/
public void setJournalid(String pJournalid){
  journalid=pJournalid;
}

/**Obtiene el valor de partitiondb
@return valor de partitiondb*/
public String getPartitiondb(){
  return partitiondb;
}
/**Fija el valor de partitiondb
@param pPartitiondb nuevo Valor de partitiondb*/
public void setPartitiondb(String pPartitiondb){
  partitiondb=pPartitiondb;
}

/**Obtiene el valor de realdate
@return valor de realdate*/
public Timestamp getRealdate(){
  return realdate;
}
/**Fija el valor de realdate
@param pRealdate nuevo Valor de realdate*/
public void setRealdate(Timestamp pRealdate){
  realdate=pRealdate;
}

/**Implementacion de la comparacion de TgeneAccountScoreJournalKey
@param o Objeto de comparacion
*/
public boolean equals(Object o){
  if (o == null)return false;
  if (! (o instanceof TgeneAccountScoreJournalKey))return false;
  TgeneAccountScoreJournalKey that = (TgeneAccountScoreJournalKey) o;
  if (this.getJournalid() == null || that.getJournalid() == null){
      return false;
  }
  if (! this.getJournalid().equals(that.getJournalid())){
    return false;
  }
  if (this.getPartitiondb() == null || that.getPartitiondb() == null){
      return false;
  }
  if (! this.getPartitiondb().equals(that.getPartitiondb())){
    return false;
  }
  if (this.getRealdate() == null || that.getRealdate() == null){
      return false;
  }
  if (! this.getRealdate().equals(that.getRealdate())){
    return false;
  }
  return true;
}
/**Implementacion del metodo hashCode bajo el patron de Bloch
@return hashCode de la instancia TgeneAccountScoreJournalKey
*/
public int hashCode(){
  if (this.hashValue == 0){
    int result = 17;
    result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode());
    result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode());
    result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().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;
	}
}
