342 lines
10 KiB
Plaintext
Executable File
342 lines
10 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.auth;
|
||
|
||
import java.io.Serializable;
|
||
import java.lang.reflect.Field;
|
||
import java.sql.Date;
|
||
import java.util.List;
|
||
|
||
import javax.persistence.Column;
|
||
import javax.persistence.EmbeddedId;
|
||
import javax.persistence.Entity;
|
||
import javax.persistence.EntityManager;
|
||
import javax.persistence.NoResultException;
|
||
import javax.persistence.Query;
|
||
import javax.persistence.Table;
|
||
import javax.persistence.Transient;
|
||
import javax.persistence.Version;
|
||
|
||
import com.fp.dto.hb.HibernateBean;
|
||
|
||
/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDECLIENTDATA */
|
||
@Entity(name = "TgeneSolicitudeClientdata")
|
||
@Table(name = "TGENESOLICITUDECLIENTDATA")
|
||
public class TgeneSolicitudeClientdata 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 TgeneSolicitudeClientdata
|
||
*/
|
||
@EmbeddedId
|
||
private TgeneSolicitudeClientdataKey pk;
|
||
|
||
@Column(name = "USERCODE", nullable = true)
|
||
/**
|
||
* Codigo de usuario que verifica la informacion del cliente
|
||
*/
|
||
private String usercode;
|
||
|
||
@Version
|
||
@Column(name = "RECORDVERSION", nullable = true)
|
||
/**
|
||
* Optimistic locking del registro.
|
||
*/
|
||
private Integer recordversion;
|
||
|
||
@Column(name = "CHECKED", nullable = true)
|
||
/**
|
||
* Y indica que la informacion fue verificada. N la informacion no esta verificada.
|
||
*/
|
||
private String checked;
|
||
|
||
@Column(name = "CHECKDATE", nullable = true)
|
||
/**
|
||
* Fecha de verificacion de la informacion.
|
||
*/
|
||
private Date checkdate;
|
||
|
||
@Column(name = "PRESENTATIONORDER", nullable = true)
|
||
/**
|
||
* Orden de presentacion
|
||
*/
|
||
private Integer presentationorder;
|
||
|
||
/** Contructor por defecto */
|
||
public TgeneSolicitudeClientdata() {
|
||
}
|
||
|
||
/**
|
||
* Contructor de TgeneSolicitudeClientdata
|
||
*
|
||
* @param pPk Clave Primaria del entity
|
||
*/
|
||
public TgeneSolicitudeClientdata(TgeneSolicitudeClientdataKey pPk) {
|
||
this();
|
||
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 TgeneSolicitudeClientdata
|
||
*/
|
||
public static TgeneSolicitudeClientdata find(EntityManager pEntityManager, TgeneSolicitudeClientdataKey pKey) throws Exception {
|
||
TgeneSolicitudeClientdata obj = pEntityManager.find(TgeneSolicitudeClientdata.class, pKey);
|
||
return obj;
|
||
}
|
||
|
||
/**
|
||
* Entrega la Clave primaria de TgeneSolicitudeClientdata
|
||
*
|
||
* @return El objeto que referencia a la Clave primaria de TgeneSolicitudeClientdata
|
||
*/
|
||
public TgeneSolicitudeClientdataKey getPk() {
|
||
return this.pk;
|
||
}
|
||
|
||
/**
|
||
* Fija un nuevo valor a la Clave primaria de TgeneSolicitudeClientdata
|
||
*
|
||
* @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeClientdata
|
||
*/
|
||
public void setPk(TgeneSolicitudeClientdataKey pPk) {
|
||
this.pk = pPk;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de usercode
|
||
*
|
||
* @return valor de usercode
|
||
*/
|
||
public String getUsercode() {
|
||
return this.usercode;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de usercode
|
||
*
|
||
* @param pUsercode nuevo Valor de usercode
|
||
*/
|
||
public void setUsercode(String pUsercode) {
|
||
this.usercode = pUsercode;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de recordversion
|
||
*
|
||
* @return valor de recordversion
|
||
*/
|
||
public Integer getRecordversion() {
|
||
return this.recordversion;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de recordversion
|
||
*
|
||
* @param pRecordversion nuevo Valor de recordversion
|
||
*/
|
||
public void setRecordversion(Integer pRecordversion) {
|
||
this.recordversion = pRecordversion;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de checked
|
||
*
|
||
* @return valor de checked
|
||
*/
|
||
public String getChecked() {
|
||
return this.checked;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de checked
|
||
*
|
||
* @param pChecked nuevo Valor de checked
|
||
*/
|
||
public void setChecked(String pChecked) {
|
||
this.checked = pChecked;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de checkdate
|
||
*
|
||
* @return valor de checkdate
|
||
*/
|
||
public Date getCheckdate() {
|
||
return this.checkdate;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de checkdate
|
||
*
|
||
* @param pCheckdate nuevo Valor de checkdate
|
||
*/
|
||
public void setCheckdate(Date pCheckdate) {
|
||
this.checkdate = pCheckdate;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de presentationorder
|
||
*
|
||
* @return valor de presentationorder
|
||
*/
|
||
public Integer getPresentationorder() {
|
||
return this.presentationorder;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de presentationorder
|
||
*
|
||
* @param pPresentationorder nuevo Valor de presentationorder
|
||
*/
|
||
public void setPresentationorder(Integer pPresentationorder) {
|
||
this.presentationorder = pPresentationorder;
|
||
}
|
||
|
||
@Override
|
||
public boolean equals(Object rhs) {
|
||
if (rhs == null) {
|
||
return false;
|
||
}
|
||
if (!(rhs instanceof TgeneSolicitudeClientdata)) {
|
||
return false;
|
||
}
|
||
TgeneSolicitudeClientdata that = (TgeneSolicitudeClientdata) 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 TgeneSolicitudeClientdata
|
||
*
|
||
* @return el hashCode la instancia
|
||
*/
|
||
@Override
|
||
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 */
|
||
@Override
|
||
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 TgeneSolicitudeClientdata */
|
||
@Override
|
||
public Object createInstance() {
|
||
TgeneSolicitudeClientdata instance = new TgeneSolicitudeClientdata();
|
||
instance.setPk(new TgeneSolicitudeClientdataKey());
|
||
return instance;
|
||
}
|
||
|
||
/**
|
||
* Clona la entidad TgeneSolicitudeClientdata
|
||
*
|
||
* @see com.fp.dto.hb.HibernateBean#cloneMe()
|
||
*/
|
||
@Override
|
||
public Object cloneMe() throws CloneNotSupportedException {
|
||
TgeneSolicitudeClientdata p = (TgeneSolicitudeClientdata) this.clone();
|
||
p.setPk((TgeneSolicitudeClientdataKey) this.pk.cloneMe());
|
||
return p;
|
||
}
|
||
|
||
// Metodos manuales.
|
||
/** Sentencia que entrga una lista de registros de TgeneSolicitudeClientdata. */
|
||
private static String JPQL = "from TgeneSolicitudeClientdata t where t.pk.solicitudnumber = :solicitudnumber and t.pk.solicitudsequence = :solicitudsequence";
|
||
|
||
/**
|
||
* Entrega una lista de {@link TgeneSolicitudeClientdata} dado el numero de solicitud y la secuencia de la
|
||
* solicitud.
|
||
*
|
||
* @param pEntityManager Referencia a la session de la base de datos.
|
||
* @param pSolicitudenumber Numero de solicitud.
|
||
* @param pSolicitudesequence Secuencia interna de la solicitud.
|
||
* @return List<TgeneSolicitudeClientdata>
|
||
* @throws Exception
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
public static List<TgeneSolicitudeClientdata> find(EntityManager pEntityManager, String pSolicitudenumber, Integer pSolicitudesequence)
|
||
throws Exception {
|
||
Query qry = pEntityManager.createQuery(TgeneSolicitudeClientdata.JPQL);
|
||
qry.setParameter("solicitudnumber", pSolicitudenumber);
|
||
qry.setParameter("solicitudsequence", pSolicitudesequence);
|
||
return qry.getResultList();
|
||
|
||
}
|
||
|
||
|
||
/**
|
||
* Sentencia SQL que devuelve un objeto de tipo TgeneSolicitudeClientdata
|
||
*/
|
||
private static final String JPQL_SOLICITUDE_CLIENT_DATA = "from TgeneSolicitudeClientdata tgs "
|
||
+ " where tgs.pk.solicitudnumber = :solicitudnumber " + " and tgs.pk.solicitudsequence = :solicitudsequence "
|
||
+ " and tgs.pk.title = :title " + " and tgs.pk.personcode = :personcode";
|
||
/**
|
||
* Metodo que devuelve un objeto de tipo TgeneSolicitudeClientdata
|
||
*
|
||
* @param solicitudnumber
|
||
* @param solicitudsequence
|
||
* @param title
|
||
* @param personcode
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
public static TgeneSolicitudeClientdata find(EntityManager pEntityManager, String solicitudnumber, Integer solicitudsequence, String title, Integer personcode)
|
||
throws Exception {
|
||
Query qry = pEntityManager.createQuery(TgeneSolicitudeClientdata.JPQL_SOLICITUDE_CLIENT_DATA);
|
||
qry.setParameter("solicitudnumber", solicitudnumber);
|
||
qry.setParameter("solicitudsequence", solicitudsequence);
|
||
qry.setParameter("title", title);
|
||
qry.setParameter("personcode", personcode);
|
||
try {
|
||
return (TgeneSolicitudeClientdata) qry.getSingleResult();
|
||
} catch (NoResultException e) {
|
||
return null;
|
||
}
|
||
}
|
||
|
||
|
||
}
|