177 lines
4.7 KiB
Plaintext
Executable File
177 lines
4.7 KiB
Plaintext
Executable File
package com.fp.persistence.pviaticos.param;
|
|
|
|
import com.fp.dto.hb.Cache;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.Id;
|
|
import javax.persistence.Column;
|
|
import javax.persistence.EntityManager;
|
|
import java.io.Serializable;
|
|
import java.math.BigDecimal;
|
|
import javax.persistence.Table;
|
|
import com.fp.dto.hb.HibernateBean;
|
|
import java.lang.reflect.Field;
|
|
import javax.persistence.Transient;
|
|
|
|
/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_PARAMETROS*/
|
|
@Entity(name="ViaParametros")
|
|
@Table(name="VIA_PARAMETROS")
|
|
public class ViaParametros extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{
|
|
/**
|
|
* 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 ViaParametros
|
|
*/
|
|
@Id
|
|
@Column(name="COD_PARAMETRO" ,nullable=false, updatable=false)
|
|
private String pk;
|
|
@Column(name="TEX_VALOR", nullable=true)
|
|
|
|
/**
|
|
* Valor texto del parametro.
|
|
*/
|
|
private String tex_valor;
|
|
|
|
@Column(name="NUM_VALOR", nullable=true)
|
|
|
|
/**
|
|
* Valor numero del parametro.
|
|
*/
|
|
private BigDecimal num_valor;
|
|
|
|
@Column(name="NOM_PARAMETRO", nullable=true)
|
|
|
|
/**
|
|
* Nombre del parametro
|
|
*/
|
|
private String nom_parametro;
|
|
|
|
/**Contructor por defecto*/
|
|
public ViaParametros(){
|
|
}
|
|
/**Contructor de ViaParametros
|
|
@param pPk Clave Primaria del entity
|
|
*/
|
|
public ViaParametros(String pPk){
|
|
this();
|
|
pk=pPk;
|
|
}
|
|
/**
|
|
* 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 ViaParametros
|
|
*/
|
|
public static ViaParametros find(EntityManager pEntityManager,Object pKey) throws Exception{
|
|
ViaParametros obj = pEntityManager.find(ViaParametros.class,pKey);
|
|
return obj;
|
|
}
|
|
/**Entrega la Clave primaria de ViaParametros
|
|
@return El objeto que referencia a la Clave primaria de ViaParametros
|
|
*/
|
|
public String getPk(){
|
|
return pk;
|
|
}
|
|
/**Fija un nuevo valor a la Clave primaria de ViaParametros
|
|
@param pPk El objeto que referencia a la nueva Clave primaria de ViaParametros
|
|
*/
|
|
public void setPk(String pPk){
|
|
pk=pPk;
|
|
}
|
|
/**Obtiene el valor de tex_valor
|
|
@return valor de tex_valor*/
|
|
public String getTex_valor(){
|
|
return tex_valor;
|
|
}
|
|
/**Fija el valor de tex_valor
|
|
@param pTex_valor nuevo Valor de tex_valor*/
|
|
public void setTex_valor(String pTex_valor){
|
|
tex_valor=pTex_valor;
|
|
}
|
|
|
|
/**Obtiene el valor de num_valor
|
|
@return valor de num_valor*/
|
|
public BigDecimal getNum_valor(){
|
|
return num_valor;
|
|
}
|
|
/**Fija el valor de num_valor
|
|
@param pNum_valor nuevo Valor de num_valor*/
|
|
public void setNum_valor(BigDecimal pNum_valor){
|
|
num_valor=pNum_valor;
|
|
}
|
|
|
|
/**Obtiene el valor de nom_parametro
|
|
@return valor de nom_parametro*/
|
|
public String getNom_parametro(){
|
|
return nom_parametro;
|
|
}
|
|
/**Fija el valor de nom_parametro
|
|
@param pNom_parametro nuevo Valor de nom_parametro*/
|
|
public void setNom_parametro(String pNom_parametro){
|
|
nom_parametro=pNom_parametro;
|
|
}
|
|
|
|
public boolean equals(Object rhs){
|
|
if (rhs == null)return false;
|
|
if (! (rhs instanceof ViaParametros))return false;
|
|
ViaParametros that = (ViaParametros) rhs;
|
|
if (this.getPk() == null || that.getPk() == null)
|
|
return false;
|
|
return (this.getPk().equals(that.getPk()));
|
|
}
|
|
/**Implementacion del metodo hashCode de la la entidad ViaParametros
|
|
@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 ViaParametros
|
|
*/
|
|
public Object createInstance(){
|
|
ViaParametros instance=new ViaParametros();
|
|
return instance;
|
|
}
|
|
/**Clona la entidad ViaParametros
|
|
@see com.fp.dto.hb.HibernateBean#cloneMe()
|
|
*/
|
|
public Object cloneMe() throws CloneNotSupportedException{
|
|
ViaParametros p=(ViaParametros)this.clone();
|
|
return p;
|
|
}
|
|
}
|