300 lines
8.1 KiB
Plaintext
Executable File
300 lines
8.1 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.safe;
|
|
|
|
import javax.persistence.EmbeddedId;
|
|
import javax.persistence.Entity;
|
|
import java.sql.Timestamp;
|
|
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 TSAFEUSERSESSIONLOG*/
|
|
@Entity(name="TsafeUserSessionLog")
|
|
@Table(name="TSAFEUSERSESSIONLOG")
|
|
public class TsafeUserSessionLog 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 TsafeUserSessionLog
|
|
*/
|
|
@EmbeddedId
|
|
private TsafeUserSessionLogKey pk;
|
|
@Column(name="USERCODE", nullable=false)
|
|
|
|
/**
|
|
* Codigo de usuario
|
|
*/
|
|
private String usercode;
|
|
|
|
@Column(name="BRANCHCODE", nullable=true)
|
|
|
|
/**
|
|
* Codigo de sucursal
|
|
*/
|
|
private Integer branchcode;
|
|
|
|
@Column(name="OFFICECODE", nullable=true)
|
|
|
|
/**
|
|
* Codigo de oficina
|
|
*/
|
|
private Integer officecode;
|
|
|
|
@Column(name="TERMINALCODE", nullable=false)
|
|
|
|
/**
|
|
* Codigo de terminal desde el cual se conecta el usuario.
|
|
*/
|
|
private String terminalcode;
|
|
|
|
@Column(name="SESSIONID", nullable=false)
|
|
|
|
/**
|
|
* Session id del browser con el servlet.
|
|
*/
|
|
private String sessionid;
|
|
|
|
@Column(name="WEBSERVERIP", nullable=false)
|
|
|
|
/**
|
|
* Ip del servidor de aplicaciones al cual esta conectado un usuario, sirve para caducar las sessiones de usuario asociadas a esta ip
|
|
*/
|
|
private String webserverip;
|
|
|
|
@Column(name="REALDATE", nullable=false)
|
|
|
|
/**
|
|
* Fecha en la que se realiza el login
|
|
*/
|
|
private Timestamp realdate;
|
|
|
|
@Column(name="ERRORCODE", nullable=false)
|
|
|
|
/**
|
|
* Codigo de error
|
|
*/
|
|
private String errorcode;
|
|
|
|
@Column(name="MESSAGELOGIN", nullable=false)
|
|
|
|
/**
|
|
* Mensaje al intentar loguearse
|
|
*/
|
|
private String messagelogin;
|
|
|
|
/**Contructor por defecto*/
|
|
public TsafeUserSessionLog(){
|
|
}
|
|
/**Contructor de TsafeUserSessionLog
|
|
@param pPk Clave Primaria del entity
|
|
@param pUsercode Codigo de usuario
|
|
@param pTerminalcode Codigo de terminal desde el cual se conecta el usuario.
|
|
@param pSessionid Session id del browser con el servlet.
|
|
@param pWebserverip Ip del servidor de aplicaciones al cual esta conectado un usuario, sirve para caducar las sessiones de usuario asociadas a esta ip
|
|
@param pRealdate Fecha en la que se realiza el login
|
|
@param pErrorcode Codigo de error
|
|
@param pMessagelogin Mensaje al intentar loguearse
|
|
*/
|
|
public TsafeUserSessionLog(TsafeUserSessionLogKey pPk,String pUsercode,String pTerminalcode,String pSessionid,String pWebserverip,Timestamp pRealdate,String pErrorcode,String pMessagelogin){
|
|
this();
|
|
pk=pPk;
|
|
usercode=pUsercode;
|
|
terminalcode=pTerminalcode;
|
|
sessionid=pSessionid;
|
|
webserverip=pWebserverip;
|
|
realdate=pRealdate;
|
|
errorcode=pErrorcode;
|
|
messagelogin=pMessagelogin;
|
|
}
|
|
/**
|
|
* 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 TsafeUserSessionLog
|
|
*/
|
|
public static TsafeUserSessionLog find(EntityManager pEntityManager,TsafeUserSessionLogKey pKey) throws Exception{
|
|
TsafeUserSessionLog obj = pEntityManager.find(TsafeUserSessionLog.class,pKey);
|
|
return obj;
|
|
}
|
|
/**Entrega la Clave primaria de TsafeUserSessionLog
|
|
@return El objeto que referencia a la Clave primaria de TsafeUserSessionLog
|
|
*/
|
|
public TsafeUserSessionLogKey getPk(){
|
|
return pk;
|
|
}
|
|
/**Fija un nuevo valor a la Clave primaria de TsafeUserSessionLog
|
|
@param pPk El objeto que referencia a la nueva Clave primaria de TsafeUserSessionLog
|
|
*/
|
|
public void setPk(TsafeUserSessionLogKey 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 branchcode
|
|
@return valor de branchcode*/
|
|
public Integer getBranchcode(){
|
|
return branchcode;
|
|
}
|
|
/**Fija el valor de branchcode
|
|
@param pBranchcode nuevo Valor de branchcode*/
|
|
public void setBranchcode(Integer pBranchcode){
|
|
branchcode=pBranchcode;
|
|
}
|
|
|
|
/**Obtiene el valor de officecode
|
|
@return valor de officecode*/
|
|
public Integer getOfficecode(){
|
|
return officecode;
|
|
}
|
|
/**Fija el valor de officecode
|
|
@param pOfficecode nuevo Valor de officecode*/
|
|
public void setOfficecode(Integer pOfficecode){
|
|
officecode=pOfficecode;
|
|
}
|
|
|
|
/**Obtiene el valor de terminalcode
|
|
@return valor de terminalcode*/
|
|
public String getTerminalcode(){
|
|
return terminalcode;
|
|
}
|
|
/**Fija el valor de terminalcode
|
|
@param pTerminalcode nuevo Valor de terminalcode*/
|
|
public void setTerminalcode(String pTerminalcode){
|
|
terminalcode=pTerminalcode;
|
|
}
|
|
|
|
/**Obtiene el valor de sessionid
|
|
@return valor de sessionid*/
|
|
public String getSessionid(){
|
|
return sessionid;
|
|
}
|
|
/**Fija el valor de sessionid
|
|
@param pSessionid nuevo Valor de sessionid*/
|
|
public void setSessionid(String pSessionid){
|
|
sessionid=pSessionid;
|
|
}
|
|
|
|
/**Obtiene el valor de webserverip
|
|
@return valor de webserverip*/
|
|
public String getWebserverip(){
|
|
return webserverip;
|
|
}
|
|
/**Fija el valor de webserverip
|
|
@param pWebserverip nuevo Valor de webserverip*/
|
|
public void setWebserverip(String pWebserverip){
|
|
webserverip=pWebserverip;
|
|
}
|
|
|
|
/**Obtiene el valor de realdate
|
|
@return valor de realdate*/
|
|
public Timestamp getRealdate(){
|
|
return realdate;
|
|
}
|
|
/**Fija el valor de realdate
|
|
@param pRealdate nuevo Valor de realdate*/
|
|
public void setRealdate(Timestamp pRealdate){
|
|
realdate=pRealdate;
|
|
}
|
|
|
|
/**Obtiene el valor de errorcode
|
|
@return valor de errorcode*/
|
|
public String getErrorcode(){
|
|
return errorcode;
|
|
}
|
|
/**Fija el valor de errorcode
|
|
@param pErrorcode nuevo Valor de errorcode*/
|
|
public void setErrorcode(String pErrorcode){
|
|
errorcode=pErrorcode;
|
|
}
|
|
|
|
/**Obtiene el valor de messagelogin
|
|
@return valor de messagelogin*/
|
|
public String getMessagelogin(){
|
|
return messagelogin;
|
|
}
|
|
/**Fija el valor de messagelogin
|
|
@param pMessagelogin nuevo Valor de messagelogin*/
|
|
public void setMessagelogin(String pMessagelogin){
|
|
messagelogin=pMessagelogin;
|
|
}
|
|
|
|
public boolean equals(Object rhs){
|
|
if (rhs == null)return false;
|
|
if (! (rhs instanceof TsafeUserSessionLog))return false;
|
|
TsafeUserSessionLog that = (TsafeUserSessionLog) rhs;
|
|
if (this.getPk() == null || that.getPk() == null)
|
|
return false;
|
|
return (this.getPk().equals(that.getPk()));
|
|
}
|
|
/**Implementacion del metodo hashCode de la la entidad TsafeUserSessionLog
|
|
@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 TsafeUserSessionLog
|
|
*/
|
|
public Object createInstance(){
|
|
TsafeUserSessionLog instance=new TsafeUserSessionLog();
|
|
instance.setPk(new TsafeUserSessionLogKey());
|
|
return instance;
|
|
}
|
|
/**Clona la entidad TsafeUserSessionLog
|
|
@see com.fp.dto.hb.HibernateBean#cloneMe()
|
|
*/
|
|
public Object cloneMe() throws CloneNotSupportedException{
|
|
TsafeUserSessionLog p=(TsafeUserSessionLog)this.clone();
|
|
p.setPk((TsafeUserSessionLogKey)this.pk.cloneMe());
|
|
return p;
|
|
}
|
|
}
|