maia_modificado/.svn/pristine/10/10151fecee8fdc3220dbf55727d...

179 lines
4.6 KiB
Plaintext
Executable File

package com.fp.persistence.pgeneral.gene;
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 TGENECITY*/
@Embeddable
public class TgeneCityKey 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="COUNTRYCODE", nullable=false,updatable=false)
/**
* Codigo de pais
*/
private String countrycode;
@Column(name="PROVINCECODE", nullable=false,updatable=false)
/**
* Codigo de provincia
*/
private String provincecode;
@Column(name="CANTONCODE", nullable=false,updatable=false)
/**
* Codigo de canton
*/
private String cantoncode;
@Column(name="CITYCODE", nullable=false,updatable=false)
/**
* Codigo de cuidad
*/
private String citycode;
/**Contructor por defecto*/
public TgeneCityKey(){}
/**Contructor de TgeneCityKey
@param pCountrycode Codigo de pais
@param pProvincecode Codigo de provincia
@param pCantoncode Codigo de canton
@param pCitycode Codigo de cuidad
*/
public TgeneCityKey(String pCountrycode,String pProvincecode,String pCantoncode,String pCitycode){
countrycode=pCountrycode;
provincecode=pProvincecode;
cantoncode=pCantoncode;
citycode=pCitycode;
}
/**Obtiene el valor de countrycode
@return valor de countrycode*/
public String getCountrycode(){
return countrycode;
}
/**Fija el valor de countrycode
@param pCountrycode nuevo Valor de countrycode*/
public void setCountrycode(String pCountrycode){
countrycode=pCountrycode;
}
/**Obtiene el valor de provincecode
@return valor de provincecode*/
public String getProvincecode(){
return provincecode;
}
/**Fija el valor de provincecode
@param pProvincecode nuevo Valor de provincecode*/
public void setProvincecode(String pProvincecode){
provincecode=pProvincecode;
}
/**Obtiene el valor de cantoncode
@return valor de cantoncode*/
public String getCantoncode(){
return cantoncode;
}
/**Fija el valor de cantoncode
@param pCantoncode nuevo Valor de cantoncode*/
public void setCantoncode(String pCantoncode){
cantoncode=pCantoncode;
}
/**Obtiene el valor de citycode
@return valor de citycode*/
public String getCitycode(){
return citycode;
}
/**Fija el valor de citycode
@param pCitycode nuevo Valor de citycode*/
public void setCitycode(String pCitycode){
citycode=pCitycode;
}
/**Implementacion de la comparacion de TgeneCityKey
@param o Objeto de comparacion
*/
public boolean equals(Object o){
if (o == null)return false;
if (! (o instanceof TgeneCityKey))return false;
TgeneCityKey that = (TgeneCityKey) o;
if (this.getCountrycode() == null || that.getCountrycode() == null){
return false;
}
if (! this.getCountrycode().equals(that.getCountrycode())){
return false;
}
if (this.getProvincecode() == null || that.getProvincecode() == null){
return false;
}
if (! this.getProvincecode().equals(that.getProvincecode())){
return false;
}
if (this.getCantoncode() == null || that.getCantoncode() == null){
return false;
}
if (! this.getCantoncode().equals(that.getCantoncode())){
return false;
}
if (this.getCitycode() == null || that.getCitycode() == null){
return false;
}
if (! this.getCitycode().equals(that.getCitycode())){
return false;
}
return true;
}
/**Implementacion del metodo hashCode bajo el patron de Bloch
@return hashCode de la instancia TgeneCityKey
*/
public int hashCode(){
if (this.hashValue == 0){
int result = 17;
result = result * 37 + (this.getCountrycode() == null ? 0 : this.getCountrycode().hashCode());
result = result * 37 + (this.getProvincecode() == null ? 0 : this.getProvincecode().hashCode());
result = result * 37 + (this.getCantoncode() == null ? 0 : this.getCantoncode().hashCode());
result = result * 37 + (this.getCitycode() == null ? 0 : this.getCitycode().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;
}
}