maia_modificado/.svn/pristine/c0/c0073c283742999989e6dbe934a...

248 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 TGENETRANSACCOUNTSTATUS */
@Entity(name = "TgeneTransAccountStatus")
@Table(name = "TGENETRANSACCOUNTSTATUS")
public class TgeneTransAccountStatus 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 TgeneTransAccountStatus
*/
@EmbeddedId
private TgeneTransAccountStatusKey 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 TgeneTransAccountStatus() {
}
/**
* Contructor de TgeneTransAccountStatus
*
* @param pPk Clave Primaria del entity
*/
public TgeneTransAccountStatus(TgeneTransAccountStatusKey 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 TgeneTransAccountStatus
*/
public static TgeneTransAccountStatus find(EntityManager pEntityManager, TgeneTransAccountStatusKey pKey)
throws Exception {
TgeneTransAccountStatus obj = pEntityManager.find(TgeneTransAccountStatus.class, pKey);
return obj;
}
/**
* Entrega la Clave primaria de TgeneTransAccountStatus
*
* @return El objeto que referencia a la Clave primaria de TgeneTransAccountStatus
*/
public TgeneTransAccountStatusKey getPk() {
return pk;
}
/**
* Fija un nuevo valor a la Clave primaria de TgeneTransAccountStatus
*
* @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransAccountStatus
*/
public void setPk(TgeneTransAccountStatusKey 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 TgeneTransAccountStatus))
return false;
TgeneTransAccountStatus that = (TgeneTransAccountStatus) 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 TgeneTransAccountStatus
*
* @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 TgeneTransAccountStatus */
public Object createInstance() {
TgeneTransAccountStatus instance = new TgeneTransAccountStatus();
instance.setPk(new TgeneTransAccountStatusKey());
return instance;
}
/**
* Clona la entidad TgeneTransAccountStatus
*
* @see com.fp.dto.hb.HibernateBean#cloneMe()
*/
public Object cloneMe() throws CloneNotSupportedException {
TgeneTransAccountStatus p = (TgeneTransAccountStatus) this.clone();
p.setPk((TgeneTransAccountStatusKey) this.pk.cloneMe());
return p;
}
//Metodos manuales.
/** Sentencia que devuelve lista de registros de TgeneTransAccountStatus.*/
private static final String HQL_TRAN_ACCOUNT_STATUS =
" from TgeneTransAccountStatus ttranaccostat " +
" where ttranaccostat.pk.transactionmodule = :transactionmodule " +
" and ttranaccostat.pk.transactioncode = :transactioncode " +
" and ttranaccostat.pk.transactionversion = :transactionversion " ;
/**
* Metodo que entrega datos de estatus 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<TgeneTransAccountStatus>
* @throws Exception
*/
@SuppressWarnings(Constant.VUNCHECKED)
public static List<TgeneTransAccountStatus> find(EntityManager pEntityManager,String pModule,Integer pTransaction,
Integer pVersion) throws Exception {
List<TgeneTransAccountStatus> status = null;
Query qry = pEntityManager.createQuery(HQL_TRAN_ACCOUNT_STATUS);
qry.setParameter("transactionmodule", pModule);
qry.setParameter("transactioncode", pTransaction);
qry.setParameter("transactionversion", pVersion);
status = qry.getResultList();
if(status.isEmpty()){
throw new DemandDepositException("CORE-0043","ESTATUS DE CUENTA NO DEFINO EN TGENETRANSACCOUNTSTATUS: {0} MODULE: {1} TRAN: {2} VER: {2}",
pModule,pTransaction,pVersion);
}
return status;
}
}