295 lines
8.7 KiB
Plaintext
Executable File
295 lines
8.7 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.gene;
|
||
|
||
import javax.persistence.EmbeddedId;
|
||
import javax.persistence.Entity;
|
||
import javax.persistence.Column;
|
||
import javax.persistence.EntityManager;
|
||
import javax.persistence.Query;
|
||
|
||
import java.io.Serializable;
|
||
import java.math.BigDecimal;
|
||
import java.util.List;
|
||
import javax.persistence.Table;
|
||
import com.fp.dto.hb.HibernateBean;
|
||
import com.fp.persistence.commondb.exception.CommondbException;
|
||
|
||
import java.lang.reflect.Field;
|
||
import javax.persistence.Transient;
|
||
|
||
/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDERELATIONSHIP*/
|
||
@Entity(name="TgeneSolicitudeRelationship")
|
||
@Table(name="TGENESOLICITUDERELATIONSHIP")
|
||
public class TgeneSolicitudeRelationship 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 TgeneSolicitudeRelationship
|
||
*/
|
||
@EmbeddedId
|
||
private TgeneSolicitudeRelationshipKey pk;
|
||
@Column(name="MODULECODE", nullable=true)
|
||
|
||
/**
|
||
* Codigo de modulo
|
||
*/
|
||
private String modulecode;
|
||
|
||
@Column(name="RELATIONSHIPCODE", nullable=true)
|
||
|
||
/**
|
||
* Codigo de relacion de la cuenta con el cliente
|
||
*/
|
||
private String relationshipcode;
|
||
|
||
@Column(name="ISPRINCIPAL", nullable=true)
|
||
|
||
/**
|
||
* Indica si el codigo de relacion es principal, en este caso el codigo de cliente se asocia a la tabla tgeneaccount
|
||
*/
|
||
private String isprincipal;
|
||
|
||
@Column(name="PRIORITY", nullable=true)
|
||
|
||
/**
|
||
* Prioridad del cleinte con la solicitud.
|
||
*/
|
||
private Integer priority;
|
||
|
||
@Column(name="CONDITION", nullable=true)
|
||
|
||
/**
|
||
* Codicion del cliente con la solicitud.
|
||
*/
|
||
private String condition;
|
||
|
||
@Column(name="PARTICIPATION", nullable=true)
|
||
|
||
/**
|
||
* Porcentaje de participacion del cliente con la solicitud.
|
||
*/
|
||
private BigDecimal participation;
|
||
|
||
@Column(name="ADDRESSNUMBER", nullable=true)
|
||
|
||
/**
|
||
* Direccion asociada
|
||
*/
|
||
private Integer addressnumber;
|
||
|
||
@Column(name="PERSONTYPE", nullable=true)
|
||
|
||
/**
|
||
* 1, Persona natural, 2 Persona Juridica.
|
||
*/
|
||
private String persontype;
|
||
|
||
/**Contructor por defecto*/
|
||
public TgeneSolicitudeRelationship(){
|
||
}
|
||
/**Contructor de TgeneSolicitudeRelationship
|
||
@param pPk Clave Primaria del entity
|
||
*/
|
||
public TgeneSolicitudeRelationship(TgeneSolicitudeRelationshipKey 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 TgeneSolicitudeRelationship
|
||
*/
|
||
public static TgeneSolicitudeRelationship find(EntityManager pEntityManager,TgeneSolicitudeRelationshipKey pKey) throws Exception{
|
||
TgeneSolicitudeRelationship obj = pEntityManager.find(TgeneSolicitudeRelationship.class,pKey);
|
||
return obj;
|
||
}
|
||
/**Entrega la Clave primaria de TgeneSolicitudeRelationship
|
||
@return El objeto que referencia a la Clave primaria de TgeneSolicitudeRelationship
|
||
*/
|
||
public TgeneSolicitudeRelationshipKey getPk(){
|
||
return pk;
|
||
}
|
||
/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeRelationship
|
||
@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeRelationship
|
||
*/
|
||
public void setPk(TgeneSolicitudeRelationshipKey pPk){
|
||
pk=pPk;
|
||
}
|
||
/**Obtiene el valor de modulecode
|
||
@return valor de modulecode*/
|
||
public String getModulecode(){
|
||
return modulecode;
|
||
}
|
||
/**Fija el valor de modulecode
|
||
@param pModulecode nuevo Valor de modulecode*/
|
||
public void setModulecode(String pModulecode){
|
||
modulecode=pModulecode;
|
||
}
|
||
|
||
/**Obtiene el valor de relationshipcode
|
||
@return valor de relationshipcode*/
|
||
public String getRelationshipcode(){
|
||
return relationshipcode;
|
||
}
|
||
/**Fija el valor de relationshipcode
|
||
@param pRelationshipcode nuevo Valor de relationshipcode*/
|
||
public void setRelationshipcode(String pRelationshipcode){
|
||
relationshipcode=pRelationshipcode;
|
||
}
|
||
|
||
/**Obtiene el valor de isprincipal
|
||
@return valor de isprincipal*/
|
||
public String getIsprincipal(){
|
||
return isprincipal;
|
||
}
|
||
/**Fija el valor de isprincipal
|
||
@param pIsprincipal nuevo Valor de isprincipal*/
|
||
public void setIsprincipal(String pIsprincipal){
|
||
isprincipal=pIsprincipal;
|
||
}
|
||
|
||
/**Obtiene el valor de priority
|
||
@return valor de priority*/
|
||
public Integer getPriority(){
|
||
return priority;
|
||
}
|
||
/**Fija el valor de priority
|
||
@param pPriority nuevo Valor de priority*/
|
||
public void setPriority(Integer pPriority){
|
||
priority=pPriority;
|
||
}
|
||
|
||
/**Obtiene el valor de condition
|
||
@return valor de condition*/
|
||
public String getCondition(){
|
||
return condition;
|
||
}
|
||
/**Fija el valor de condition
|
||
@param pCondition nuevo Valor de condition*/
|
||
public void setCondition(String pCondition){
|
||
condition=pCondition;
|
||
}
|
||
|
||
/**Obtiene el valor de participation
|
||
@return valor de participation*/
|
||
public BigDecimal getParticipation(){
|
||
return participation;
|
||
}
|
||
/**Fija el valor de participation
|
||
@param pParticipation nuevo Valor de participation*/
|
||
public void setParticipation(BigDecimal pParticipation){
|
||
participation=pParticipation;
|
||
}
|
||
|
||
/**Obtiene el valor de addressnumber
|
||
@return valor de addressnumber*/
|
||
public Integer getAddressnumber(){
|
||
return addressnumber;
|
||
}
|
||
/**Fija el valor de addressnumber
|
||
@param pAddressnumber nuevo Valor de addressnumber*/
|
||
public void setAddressnumber(Integer pAddressnumber){
|
||
addressnumber=pAddressnumber;
|
||
}
|
||
|
||
/**Obtiene el valor de persontype
|
||
@return valor de persontype*/
|
||
public String getPersontype(){
|
||
return persontype;
|
||
}
|
||
/**Fija el valor de persontype
|
||
@param pPersontype nuevo Valor de persontype*/
|
||
public void setPersontype(String pPersontype){
|
||
persontype=pPersontype;
|
||
}
|
||
|
||
public boolean equals(Object rhs){
|
||
if (rhs == null)return false;
|
||
if (! (rhs instanceof TgeneSolicitudeRelationship))return false;
|
||
TgeneSolicitudeRelationship that = (TgeneSolicitudeRelationship) 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 TgeneSolicitudeRelationship
|
||
@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 TgeneSolicitudeRelationship
|
||
*/
|
||
public Object createInstance(){
|
||
TgeneSolicitudeRelationship instance=new TgeneSolicitudeRelationship();
|
||
instance.setPk(new TgeneSolicitudeRelationshipKey());
|
||
return instance;
|
||
}
|
||
/**Clona la entidad TgeneSolicitudeRelationship
|
||
@see com.fp.dto.hb.HibernateBean#cloneMe()
|
||
*/
|
||
public Object cloneMe() throws CloneNotSupportedException{
|
||
TgeneSolicitudeRelationship p=(TgeneSolicitudeRelationship)this.clone();
|
||
p.setPk((TgeneSolicitudeRelationshipKey)this.pk.cloneMe());
|
||
return p;
|
||
}
|
||
|
||
//METODOS MANUALES
|
||
/** Sentencia que devuelve las excepciones de una solicitud. */
|
||
private static final String JPQL_SOL_RELATIONSHIP = "from TgeneSolicitudeRelationship solrel "
|
||
+ " where solrel.pk.solicitudnumber = :solicitudnumber " + " and solrel.pk.solicitudsequence = :solicitudsequence ";
|
||
/**
|
||
* Entrega una lista de clientes relacionados a la solicitud.
|
||
*
|
||
* @param pSolicitudenumber Numero de solicitud.
|
||
* @param pSolicitudesequence Secuencia interna de la solicitud.
|
||
* @return List<TgeneSolicitudeRelationship>
|
||
* @throws Exception
|
||
*/
|
||
@SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED)
|
||
public static List<TgeneSolicitudeRelationship> findBySolicitudeNumber(EntityManager pEntityManager, String pSolicitudenumber, Integer pSolicitudesequence) throws Exception {
|
||
List<TgeneSolicitudeRelationship> lObjects = null;
|
||
Query qry = pEntityManager.createQuery(TgeneSolicitudeRelationship.JPQL_SOL_RELATIONSHIP);
|
||
qry.setParameter("solicitudnumber", pSolicitudenumber);
|
||
qry.setParameter("solicitudsequence", pSolicitudesequence);
|
||
lObjects = qry.getResultList();
|
||
return lObjects;
|
||
}
|
||
|
||
}
|