402 lines
10 KiB
Plaintext
Executable File
402 lines
10 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.acco;
|
||
|
||
import java.io.Serializable;
|
||
import java.lang.reflect.Field;
|
||
import java.math.BigDecimal;
|
||
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.dto.hb.HibernateBean;
|
||
|
||
/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTFORCREDIT */
|
||
@Entity(name = "TgeneAccountForCredit")
|
||
@Table(name = "TGENEACCOUNTFORCREDIT")
|
||
public class TgeneAccountForCredit 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 TgeneAccountForCredit
|
||
*/
|
||
@EmbeddedId
|
||
private TgeneAccountForCreditKey pk;
|
||
@Column(name = "CASH", nullable = true)
|
||
/**
|
||
* Indica que el pago se realiaza en efectivo.
|
||
*/
|
||
private String cash;
|
||
|
||
@Column(name = "CHECKS", nullable = true)
|
||
/**
|
||
* Indica que el pago se realiaza en cheque.
|
||
*/
|
||
private String checks;
|
||
|
||
@Column(name = "CREDIT", nullable = true)
|
||
/**
|
||
* Indica que el pago se realiaza con credito a una cuenta.
|
||
*/
|
||
private String credit;
|
||
|
||
@Column(name = "CREDITACCOUNT", nullable = true)
|
||
/**
|
||
* Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta.
|
||
*/
|
||
private String creditaccount;
|
||
|
||
@Column(name = "CREDITACCOUNTINGCODE", nullable = true)
|
||
/**
|
||
* Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta.
|
||
*/
|
||
private String creditaccountingcode;
|
||
|
||
@Column(name = "CURRENCY", nullable = true)
|
||
/**
|
||
* Codigo de moneda de la cuenta de la operacion.
|
||
*/
|
||
private String currency;
|
||
|
||
@Column(name = "VALUE", nullable = true)
|
||
/**
|
||
* El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc..
|
||
*/
|
||
private BigDecimal value;
|
||
|
||
@Column(name = "PERSONCODE", nullable = true)
|
||
/**
|
||
* Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado.
|
||
*/
|
||
private Integer personcode;
|
||
|
||
@Column(name = "IDBENEFICIARY", nullable = true)
|
||
/**
|
||
* Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario.
|
||
*/
|
||
private String idbeneficiary;
|
||
|
||
@Column(name = "BENEFICIARYNAME", nullable = true)
|
||
/**
|
||
* Nombre del beneficiario.
|
||
*/
|
||
private String beneficiaryname;
|
||
|
||
/** Contructor por defecto */
|
||
public TgeneAccountForCredit() {
|
||
}
|
||
/**
|
||
* Contructor de TgeneAccountForCredit
|
||
*
|
||
* @param pPk Clave Primaria del entity
|
||
*/
|
||
public TgeneAccountForCredit(TgeneAccountForCreditKey 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 TgeneAccountForCredit
|
||
*/
|
||
public static TgeneAccountForCredit find(EntityManager pEntityManager, TgeneAccountForCreditKey pKey)
|
||
throws Exception {
|
||
TgeneAccountForCredit obj = pEntityManager.find(TgeneAccountForCredit.class, pKey);
|
||
return obj;
|
||
}
|
||
/**
|
||
* Entrega la Clave primaria de TgeneAccountForCredit
|
||
*
|
||
* @return El objeto que referencia a la Clave primaria de TgeneAccountForCredit
|
||
*/
|
||
public TgeneAccountForCreditKey getPk() {
|
||
return pk;
|
||
}
|
||
/**
|
||
* Fija un nuevo valor a la Clave primaria de TgeneAccountForCredit
|
||
*
|
||
* @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountForCredit
|
||
*/
|
||
public void setPk(TgeneAccountForCreditKey pPk) {
|
||
pk = pPk;
|
||
}
|
||
/**
|
||
* Obtiene el valor de cash
|
||
*
|
||
* @return valor de cash
|
||
*/
|
||
public String getCash() {
|
||
return cash;
|
||
}
|
||
/**
|
||
* Fija el valor de cash
|
||
*
|
||
* @param pCash nuevo Valor de cash
|
||
*/
|
||
public void setCash(String pCash) {
|
||
cash = pCash;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de checks
|
||
*
|
||
* @return valor de checks
|
||
*/
|
||
public String getChecks() {
|
||
return checks;
|
||
}
|
||
/**
|
||
* Fija el valor de checks
|
||
*
|
||
* @param pChecks nuevo Valor de checks
|
||
*/
|
||
public void setChecks(String pChecks) {
|
||
checks = pChecks;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de credit
|
||
*
|
||
* @return valor de credit
|
||
*/
|
||
public String getCredit() {
|
||
return credit;
|
||
}
|
||
/**
|
||
* Fija el valor de credit
|
||
*
|
||
* @param pCredit nuevo Valor de credit
|
||
*/
|
||
public void setCredit(String pCredit) {
|
||
credit = pCredit;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de creditaccount
|
||
*
|
||
* @return valor de creditaccount
|
||
*/
|
||
public String getCreditaccount() {
|
||
return creditaccount;
|
||
}
|
||
/**
|
||
* Fija el valor de creditaccount
|
||
*
|
||
* @param pCreditaccount nuevo Valor de creditaccount
|
||
*/
|
||
public void setCreditaccount(String pCreditaccount) {
|
||
creditaccount = pCreditaccount;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de creditaccountingcode
|
||
*
|
||
* @return valor de creditaccountingcode
|
||
*/
|
||
public String getCreditaccountingcode() {
|
||
return creditaccountingcode;
|
||
}
|
||
/**
|
||
* Fija el valor de creditaccountingcode
|
||
*
|
||
* @param pCreditaccountingcode nuevo Valor de creditaccountingcode
|
||
*/
|
||
public void setCreditaccountingcode(String pCreditaccountingcode) {
|
||
creditaccountingcode = pCreditaccountingcode;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de currency
|
||
*
|
||
* @return valor de currency
|
||
*/
|
||
public String getCurrency() {
|
||
return currency;
|
||
}
|
||
/**
|
||
* Fija el valor de currency
|
||
*
|
||
* @param pCurrency nuevo Valor de currency
|
||
*/
|
||
public void setCurrency(String pCurrency) {
|
||
currency = pCurrency;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de value
|
||
*
|
||
* @return valor de value
|
||
*/
|
||
public BigDecimal getValue() {
|
||
return value;
|
||
}
|
||
/**
|
||
* Fija el valor de value
|
||
*
|
||
* @param pValue nuevo Valor de value
|
||
*/
|
||
public void setValue(BigDecimal pValue) {
|
||
value = pValue;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de personcode
|
||
*
|
||
* @return valor de personcode
|
||
*/
|
||
public Integer getPersoncode() {
|
||
return personcode;
|
||
}
|
||
/**
|
||
* Fija el valor de personcode
|
||
*
|
||
* @param pPersoncode nuevo Valor de personcode
|
||
*/
|
||
public void setPersoncode(Integer pPersoncode) {
|
||
personcode = pPersoncode;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de idbeneficiary
|
||
*
|
||
* @return valor de idbeneficiary
|
||
*/
|
||
public String getIdbeneficiary() {
|
||
return idbeneficiary;
|
||
}
|
||
/**
|
||
* Fija el valor de idbeneficiary
|
||
*
|
||
* @param pIdbeneficiary nuevo Valor de idbeneficiary
|
||
*/
|
||
public void setIdbeneficiary(String pIdbeneficiary) {
|
||
idbeneficiary = pIdbeneficiary;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de beneficiaryname
|
||
*
|
||
* @return valor de beneficiaryname
|
||
*/
|
||
public String getBeneficiaryname() {
|
||
return beneficiaryname;
|
||
}
|
||
/**
|
||
* Fija el valor de beneficiaryname
|
||
*
|
||
* @param pBeneficiaryname nuevo Valor de beneficiaryname
|
||
*/
|
||
public void setBeneficiaryname(String pBeneficiaryname) {
|
||
beneficiaryname = pBeneficiaryname;
|
||
}
|
||
|
||
public boolean equals(Object rhs) {
|
||
if (rhs == null)
|
||
return false;
|
||
if (!(rhs instanceof TgeneAccountForCredit))
|
||
return false;
|
||
TgeneAccountForCredit that = (TgeneAccountForCredit) 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 TgeneAccountForCredit
|
||
*
|
||
* @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 TgeneAccountForCredit */
|
||
public Object createInstance() {
|
||
TgeneAccountForCredit instance = new TgeneAccountForCredit();
|
||
instance.setPk(new TgeneAccountForCreditKey());
|
||
return instance;
|
||
}
|
||
/**
|
||
* Clona la entidad TgeneAccountForCredit
|
||
*
|
||
* @see com.fp.dto.hb.HibernateBean#cloneMe()
|
||
*/
|
||
public Object cloneMe() throws CloneNotSupportedException {
|
||
TgeneAccountForCredit p = (TgeneAccountForCredit) this.clone();
|
||
p.setPk((TgeneAccountForCreditKey) this.pk.cloneMe());
|
||
return p;
|
||
}
|
||
|
||
//Metodos manuales.
|
||
/** Sentencia que devuelve datos de la tabla TgeneAccountForCredit.*/
|
||
private static final String HQL_ACCOUNT_FOR_CREDIT =
|
||
"from TgeneAccountForCredit tafc " +
|
||
" where tafc.pk.account = :account "+
|
||
" and tafc.pk.company = :company "+
|
||
" order by tafc.pk.creditsequence ";
|
||
|
||
/**
|
||
* Entrega datos de cuentas a acreditar ejemplo definicion de la forma de pago de certificado de deposito.
|
||
* @param pAccount Numero de cuenta.
|
||
* @param pCompany Codigo de compania.
|
||
* @return List<TgeneAccountForCredit>
|
||
* @throws Exception
|
||
*/
|
||
@SuppressWarnings(Constant.VUNCHECKED)
|
||
public static List<TgeneAccountForCredit> find(EntityManager pEntityManager,
|
||
String pAccount,Integer pCompany) throws Exception {
|
||
List<TgeneAccountForCredit> lcredit = null;
|
||
Query qry = pEntityManager.createQuery(HQL_ACCOUNT_FOR_CREDIT);
|
||
qry.setParameter("account", pAccount);
|
||
qry.setParameter("company", pCompany);
|
||
lcredit = qry.getResultList();
|
||
return lcredit;
|
||
}
|
||
}
|