package com.fp.persistence.pbpm.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 TBPMACTIVITIES*/
@Embeddable
public class TbpmActivitiesKey  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 mensaje asociado al a instacioa del flujo.
*/
private String journalid;

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

/**
* Nombre de la Actividad
*/
private String activityname;

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

/**
* Secuencia de Actividades
*/
private Integer sequence;

/**Contructor por defecto*/
public TbpmActivitiesKey(){}
/**Contructor de TbpmActivitiesKey
@param pJournalid Numero de mensaje asociado al a instacioa del flujo.
@param pActivityname Nombre de la Actividad
@param pSequence Secuencia de Actividades
*/
public TbpmActivitiesKey(String pJournalid,String pActivityname,Integer pSequence){
 journalid=pJournalid;
 activityname=pActivityname;
 sequence=pSequence;
}
/**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 activityname
@return valor de activityname*/
public String getActivityname(){
  return activityname;
}
/**Fija el valor de activityname
@param pActivityname nuevo Valor de activityname*/
public void setActivityname(String pActivityname){
  activityname=pActivityname;
}

/**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;
}

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