298 lines
8.6 KiB
Plaintext
Executable File
298 lines
8.6 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.gene;
|
||
|
||
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 TGENESOLICITUDEDEBITOPENING*/
|
||
@Entity(name="TgeneSolicitudeDebitOpening")
|
||
@Table(name="TGENESOLICITUDEDEBITOPENING")
|
||
public class TgeneSolicitudeDebitOpening 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 TgeneSolicitudeDebitOpening
|
||
*/
|
||
@EmbeddedId
|
||
private TgeneSolicitudeDebitOpeningKey pk;
|
||
@Column(name="CURRENCYCODE", nullable=true)
|
||
|
||
/**
|
||
* Codigo de moneda en la que esta expresado el valor a aplicar dependiendo al forma de debito
|
||
*/
|
||
private String currencycode;
|
||
|
||
@Column(name="CASH", nullable=true)
|
||
|
||
/**
|
||
* Indica que el valor se cobra en efectivo.
|
||
*/
|
||
private String cash;
|
||
|
||
@Column(name="CHECKS", nullable=true)
|
||
|
||
/**
|
||
* Indica que el valor se cobra en cheques.
|
||
*/
|
||
private String checks;
|
||
|
||
@Column(name="DEBIT", nullable=true)
|
||
|
||
/**
|
||
* Indica que el valor se cobra con debito a uan cuenta o debito a un codigo contable.
|
||
*/
|
||
private String debit;
|
||
|
||
@Column(name="DEBITACCOUNT", nullable=true)
|
||
|
||
/**
|
||
* Numero de cuenta a la vista a debitar, si la moneda de la cuenta es diferente a la moneda en la cual esta expresado el valor se tiene que hacer la compra venta de divisas
|
||
*/
|
||
private String debitaccount;
|
||
|
||
@Column(name="ACCOUNTMODULE", nullable=true)
|
||
|
||
/**
|
||
* Codigo de modulo al que pertenece la cuenta
|
||
*/
|
||
private String accountmodule;
|
||
|
||
@Column(name="DEBITACCOUNTINGCODE", nullable=true)
|
||
|
||
/**
|
||
* Codigo contable a relaizar el debito de la cuenta.
|
||
*/
|
||
private String debitaccountingcode;
|
||
|
||
@Column(name="VALUE", nullable=true)
|
||
|
||
/**
|
||
* Valor en la moneda de la solicitud, la compra venta se hace en funcion a la moneda de la cuenta debito
|
||
*/
|
||
private BigDecimal value;
|
||
|
||
/**Contructor por defecto*/
|
||
public TgeneSolicitudeDebitOpening(){
|
||
}
|
||
/**Contructor de TgeneSolicitudeDebitOpening
|
||
@param pPk Clave Primaria del entity
|
||
*/
|
||
public TgeneSolicitudeDebitOpening(TgeneSolicitudeDebitOpeningKey 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 TgeneSolicitudeDebitOpening
|
||
*/
|
||
public static TgeneSolicitudeDebitOpening find(EntityManager pEntityManager,TgeneSolicitudeDebitOpeningKey pKey) throws Exception{
|
||
TgeneSolicitudeDebitOpening obj = pEntityManager.find(TgeneSolicitudeDebitOpening.class,pKey);
|
||
return obj;
|
||
}
|
||
/**Entrega la Clave primaria de TgeneSolicitudeDebitOpening
|
||
@return El objeto que referencia a la Clave primaria de TgeneSolicitudeDebitOpening
|
||
*/
|
||
public TgeneSolicitudeDebitOpeningKey getPk(){
|
||
return pk;
|
||
}
|
||
/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeDebitOpening
|
||
@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeDebitOpening
|
||
*/
|
||
public void setPk(TgeneSolicitudeDebitOpeningKey pPk){
|
||
pk=pPk;
|
||
}
|
||
/**Obtiene el valor de currencycode
|
||
@return valor de currencycode*/
|
||
public String getCurrencycode(){
|
||
return currencycode;
|
||
}
|
||
/**Fija el valor de currencycode
|
||
@param pCurrencycode nuevo Valor de currencycode*/
|
||
public void setCurrencycode(String pCurrencycode){
|
||
currencycode=pCurrencycode;
|
||
}
|
||
|
||
/**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 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;
|
||
}
|
||
|
||
public boolean equals(Object rhs){
|
||
if (rhs == null)return false;
|
||
if (! (rhs instanceof TgeneSolicitudeDebitOpening))return false;
|
||
TgeneSolicitudeDebitOpening that = (TgeneSolicitudeDebitOpening) 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 TgeneSolicitudeDebitOpening
|
||
@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 TgeneSolicitudeDebitOpening
|
||
*/
|
||
public Object createInstance(){
|
||
TgeneSolicitudeDebitOpening instance=new TgeneSolicitudeDebitOpening();
|
||
instance.setPk(new TgeneSolicitudeDebitOpeningKey());
|
||
return instance;
|
||
}
|
||
/**Clona la entidad TgeneSolicitudeDebitOpening
|
||
@see com.fp.dto.hb.HibernateBean#cloneMe()
|
||
*/
|
||
public Object cloneMe() throws CloneNotSupportedException{
|
||
TgeneSolicitudeDebitOpening p=(TgeneSolicitudeDebitOpening)this.clone();
|
||
p.setPk((TgeneSolicitudeDebitOpeningKey)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_SOLICITUDE_DEBIT =
|
||
"from TgeneSolicitudeDebitOpening tsdo " +
|
||
" where tsdo.pk.solicitudnumber = :solicitudnumber "+
|
||
" and tsdo.pk.solicitudsequence = :solicitudsequence "+
|
||
" order by tsdo.pk.debitsequence ";
|
||
|
||
/**
|
||
* Metodo que entrega una lista de valores a cobrar al cliente, en la aperturad e una operacion.
|
||
* @param pSolicitudNumber Numero de solicitud.
|
||
* @param pSolicitudSequence Secuencia dentro de la solicitud.
|
||
* @return List<TgeneSolicitudeDebitOpening>
|
||
* @throws Exception
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
public static List<TgeneSolicitudeDebitOpening> find(EntityManager pEntityManager,String pSolicitudNumber,
|
||
Integer pSolicitudSequence) throws Exception {
|
||
List<TgeneSolicitudeDebitOpening> lObjects = null;
|
||
Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_DEBIT);
|
||
qry.setParameter("solicitudnumber", pSolicitudNumber);
|
||
qry.setParameter("solicitudsequence", pSolicitudSequence);
|
||
lObjects = qry.getResultList();
|
||
return lObjects;
|
||
}
|
||
|
||
}
|