918 lines
26 KiB
Plaintext
Executable File
918 lines
26 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.gene;
|
|
|
|
import java.io.Serializable;
|
|
import java.lang.reflect.Field;
|
|
import java.sql.Date;
|
|
import java.sql.Timestamp;
|
|
import java.util.List;
|
|
|
|
import javax.persistence.Column;
|
|
import javax.persistence.EmbeddedId;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.EntityManager;
|
|
import javax.persistence.NoResultException;
|
|
import javax.persistence.Query;
|
|
import javax.persistence.Table;
|
|
import javax.persistence.Transient;
|
|
|
|
import com.fp.common.helper.Constant;
|
|
import com.fp.dto.hb.HibernateBean;
|
|
|
|
/**
|
|
* Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDE
|
|
*/
|
|
@Entity(name = "TgeneSolicitude")
|
|
@Table(name = "TGENESOLICITUDE")
|
|
public class TgeneSolicitude 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 TgeneSolicitude
|
|
*/
|
|
@EmbeddedId
|
|
private TgeneSolicitudeKey pk;
|
|
|
|
@Column(name = "DATEFROM", nullable = false)
|
|
/**
|
|
* Fecha desde la cual esta vigente el registro de solicitud
|
|
*/
|
|
private Timestamp datefrom;
|
|
|
|
@Column(name = "ACCOUNT", nullable = true)
|
|
/**
|
|
* Numero de cuenta asociado a la solicitud
|
|
*/
|
|
private String account;
|
|
|
|
@Column(name = "COMPANY", nullable = false)
|
|
/**
|
|
* Codigo de compania a la que pertence la cuenta
|
|
*/
|
|
private Integer company;
|
|
|
|
@Column(name = "CURRENCYCODE", nullable = false)
|
|
/**
|
|
* Codigo de moneda
|
|
*/
|
|
private String currencycode;
|
|
|
|
@Column(name = "ACCOUNTNAME", nullable = true)
|
|
/**
|
|
* Nombre de la cuenta
|
|
*/
|
|
private String accountname;
|
|
|
|
@Column(name = "PERSONCODE", nullable = true)
|
|
/**
|
|
* Codigo de persona principal de la cuenta
|
|
*/
|
|
private Integer personcode;
|
|
|
|
@Column(name = "MODULECODE", nullable = true)
|
|
/**
|
|
* Codigo de modulo al que pertenece la cuenta
|
|
*/
|
|
private String modulecode;
|
|
|
|
@Column(name = "STATUSCODE", nullable = true)
|
|
/**
|
|
* Estatus de la solicitud
|
|
*/
|
|
private String statuscode;
|
|
|
|
@Column(name = "OFFICECODE", nullable = true)
|
|
/**
|
|
* Codigo de oficina a la que pertenece la cuenta
|
|
*/
|
|
private Integer officecode;
|
|
|
|
@Column(name = "BRANCHCODE", nullable = true)
|
|
/**
|
|
* Codigo de sucursal a la que pertenece la cuenta
|
|
*/
|
|
private Integer branchcode;
|
|
|
|
@Column(name = "OPENOFFICECODE", nullable = true)
|
|
/**
|
|
* Codigo de oficina de apertura de la cuenta
|
|
*/
|
|
private Integer openofficecode;
|
|
|
|
@Column(name = "OPENBRANCHCODE", nullable = true)
|
|
/**
|
|
* Codigo de sucursal de apertura de la cuenta
|
|
*/
|
|
private Integer openbranchcode;
|
|
|
|
@Column(name = "OPENINGUSERCODE", nullable = true)
|
|
/**
|
|
* Codigo de usuario de apertura de la cuenta
|
|
*/
|
|
private String openingusercode;
|
|
|
|
@Column(name = "CHARGECATALOG", nullable = true)
|
|
/**
|
|
* Codigo de catalogo 01 Natural, 02 Juridico
|
|
*/
|
|
private String chargecatalog;
|
|
|
|
@Column(name = "CHARGECATALOGCODE", nullable = true)
|
|
/**
|
|
* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona
|
|
*/
|
|
private String chargecatalogcode;
|
|
|
|
@Column(name = "RATECATALOG", nullable = true)
|
|
/**
|
|
* Codigo de catalogo 01 Natural, 02 Juridico
|
|
*/
|
|
private String ratecatalog;
|
|
|
|
@Column(name = "RATECATALOGCODE", nullable = true)
|
|
/**
|
|
* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona
|
|
*/
|
|
private String ratecatalogcode;
|
|
|
|
@Column(name = "CREDITTYPECODE", nullable = true)
|
|
/**
|
|
* Codigo de tipo de credito
|
|
*/
|
|
private String credittypecode;
|
|
|
|
@Column(name = "PRODUCTCODE", nullable = true)
|
|
/**
|
|
* Codigo de producto
|
|
*/
|
|
private String productcode;
|
|
|
|
@Column(name = "SUBPRODUCTCODE", nullable = true)
|
|
/**
|
|
* Codigo de subproducto
|
|
*/
|
|
private String subproductcode;
|
|
|
|
@Column(name = "OFFICER", nullable = true)
|
|
/**
|
|
* Codigo de usuario oficial de cuenta
|
|
*/
|
|
private String officer;
|
|
|
|
@Column(name = "SECURITYLEVEL", nullable = true)
|
|
/**
|
|
* Nivel de seguridad de la cuenta
|
|
*/
|
|
private Integer securitylevel;
|
|
|
|
@Column(name = "JOURNALID", nullable = true)
|
|
/**
|
|
* Numero de mensaje con el que se modifico el registro vigente
|
|
*/
|
|
private String journalid;
|
|
|
|
@Column(name = "OLDJOURNALID", nullable = true)
|
|
/**
|
|
* Numero de mensaje anterior
|
|
*/
|
|
private String oldjournalid;
|
|
|
|
/**
|
|
* Contructor por defecto
|
|
*/
|
|
public TgeneSolicitude() {
|
|
}
|
|
|
|
/**
|
|
* Contructor de TgeneSolicitude
|
|
*
|
|
* @param pPk Clave Primaria del entity
|
|
* @param pDatefrom Fecha desde la cual esta vigente el registro de solicitud
|
|
* @param pCompany Codigo de compania a la que pertence la cuenta
|
|
* @param pCurrencycode Codigo de moneda
|
|
*/
|
|
public TgeneSolicitude(TgeneSolicitudeKey pPk, Timestamp pDatefrom, Integer pCompany, String pCurrencycode) {
|
|
this();
|
|
this.pk = pPk;
|
|
this.datefrom = pDatefrom;
|
|
this.company = pCompany;
|
|
this.currencycode = pCurrencycode;
|
|
}
|
|
|
|
/**
|
|
* 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 TgeneSolicitude
|
|
*/
|
|
public static TgeneSolicitude find(EntityManager pEntityManager, TgeneSolicitudeKey pKey) throws Exception {
|
|
TgeneSolicitude obj = pEntityManager.find(TgeneSolicitude.class, pKey);
|
|
return obj;
|
|
}
|
|
|
|
/**
|
|
* Entrega la Clave primaria de TgeneSolicitude
|
|
*
|
|
* @return El objeto que referencia a la Clave primaria de TgeneSolicitude
|
|
*/
|
|
public TgeneSolicitudeKey getPk() {
|
|
return this.pk;
|
|
}
|
|
|
|
/**
|
|
* Fija un nuevo valor a la Clave primaria de TgeneSolicitude
|
|
*
|
|
* @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitude
|
|
*/
|
|
public void setPk(TgeneSolicitudeKey pPk) {
|
|
this.pk = pPk;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de datefrom
|
|
*
|
|
* @return valor de datefrom
|
|
*/
|
|
public Timestamp getDatefrom() {
|
|
return this.datefrom;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de datefrom
|
|
*
|
|
* @param pDatefrom nuevo Valor de datefrom
|
|
*/
|
|
public void setDatefrom(Timestamp pDatefrom) {
|
|
this.datefrom = pDatefrom;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de account
|
|
*
|
|
* @return valor de account
|
|
*/
|
|
public String getAccount() {
|
|
return this.account;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de account
|
|
*
|
|
* @param pAccount nuevo Valor de account
|
|
*/
|
|
public void setAccount(String pAccount) {
|
|
this.account = pAccount;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de company
|
|
*
|
|
* @return valor de company
|
|
*/
|
|
public Integer getCompany() {
|
|
return this.company;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de company
|
|
*
|
|
* @param pCompany nuevo Valor de company
|
|
*/
|
|
public void setCompany(Integer pCompany) {
|
|
this.company = pCompany;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de currencycode
|
|
*
|
|
* @return valor de currencycode
|
|
*/
|
|
public String getCurrencycode() {
|
|
return this.currencycode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de currencycode
|
|
*
|
|
* @param pCurrencycode nuevo Valor de currencycode
|
|
*/
|
|
public void setCurrencycode(String pCurrencycode) {
|
|
this.currencycode = pCurrencycode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de accountname
|
|
*
|
|
* @return valor de accountname
|
|
*/
|
|
public String getAccountname() {
|
|
return this.accountname;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de accountname
|
|
*
|
|
* @param pAccountname nuevo Valor de accountname
|
|
*/
|
|
public void setAccountname(String pAccountname) {
|
|
this.accountname = pAccountname;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de personcode
|
|
*
|
|
* @return valor de personcode
|
|
*/
|
|
public Integer getPersoncode() {
|
|
return this.personcode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de personcode
|
|
*
|
|
* @param pPersoncode nuevo Valor de personcode
|
|
*/
|
|
public void setPersoncode(Integer pPersoncode) {
|
|
this.personcode = pPersoncode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de modulecode
|
|
*
|
|
* @return valor de modulecode
|
|
*/
|
|
public String getModulecode() {
|
|
return this.modulecode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de modulecode
|
|
*
|
|
* @param pModulecode nuevo Valor de modulecode
|
|
*/
|
|
public void setModulecode(String pModulecode) {
|
|
this.modulecode = pModulecode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de statuscode
|
|
*
|
|
* @return valor de statuscode
|
|
*/
|
|
public String getStatuscode() {
|
|
return this.statuscode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de statuscode
|
|
*
|
|
* @param pStatuscode nuevo Valor de statuscode
|
|
*/
|
|
public void setStatuscode(String pStatuscode) {
|
|
this.statuscode = pStatuscode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de officecode
|
|
*
|
|
* @return valor de officecode
|
|
*/
|
|
public Integer getOfficecode() {
|
|
return this.officecode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de officecode
|
|
*
|
|
* @param pOfficecode nuevo Valor de officecode
|
|
*/
|
|
public void setOfficecode(Integer pOfficecode) {
|
|
this.officecode = pOfficecode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de branchcode
|
|
*
|
|
* @return valor de branchcode
|
|
*/
|
|
public Integer getBranchcode() {
|
|
return this.branchcode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de branchcode
|
|
*
|
|
* @param pBranchcode nuevo Valor de branchcode
|
|
*/
|
|
public void setBranchcode(Integer pBranchcode) {
|
|
this.branchcode = pBranchcode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de openofficecode
|
|
*
|
|
* @return valor de openofficecode
|
|
*/
|
|
public Integer getOpenofficecode() {
|
|
return this.openofficecode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de openofficecode
|
|
*
|
|
* @param pOpenofficecode nuevo Valor de openofficecode
|
|
*/
|
|
public void setOpenofficecode(Integer pOpenofficecode) {
|
|
this.openofficecode = pOpenofficecode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de openbranchcode
|
|
*
|
|
* @return valor de openbranchcode
|
|
*/
|
|
public Integer getOpenbranchcode() {
|
|
return this.openbranchcode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de openbranchcode
|
|
*
|
|
* @param pOpenbranchcode nuevo Valor de openbranchcode
|
|
*/
|
|
public void setOpenbranchcode(Integer pOpenbranchcode) {
|
|
this.openbranchcode = pOpenbranchcode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de openingusercode
|
|
*
|
|
* @return valor de openingusercode
|
|
*/
|
|
public String getOpeningusercode() {
|
|
return this.openingusercode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de openingusercode
|
|
*
|
|
* @param pOpeningusercode nuevo Valor de openingusercode
|
|
*/
|
|
public void setOpeningusercode(String pOpeningusercode) {
|
|
this.openingusercode = pOpeningusercode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de chargecatalog
|
|
*
|
|
* @return valor de chargecatalog
|
|
*/
|
|
public String getChargecatalog() {
|
|
return this.chargecatalog;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de chargecatalog
|
|
*
|
|
* @param pChargecatalog nuevo Valor de chargecatalog
|
|
*/
|
|
public void setChargecatalog(String pChargecatalog) {
|
|
this.chargecatalog = pChargecatalog;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de chargecatalogcode
|
|
*
|
|
* @return valor de chargecatalogcode
|
|
*/
|
|
public String getChargecatalogcode() {
|
|
return this.chargecatalogcode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de chargecatalogcode
|
|
*
|
|
* @param pChargecatalogcode nuevo Valor de chargecatalogcode
|
|
*/
|
|
public void setChargecatalogcode(String pChargecatalogcode) {
|
|
this.chargecatalogcode = pChargecatalogcode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de ratecatalog
|
|
*
|
|
* @return valor de ratecatalog
|
|
*/
|
|
public String getRatecatalog() {
|
|
return this.ratecatalog;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de ratecatalog
|
|
*
|
|
* @param pRatecatalog nuevo Valor de ratecatalog
|
|
*/
|
|
public void setRatecatalog(String pRatecatalog) {
|
|
this.ratecatalog = pRatecatalog;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de ratecatalogcode
|
|
*
|
|
* @return valor de ratecatalogcode
|
|
*/
|
|
public String getRatecatalogcode() {
|
|
return this.ratecatalogcode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de ratecatalogcode
|
|
*
|
|
* @param pRatecatalogcode nuevo Valor de ratecatalogcode
|
|
*/
|
|
public void setRatecatalogcode(String pRatecatalogcode) {
|
|
this.ratecatalogcode = pRatecatalogcode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de credittypecode
|
|
*
|
|
* @return valor de credittypecode
|
|
*/
|
|
public String getCredittypecode() {
|
|
return this.credittypecode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de credittypecode
|
|
*
|
|
* @param pCredittypecode nuevo Valor de credittypecode
|
|
*/
|
|
public void setCredittypecode(String pCredittypecode) {
|
|
this.credittypecode = pCredittypecode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de productcode
|
|
*
|
|
* @return valor de productcode
|
|
*/
|
|
public String getProductcode() {
|
|
return this.productcode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de productcode
|
|
*
|
|
* @param pProductcode nuevo Valor de productcode
|
|
*/
|
|
public void setProductcode(String pProductcode) {
|
|
this.productcode = pProductcode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de subproductcode
|
|
*
|
|
* @return valor de subproductcode
|
|
*/
|
|
public String getSubproductcode() {
|
|
return this.subproductcode;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de subproductcode
|
|
*
|
|
* @param pSubproductcode nuevo Valor de subproductcode
|
|
*/
|
|
public void setSubproductcode(String pSubproductcode) {
|
|
this.subproductcode = pSubproductcode;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de officer
|
|
*
|
|
* @return valor de officer
|
|
*/
|
|
public String getOfficer() {
|
|
return this.officer;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de officer
|
|
*
|
|
* @param pOfficer nuevo Valor de officer
|
|
*/
|
|
public void setOfficer(String pOfficer) {
|
|
this.officer = pOfficer;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de securitylevel
|
|
*
|
|
* @return valor de securitylevel
|
|
*/
|
|
public Integer getSecuritylevel() {
|
|
return this.securitylevel;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de securitylevel
|
|
*
|
|
* @param pSecuritylevel nuevo Valor de securitylevel
|
|
*/
|
|
public void setSecuritylevel(Integer pSecuritylevel) {
|
|
this.securitylevel = pSecuritylevel;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de journalid
|
|
*
|
|
* @return valor de journalid
|
|
*/
|
|
public String getJournalid() {
|
|
return this.journalid;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de journalid
|
|
*
|
|
* @param pJournalid nuevo Valor de journalid
|
|
*/
|
|
public void setJournalid(String pJournalid) {
|
|
this.journalid = pJournalid;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de oldjournalid
|
|
*
|
|
* @return valor de oldjournalid
|
|
*/
|
|
public String getOldjournalid() {
|
|
return this.oldjournalid;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de oldjournalid
|
|
*
|
|
* @param pOldjournalid nuevo Valor de oldjournalid
|
|
*/
|
|
public void setOldjournalid(String pOldjournalid) {
|
|
this.oldjournalid = pOldjournalid;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object rhs) {
|
|
if (rhs == null) {
|
|
return false;
|
|
}
|
|
if (!(rhs instanceof TgeneSolicitude)) {
|
|
return false;
|
|
}
|
|
TgeneSolicitude that = (TgeneSolicitude) rhs;
|
|
if ((this.getPk() == null) || (that.getPk() == null)) {
|
|
return false;
|
|
}
|
|
return (this.getPk().equals(that.getPk()));
|
|
}
|
|
|
|
/**
|
|
* Implementacion del metodo hashCode de la la entidad TgeneSolicitude
|
|
*
|
|
* @return el hashCode la instancia
|
|
*/
|
|
@Override
|
|
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
|
|
*/
|
|
@Override
|
|
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 TgeneSolicitude
|
|
*/
|
|
@Override
|
|
public Object createInstance() {
|
|
TgeneSolicitude instance = new TgeneSolicitude();
|
|
instance.setPk(new TgeneSolicitudeKey());
|
|
return instance;
|
|
}
|
|
|
|
/**
|
|
* Clona la entidad TgeneSolicitude
|
|
*
|
|
* @see com.fp.dto.hb.HibernateBean#cloneMe()
|
|
*/
|
|
@Override
|
|
public Object cloneMe() throws CloneNotSupportedException {
|
|
TgeneSolicitude p = (TgeneSolicitude) this.clone();
|
|
p.setPk((TgeneSolicitudeKey) this.pk.cloneMe());
|
|
return p;
|
|
}
|
|
|
|
public Object getId() {
|
|
return this.pk;
|
|
}
|
|
|
|
// METODOS MANUALES
|
|
/**
|
|
* Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude
|
|
*/
|
|
private static final String JPQL_SOLICITUDE = "from TgeneSolicitude tgs" + " where tgs.pk.solicitudnumber = :solicitudnumber"
|
|
+ " and tgs.pk.solicitudsequence = :solicitudsequence" + " and tgs.pk.dateto = :dateto";
|
|
|
|
/**
|
|
* Metodo que devuelve un objeto de tipo TgeneSolicitude
|
|
*
|
|
* @param solicitudnumber
|
|
* @param solicitudsequence
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public static TgeneSolicitude find(EntityManager pEntityManager, String solicitudnumber, Integer solicitudsequence) throws Exception {
|
|
Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE);
|
|
qry.setParameter("solicitudnumber", solicitudnumber);
|
|
qry.setParameter("solicitudsequence", solicitudsequence);
|
|
qry.setParameter("dateto", Constant.getDefaultExpiryDate());
|
|
try {
|
|
return (TgeneSolicitude) qry.getSingleResult();
|
|
} catch (NoResultException e) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude por codigo modulo
|
|
*/
|
|
private static final String JPQL_SOLICITUDE_WITHOUT_DISB_BY_ACCOUNT = "from TgeneSolicitude sol where (coalesce(sol.account, 'null') = 'null'"
|
|
+ " or sol.account in(select acc.pk.account from TgeneAccount acc where acc.accountstatuscode!='VIG' and acc.pk.dateto = :dateto ))"
|
|
+ "and sol.statuscode in('ENT', 'APR') and sol.modulecode = :modulecode and sol.account = :account and sol.pk.dateto = :dateto";
|
|
|
|
/**
|
|
* Metodo que devuelve una lista de TgeneSolicitude nuevas y que no tengan cuentas con estado VIG por codigo de
|
|
* cuenta
|
|
*
|
|
* @param pEntityManager
|
|
* @param moduleCode
|
|
* @param accountNumber
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
public static List<TgeneSolicitude> findWithoutDisbursementByAccount(EntityManager pEntityManager, String moduleCode, String accountNumber,
|
|
Integer page, Integer recordperpage) throws Exception {
|
|
Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_WITHOUT_DISB_BY_ACCOUNT);
|
|
qry.setParameter("modulecode", moduleCode);
|
|
qry.setParameter("account", accountNumber);
|
|
qry.setParameter("dateto", Constant.getDefaultExpiryDate());
|
|
if ((page != null) && (recordperpage != null) && (page >= 0) && (recordperpage > 0)) {
|
|
if (page > 1) {
|
|
qry.setFirstResult((page - 1) * recordperpage);
|
|
}
|
|
qry.setMaxResults(recordperpage);
|
|
}
|
|
return qry.getResultList();
|
|
}
|
|
|
|
/**
|
|
* Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude por codigo de persona
|
|
*/
|
|
private static final String JPQL_SOLICITUDE_WITHOUT_DISB_BY_PERSON = "from TgeneSolicitude sol where (coalesce(sol.account, 'null') = 'null'"
|
|
+ " or sol.account in(select acc.pk.account from TgeneAccount acc where acc.accountstatuscode!='VIG' and acc.pk.dateto = :dateto ))"
|
|
+ "and sol.statuscode in('ENT', 'APR') and sol.modulecode = :modulecode and sol.personcode = :personcode and sol.pk.dateto = :dateto";
|
|
|
|
/**
|
|
* Metodo que devuelve una lista de TgeneSolicitude nuevas y que no tengan cuentas con estado VIG por codigo de
|
|
* persona
|
|
*
|
|
* @param pEntityManager
|
|
* @param moduleCode
|
|
* @param personCode
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
public static List<TgeneSolicitude> findWithoutDisbursementByPerson(EntityManager pEntityManager, String moduleCode, Integer personCode,
|
|
Integer page, Integer recordperpage) throws Exception {
|
|
Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_WITHOUT_DISB_BY_PERSON);
|
|
qry.setParameter("modulecode", moduleCode);
|
|
qry.setParameter("personcode", personCode);
|
|
qry.setParameter("dateto", Constant.getDefaultExpiryDate());
|
|
if ((page != null) && (recordperpage != null) && (page >= 0) && (recordperpage > 0)) {
|
|
if (page > 1) {
|
|
qry.setFirstResult((page - 1) * recordperpage);
|
|
}
|
|
qry.setMaxResults(recordperpage);
|
|
}
|
|
return qry.getResultList();
|
|
}
|
|
|
|
/**
|
|
* Sentencia SQL que consulta retorna la solicitud dada una cuenta y estatus
|
|
*/
|
|
private static final String JPQL_SOLICITUDE_BY_ACCOUNT_AND_STATUS = "from TgeneSolicitude sol " + " where sol.account = :account "
|
|
+ " and sol.company = :company " + " and sol.statuscode = :statuscode and sol.pk.dateto = :dateto";
|
|
|
|
/**
|
|
* Sentencia SQL que consulta retorna la solicitud dada una cuenta
|
|
*/
|
|
private static final String JPQL_SOLICITUDE_BY_ACCOUNT = "from TgeneSolicitude sol " + " where sol.account = :account "
|
|
+ " and sol.company = :company " + " and sol.pk.dateto = :dateto";
|
|
|
|
/**
|
|
* Metodo que devuelve una solicitud por medio de la cuenta que ha creado y el estado de la solicitud
|
|
*
|
|
* @param pEntityManager
|
|
* @param paccount
|
|
* @param pcompany
|
|
* @param status
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public static TgeneSolicitude findByAccountAndStatus(EntityManager pEntityManager, String paccount, Integer pcompany, String status)
|
|
throws Exception {
|
|
Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_BY_ACCOUNT_AND_STATUS);
|
|
qry.setParameter("account", paccount);
|
|
qry.setParameter("company", pcompany);
|
|
qry.setParameter("dateto", Constant.getDefaultExpiryDate());
|
|
qry.setParameter("statuscode", status);
|
|
qry.setMaxResults(1);
|
|
if (qry.getResultList().isEmpty()) {
|
|
return null;
|
|
}
|
|
return (TgeneSolicitude) qry.getResultList().get(0);
|
|
}
|
|
|
|
/**
|
|
* Metodo que devuelve una solicitud por medio de la cuenta que ha creado
|
|
*
|
|
* @param pEntityManager
|
|
* @param paccount
|
|
* @param pcompany
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public static TgeneSolicitude findByAccount(EntityManager pEntityManager, String paccount, Integer pcompany) throws Exception {
|
|
Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_BY_ACCOUNT);
|
|
qry.setParameter("account", paccount);
|
|
qry.setParameter("company", pcompany);
|
|
qry.setParameter("dateto", Constant.getDefaultExpiryDate());
|
|
qry.setMaxResults(1);
|
|
return (TgeneSolicitude) qry.getResultList().get(0);
|
|
}
|
|
|
|
private static final String JPQL_SOLICITUDE_APPDATE = " select min(datefrom) from TgeneSolicitude sol "
|
|
+ " where sol.pk.solicitudnumber = :solicitudnumber" + " and sol.company = :company ";
|
|
|
|
public static Date findApplicationDate(EntityManager pEntityManager, String solicitudnumber, Integer company) {
|
|
Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_APPDATE);
|
|
qry.setParameter("solicitudnumber", solicitudnumber);
|
|
qry.setParameter("company", company);
|
|
Timestamp obj = (Timestamp) qry.getSingleResult();
|
|
return new Date(obj.getTime());
|
|
}
|
|
}
|