314 lines
8.6 KiB
Plaintext
Executable File
314 lines
8.6 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.dto.hb.HibernateBean;
|
||
|
||
/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTDEBITOPENING*/
|
||
@Entity(name="TgeneAccountDebitOpening")
|
||
@Table(name="TGENEACCOUNTDEBITOPENING")
|
||
public class TgeneAccountDebitOpening 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 TgeneAccountDebitOpening
|
||
*/
|
||
@EmbeddedId
|
||
private TgeneAccountDebitOpeningKey pk;
|
||
@Column(name="CASH", nullable=true)
|
||
|
||
/**
|
||
* Indica que el cargo se realiaza en efectivo.
|
||
*/
|
||
private String cash;
|
||
|
||
@Column(name="CHECKS", nullable=true)
|
||
|
||
/**
|
||
* Indica que el cargo se realiaza en cheque.
|
||
*/
|
||
private String checks;
|
||
|
||
@Column(name="DEBIT", nullable=true)
|
||
|
||
/**
|
||
* Indica que el cargo se realiaza con debito a la cuenta.
|
||
*/
|
||
private String debit;
|
||
|
||
@Column(name="DEBITACCOUNT", nullable=true)
|
||
|
||
/**
|
||
* Numero de cuenta a debitar cuando el cargo se cobra con debito a la cuenta.
|
||
*/
|
||
private String debitaccount;
|
||
|
||
@Column(name="ACCOUNTMODULE", nullable=true)
|
||
|
||
/**
|
||
* Codigo de modulo al que pertenece la cuenta a debitar
|
||
*/
|
||
private String accountmodule;
|
||
|
||
@Column(name="DEBITACCOUNTINGCODE", nullable=true)
|
||
|
||
/**
|
||
* Codigo contable cuando el cargo se cobra con debito a la cuenta.
|
||
*/
|
||
private String debitaccountingcode;
|
||
|
||
@Column(name="CURRENCY", nullable=true)
|
||
|
||
/**
|
||
* Codigo de moneda de la cuenta de la operacion.
|
||
*/
|
||
private String currency;
|
||
|
||
@Column(name="VALUE", nullable=true)
|
||
|
||
/**
|
||
* Valor en la moneda de la cuenta, la compra venta se hace en funcion a la moneda de la cuenta debito
|
||
*/
|
||
private BigDecimal value;
|
||
|
||
@Column(name="JOURNALID", nullable=true)
|
||
|
||
/**
|
||
* Numero de mensaje con el que se realizo el financiero.
|
||
*/
|
||
private String journalid;
|
||
|
||
/**Contructor por defecto*/
|
||
public TgeneAccountDebitOpening(){
|
||
}
|
||
/**Contructor de TgeneAccountDebitOpening
|
||
@param pPk Clave Primaria del entity
|
||
*/
|
||
public TgeneAccountDebitOpening(TgeneAccountDebitOpeningKey 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 TgeneAccountDebitOpening
|
||
*/
|
||
public static TgeneAccountDebitOpening find(EntityManager pEntityManager,TgeneAccountDebitOpeningKey pKey) throws Exception{
|
||
TgeneAccountDebitOpening obj = pEntityManager.find(TgeneAccountDebitOpening.class,pKey);
|
||
return obj;
|
||
}
|
||
/**Entrega la Clave primaria de TgeneAccountDebitOpening
|
||
@return El objeto que referencia a la Clave primaria de TgeneAccountDebitOpening
|
||
*/
|
||
public TgeneAccountDebitOpeningKey getPk(){
|
||
return pk;
|
||
}
|
||
/**Fija un nuevo valor a la Clave primaria de TgeneAccountDebitOpening
|
||
@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountDebitOpening
|
||
*/
|
||
public void setPk(TgeneAccountDebitOpeningKey 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 debit
|
||
@return valor de debit*/
|
||
public String getDebit(){
|
||
return debit;
|
||
}
|
||
/**Fija el valor de debit
|
||
@param pDebit nuevo Valor de debit*/
|
||
public void setDebit(String pDebit){
|
||
debit=pDebit;
|
||
}
|
||
|
||
/**Obtiene el valor de debitaccount
|
||
@return valor de debitaccount*/
|
||
public String getDebitaccount(){
|
||
return debitaccount;
|
||
}
|
||
/**Fija el valor de debitaccount
|
||
@param pDebitaccount nuevo Valor de debitaccount*/
|
||
public void setDebitaccount(String pDebitaccount){
|
||
debitaccount=pDebitaccount;
|
||
}
|
||
|
||
/**Obtiene el valor de accountmodule
|
||
@return valor de accountmodule*/
|
||
public String getAccountmodule(){
|
||
return accountmodule;
|
||
}
|
||
/**Fija el valor de accountmodule
|
||
@param pAccountmodule nuevo Valor de accountmodule*/
|
||
public void setAccountmodule(String pAccountmodule){
|
||
accountmodule=pAccountmodule;
|
||
}
|
||
|
||
/**Obtiene el valor de debitaccountingcode
|
||
@return valor de debitaccountingcode*/
|
||
public String getDebitaccountingcode(){
|
||
return debitaccountingcode;
|
||
}
|
||
/**Fija el valor de debitaccountingcode
|
||
@param pDebitaccountingcode nuevo Valor de debitaccountingcode*/
|
||
public void setDebitaccountingcode(String pDebitaccountingcode){
|
||
debitaccountingcode=pDebitaccountingcode;
|
||
}
|
||
|
||
/**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 journalid
|
||
@return valor de value*/
|
||
public String getJournalid(){
|
||
return journalid;
|
||
}
|
||
/**Fija el valor de journalid
|
||
@param journalid nuevo Valor de journalid*/
|
||
public void setJournalid(String pJournalid){
|
||
journalid=pJournalid;
|
||
}
|
||
|
||
public boolean equals(Object rhs){
|
||
if (rhs == null)return false;
|
||
if (! (rhs instanceof TgeneAccountDebitOpening))return false;
|
||
TgeneAccountDebitOpening that = (TgeneAccountDebitOpening) 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 TgeneAccountDebitOpening
|
||
@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 TgeneAccountDebitOpening
|
||
*/
|
||
public Object createInstance(){
|
||
TgeneAccountDebitOpening instance=new TgeneAccountDebitOpening();
|
||
instance.setPk(new TgeneAccountDebitOpeningKey());
|
||
return instance;
|
||
}
|
||
/**Clona la entidad TgeneAccountDebitOpening
|
||
@see com.fp.dto.hb.HibernateBean#cloneMe()
|
||
*/
|
||
public Object cloneMe() throws CloneNotSupportedException{
|
||
TgeneAccountDebitOpening p=(TgeneAccountDebitOpening)this.clone();
|
||
p.setPk((TgeneAccountDebitOpeningKey)this.pk.cloneMe());
|
||
return p;
|
||
}
|
||
//Metodos manuales.
|
||
/**Sentencia que devuelve uan lista con los valores de cargos asociados a una solicitud.*/
|
||
private static final String HQL_ACCO_DEBIT_OPENING =
|
||
"from TgeneAccountDebitOpening t " +
|
||
" where t.pk.account = :account "+
|
||
" and t.pk.company = :company "+
|
||
" order by t.pk.debitsequence ";
|
||
|
||
/**
|
||
* Metodo que entrega una lista de valores a cobrar al cliente, en la aperturad e una operacion.
|
||
* @param pAccount Numero de cuenta.
|
||
* @param pCompany Codigo de compania a la que pertenece la cuenta.
|
||
* @return List<TgeneAccountDebitOpening>
|
||
* @throws Exception
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
public static List<TgeneAccountDebitOpening> find(EntityManager pEntityManager,String pAccount,Integer pCompany) throws Exception {
|
||
List<TgeneAccountDebitOpening> lObjects = null;
|
||
Query qry = pEntityManager.createQuery(HQL_ACCO_DEBIT_OPENING);
|
||
qry.setParameter("account", pAccount);
|
||
qry.setParameter("company", pCompany);
|
||
lObjects = qry.getResultList();
|
||
return lObjects;
|
||
}
|
||
|
||
}
|