211 lines
5.4 KiB
Plaintext
Executable File
211 lines
5.4 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.excel;
|
|
|
|
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;
|
|
|
|
/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEREADEXCEL*/
|
|
@Entity(name="TgeneReadExcel")
|
|
@Table(name="TGENEREADEXCEL")
|
|
public class TgeneReadExcel 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 TgeneReadExcel
|
|
*/
|
|
@Id
|
|
@Column(name="FILECODE" ,nullable=false, updatable=false)
|
|
private String pk;
|
|
@Column(name="FIRSTROW", nullable=true)
|
|
|
|
/**
|
|
* Primera fila del archivo a leer
|
|
*/
|
|
private Integer firstrow;
|
|
|
|
@Column(name="MAXROW", nullable=true)
|
|
|
|
/**
|
|
* Última fila del archivo a leer
|
|
*/
|
|
private Integer maxrow;
|
|
|
|
@Column(name="FIRSTCOLUMN", nullable=true)
|
|
|
|
/**
|
|
* Primera columna del archivo a leer
|
|
*/
|
|
private Integer firstcolumn;
|
|
|
|
@Column(name="MAXCOLUM", nullable=true)
|
|
|
|
/**
|
|
* Última columan del archivo a leer
|
|
*/
|
|
private Integer maxcolum;
|
|
|
|
@Column(name="CLASSNAME", nullable=true)
|
|
|
|
/**
|
|
* Paquete clase de negocio que se encarga de manipular la lista de objetos que fueron leídos del excel
|
|
*/
|
|
private String classname;
|
|
|
|
/**Contructor por defecto*/
|
|
public TgeneReadExcel(){
|
|
}
|
|
/**Contructor de TgeneReadExcel
|
|
@param pPk Clave Primaria del entity
|
|
*/
|
|
public TgeneReadExcel(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 TgeneReadExcel
|
|
*/
|
|
public static TgeneReadExcel find(EntityManager pEntityManager,Object pKey) throws Exception{
|
|
TgeneReadExcel obj = pEntityManager.find(TgeneReadExcel.class,pKey);
|
|
return obj;
|
|
}
|
|
/**Entrega la Clave primaria de TgeneReadExcel
|
|
@return El objeto que referencia a la Clave primaria de TgeneReadExcel
|
|
*/
|
|
public String getPk(){
|
|
return pk;
|
|
}
|
|
/**Fija un nuevo valor a la Clave primaria de TgeneReadExcel
|
|
@param pPk El objeto que referencia a la nueva Clave primaria de TgeneReadExcel
|
|
*/
|
|
public void setPk(String pPk){
|
|
pk=pPk;
|
|
}
|
|
/**Obtiene el valor de firstrow
|
|
@return valor de firstrow*/
|
|
public Integer getFirstrow(){
|
|
return firstrow;
|
|
}
|
|
/**Fija el valor de firstrow
|
|
@param pFirstrow nuevo Valor de firstrow*/
|
|
public void setFirstrow(Integer pFirstrow){
|
|
firstrow=pFirstrow;
|
|
}
|
|
|
|
/**Obtiene el valor de maxrow
|
|
@return valor de maxrow*/
|
|
public Integer getMaxrow(){
|
|
return maxrow;
|
|
}
|
|
/**Fija el valor de maxrow
|
|
@param pMaxrow nuevo Valor de maxrow*/
|
|
public void setMaxrow(Integer pMaxrow){
|
|
maxrow=pMaxrow;
|
|
}
|
|
|
|
/**Obtiene el valor de firstcolumn
|
|
@return valor de firstcolumn*/
|
|
public Integer getFirstcolumn(){
|
|
return firstcolumn;
|
|
}
|
|
/**Fija el valor de firstcolumn
|
|
@param pFirstcolumn nuevo Valor de firstcolumn*/
|
|
public void setFirstcolumn(Integer pFirstcolumn){
|
|
firstcolumn=pFirstcolumn;
|
|
}
|
|
|
|
/**Obtiene el valor de maxcolum
|
|
@return valor de maxcolum*/
|
|
public Integer getMaxcolum(){
|
|
return maxcolum;
|
|
}
|
|
/**Fija el valor de maxcolum
|
|
@param pMaxcolum nuevo Valor de maxcolum*/
|
|
public void setMaxcolum(Integer pMaxcolum){
|
|
maxcolum=pMaxcolum;
|
|
}
|
|
|
|
/**Obtiene el valor de classname
|
|
@return valor de classname*/
|
|
public String getClassname(){
|
|
return classname;
|
|
}
|
|
/**Fija el valor de classname
|
|
@param pClassname nuevo Valor de classname*/
|
|
public void setClassname(String pClassname){
|
|
classname=pClassname;
|
|
}
|
|
|
|
public boolean equals(Object rhs){
|
|
if (rhs == null)return false;
|
|
if (! (rhs instanceof TgeneReadExcel))return false;
|
|
TgeneReadExcel that = (TgeneReadExcel) rhs;
|
|
if (this.getPk() == null || that.getPk() == null)
|
|
return false;
|
|
return (this.getPk().equals(that.getPk()));
|
|
}
|
|
/**Implementación del metodo hashCode de la la entidad TgeneReadExcel
|
|
@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ó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ón de la creación de un bean en blanco TgeneReadExcel
|
|
*/
|
|
public Object createInstance(){
|
|
TgeneReadExcel instance=new TgeneReadExcel();
|
|
return instance;
|
|
}
|
|
/**Clona la entidad TgeneReadExcel
|
|
@see com.fp.dto.hb.HibernateBean#cloneMe()
|
|
*/
|
|
public Object cloneMe() throws CloneNotSupportedException{
|
|
TgeneReadExcel p=(TgeneReadExcel)this.clone();
|
|
return p;
|
|
}
|
|
}
|