package com.fp.persistence.pgeneral.msg; 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; /**Clase que hace referencia a la Clave Primaria de TGENEMESSAGESTRUCTUREDATA*/ @Embeddable public class TgeneMessageStructureDataKey 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="STRUCTURECODE", nullable=false,updatable=false) /** * Codigo de estructura de mensaje */ private String structurecode; @Column(name="CODE", nullable=false,updatable=false) /** * Codigo de estructura de mensaje */ private Integer code; /**Contructor por defecto*/ public TgeneMessageStructureDataKey(){} /**Contructor de TgeneMessageStructureDataKey @param pStructurecode Codigo de estructura de mensaje @param pCode Codigo de estructura de mensaje */ public TgeneMessageStructureDataKey(String pStructurecode,Integer pCode){ structurecode=pStructurecode; code=pCode; } /**Obtiene el valor de structurecode @return valor de structurecode*/ public String getStructurecode(){ return structurecode; } /**Fija el valor de structurecode @param pStructurecode nuevo Valor de structurecode*/ public void setStructurecode(String pStructurecode){ structurecode=pStructurecode; } /**Obtiene el valor de code @return valor de code*/ public Integer getCode(){ return code; } /**Fija el valor de code @param pCode nuevo Valor de code*/ public void setCode(Integer pCode){ code=pCode; } /**Implementación de la comparación de TgeneMessageStructureDataKey @param o Objeto de comparación */ public boolean equals(Object o){ if (o == null)return false; if (! (o instanceof TgeneMessageStructureDataKey))return false; TgeneMessageStructureDataKey that = (TgeneMessageStructureDataKey) o; if (this.getStructurecode() == null || that.getStructurecode() == null){ return false; } if (! this.getStructurecode().equals(that.getStructurecode())){ return false; } if (this.getCode() == null || that.getCode() == null){ return false; } if (! this.getCode().equals(that.getCode())){ return false; } return true; } /**Implementación del método hashCode bajo el patrón de Bloch @return hashCode de la instancia TgeneMessageStructureDataKey */ public int hashCode(){ if (this.hashValue == 0){ int result = 17; result = result * 37 + (this.getStructurecode() == null ? 0 : this.getStructurecode().hashCode()); result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); this.hashValue = result; } return this.hashValue; } public Object cloneMe() throws CloneNotSupportedException { return this.clone(); } /**Implementació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+="pk."+name+"="+f.get(this)+";"; }catch(Exception e){ continue; } } if(data.compareTo("")==0){ data=super.toString(); } return data; } }