package com.fp.persistence.pbpm.gene; import java.io.Serializable; import java.lang.reflect.Field; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.EntityManager; import javax.persistence.Lob; import javax.persistence.Table; import javax.persistence.Transient; import com.fp.dto.hb.HibernateBean; /** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMPROCESSVARIABLES */ @Entity(name = "TbpmProcessVariables") @Table(name = "TBPMPROCESSVARIABLES") public class TbpmProcessVariables 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 TbpmProcessVariables */ @EmbeddedId private TbpmProcessVariablesKey pk; // @Lob @Column(name = "CONTENT", nullable = false) /** * Valor de la Variable en Formato JSON */ private String content; /** Contructor por defecto */ public TbpmProcessVariables() { } /** * Contructor de TbpmProcessVariables * * @param pPk Clave Primaria del entity * @param pContent Valor de la Variable en Formato JSON */ public TbpmProcessVariables(TbpmProcessVariablesKey pPk, String pContent) { this(); this.pk = pPk; this.content = pContent; } /** * 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 TbpmProcessVariables */ public static TbpmProcessVariables find(EntityManager pEntityManager, TbpmProcessVariablesKey pKey) throws Exception { TbpmProcessVariables obj = pEntityManager.find(TbpmProcessVariables.class, pKey); return obj; } /** * Entrega la Clave primaria de TbpmProcessVariables * * @return El objeto que referencia a la Clave primaria de TbpmProcessVariables */ public TbpmProcessVariablesKey getPk() { return this.pk; } /** * Fija un nuevo valor a la Clave primaria de TbpmProcessVariables * * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmProcessVariables */ public void setPk(TbpmProcessVariablesKey pPk) { this.pk = pPk; } /** * Obtiene el valor de content * * @return valor de content */ public String getContent() { return this.content; } /** * Fija el valor de content * * @param pContent nuevo Valor de content */ public void setContent(String pContent) { this.content = pContent; } @Override public boolean equals(Object rhs) { if (rhs == null) { return false; } if (!(rhs instanceof TbpmProcessVariables)) { return false; } TbpmProcessVariables that = (TbpmProcessVariables) rhs; if ((this.getPk() == null) || (that.getPk() == null)) { return false; } return (this.getPk().equals(that.getPk())); } /** * Implementacion del metodo hashCode de la la entidad TbpmProcessVariables * * @return el hashCode la instancia */ @Override 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 */ @Override 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 TbpmProcessVariables */ @Override public Object createInstance() { TbpmProcessVariables instance = new TbpmProcessVariables(); instance.setPk(new TbpmProcessVariablesKey()); return instance; } /** * Clona la entidad TbpmProcessVariables * * @see com.fp.dto.hb.HibernateBean#cloneMe() */ @Override public Object cloneMe() throws CloneNotSupportedException { TbpmProcessVariables p = (TbpmProcessVariables) this.clone(); p.setPk((TbpmProcessVariablesKey) this.pk.cloneMe()); return p; } }