maia_modificado/.svn/pristine/ea/ea5b3a35085f05cc08d465715c7...

250 lines
7.3 KiB
Plaintext
Executable File
Raw Permalink Blame History

package com.fp.persistence.pgeneral.acco;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.fp.common.helper.Constant;
import com.fp.demandeposit.exception.DemandDepositException;
import com.fp.dto.hb.HibernateBean;
/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACCOUNTOPERSTAT */
@Entity(name = "TgeneTransAccountOperStat")
@Table(name = "TGENETRANSACCOUNTOPERSTAT")
public class TgeneTransAccountOperStat 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 TgeneTransAccountOperStat
*/
@EmbeddedId
private TgeneTransAccountOperStatKey pk;
@Column(name = "EVALUATETRUE", nullable = true)
/**
* Y, Indica que el estatus actual del ceque tiene que estar en esta condicion, N, el estatus actual del cheque no tiene que estar en la condicion del registro
*/
private String evaluatetrue;
@Column(name = "VALIDATEDEBIT", nullable = true)
/**
* Y, Indica que valida cuenta debito
*/
private String validatedebit;
@Column(name = "VALIDATECREDIT", nullable = true)
/**
* Y, Indica que valida la cuenta credito
*/
private String validatecredit;
/** Contructor por defecto */
public TgeneTransAccountOperStat() {
}
/**
* Contructor de TgeneTransAccountOperStat
*
* @param pPk Clave Primaria del entity
*/
public TgeneTransAccountOperStat(TgeneTransAccountOperStatKey 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 TgeneTransAccountOperStat
*/
public static TgeneTransAccountOperStat find(EntityManager pEntityManager, TgeneTransAccountOperStatKey pKey)
throws Exception {
TgeneTransAccountOperStat obj = pEntityManager.find(TgeneTransAccountOperStat.class, pKey);
return obj;
}
/**
* Entrega la Clave primaria de TgeneTransAccountOperStat
*
* @return El objeto que referencia a la Clave primaria de TgeneTransAccountOperStat
*/
public TgeneTransAccountOperStatKey getPk() {
return pk;
}
/**
* Fija un nuevo valor a la Clave primaria de TgeneTransAccountOperStat
*
* @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransAccountOperStat
*/
public void setPk(TgeneTransAccountOperStatKey pPk) {
pk = pPk;
}
/**
* Obtiene el valor de evaluatetrue
*
* @return valor de evaluatetrue
*/
public String getEvaluatetrue() {
return evaluatetrue;
}
/**
* Fija el valor de evaluatetrue
*
* @param pEvaluatetrue nuevo Valor de evaluatetrue
*/
public void setEvaluatetrue(String pEvaluatetrue) {
evaluatetrue = pEvaluatetrue;
}
/**
* Obtiene el valor de validatedebit
*
* @return valor de validatedebit
*/
public String getValidatedebit() {
return validatedebit;
}
/**
* Fija el valor de validatedebit
*
* @param pValidatedebit nuevo Valor de validatedebit
*/
public void setValidatedebit(String pValidatedebit) {
validatedebit = pValidatedebit;
}
/**
* Obtiene el valor de validatecredit
*
* @return valor de validatecredit
*/
public String getValidatecredit() {
return validatecredit;
}
/**
* Fija el valor de validatecredit
*
* @param pValidatecredit nuevo Valor de validatecredit
*/
public void setValidatecredit(String pValidatecredit) {
validatecredit = pValidatecredit;
}
public boolean equals(Object rhs) {
if (rhs == null)
return false;
if (!(rhs instanceof TgeneTransAccountOperStat))
return false;
TgeneTransAccountOperStat that = (TgeneTransAccountOperStat) 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 TgeneTransAccountOperStat
*
* @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 TgeneTransAccountOperStat */
public Object createInstance() {
TgeneTransAccountOperStat instance = new TgeneTransAccountOperStat();
instance.setPk(new TgeneTransAccountOperStatKey());
return instance;
}
/**
* Clona la entidad TgeneTransAccountOperStat
*
* @see com.fp.dto.hb.HibernateBean#cloneMe()
*/
public Object cloneMe() throws CloneNotSupportedException {
TgeneTransAccountOperStat p = (TgeneTransAccountOperStat) this.clone();
p.setPk((TgeneTransAccountOperStatKey) this.pk.cloneMe());
return p;
}
//Metodos manuales.
/** Sentencia que devuelve lista de registros de TgeneTransAccountOperStat.*/
private static final String HQL_TRAN_ACCOUNT_OPER =
" from TgeneTransAccountOperStat t " +
" where t.pk.transactionmodule = :module " +
" and t.pk.transactioncode = :code " +
" and t.pk.transactionversion = :version " ;
/**
* Metodo que entrega datos de condicion operativa de cuentas por transaccion.
* @param pEntityManager Referencia a la session de la base de datos.
* @param pModule Codigo de modulo.
* @param pTransaction Codigo de transaccion.
* @param pVersion Codigo de version de transaccion.
* @return List<TgeneTransAccountOperStat>
* @throws Exception
*/
@SuppressWarnings(Constant.VUNCHECKED)
public static List<TgeneTransAccountOperStat> find(EntityManager pEntityManager,String pModule,Integer pTransaction,
Integer pVersion) throws Exception {
List<TgeneTransAccountOperStat> lobj = null;
Query qry = pEntityManager.createQuery(HQL_TRAN_ACCOUNT_OPER);
qry.setParameter("module", pModule);
qry.setParameter("code", pTransaction);
qry.setParameter("version", pVersion);
lobj = qry.getResultList();
if(lobj.isEmpty()){
throw new DemandDepositException("CORE-0049","CONDICION OPERATIVA DE CUENTA NO DEFINO EN TGENETRANSACCOUNTOPERSTAT: MODULE: {0} TRAN: {1} VER: {2}",
pModule,pTransaction,pVersion);
}
return lobj;
}
}