318 lines
12 KiB
Plaintext
Executable File
318 lines
12 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.product.rate;
|
|
|
|
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.dto.hb.HibernateBean;
|
|
|
|
/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTINSTALLRATES */
|
|
@Entity(name = "TgeneSubProductInstallmentRates")
|
|
@Table(name = "TGENESUBPRODUCTINSTALLRATES")
|
|
public class TgeneSubProductInstallmentRates 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 TgeneSubProductInstallmentRates
|
|
*/
|
|
@EmbeddedId
|
|
private TgeneSubProductInstallmentRatesKey pk;
|
|
|
|
@Column(name = "PRINCIPALBALANCETYPE", nullable = true)
|
|
/**
|
|
* Código de tipo de capital sobre el cual se aplica una tasa y se calcula un valor a provisionar
|
|
*/
|
|
private String principalbalancetype;
|
|
|
|
@Column(name = "PRINCIPALBALANCEGROUP", nullable = true)
|
|
/**
|
|
* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor
|
|
*/
|
|
private String principalbalancegroup;
|
|
|
|
@Column(name = "NEGOTIABLE", nullable = true)
|
|
/**
|
|
* Indica si la tasa se puede negociar con el cliente
|
|
*/
|
|
private String negotiable;
|
|
|
|
@Column(name = "ACTIVE", nullable = true)
|
|
/**
|
|
* null
|
|
*/
|
|
private String active;
|
|
|
|
/** Contructor por defecto */
|
|
public TgeneSubProductInstallmentRates() {
|
|
}
|
|
|
|
/**
|
|
* Contructor de TgeneSubProductInstallmentRates
|
|
*
|
|
* @param pPk Clave Primaria del entity
|
|
*/
|
|
public TgeneSubProductInstallmentRates(TgeneSubProductInstallmentRatesKey pPk) {
|
|
this();
|
|
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 TgeneSubProductInstallmentRates
|
|
*/
|
|
public static TgeneSubProductInstallmentRates find(EntityManager pEntityManager, TgeneSubProductInstallmentRatesKey pKey) throws Exception {
|
|
TgeneSubProductInstallmentRates obj = pEntityManager.find(TgeneSubProductInstallmentRates.class, pKey);
|
|
return obj;
|
|
}
|
|
|
|
/**
|
|
* Entrega la Clave primaria de TgeneSubProductInstallmentRates
|
|
*
|
|
* @return El objeto que referencia a la Clave primaria de TgeneSubProductInstallmentRates
|
|
*/
|
|
public TgeneSubProductInstallmentRatesKey getPk() {
|
|
return this.pk;
|
|
}
|
|
|
|
/**
|
|
* Fija un nuevo valor a la Clave primaria de TgeneSubProductInstallmentRates
|
|
*
|
|
* @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductInstallmentRates
|
|
*/
|
|
public void setPk(TgeneSubProductInstallmentRatesKey pPk) {
|
|
this.pk = pPk;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de principalbalancetype
|
|
*
|
|
* @return valor de principalbalancetype
|
|
*/
|
|
public String getPrincipalbalancetype() {
|
|
return this.principalbalancetype;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de principalbalancetype
|
|
*
|
|
* @param pPrincipalbalancetype nuevo Valor de principalbalancetype
|
|
*/
|
|
public void setPrincipalbalancetype(String pPrincipalbalancetype) {
|
|
this.principalbalancetype = pPrincipalbalancetype;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de principalbalancegroup
|
|
*
|
|
* @return valor de principalbalancegroup
|
|
*/
|
|
public String getPrincipalbalancegroup() {
|
|
return this.principalbalancegroup;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de principalbalancegroup
|
|
*
|
|
* @param pPrincipalbalancegroup nuevo Valor de principalbalancegroup
|
|
*/
|
|
public void setPrincipalbalancegroup(String pPrincipalbalancegroup) {
|
|
this.principalbalancegroup = pPrincipalbalancegroup;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de negotiable
|
|
*
|
|
* @return valor de negotiable
|
|
*/
|
|
public String getNegotiable() {
|
|
return this.negotiable;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de negotiable
|
|
*
|
|
* @param pNegotiable nuevo Valor de negotiable
|
|
*/
|
|
public void setNegotiable(String pNegotiable) {
|
|
this.negotiable = pNegotiable;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de active
|
|
*
|
|
* @return valor de active
|
|
*/
|
|
public String getActive() {
|
|
return this.active;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de active
|
|
*
|
|
* @param pActive nuevo Valor de active
|
|
*/
|
|
public void setActive(String pActive) {
|
|
this.active = pActive;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object rhs) {
|
|
if (rhs == null) {
|
|
return false;
|
|
}
|
|
if (!(rhs instanceof TgeneSubProductInstallmentRates)) {
|
|
return false;
|
|
}
|
|
TgeneSubProductInstallmentRates that = (TgeneSubProductInstallmentRates) 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 TgeneSubProductInstallmentRates
|
|
*
|
|
* @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;
|
|
}
|
|
|
|
/** Implementación 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;
|
|
}
|
|
|
|
/** Implementación de la creación de un bean en blanco TgeneSubProductInstallmentRates */
|
|
@Override
|
|
public Object createInstance() {
|
|
TgeneSubProductInstallmentRates instance = new TgeneSubProductInstallmentRates();
|
|
instance.setPk(new TgeneSubProductInstallmentRatesKey());
|
|
return instance;
|
|
}
|
|
|
|
/**
|
|
* Clona la entidad TgeneSubProductInstallmentRates
|
|
*
|
|
* @see com.fp.dto.hb.HibernateBean#cloneMe()
|
|
*/
|
|
@Override
|
|
public Object cloneMe() throws CloneNotSupportedException {
|
|
TgeneSubProductInstallmentRates p = (TgeneSubProductInstallmentRates) this.clone();
|
|
p.setPk((TgeneSubProductInstallmentRatesKey) this.pk.cloneMe());
|
|
return p;
|
|
}
|
|
|
|
// Metodos manuales.
|
|
/** Sentencia que devuelve la definicion de valores a provisionar asociados al producto de una solicitud. */
|
|
private static final String HQL_INSTALLMENT_RATES = "from TgeneSubProductInstallmentRates t " + " where t.pk.modulecode = :modulecode "
|
|
+ " and t.pk.productcode = :productcode " + " and t.pk.subproductcode = :subproductcode " + " and t.pk.currencycode = :currencycode "
|
|
+ " and t.active = 'Y' ";
|
|
|
|
/**
|
|
* Entrega una lista de cargos asociados a una tabla de amortizacion, estos se pueden cobrar en la cuota,
|
|
* incrementar el valor del credito, o el cliente puede pagar en caja o con debito a la cuenta.
|
|
*
|
|
* @param pModuleCode Codigo de modulo a obtener valores a provisionar asociados a la solicitud.
|
|
* @param pProductCode Codigo de producto a obtener valores a provisionar asociados a la solicitud.
|
|
* @param pSubproductCode Codigo de subproducto a obtener valores a provisionar asociados a la solicitud.
|
|
* @param pCurrencyCode Codigo de moneda a obtener valores a provisionar asociados a la solicitud.
|
|
* @return List<TgeneSubProductInstallmentRates>
|
|
* @throws Exception
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
public static List<TgeneSubProductInstallmentRates> find(EntityManager pEntityManager, String pModuleCode, String pProductCode,
|
|
String pSubproductCode, String pCurrencyCode) throws Exception {
|
|
List<TgeneSubProductInstallmentRates> lObjects = null;
|
|
Query qry = pEntityManager.createQuery(HQL_INSTALLMENT_RATES);
|
|
qry.setParameter("modulecode", pModuleCode);
|
|
qry.setParameter("productcode", pProductCode);
|
|
qry.setParameter("subproductcode", pSubproductCode);
|
|
qry.setParameter("currencycode", pCurrencyCode);
|
|
lObjects = qry.getResultList();
|
|
return lObjects;
|
|
}
|
|
|
|
/** Sentencia que devuelve la definicion de valores a provisionar asociados al producto de una solicitud. */
|
|
private static final String HQL_INSTALLMENT_RATES_BTYPE = "from TgeneSubProductInstallmentRates t " + " where t.pk.modulecode = :modulecode "
|
|
+ " and t.pk.productcode = :productcode " + " and t.pk.subproductcode = :subproductcode " + " and t.pk.currencycode = :currencycode "
|
|
+ " and t.principalbalancetype = :btype " + " and t.principalbalancegroup = :bgroup " + " and t.active = 'Y' ";
|
|
|
|
/**
|
|
* Entrega una lista de cargos asociados a una tabla de amortizacion, estos se pueden cobrar en la cuota,
|
|
* incrementar el valor del credito, o el cliente puede pagar en caja o con debito a la cuenta.
|
|
*
|
|
* @param pModuleCode Codigo de modulo a obtener valores a provisionar asociados a la solicitud.
|
|
* @param pProductCode Codigo de producto a obtener valores a provisionar asociados a la solicitud.
|
|
* @param pSubproductCode Codigo de subproducto a obtener valores a provisionar asociados a la solicitud.
|
|
* @param pCurrencyCode Codigo de moneda a obtener valores a provisionar asociados a la solicitud.
|
|
* @return List<TgeneSubProductInstallmentRates>
|
|
* @throws Exception
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
public static List<TgeneSubProductInstallmentRates> find(EntityManager pEntityManager, String pModuleCode, String pProductCode,
|
|
String pSubproductCode, String pCurrencyCode, String pBalanceType, String pBalanceGroup) throws Exception {
|
|
List<TgeneSubProductInstallmentRates> lObjects = null;
|
|
Query qry = pEntityManager.createQuery(HQL_INSTALLMENT_RATES_BTYPE);
|
|
qry.setParameter("modulecode", pModuleCode);
|
|
qry.setParameter("productcode", pProductCode);
|
|
qry.setParameter("subproductcode", pSubproductCode);
|
|
qry.setParameter("currencycode", pCurrencyCode);
|
|
qry.setParameter("btype", pBalanceType);
|
|
qry.setParameter("bgroup", pBalanceGroup);
|
|
lObjects = qry.getResultList();
|
|
return lObjects;
|
|
}
|
|
}
|