490 lines
13 KiB
Plaintext
Executable File
490 lines
13 KiB
Plaintext
Executable File
package com.fp.persistence.pcustomer.company;
|
||
|
||
import java.io.Serializable;
|
||
import java.lang.reflect.Field;
|
||
import java.math.BigDecimal;
|
||
import java.sql.Date;
|
||
import java.sql.Timestamp;
|
||
|
||
import javax.persistence.Column;
|
||
import javax.persistence.EmbeddedId;
|
||
import javax.persistence.Entity;
|
||
import javax.persistence.EntityManager;
|
||
import javax.persistence.GeneratedValue;
|
||
import javax.persistence.Table;
|
||
import javax.persistence.Transient;
|
||
import javax.persistence.Version;
|
||
|
||
import org.hibernate.annotations.GenericGenerator;
|
||
import org.hibernate.annotations.Parameter;
|
||
|
||
import com.fp.dto.hb.HibernateBean;
|
||
import com.fp.dto.hb.Log;
|
||
|
||
/**
|
||
* Clase que implementa la entidad de Hibernate que hace referencia a la tabla
|
||
* TCUSTCOMPANYCLIENT
|
||
*/
|
||
@Entity(name = "TcustCompanyClient")
|
||
@Table(name = "TCUSTCOMPANYCLIENT")
|
||
public class TcustCompanyClient 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 TcustCompanyClient
|
||
*/
|
||
@EmbeddedId
|
||
@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = {
|
||
@Parameter(name = "sql", value = "select coalesce(max(CLIENTSEQUENCE),0)+1 from TCUSTCOMPANYCLIENT where personcode=:code"),
|
||
@Parameter(name = "type", value = "java.lang.Integer"),
|
||
@Parameter(name = "param", value = "code,pk.personcode"),
|
||
@Parameter(name = "field", value = "clientsequence")})
|
||
@GeneratedValue(generator = "seq_id")
|
||
private TcustCompanyClientKey pk;
|
||
@Column(name = "DATEFROM", nullable = false)
|
||
/**
|
||
* Fecha desde la cual esta vigente el registro
|
||
*/
|
||
private Timestamp datefrom;
|
||
@Version
|
||
@Column(name = "RECORDVERSION", nullable = true)
|
||
/**
|
||
* Optimistic locking del registro
|
||
*/
|
||
private Integer recordversion;
|
||
@Column(name = "CLIENTPERSONCODE", nullable = true)
|
||
/**
|
||
* Codigo de persona asociada al cliente de la empresa
|
||
*/
|
||
private Integer clientpersoncode;
|
||
@Column(name = "CURRENCYCODE", nullable = true)
|
||
/**
|
||
* Codigo de moneda
|
||
*/
|
||
private String currencycode;
|
||
@Column(name = "PAYMENTMETHODCATALOG", nullable = true)
|
||
/**
|
||
* Codigo de catalogo 1, efectivo, 2 cheque, 3 credito
|
||
*/
|
||
private String paymentmethodcatalog;
|
||
@Column(name = "PAYMENTMETHODCATALOGCODE", nullable = true)
|
||
/**
|
||
* Codigo de tabla de catalogo PAYMENTMETHOD de la forma de pago
|
||
*/
|
||
private String paymentmethodcatalogcode;
|
||
@Column(name = "MAXCREDIT", nullable = true)
|
||
/**
|
||
* Monto maximo de creditos.
|
||
*/
|
||
private BigDecimal maxcredit;
|
||
@Column(name = "ANNUALPURCHASE", nullable = true)
|
||
/**
|
||
* Monto de compras anuales del cliente en la compania
|
||
*/
|
||
private BigDecimal annualpurchase;
|
||
@Column(name = "CLIENTDATE", nullable = true)
|
||
/**
|
||
* Fecha desde la cual la persona es cliente de la compania
|
||
*/
|
||
private Date clientdate;
|
||
@Column(name = "NAME", nullable = true)
|
||
/**
|
||
* Nombre del cliente si no esta en la base de personas
|
||
*/
|
||
private String name;
|
||
@Column(name = "REMARK", nullable = true)
|
||
/**
|
||
* Comentarios
|
||
*/
|
||
private String remark;
|
||
@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 TcustCompanyClient() {
|
||
}
|
||
|
||
/**
|
||
* Contructor de TcustCompanyClient
|
||
*
|
||
* @param pPk Clave Primaria del entity
|
||
* @param pDatefrom Fecha desde la cual esta vigente el registro
|
||
*/
|
||
public TcustCompanyClient(TcustCompanyClientKey pPk, Timestamp pDatefrom) {
|
||
this();
|
||
this.pk = pPk;
|
||
this.datefrom = pDatefrom;
|
||
}
|
||
|
||
/**
|
||
* 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 TcustCompanyClient
|
||
*/
|
||
public static TcustCompanyClient find(EntityManager pEntityManager, TcustCompanyClientKey pKey) throws Exception {
|
||
TcustCompanyClient obj = pEntityManager.find(TcustCompanyClient.class, pKey);
|
||
return obj;
|
||
}
|
||
|
||
/**
|
||
* Entrega la Clave primaria de TcustCompanyClient
|
||
*
|
||
* @return El objeto que referencia a la Clave primaria de
|
||
* TcustCompanyClient
|
||
*/
|
||
public TcustCompanyClientKey getPk() {
|
||
return this.pk;
|
||
}
|
||
|
||
/**
|
||
* Fija un nuevo valor a la Clave primaria de TcustCompanyClient
|
||
*
|
||
* @param pPk El objeto que referencia a la nueva Clave primaria de
|
||
* TcustCompanyClient
|
||
*/
|
||
public void setPk(TcustCompanyClientKey pPk) {
|
||
this.pk = pPk;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de datefrom
|
||
*
|
||
* @return valor de datefrom
|
||
*/
|
||
public Timestamp getDatefrom() {
|
||
return this.datefrom;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de datefrom
|
||
*
|
||
* @param pDatefrom nuevo Valor de datefrom
|
||
*/
|
||
public void setDatefrom(Timestamp pDatefrom) {
|
||
this.datefrom = pDatefrom;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de recordversion
|
||
*
|
||
* @return valor de recordversion
|
||
*/
|
||
public Integer getRecordversion() {
|
||
return this.recordversion;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de recordversion
|
||
*
|
||
* @param pRecordversion nuevo Valor de recordversion
|
||
*/
|
||
public void setRecordversion(Integer pRecordversion) {
|
||
this.recordversion = pRecordversion;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de clientpersoncode
|
||
*
|
||
* @return valor de clientpersoncode
|
||
*/
|
||
public Integer getClientpersoncode() {
|
||
return this.clientpersoncode;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de clientpersoncode
|
||
*
|
||
* @param pClientpersoncode nuevo Valor de clientpersoncode
|
||
*/
|
||
public void setClientpersoncode(Integer pClientpersoncode) {
|
||
this.clientpersoncode = pClientpersoncode;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de currencycode
|
||
*
|
||
* @return valor de currencycode
|
||
*/
|
||
public String getCurrencycode() {
|
||
return this.currencycode;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de currencycode
|
||
*
|
||
* @param pCurrencycode nuevo Valor de currencycode
|
||
*/
|
||
public void setCurrencycode(String pCurrencycode) {
|
||
this.currencycode = pCurrencycode;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de paymentmethodcatalog
|
||
*
|
||
* @return valor de paymentmethodcatalog
|
||
*/
|
||
public String getPaymentmethodcatalog() {
|
||
return this.paymentmethodcatalog;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de paymentmethodcatalog
|
||
*
|
||
* @param pPaymentmethodcatalog nuevo Valor de paymentmethodcatalog
|
||
*/
|
||
public void setPaymentmethodcatalog(String pPaymentmethodcatalog) {
|
||
this.paymentmethodcatalog = pPaymentmethodcatalog;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de paymentmethodcatalogcode
|
||
*
|
||
* @return valor de paymentmethodcatalogcode
|
||
*/
|
||
public String getPaymentmethodcatalogcode() {
|
||
return this.paymentmethodcatalogcode;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de paymentmethodcatalogcode
|
||
*
|
||
* @param pPaymentmethodcatalogcode nuevo Valor de paymentmethodcatalogcode
|
||
*/
|
||
public void setPaymentmethodcatalogcode(String pPaymentmethodcatalogcode) {
|
||
this.paymentmethodcatalogcode = pPaymentmethodcatalogcode;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de maxcredit
|
||
*
|
||
* @return valor de maxcredit
|
||
*/
|
||
public BigDecimal getMaxcredit() {
|
||
return this.maxcredit;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de maxcredit
|
||
*
|
||
* @param pMaxcredit nuevo Valor de maxcredit
|
||
*/
|
||
public void setMaxcredit(BigDecimal pMaxcredit) {
|
||
this.maxcredit = pMaxcredit;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de annualpurchase
|
||
*
|
||
* @return valor de annualpurchase
|
||
*/
|
||
public BigDecimal getAnnualpurchase() {
|
||
return this.annualpurchase;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de annualpurchase
|
||
*
|
||
* @param pAnnualpurchase nuevo Valor de annualpurchase
|
||
*/
|
||
public void setAnnualpurchase(BigDecimal pAnnualpurchase) {
|
||
this.annualpurchase = pAnnualpurchase;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de clientdate
|
||
*
|
||
* @return valor de clientdate
|
||
*/
|
||
public Date getClientdate() {
|
||
return this.clientdate;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de clientdate
|
||
*
|
||
* @param pClientdate nuevo Valor de clientdate
|
||
*/
|
||
public void setClientdate(Date pClientdate) {
|
||
this.clientdate = pClientdate;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de name
|
||
*
|
||
* @return valor de name
|
||
*/
|
||
public String getName() {
|
||
return this.name;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de name
|
||
*
|
||
* @param pName nuevo Valor de name
|
||
*/
|
||
public void setName(String pName) {
|
||
this.name = pName;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de remark
|
||
*
|
||
* @return valor de remark
|
||
*/
|
||
public String getRemark() {
|
||
return this.remark;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de remark
|
||
*
|
||
* @param pRemark nuevo Valor de remark
|
||
*/
|
||
public void setRemark(String pRemark) {
|
||
this.remark = pRemark;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de ingressuser
|
||
*
|
||
* @return valor de ingressuser
|
||
*/
|
||
public String getIngressuser() {
|
||
return this.ingressuser;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de ingressuser
|
||
*
|
||
* @param pIngressuser nuevo Valor de ingressuser
|
||
*/
|
||
public void setIngressuser(String pIngressuser) {
|
||
this.ingressuser = pIngressuser;
|
||
}
|
||
|
||
/**
|
||
* Obtiene el valor de modifyuser
|
||
*
|
||
* @return valor de modifyuser
|
||
*/
|
||
public String getModifyuser() {
|
||
return this.modifyuser;
|
||
}
|
||
|
||
/**
|
||
* Fija el valor de modifyuser
|
||
*
|
||
* @param pModifyuser nuevo Valor de modifyuser
|
||
*/
|
||
public void setModifyuser(String pModifyuser) {
|
||
this.modifyuser = pModifyuser;
|
||
}
|
||
|
||
@Override
|
||
public boolean equals(Object rhs) {
|
||
if (rhs == null) {
|
||
return false;
|
||
}
|
||
if (!(rhs instanceof TcustCompanyClient)) {
|
||
return false;
|
||
}
|
||
TcustCompanyClient that = (TcustCompanyClient) rhs;
|
||
if ((this.getPk() == null) || (that.getPk() == null)) {
|
||
return false;
|
||
}
|
||
return (this.getPk().equals(that.getPk()));
|
||
}
|
||
|
||
/**
|
||
* Implementaci<63>n del metodo hashCode de la la entidad TcustCompanyClient
|
||
*
|
||
* @return el hashCode la instancia
|
||
*/
|
||
@Override
|
||
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<63>n toString
|
||
*/
|
||
@Override
|
||
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<63>n de la creaci<63>n de un bean en blanco TcustCompanyClient
|
||
*/
|
||
@Override
|
||
public Object createInstance() {
|
||
TcustCompanyClient instance = new TcustCompanyClient();
|
||
instance.setPk(new TcustCompanyClientKey());
|
||
return instance;
|
||
}
|
||
|
||
/**
|
||
* Clona la entidad TcustCompanyClient
|
||
*
|
||
* @see com.fp.dto.hb.HibernateBean#cloneMe()
|
||
*/
|
||
@Override
|
||
public Object cloneMe() throws CloneNotSupportedException {
|
||
TcustCompanyClient p = (TcustCompanyClient) this.clone();
|
||
p.setPk((TcustCompanyClientKey) this.pk.cloneMe());
|
||
return p;
|
||
}
|
||
|
||
public Object getId() {
|
||
return this.pk;
|
||
}
|
||
}
|