package com.fp.persistence.pcustomer.company; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import java.sql.Timestamp; import javax.persistence.Column; import javax.persistence.EntityManager; import java.io.Serializable; import javax.persistence.Table; import com.fp.dto.hb.HibernateBean; import com.fp.dto.hb.Log; import javax.persistence.Version; import java.lang.reflect.Field; import javax.persistence.Transient; import java.sql.Date; /** * Clase que implementa la entidad de Hibernate que hace referencia a la tabla * TCUSTLEGALLINK */ @Entity(name = "TcustLegalLink") @Table(name = "TCUSTLEGALLINK") public class TcustLegalLink extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { /** * 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 TcustLegalLink */ @EmbeddedId private TcustLegalLinkKey pk; @Column(name = "DATEFROM", nullable = true) /** * Fecha desde la cual esta vigente el registro del telefono */ private Timestamp datefrom; @Column(name = "LEGALLINKCATALOG", nullable = true) /** * Codigo de catalogo PG1 Causales P01 y G01 */ private String legallinkcatalog; @Column(name = "LEGALLINKCATALOGCODE", nullable = true) /** * Codigo de tabla de catalogo LEGALLINK vinculaciones legales */ private String legallinkcatalogcode; @Version @Column(name = "RECORDVERSION", nullable = false) /** * Optimistic locking del registro */ private Integer recordversion; @Column(name = "INGRESSDATE", nullable = true) /** * Fecha de inicio de la vinculacion. */ private Date ingressdate; @Column(name = "EXITDATE", nullable = true) /** * Fecha en la que finaliza la vinculacion de la persona. */ private Date exitdate; @Column(name = "INGRESSUSER", nullable = true) /** * Codigo de usuario que crea el cliente */ private String ingressuser; @Column(name = "MODIFYUSER", nullable = true) /** * Codigo de usuario que modifica datos del cliente */ private String modifyuser; /** * Contructor por defecto */ public TcustLegalLink() { } /** * Contructor de TcustLegalLink * * @param pPk Clave Primaria del entity * @param pRecordversion Optimistic locking del registro */ public TcustLegalLink(TcustLegalLinkKey pPk, Integer pRecordversion) { this(); pk = pPk; recordversion = pRecordversion; } /** * 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 TcustLegalLink */ public static TcustLegalLink find(EntityManager pEntityManager, TcustLegalLinkKey pKey) throws Exception { TcustLegalLink obj = pEntityManager.find(TcustLegalLink.class, pKey); return obj; } /** * Entrega la Clave primaria de TcustLegalLink * * @return El objeto que referencia a la Clave primaria de TcustLegalLink */ public TcustLegalLinkKey getPk() { return pk; } /** * Fija un nuevo valor a la Clave primaria de TcustLegalLink * * @param pPk El objeto que referencia a la nueva Clave primaria de * TcustLegalLink */ public void setPk(TcustLegalLinkKey pPk) { pk = pPk; } /** * Obtiene el valor de datefrom * * @return valor de datefrom */ public Timestamp getDatefrom() { return datefrom; } /** * Fija el valor de datefrom * * @param pDatefrom nuevo Valor de datefrom */ public void setDatefrom(Timestamp pDatefrom) { datefrom = pDatefrom; } /** * Obtiene el valor de legallinkcatalog * * @return valor de legallinkcatalog */ public String getLegallinkcatalog() { return legallinkcatalog; } /** * Fija el valor de legallinkcatalog * * @param pLegallinkcatalog nuevo Valor de legallinkcatalog */ public void setLegallinkcatalog(String pLegallinkcatalog) { legallinkcatalog = pLegallinkcatalog; } /** * Obtiene el valor de legallinkcatalogcode * * @return valor de legallinkcatalogcode */ public String getLegallinkcatalogcode() { return legallinkcatalogcode; } /** * Fija el valor de legallinkcatalogcode * * @param pLegallinkcatalogcode nuevo Valor de legallinkcatalogcode */ public void setLegallinkcatalogcode(String pLegallinkcatalogcode) { legallinkcatalogcode = pLegallinkcatalogcode; } /** * Obtiene el valor de recordversion * * @return valor de recordversion */ public Integer getRecordversion() { return recordversion; } /** * Fija el valor de recordversion * * @param pRecordversion nuevo Valor de recordversion */ public void setRecordversion(Integer pRecordversion) { recordversion = pRecordversion; } /** * Obtiene el valor de ingressdate * * @return valor de ingressdate */ public Date getIngressdate() { return ingressdate; } /** * Fija el valor de ingressdate * * @param pIngressdate nuevo Valor de ingressdate */ public void setIngressdate(Date pIngressdate) { ingressdate = pIngressdate; } /** * Obtiene el valor de exitdate * * @return valor de exitdate */ public Date getExitdate() { return exitdate; } /** * Fija el valor de exitdate * * @param pExitdate nuevo Valor de exitdate */ public void setExitdate(Date pExitdate) { exitdate = pExitdate; } /** * Obtiene el valor de ingressuser * * @return valor de ingressuser */ public String getIngressuser() { return ingressuser; } /** * Fija el valor de ingressuser * * @param pIngressuser nuevo Valor de ingressuser */ public void setIngressuser(String pIngressuser) { ingressuser = pIngressuser; } /** * Obtiene el valor de modifyuser * * @return valor de modifyuser */ public String getModifyuser() { return modifyuser; } /** * Fija el valor de modifyuser * * @param pModifyuser nuevo Valor de modifyuser */ public void setModifyuser(String pModifyuser) { modifyuser = pModifyuser; } public boolean equals(Object rhs) { if (rhs == null) { return false; } if (!(rhs instanceof TcustLegalLink)) { return false; } TcustLegalLink that = (TcustLegalLink) rhs; if (this.getPk() == null || that.getPk() == null) { return false; } return (this.getPk().equals(that.getPk())); } /** * Implementación del metodo hashCode de la la entidad TcustLegalLink * * @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ó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ón de la creación de un bean en blanco TcustLegalLink */ public Object createInstance() { TcustLegalLink instance = new TcustLegalLink(); instance.setPk(new TcustLegalLinkKey()); return instance; } /** * Clona la entidad TcustLegalLink * * @see com.fp.dto.hb.HibernateBean#cloneMe() */ public Object cloneMe() throws CloneNotSupportedException { TcustLegalLink p = (TcustLegalLink) this.clone(); p.setPk((TcustLegalLinkKey) this.pk.cloneMe()); return p; } public Object getId() { return this.pk; } }