199 lines
6.3 KiB
Plaintext
Executable File
199 lines
6.3 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.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.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 TGENEACCOUNTINSTALLCHARGES*/
|
||
@Entity(name="TgeneAccountInstallCharges")
|
||
@Table(name="TGENEACCOUNTINSTALLCHARGES")
|
||
public class TgeneAccountInstallCharges 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 TgeneAccountInstallCharges
|
||
*/
|
||
@EmbeddedId
|
||
private TgeneAccountInstallChargesKey pk;
|
||
@Column(name="DATEFROM", nullable=false)
|
||
|
||
/**
|
||
* Fecha desde la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas
|
||
*/
|
||
private Timestamp datefrom;
|
||
|
||
@Column(name="VALUE", nullable=true)
|
||
|
||
/**
|
||
* Valor del cargo en la moneda de la operacion
|
||
*/
|
||
private BigDecimal value;
|
||
|
||
/**Contructor por defecto*/
|
||
public TgeneAccountInstallCharges(){
|
||
}
|
||
/**Contructor de TgeneAccountInstallCharges
|
||
@param pPk Clave Primaria del entity
|
||
@param pDatefrom Fecha desde la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas
|
||
*/
|
||
public TgeneAccountInstallCharges(TgeneAccountInstallChargesKey pPk,Timestamp pDatefrom){
|
||
this();
|
||
pk=pPk;
|
||
datefrom=pDatefrom;
|
||
}
|
||
/**
|
||
* 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 TgeneAccountInstallCharges
|
||
*/
|
||
public static TgeneAccountInstallCharges find(EntityManager pEntityManager,TgeneAccountInstallChargesKey pKey) throws Exception{
|
||
TgeneAccountInstallCharges obj = pEntityManager.find(TgeneAccountInstallCharges.class,pKey);
|
||
return obj;
|
||
}
|
||
/**Entrega la Clave primaria de TgeneAccountInstallCharges
|
||
@return El objeto que referencia a la Clave primaria de TgeneAccountInstallCharges
|
||
*/
|
||
public TgeneAccountInstallChargesKey getPk(){
|
||
return pk;
|
||
}
|
||
/**Fija un nuevo valor a la Clave primaria de TgeneAccountInstallCharges
|
||
@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountInstallCharges
|
||
*/
|
||
public void setPk(TgeneAccountInstallChargesKey pPk){
|
||
pk=pPk;
|
||
}
|
||
/**Obtiene el valor de datefrom
|
||
@return valor de datefrom*/
|
||
public Timestamp getDatefrom(){
|
||
return datefrom;
|
||
}
|
||
/**Fija el valor de datefrom
|
||
@param pDatefrom nuevo Valor de datefrom*/
|
||
public void setDatefrom(Timestamp pDatefrom){
|
||
datefrom=pDatefrom;
|
||
}
|
||
|
||
/**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 TgeneAccountInstallCharges))return false;
|
||
TgeneAccountInstallCharges that = (TgeneAccountInstallCharges) 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 TgeneAccountInstallCharges
|
||
@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 TgeneAccountInstallCharges
|
||
*/
|
||
public Object createInstance(){
|
||
TgeneAccountInstallCharges instance=new TgeneAccountInstallCharges();
|
||
instance.setPk(new TgeneAccountInstallChargesKey());
|
||
return instance;
|
||
}
|
||
/**Clona la entidad TgeneAccountInstallCharges
|
||
@see com.fp.dto.hb.HibernateBean#cloneMe()
|
||
*/
|
||
public Object cloneMe() throws CloneNotSupportedException{
|
||
TgeneAccountInstallCharges p=(TgeneAccountInstallCharges)this.clone();
|
||
p.setPk((TgeneAccountInstallChargesKey)this.pk.cloneMe());
|
||
return p;
|
||
}
|
||
public Object getId() {
|
||
return this.pk;
|
||
}
|
||
|
||
//Metodos manuales.
|
||
/**Sentencia que devuelve la definicion de cargos a adicionar a la tabla de amortizacion.*/
|
||
private static final String HQL_ACCOUNT_INSTALLMENT_CHARGES =
|
||
"from TgeneAccountInstallCharges taccoinstchr "
|
||
+ " where taccoinstchr.pk.account = :account "
|
||
+ " and taccoinstchr.pk.company = :company "
|
||
+ " and taccoinstchr.pk.dateto = :dateto ";
|
||
|
||
/**
|
||
* Metodo que entrega una lista con los cargos a adicionar a la tabla de amortizacion para una cuenta.
|
||
* @param pAccount Numero de cuenta.
|
||
* @param pCompany Compania a la que pertenece la cuenta.
|
||
* @return List<TgeneAccountInstallCharges>
|
||
* @throws Exception
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
public static List<TgeneAccountInstallCharges> find(EntityManager pEntityManager,String pAccount,
|
||
Integer pCompany) throws Exception {
|
||
List<TgeneAccountInstallCharges> lObjects = null;
|
||
Query qry = pEntityManager.createQuery(HQL_ACCOUNT_INSTALLMENT_CHARGES);
|
||
qry.setParameter("account", pAccount);
|
||
qry.setParameter("company", pCompany);
|
||
qry.setParameter("dateto", Constant.getDefaultExpiryDate());
|
||
lObjects = qry.getResultList();
|
||
return lObjects;
|
||
}
|
||
|
||
|
||
}
|