328 lines
8.4 KiB
Plaintext
Executable File
328 lines
8.4 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.gene;
|
||
|
||
import javax.persistence.EmbeddedId;
|
||
import javax.persistence.Entity;
|
||
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;
|
||
|
||
/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEENTITY*/
|
||
@Entity(name="TgeneEntity")
|
||
@Table(name="TGENEENTITY")
|
||
public class TgeneEntity 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 TgeneEntity
|
||
*/
|
||
@EmbeddedId
|
||
private TgeneEntityKey pk;
|
||
@Column(name="PROJECT", nullable=true)
|
||
|
||
/**
|
||
* Projecto en el cual se maneja el bean.
|
||
*/
|
||
private String project;
|
||
|
||
@Column(name="PAC", nullable=false)
|
||
|
||
/**
|
||
* Nombre del subpaquete en el cual se creara la clase
|
||
*/
|
||
private String pac;
|
||
|
||
@Column(name="JAVAEXTENDS", nullable=true)
|
||
|
||
/**
|
||
* Indica si el bean extiende de alguna clase en particular
|
||
*/
|
||
private String javaextends;
|
||
|
||
@Column(name="JAVAIMPLEMENTS", nullable=true)
|
||
|
||
/**
|
||
* Indica si la clase implementa alguna clase en particular
|
||
*/
|
||
private String javaimplements;
|
||
|
||
@Column(name="CREATEREFERENCES", nullable=false)
|
||
|
||
/**
|
||
* Indica si el entity genera referencias a entities padre.
|
||
*/
|
||
private String createreferences;
|
||
|
||
@Column(name="OPTIMISTICLOCKING", nullable=false)
|
||
|
||
/**
|
||
* Indca si en enity lleva control de bloqueo optimista
|
||
*/
|
||
private String optimisticlocking;
|
||
|
||
@Column(name="HISTORY", nullable=false)
|
||
|
||
/**
|
||
* Indica si el entity maneja historia.
|
||
*/
|
||
private String history;
|
||
|
||
@Column(name="AUTOIMPORT", nullable=true)
|
||
|
||
/**
|
||
* Indica
|
||
*/
|
||
private String autoimport;
|
||
|
||
@Column(name="INMANUAL", nullable=true)
|
||
|
||
/**
|
||
* Indica que la clase tiene implementados metodos manualmete y no se puede generar el bean automaticamente.
|
||
*/
|
||
private String inmanual;
|
||
|
||
@Column(name="CACHE", nullable=true)
|
||
|
||
/**
|
||
* Indica que la tabla manaja cache, si se da mantenimiento se limpia el cache de la tabla
|
||
*/
|
||
private String cache;
|
||
|
||
@Column(name="LOG", nullable=true)
|
||
|
||
/**
|
||
* Indica que la tabla manaja auditoria de cambios
|
||
*/
|
||
private String log;
|
||
|
||
/**Contructor por defecto*/
|
||
public TgeneEntity(){
|
||
}
|
||
/**Contructor de TgeneEntity
|
||
@param pPk Clave Primaria del entity
|
||
@param pPac Nombre del subpaquete en el cual se creara la clase
|
||
@param pCreatereferences Indica si el entity genera referencias a entities padre.
|
||
@param pOptimisticlocking Indca si en enity lleva control de bloqueo optimista
|
||
@param pHistory Indica si el entity maneja historia.
|
||
*/
|
||
public TgeneEntity(TgeneEntityKey pPk,String pPac,String pCreatereferences,String pOptimisticlocking,String pHistory){
|
||
this();
|
||
pk=pPk;
|
||
pac=pPac;
|
||
createreferences=pCreatereferences;
|
||
optimisticlocking=pOptimisticlocking;
|
||
history=pHistory;
|
||
}
|
||
/**
|
||
* 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 TgeneEntity
|
||
*/
|
||
public static TgeneEntity find(EntityManager pEntityManager,TgeneEntityKey pKey) throws Exception{
|
||
TgeneEntity obj = pEntityManager.find(TgeneEntity.class,pKey);
|
||
return obj;
|
||
}
|
||
/**Entrega la Clave primaria de TgeneEntity
|
||
@return El objeto que referencia a la Clave primaria de TgeneEntity
|
||
*/
|
||
public TgeneEntityKey getPk(){
|
||
return pk;
|
||
}
|
||
/**Fija un nuevo valor a la Clave primaria de TgeneEntity
|
||
@param pPk El objeto que referencia a la nueva Clave primaria de TgeneEntity
|
||
*/
|
||
public void setPk(TgeneEntityKey pPk){
|
||
pk=pPk;
|
||
}
|
||
/**Obtiene el valor de project
|
||
@return valor de project*/
|
||
public String getProject(){
|
||
return project;
|
||
}
|
||
/**Fija el valor de project
|
||
@param pProject nuevo Valor de project*/
|
||
public void setProject(String pProject){
|
||
project=pProject;
|
||
}
|
||
|
||
/**Obtiene el valor de pac
|
||
@return valor de pac*/
|
||
public String getPac(){
|
||
return pac;
|
||
}
|
||
/**Fija el valor de pac
|
||
@param pPac nuevo Valor de pac*/
|
||
public void setPac(String pPac){
|
||
pac=pPac;
|
||
}
|
||
|
||
/**Obtiene el valor de javaextends
|
||
@return valor de javaextends*/
|
||
public String getJavaextends(){
|
||
return javaextends;
|
||
}
|
||
/**Fija el valor de javaextends
|
||
@param pJavaextends nuevo Valor de javaextends*/
|
||
public void setJavaextends(String pJavaextends){
|
||
javaextends=pJavaextends;
|
||
}
|
||
|
||
/**Obtiene el valor de javaimplements
|
||
@return valor de javaimplements*/
|
||
public String getJavaimplements(){
|
||
return javaimplements;
|
||
}
|
||
/**Fija el valor de javaimplements
|
||
@param pJavaimplements nuevo Valor de javaimplements*/
|
||
public void setJavaimplements(String pJavaimplements){
|
||
javaimplements=pJavaimplements;
|
||
}
|
||
|
||
/**Obtiene el valor de createreferences
|
||
@return valor de createreferences*/
|
||
public String getCreatereferences(){
|
||
return createreferences;
|
||
}
|
||
/**Fija el valor de createreferences
|
||
@param pCreatereferences nuevo Valor de createreferences*/
|
||
public void setCreatereferences(String pCreatereferences){
|
||
createreferences=pCreatereferences;
|
||
}
|
||
|
||
/**Obtiene el valor de optimisticlocking
|
||
@return valor de optimisticlocking*/
|
||
public String getOptimisticlocking(){
|
||
return optimisticlocking;
|
||
}
|
||
/**Fija el valor de optimisticlocking
|
||
@param pOptimisticlocking nuevo Valor de optimisticlocking*/
|
||
public void setOptimisticlocking(String pOptimisticlocking){
|
||
optimisticlocking=pOptimisticlocking;
|
||
}
|
||
|
||
/**Obtiene el valor de history
|
||
@return valor de history*/
|
||
public String getHistory(){
|
||
return history;
|
||
}
|
||
/**Fija el valor de history
|
||
@param pHistory nuevo Valor de history*/
|
||
public void setHistory(String pHistory){
|
||
history=pHistory;
|
||
}
|
||
|
||
/**Obtiene el valor de autoimport
|
||
@return valor de autoimport*/
|
||
public String getAutoimport(){
|
||
return autoimport;
|
||
}
|
||
/**Fija el valor de autoimport
|
||
@param pAutoimport nuevo Valor de autoimport*/
|
||
public void setAutoimport(String pAutoimport){
|
||
autoimport=pAutoimport;
|
||
}
|
||
|
||
/**Obtiene el valor de inmanual
|
||
@return valor de inmanual*/
|
||
public String getInmanual(){
|
||
return inmanual;
|
||
}
|
||
/**Fija el valor de inmanual
|
||
@param pInmanual nuevo Valor de inmanual*/
|
||
public void setInmanual(String pInmanual){
|
||
inmanual=pInmanual;
|
||
}
|
||
|
||
/**Obtiene el valor de cache
|
||
@return valor de cache*/
|
||
public String getCache(){
|
||
return cache;
|
||
}
|
||
/**Fija el valor de cache
|
||
@param pCache nuevo Valor de cache*/
|
||
public void setCache(String pCache){
|
||
cache=pCache;
|
||
}
|
||
|
||
/**Obtiene el valor de log
|
||
@return valor de log*/
|
||
public String getLog(){
|
||
return log;
|
||
}
|
||
/**Fija el valor de log
|
||
@param pLog nuevo Valor de log*/
|
||
public void setLog(String pLog){
|
||
log=pLog;
|
||
}
|
||
|
||
public boolean equals(Object rhs){
|
||
if (rhs == null)return false;
|
||
if (! (rhs instanceof TgeneEntity))return false;
|
||
TgeneEntity that = (TgeneEntity) rhs;
|
||
if (this.getPk() == null || that.getPk() == null)
|
||
return false;
|
||
return (this.getPk().equals(that.getPk()));
|
||
}
|
||
/**Implementaci<63>n del metodo hashCode de la la entidad TgeneEntity
|
||
@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;
|
||
}
|
||
/**Implementaci<63>n 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;
|
||
}
|
||
/**Implementaci<63>n de la creaci<63>n de un bean en blanco TgeneEntity
|
||
*/
|
||
public Object createInstance(){
|
||
TgeneEntity instance=new TgeneEntity();
|
||
instance.setPk(new TgeneEntityKey());
|
||
return instance;
|
||
}
|
||
/**Clona la entidad TgeneEntity
|
||
@see com.fp.dto.hb.HibernateBean#cloneMe()
|
||
*/
|
||
public Object cloneMe() throws CloneNotSupportedException{
|
||
TgeneEntity p=(TgeneEntity)this.clone();
|
||
p.setPk((TgeneEntityKey)this.pk.cloneMe());
|
||
return p;
|
||
}
|
||
}
|