package com.fp.persistence.pcustomer.company;

import java.sql.Timestamp;
import javax.persistence.Column;
import java.io.Serializable;
import com.fp.dto.hb.HibernateId;
import java.lang.reflect.Field;
import javax.persistence.Embeddable;
import com.fp.dto.hb.History;
import javax.persistence.Transient;

/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYMANAGERS*/
@Embeddable
public class TcustCompanyManagersKey  extends com.fp.dto.AbstractDataTransport  implements Serializable,Cloneable,HibernateId,History{
/**
* HashCode asociado con la Instancia
*/
@Transient
private int hashValue = 0;
/**
* Version de la Clase
*/
private static final long serialVersionUID = 1L;
@Column(name="PERSONCODE", nullable=false,updatable=false)

/**
* Codigo de persona
*/
private Integer personcode;

@Column(name="DATETO", nullable=false,updatable=false)

/**
* Fecha hasta la cual esta vigente el registro
*/
private Timestamp dateto;

@Column(name="MANAGERPERSONCODE", nullable=false,updatable=false)

/**
* Codigo de persona asociado al directivo de la empresa
*/
private Integer managerpersoncode;

@Column(name="APPOINTMENTCATALOG", nullable=false,updatable=false)

/**
* Codigo de catalogo  de tipo  de cargo, 1 Gerente, 2 Contador
*/
private String appointmentcatalog;

@Column(name="APPOINTMENTCATALOGCODE", nullable=false,updatable=false)

/**
* Codigo de tabla de catalogo de tipo de empresa APPOINTMENT
*/
private String appointmentcatalogcode;

/**Contructor por defecto*/
public TcustCompanyManagersKey(){}
/**Contructor de TcustCompanyManagersKey
@param pPersoncode Codigo de persona
@param pDateto Fecha hasta la cual esta vigente el registro
@param pManagerpersoncode Codigo de persona asociado al directivo de la empresa
@param pAppointmentcatalog Codigo de catalogo  de tipo  de cargo, 1 Gerente, 2 Contador
@param pAppointmentcatalogcode Codigo de tabla de catalogo de tipo de empresa APPOINTMENT
*/
public TcustCompanyManagersKey(Integer pPersoncode,Timestamp pDateto,Integer pManagerpersoncode,String pAppointmentcatalog,String pAppointmentcatalogcode){
 personcode=pPersoncode;
 dateto=pDateto;
 managerpersoncode=pManagerpersoncode;
 appointmentcatalog=pAppointmentcatalog;
 appointmentcatalogcode=pAppointmentcatalogcode;
}
/**Obtiene el valor de personcode
@return valor de personcode*/
public Integer getPersoncode(){
  return personcode;
}
/**Fija el valor de personcode
@param pPersoncode nuevo Valor de personcode*/
public void setPersoncode(Integer pPersoncode){
  personcode=pPersoncode;
}

/**Obtiene el valor de dateto
@return valor de dateto*/
public Timestamp getDateto(){
  return dateto;
}
/**Fija el valor de dateto
@param pDateto nuevo Valor de dateto*/
public void setDateto(Timestamp pDateto){
  dateto=pDateto;
}

/**Obtiene el valor de managerpersoncode
@return valor de managerpersoncode*/
public Integer getManagerpersoncode(){
  return managerpersoncode;
}
/**Fija el valor de managerpersoncode
@param pManagerpersoncode nuevo Valor de managerpersoncode*/
public void setManagerpersoncode(Integer pManagerpersoncode){
  managerpersoncode=pManagerpersoncode;
}

/**Obtiene el valor de appointmentcatalog
@return valor de appointmentcatalog*/
public String getAppointmentcatalog(){
  return appointmentcatalog;
}
/**Fija el valor de appointmentcatalog
@param pAppointmentcatalog nuevo Valor de appointmentcatalog*/
public void setAppointmentcatalog(String pAppointmentcatalog){
  appointmentcatalog=pAppointmentcatalog;
}

/**Obtiene el valor de appointmentcatalogcode
@return valor de appointmentcatalogcode*/
public String getAppointmentcatalogcode(){
  return appointmentcatalogcode;
}
/**Fija el valor de appointmentcatalogcode
@param pAppointmentcatalogcode nuevo Valor de appointmentcatalogcode*/
public void setAppointmentcatalogcode(String pAppointmentcatalogcode){
  appointmentcatalogcode=pAppointmentcatalogcode;
}

/**Implementacion de la comparacion de TcustCompanyManagersKey
@param o Objeto de comparacion
*/
public boolean equals(Object o){
  if (o == null)return false;
  if (! (o instanceof TcustCompanyManagersKey))return false;
  TcustCompanyManagersKey that = (TcustCompanyManagersKey) o;
  if (this.getPersoncode() == null || that.getPersoncode() == null){
      return false;
  }
  if (! this.getPersoncode().equals(that.getPersoncode())){
    return false;
  }
  if (this.getDateto() == null || that.getDateto() == null){
      return false;
  }
  if (! this.getDateto().equals(that.getDateto())){
    return false;
  }
  if (this.getManagerpersoncode() == null || that.getManagerpersoncode() == null){
      return false;
  }
  if (! this.getManagerpersoncode().equals(that.getManagerpersoncode())){
    return false;
  }
  if (this.getAppointmentcatalog() == null || that.getAppointmentcatalog() == null){
      return false;
  }
  if (! this.getAppointmentcatalog().equals(that.getAppointmentcatalog())){
    return false;
  }
  if (this.getAppointmentcatalogcode() == null || that.getAppointmentcatalogcode() == null){
      return false;
  }
  if (! this.getAppointmentcatalogcode().equals(that.getAppointmentcatalogcode())){
    return false;
  }
  return true;
}
/**Implementacion del metodo hashCode bajo el patron de Bloch
@return hashCode de la instancia TcustCompanyManagersKey
*/
public int hashCode(){
  if (this.hashValue == 0){
    int result = 17;
    result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode());
    result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode());
    result = result * 37 + (this.getManagerpersoncode() == null ? 0 : this.getManagerpersoncode().hashCode());
    result = result * 37 + (this.getAppointmentcatalog() == null ? 0 : this.getAppointmentcatalog().hashCode());
    result = result * 37 + (this.getAppointmentcatalogcode() == null ? 0 : this.getAppointmentcatalogcode().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;
	}
public Object getId() {
  return null;
}
}
