maia_modificado/.svn/pristine/b8/b8685a2eb62c7f8c3d4c5bdef39...

316 lines
8.9 KiB
Plaintext
Executable File
Raw Permalink Blame History

package com.fp.persistence.pgeneral.auth;
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 TGENESOLICITUDEEXCEPTIONS*/
@Entity(name="TgeneSolicitudeExceptions")
@Table(name="TGENESOLICITUDEEXCEPTIONS")
public class TgeneSolicitudeExceptions 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 TgeneSolicitudeExceptions
*/
@EmbeddedId
private TgeneSolicitudeExceptionsKey pk;
@Column(name="PROFILECODE", nullable=true)
/**
* Codigo de perfil de usuario
*/
private String profilecode;
@Column(name="USERCODE", nullable=true)
/**
* Codigo de usuario
*/
private String usercode;
@Column(name="MODULECODE", nullable=true)
/**
* Codigo de modulo
*/
private String modulecode;
@Column(name="STATUSCODE", nullable=true)
/**
* Estatus de cuenta
*/
private String statuscode;
@Column(name="CONDITION", nullable=true)
/**
* Condicion a evaluar
*/
private String condition;
@Column(name="STRINGVALUE", nullable=true)
/**
* Valor a compar con el dato del campo
*/
private String stringvalue;
@Column(name="NUMERICVALUE", nullable=true)
/**
* Valor a compar con el dato del campo
*/
private BigDecimal numericvalue;
@Column(name="EXCEPTION", nullable=true)
/**
* Mensaje compuesto por el titulo de la excepcion condicion y valor
*/
private String exception;
@Column(name="OBSERVATTION", nullable=true)
/**
* Texto libre del usuario que aprueba o niega la excepcion
*/
private String observattion;
/**Contructor por defecto*/
public TgeneSolicitudeExceptions(){
}
/**Contructor de TgeneSolicitudeExceptions
@param pPk Clave Primaria del entity
*/
public TgeneSolicitudeExceptions(TgeneSolicitudeExceptionsKey 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 TgeneSolicitudeExceptions
*/
public static TgeneSolicitudeExceptions find(EntityManager pEntityManager,TgeneSolicitudeExceptionsKey pKey) throws Exception{
TgeneSolicitudeExceptions obj = pEntityManager.find(TgeneSolicitudeExceptions.class,pKey);
return obj;
}
/**Entrega la Clave primaria de TgeneSolicitudeExceptions
@return El objeto que referencia a la Clave primaria de TgeneSolicitudeExceptions
*/
public TgeneSolicitudeExceptionsKey getPk(){
return pk;
}
/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeExceptions
@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeExceptions
*/
public void setPk(TgeneSolicitudeExceptionsKey pPk){
pk=pPk;
}
/**Obtiene el valor de profilecode
@return valor de profilecode*/
public String getProfilecode(){
return profilecode;
}
/**Fija el valor de profilecode
@param pProfilecode nuevo Valor de profilecode*/
public void setProfilecode(String pProfilecode){
profilecode=pProfilecode;
}
/**Obtiene el valor de usercode
@return valor de usercode*/
public String getUsercode(){
return usercode;
}
/**Fija el valor de usercode
@param pUsercode nuevo Valor de usercode*/
public void setUsercode(String pUsercode){
usercode=pUsercode;
}
/**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 statuscode
@return valor de statuscode*/
public String getStatuscode(){
return statuscode;
}
/**Fija el valor de statuscode
@param pStatuscode nuevo Valor de statuscode*/
public void setStatuscode(String pStatuscode){
statuscode=pStatuscode;
}
/**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 stringvalue
@return valor de stringvalue*/
public String getStringvalue(){
return stringvalue;
}
/**Fija el valor de stringvalue
@param pStringvalue nuevo Valor de stringvalue*/
public void setStringvalue(String pStringvalue){
stringvalue=pStringvalue;
}
/**Obtiene el valor de numericvalue
@return valor de numericvalue*/
public BigDecimal getNumericvalue(){
return numericvalue;
}
/**Fija el valor de numericvalue
@param pNumericvalue nuevo Valor de numericvalue*/
public void setNumericvalue(BigDecimal pNumericvalue){
numericvalue=pNumericvalue;
}
/**Obtiene el valor de exception
@return valor de exception*/
public String getException(){
return exception;
}
/**Fija el valor de exception
@param pException nuevo Valor de exception*/
public void setException(String pException){
exception=pException;
}
/**Obtiene el valor de observattion
@return valor de observattion*/
public String getObservattion(){
return observattion;
}
/**Fija el valor de observattion
@param pObservattion nuevo Valor de observattion*/
public void setObservattion(String pObservattion){
observattion=pObservattion;
}
public boolean equals(Object rhs){
if (rhs == null)return false;
if (! (rhs instanceof TgeneSolicitudeExceptions))return false;
TgeneSolicitudeExceptions that = (TgeneSolicitudeExceptions) 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 TgeneSolicitudeExceptions
@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 TgeneSolicitudeExceptions
*/
public Object createInstance(){
TgeneSolicitudeExceptions instance=new TgeneSolicitudeExceptions();
instance.setPk(new TgeneSolicitudeExceptionsKey());
return instance;
}
/**Clona la entidad TgeneSolicitudeExceptions
@see com.fp.dto.hb.HibernateBean#cloneMe()
*/
public Object cloneMe() throws CloneNotSupportedException{
TgeneSolicitudeExceptions p=(TgeneSolicitudeExceptions)this.clone();
p.setPk((TgeneSolicitudeExceptionsKey)this.pk.cloneMe());
return p;
}
//METODOS MANUALES
/** Sentencia que devuelve las excepciones de una solicitud. */
private static final String JPQL_SOLICITUDE_EXCEPTIONS = "from TgeneSolicitudeExceptions solexe "
+ " where solexe.pk.solicitudnumber = :solicitudnumber " + " and solexe.pk.solicitudsequence = :solicitudsequence "
+ " order by solexe.pk.exceptionorder ";
/**
* Entrega una lista de excepciones de solicitud.
*
* @param pSolicitudenumber Numero de solicitud.
* @param pSolicitudesequence Secuencia interna de la solicitud.
* @return List<TgeneSolicitudeExceptions>
* @throws Exception
*/
@SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED)
public static List<TgeneSolicitudeExceptions> findBySolicitudeNumber(EntityManager pEntityManager, String pSolicitudenumber, Integer pSolicitudesequence) throws Exception {
List<TgeneSolicitudeExceptions> lObjects = null;
Query qry = pEntityManager.createQuery(TgeneSolicitudeExceptions.JPQL_SOLICITUDE_EXCEPTIONS);
qry.setParameter("solicitudnumber", pSolicitudenumber);
qry.setParameter("solicitudsequence", pSolicitudesequence);
lObjects = qry.getResultList();
return lObjects;
}
}