package com.fp.persistence.pbpm.gene;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.EntityManager;
import java.io.Serializable;
import javax.persistence.Table;
import com.fp.dto.hb.HibernateBean;
import java.lang.reflect.Field;
import javax.persistence.Transient;
import java.sql.Date;

/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMTASKCOMMENTS*/
@Entity(name="TbpmTaskComments")
@Table(name="TBPMTASKCOMMENTS")
public class TbpmTaskComments extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{
/**
* HashCode asociado con la Instancia
*/
@Transient
private int hashValue = 0;
/**
* Version de la Clase
*/
private static final long serialVersionUID = 1L;
/**
* Clave primaria de la Entidad TbpmTaskComments
*/
@Id
@Column(name="ID" ,nullable=false, updatable=false)
private Long pk;
@Column(name="USERCODE", nullable=true)

/**
* Codigo de usuario
*/
private String usercode;

@Column(name="ADDED", nullable=false)

/**
* Anadido
*/
private Date added;

@Column(name="TEXT", nullable=false)

/**
* contenido
*/
private String text;

@Column(name="TASKID", nullable=false)

/**
* tarea
*/
private Long taskid;

/**Contructor por defecto*/
public TbpmTaskComments(){
}
/**Contructor de TbpmTaskComments
@param pPk Clave Primaria del entity
@param pAdded Anadido
@param pText contenido
@param pTaskid tarea
*/
public TbpmTaskComments(Long pPk,Date pAdded,String pText,Long pTaskid){
 this();
 pk=pPk;
 added=pAdded;
 text=pText;
 taskid=pTaskid;
}
/**
* Metodo que entrega datos de la tabla dada la clave primaria.
* @param pEntityManager referencia de la session a obtener datos del bean.
* @param pKey Caleve primaria del bean.
* @return TbpmTaskComments
*/
public static TbpmTaskComments find(EntityManager pEntityManager,Object pKey) throws Exception{
    TbpmTaskComments obj = pEntityManager.find(TbpmTaskComments.class,pKey);
    return obj;
}
/**Entrega la Clave primaria de TbpmTaskComments
@return El objeto que referencia a la Clave primaria de TbpmTaskComments
*/
public Long getPk(){
  return pk;
}
/**Fija un nuevo valor a la Clave primaria de TbpmTaskComments
@param pPk El objeto que referencia a la nueva Clave primaria de TbpmTaskComments
*/
public void setPk(Long pPk){
  pk=pPk;
}
/**Obtiene el valor de usercode
@return valor de usercode*/
public String getUsercode(){
  return usercode;
}
/**Fija el valor de usercode
@param pUsercode nuevo Valor de usercode*/
public void setUsercode(String pUsercode){
  usercode=pUsercode;
}

/**Obtiene el valor de added
@return valor de added*/
public Date getAdded(){
  return added;
}
/**Fija el valor de added
@param pAdded nuevo Valor de added*/
public void setAdded(Date pAdded){
  added=pAdded;
}

/**Obtiene el valor de text
@return valor de text*/
public String getText(){
  return text;
}
/**Fija el valor de text
@param pText nuevo Valor de text*/
public void setText(String pText){
  text=pText;
}

/**Obtiene el valor de taskid
@return valor de taskid*/
public Long getTaskid(){
  return taskid;
}
/**Fija el valor de taskid
@param pTaskid nuevo Valor de taskid*/
public void setTaskid(Long pTaskid){
  taskid=pTaskid;
}

public boolean equals(Object rhs){
    if (rhs == null)return false;
    if (! (rhs instanceof TbpmTaskComments))return false;
    TbpmTaskComments that = (TbpmTaskComments) rhs;
    if (this.getPk() == null || that.getPk() == null)
        return false;
    return (this.getPk().equals(that.getPk()));
}
/**Implementacion del metodo hashCode de la la entidad TbpmTaskComments
@return el hashCode la instancia
*/
public int hashCode()    {
    if (this.hashValue == 0){
        int result = 17;
        if (this.getPk() == null){
            result = super.hashCode();
        }else{
            result = this.getPk().hashCode();
        }
        this.hashValue = result;
    }
    return this.hashValue;
}
/**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+=name+"="+f.get(this)+";";
	 }catch(Exception e){
		 continue;
	 }
		}
		if(data.compareTo("")==0){
		data=super.toString();
		}
	return data;
	}
/**Implementacion de la creacion de un bean en blanco TbpmTaskComments
*/
public Object createInstance(){
 TbpmTaskComments instance=new TbpmTaskComments();	
 return instance;
}
/**Clona la entidad TbpmTaskComments
@see com.fp.dto.hb.HibernateBean#cloneMe()
*/
public Object cloneMe() throws CloneNotSupportedException{
  TbpmTaskComments p=(TbpmTaskComments)this.clone();
  return p;
}
}
