/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author Rafius */ @Entity @SequenceGenerator(name = "PRICING_SEQ", sequenceName = "PRICING_SEQ", allocationSize = 1) @Table(name = "PRICING") public class Pricing implements Serializable { private static final long serialVersionUID = 1L; public static final Integer ATIVO = 1; public static final Integer INATIVO = 2; public static final Integer EXCLUIDO = 0; @Id @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_SEQ") @Column(name = "PRICING_ID") private Integer pricingId; @Column(name = "NOMBPRICING") private String nombPricing; @Column(name = "CANTBOLETO") private Short cantboleto; // Rafael - Campo retirado pela Leticia no dia 15/02/2011. // @Column(name = "DESCUENTOIMPORTE") // private BigDecimal descuentoimporte; @Column(name = "DESCUENTOPORCENTAJE") private BigDecimal descuentoporcentaje; @Column(name = "DESCUENTOPORCREDONDO") private BigDecimal descuentoporcredondo; @Column(name = "INDTRANSFERIBLE") private Boolean indtransferible; @Column(name = "INDRESERVABLE") private Boolean indreservable; @Column(name = "EXIBEVENDA") private Boolean exibeVenda; @Column(name = "INDCANCELABLE") private Boolean indcancelable; @Column(name = "ACTIVO") private Integer activo; @Column(name = "FECMODIF") @Temporal(TemporalType.TIMESTAMP) private Date fecmodif; @Column(name = "USUARIO_ID") private Integer usuarioId; @Column(name = "CANTDIASANTICIPACION") private Integer cantdiasanticipacion; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingAsientoList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingMercadoList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingMarcaList; @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") @ManyToOne private Empresa empresa; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingRutaList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingDiaList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingImporteList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingTipoptovtaList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingCategoriaList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingVigenciaList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingClaseList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingCorridaList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingPuntoventaList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingTipoServicioList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingOcupaAntecipaList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingFormapagoList; @Column(name = "INDGENERAFERIADOVIAJE") private String indGeneraFeriadoViaje; @Column(name = "INDGENERAFERIADOVENTA") private String indGeneraFeriadoVenta; public enum GerarFeriado { // Declaração dos enum GERARSEMPRE("GERAR SEMPRE", "S"), GERARQUANDOFERIADO("GERAR SÓ QUANDO FOR FERIADO", "F"), GERARQUANDONAOFERIADO("GERAR QUANDO NÃO FOR FERIADO", "N"); // Definição das constantes public final String valor; public final String descricao; public String valor() { return this.valor; } public String descricao() { return this.descricao; } private GerarFeriado(String descricao, String valor) { this.descricao = descricao; this.valor = valor; } } public Pricing() { } public Pricing(Integer pricingId) { this.pricingId = pricingId; } public Integer getPricingId() { return pricingId; } public void setPricingId(Integer pricingId) { this.pricingId = pricingId; } public Short getCantboleto() { return cantboleto; } public Integer getCantdiasanticipacion() { return cantdiasanticipacion; } public void setCantdiasanticipacion(Integer cantdiasanticipacion) { this.cantdiasanticipacion = cantdiasanticipacion; } public void setCantboleto(Short cantboleto) { this.cantboleto = cantboleto; } public BigDecimal getDescuentoporcentaje() { return descuentoporcentaje; } public void setDescuentoporcentaje(BigDecimal descuentoporcentaje) { this.descuentoporcentaje = descuentoporcentaje; } public BigDecimal getDescuentoporcredondo() { return descuentoporcredondo; } public void setDescuentoporcredondo(BigDecimal descuentoporcredondo) { this.descuentoporcredondo = descuentoporcredondo; } public Boolean getIndtransferible() { return indtransferible; } public void setIndtransferible(Boolean indtransferible) { this.indtransferible = indtransferible; } public Boolean getIndreservable() { return indreservable; } public void setIndreservable(Boolean indreservable) { this.indreservable = indreservable; } public Boolean getIndcancelable() { return indcancelable; } public void setIndcancelable(Boolean indcancelable) { this.indcancelable = indcancelable; } public Integer getActivo() { return activo; } public void setActivo(Integer activo) { this.activo = activo; } public Date getFecmodif() { return fecmodif; } public void setFecmodif(Date fecmodif) { this.fecmodif = fecmodif; } public Integer getUsuarioId() { return usuarioId; } public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } public List getPricingOcupaAntecipaList() { List poaList = new ArrayList(); for (PricingOcupaAntecipa poa : this.pricingOcupaAntecipaList) { if (poa.getActivo() != EXCLUIDO.intValue()) { poaList.add(poa); } } return poaList; } public void setPricingOcupaAntecipaList(List pricingOcupaAntecipaList) { this.pricingOcupaAntecipaList = pricingOcupaAntecipaList; } public List getPricingAsientoList() { List paList = new ArrayList(); for (PricingAsiento pa : this.pricingAsientoList) { if (pa.getActivo() != EXCLUIDO.intValue()) { paList.add(pa); } } return paList; } public void setPricingAsientoList(List pricingAsientoList) { this.pricingAsientoList = pricingAsientoList; } public List getPricingMercadoList() { List pmList = new ArrayList(); for (PricingMercado pm : this.pricingMercadoList) { if (pm.getActivo() != EXCLUIDO.intValue()) { pmList.add(pm); } } return pmList; } public void setPricingMercadoList(List pricingMercadoList) { this.pricingMercadoList = pricingMercadoList; } public List getPricingMarcaList() { List pmList = new ArrayList(); for (PricingMarca pm : this.pricingMarcaList) { if (pm.getActivo() != EXCLUIDO.intValue()) { pmList.add(pm); } } return pmList; } public void setPricingMarcaList(List pricingMarcaList) { this.pricingMarcaList = pricingMarcaList; } public Empresa getEmpresa() { return empresa; } public void setEmpresa(Empresa empresa) { this.empresa = empresa; } public List getPricingRutaList() { List prList = new ArrayList(); for (PricingRuta pr : this.pricingRutaList) { if (pr.getActivo() != EXCLUIDO.intValue()) { prList.add(pr); } } return prList; } public void setPricingRutaList(List pricingRutaList) { this.pricingRutaList = pricingRutaList; } public List getPricingDiaList() { List pdList = new ArrayList(); for (PricingDia pd : this.pricingDiaList) { if (pd.getActivo() != EXCLUIDO.intValue()) { pdList.add(pd); } } return pdList; } public void setPricingDiaList(List pricingDiaList) { this.pricingDiaList = pricingDiaList; } public List getPricingImporteList() { List piList = new ArrayList(); for (PricingImporte pi : this.pricingImporteList) { if (pi.getActivo() != EXCLUIDO.intValue()) { piList.add(pi); } } return piList; } public void setPricingImporteList(List pricingImporteList) { this.pricingImporteList = pricingImporteList; } public List getPricingTipoptovtaList() { List ptList = new ArrayList(); for (PricingTipoPtoVta pt : this.pricingTipoptovtaList) { if (pt.getActivo() != EXCLUIDO.intValue()) { ptList.add(pt); } } return ptList; } public void setPricingTipoptovtaList(List pricingTipoptovtaList) { this.pricingTipoptovtaList = pricingTipoptovtaList; } public List getPricingCategoriaList() { List pcList = new ArrayList(); for (PricingCategoria pc : this.pricingCategoriaList) { if (pc.getActivo() != EXCLUIDO.intValue()) { pcList.add(pc); } } return pcList; } public void setPricingCategoriaList(List pricingCategoriaList) { this.pricingCategoriaList = pricingCategoriaList; } public List getPricingVigenciaList() { List pvList = new ArrayList(); if (this.pricingVigenciaList != null) { for (PricingVigencia pv : this.pricingVigenciaList) { if (pv.getActivo() != EXCLUIDO.intValue()) { pvList.add(pv); } } } return pvList; } public void setPricingVigenciaList(List pricingVigenciaList) { this.pricingVigenciaList = pricingVigenciaList; } public List getPricingClaseList() { List pcList = new ArrayList(); for (PricingClase pc : this.pricingClaseList) { if (pc.getActivo() != EXCLUIDO.intValue()) { pcList.add(pc); } } return pcList; } public void setPricingClaseList(List pricingClaseList) { this.pricingClaseList = pricingClaseList; } public List getPricingCorridaList() { List pcList = new ArrayList(); if (pricingCorridaList == null) { return null; } for (PricingCorrida pc : this.pricingCorridaList) { if (pc.getActivo() != EXCLUIDO.intValue()) { pcList.add(pc); } } return pcList; } public void setPricingCorridaList(List pricingCorridaList) { this.pricingCorridaList = pricingCorridaList; } public List getPricingPuntoventaList() { List ppList = new ArrayList(); for (PricingPuntoVenta pp : this.pricingPuntoventaList) { if (pp.getActivo() != EXCLUIDO.intValue()) { ppList.add(pp); } } return ppList; } public void setPricingPuntoventaList(List pricingPuntoventaList) { this.pricingPuntoventaList = pricingPuntoventaList; } public List getPricingTipoServicioList() { List ppList = new ArrayList(); for (PricingTipoServicio pp : this.pricingTipoServicioList) { if (pp.getActivo() != EXCLUIDO.intValue()) { ppList.add(pp); } } return ppList; } public void setPricingTipoServicioList(List pricingTipoServicioList) { this.pricingTipoServicioList = pricingTipoServicioList; } public List getPricingFormapagoList() { List pfpList = new ArrayList(); for (PricingFormapago pfp : this.pricingFormapagoList) { if (pfp.getActivo() != EXCLUIDO.intValue()) { pfpList.add(pfp); } } return pfpList; } public void setPricingFormapagoList(List pricingFormapagoList) { this.pricingFormapagoList = pricingFormapagoList; } public String getIndGeneraFeriadoViaje() { return indGeneraFeriadoViaje; } public void setIndGeneraFeriadoViaje(String indGeneraFeriadoViaje) { this.indGeneraFeriadoViaje = indGeneraFeriadoViaje; } public String getIndGeneraFeriadoVenta() { return indGeneraFeriadoVenta; } public void setIndGeneraFeriadoVenta(String indGeneraFeriadoVenta) { this.indGeneraFeriadoVenta = indGeneraFeriadoVenta; } public String getNombPricing() { return nombPricing; } public void setNombPricing(String nombPricing) { this.nombPricing = nombPricing; } public Boolean getExibeVenda() { return exibeVenda; } public void setExibeVenda(Boolean exibeVenda) { this.exibeVenda = exibeVenda; } @Override public int hashCode() { int hash = 0; hash += (pricingId != null ? pricingId.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (!(object instanceof Pricing)) { return false; } Pricing other = (Pricing) object; if ((this.pricingId == null && other.pricingId != null) || (this.pricingId != null && !this.pricingId.equals(other.pricingId))) { return false; } return true; } @Override public String toString() { return "entidad.test.Pricing[pricingId=" + pricingId + "]"; } }