maia/.svn/pristine/1c/1cdb6b57e79fbc0885491951b1d...

429 lines
12 KiB
Plaintext
Executable File
Raw Permalink Blame History

package com.fp.persistence.pcustomer.company;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.math.BigDecimal;
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 TCUSTCOMPANYPRODUCTS
*/
@Entity(name = "TcustCompanyProducts")
@Table(name = "TCUSTCOMPANYPRODUCTS")
public class TcustCompanyProducts 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 TcustCompanyProducts
*/
@EmbeddedId
@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = {
@Parameter(name = "sql", value = "select coalesce(max(PRODUCTSEQUENCE),0)+1 from TCUSTCOMPANYPRODUCTS where personcode=:code"),
@Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"),
@Parameter(name = "field", value = "productsequence") })
@GeneratedValue(generator = "seq_id")
private TcustCompanyProductsKey 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 = "MARKETINGTYPECATALOG", nullable = true)
/**
* Codigo de catalogo 1, masivo, 2 persona a persona, directa, tercerizada
*/
private String marketingtypecatalog;
@Column(name = "MARKETINGTYPECATALOGCODE", nullable = true)
/**
* Codigo de tabla de catalogo MARKETINGTYPE, forma de comercializacion
*/
private String marketingtypecatalogcode;
@Column(name = "ANNUALSALES", nullable = true)
/**
* Monto ventas anuales
*/
private BigDecimal annualsales;
@Column(name = "PRODUCTDETAIL", nullable = true)
/**
* Descripcion del producto
*/
private String productdetail;
@Column(name = "PERCENT", nullable = true)
/**
* Porcentaje de ventas del producto dentro de la empresa
*/
private BigDecimal percent;
@Column(name = "ISSERVICE", nullable = true)
/**
* Y indica, que el producto es un servicio, N es un producto final o
* entrada para otro producto
*/
private String isservice;
@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 TcustCompanyProducts() {
}
/**
* Contructor de TcustCompanyProducts
*
* @param pPk Clave Primaria del entity
* @param pDatefrom Fecha desde la cual esta vigente el registro
*/
public TcustCompanyProducts(TcustCompanyProductsKey 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 TcustCompanyProducts
*/
public static TcustCompanyProducts find(EntityManager pEntityManager, TcustCompanyProductsKey pKey) throws Exception {
TcustCompanyProducts obj = pEntityManager.find(TcustCompanyProducts.class, pKey);
return obj;
}
/**
* Entrega la Clave primaria de TcustCompanyProducts
*
* @return El objeto que referencia a la Clave primaria de TcustCompanyProducts
*/
public TcustCompanyProductsKey getPk() {
return this.pk;
}
/**
* Fija un nuevo valor a la Clave primaria de TcustCompanyProducts
*
* @param pPk El objeto que referencia a la nueva Clave primaria de TcustCompanyProducts
*/
public void setPk(TcustCompanyProductsKey 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 marketingtypecatalog
*
* @return valor de marketingtypecatalog
*/
public String getMarketingtypecatalog() {
return this.marketingtypecatalog;
}
/**
* Fija el valor de marketingtypecatalog
*
* @param pMarketingtypecatalog nuevo Valor de marketingtypecatalog
*/
public void setMarketingtypecatalog(String pMarketingtypecatalog) {
this.marketingtypecatalog = pMarketingtypecatalog;
}
/**
* Obtiene el valor de marketingtypecatalogcode
*
* @return valor de marketingtypecatalogcode
*/
public String getMarketingtypecatalogcode() {
return this.marketingtypecatalogcode;
}
/**
* Fija el valor de marketingtypecatalogcode
*
* @param pMarketingtypecatalogcode nuevo Valor de marketingtypecatalogcode
*/
public void setMarketingtypecatalogcode(String pMarketingtypecatalogcode) {
this.marketingtypecatalogcode = pMarketingtypecatalogcode;
}
/**
* Obtiene el valor de annualsales
*
* @return valor de annualsales
*/
public BigDecimal getAnnualsales() {
return this.annualsales;
}
/**
* Fija el valor de annualsales
*
* @param pAnnualsales nuevo Valor de annualsales
*/
public void setAnnualsales(BigDecimal pAnnualsales) {
this.annualsales = pAnnualsales;
}
/**
* Obtiene el valor de productdetail
*
* @return valor de productdetail
*/
public String getProductdetail() {
return this.productdetail;
}
/**
* Fija el valor de productdetail
*
* @param pProductdetail nuevo Valor de productdetail
*/
public void setProductdetail(String pProductdetail) {
this.productdetail = pProductdetail;
}
/**
* Obtiene el valor de percent
*
* @return valor de percent
*/
public BigDecimal getPercent() {
return this.percent;
}
/**
* Fija el valor de percent
*
* @param pPercent nuevo Valor de percent
*/
public void setPercent(BigDecimal pPercent) {
this.percent = pPercent;
}
/**
* Obtiene el valor de isservice
*
* @return valor de isservice
*/
public String getIsservice() {
return this.isservice;
}
/**
* Fija el valor de isservice
*
* @param pIsservice nuevo Valor de isservice
*/
public void setIsservice(String pIsservice) {
this.isservice = pIsservice;
}
/**
* 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 TcustCompanyProducts)) {
return false;
}
TcustCompanyProducts that = (TcustCompanyProducts) 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 TcustCompanyProducts
*
* @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 TcustCompanyProducts
*/
@Override
public Object createInstance() {
TcustCompanyProducts instance = new TcustCompanyProducts();
instance.setPk(new TcustCompanyProductsKey());
return instance;
}
/**
* Clona la entidad TcustCompanyProducts
*
* @see com.fp.dto.hb.HibernateBean#cloneMe()
*/
@Override
public Object cloneMe() throws CloneNotSupportedException {
TcustCompanyProducts p = (TcustCompanyProducts) this.clone();
p.setPk((TcustCompanyProductsKey) this.pk.cloneMe());
return p;
}
public Object getId() {
return this.pk;
}
}