maia/.svn/pristine/d4/d4651b42fee5f1cc454201c36be...

126 lines
3.6 KiB
Plaintext
Executable File

package com.fp.persistence.pfirmas.param;
import javax.persistence.Column;
import java.io.Serializable;
import com.fp.dto.hb.HibernateId;
import java.lang.reflect.Field;
import javax.persistence.Embeddable;
import javax.persistence.Transient;
import java.sql.Date;
/**Clase que hace referencia a la Clave Primaria de TFIRMCERTIFICADO*/
@Embeddable
public class TfirmCertificadoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{
/**
* HashCode asociado con la Instancia
*/
@Transient
private int hashValue = 0;
/**
* Version de la Clase
*/
private static final long serialVersionUID = 1L;
@Column(name="IDCERTIFICADO", nullable=false,updatable=false)
/**
* Id del certificado que viene desde el banco central
*/
private String idcertificado;
@Column(name="FCADUCIDAD", nullable=false,updatable=false)
/**
* Fecha de caducidad del certificado.
*/
private Date fcaducidad;
/**Contructor por defecto*/
public TfirmCertificadoKey(){}
/**Contructor de TfirmCertificadoKey
@param pIdcertificado Id del certificado que viene desde el banco central
@param pFcaducidad Fecha de caducidad del certificado.
*/
public TfirmCertificadoKey(String pIdcertificado,Date pFcaducidad){
idcertificado=pIdcertificado;
fcaducidad=pFcaducidad;
}
/**Obtiene el valor de idcertificado
@return valor de idcertificado*/
public String getIdcertificado(){
return idcertificado;
}
/**Fija el valor de idcertificado
@param pIdcertificado nuevo Valor de idcertificado*/
public void setIdcertificado(String pIdcertificado){
idcertificado=pIdcertificado;
}
/**Obtiene el valor de fcaducidad
@return valor de fcaducidad*/
public Date getFcaducidad(){
return fcaducidad;
}
/**Fija el valor de fcaducidad
@param pFcaducidad nuevo Valor de fcaducidad*/
public void setFcaducidad(Date pFcaducidad){
fcaducidad=pFcaducidad;
}
/**Implementacion de la comparacion de TfirmCertificadoKey
@param o Objeto de comparacion
*/
public boolean equals(Object o){
if (o == null)return false;
if (! (o instanceof TfirmCertificadoKey))return false;
TfirmCertificadoKey that = (TfirmCertificadoKey) o;
if (this.getIdcertificado() == null || that.getIdcertificado() == null){
return false;
}
if (! this.getIdcertificado().equals(that.getIdcertificado())){
return false;
}
if (this.getFcaducidad() == null || that.getFcaducidad() == null){
return false;
}
if (! this.getFcaducidad().equals(that.getFcaducidad())){
return false;
}
return true;
}
/**Implementacion del metodo hashCode bajo el patron de Bloch
@return hashCode de la instancia TfirmCertificadoKey
*/
public int hashCode(){
if (this.hashValue == 0){
int result = 17;
result = result * 37 + (this.getIdcertificado() == null ? 0 : this.getIdcertificado().hashCode());
result = result * 37 + (this.getFcaducidad() == null ? 0 : this.getFcaducidad().hashCode());
this.hashValue = result;
}
return this.hashValue;
}
public Object cloneMe() throws CloneNotSupportedException {
return this.clone();
}
/**Implementacion 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+="pk."+name+"="+f.get(this)+";";
}catch(Exception e){
continue;
}
}
if(data.compareTo("")==0){
data=super.toString();
}
return data;
}
}