AdmMono/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java

326 lines
8.3 KiB
Java

/*
* 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.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
import com.rjconsultores.ventaboletos.enums.TipoClasseServicoBPe;
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
import br.com.rjconsultores.auditador.interfaces.Auditavel;
/**
*
* @author Administrador
*/
@Entity
@AuditarClasse(nome = "CategoriaDescuento", tela = "auditarClasse.ClaseServicio")
@SequenceGenerator(name = "CLASE_SERVICIO_SEQ", sequenceName = "CLASE_SERVICIO_SEQ", allocationSize = 1)
@Table(name = "CLASE_SERVICIO")
public class ClaseServicio implements Serializable, Auditavel<ClaseServicio> {
public final static short TODOS = -1;
private static final long serialVersionUID = 1L;
@Id
@GenericGenerator(name = "claseservicioIdgen", strategy = "com.rjconsultores.ventaboletos.dao.util.ClaseServicioGenerator")
@GeneratedValue(generator = "claseservicioIdgen")
@Column(name = "CLASESERVICIO_ID")
private Integer claseservicioId;
@Column(name = "DESCCLASE")
private String descclase;
@Column(name = "TIPOSERVICOBPE")
private Integer tipoServicoBPe;
@Column(name = "ACTIVO")
private Boolean activo;
@Basic(optional = false)
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
@OneToMany(mappedBy = "claseServicio")
private List<CategoriaClase> categoriaClaseList;
@OneToMany(mappedBy = "claseServicio")
private List<ReservacionClase> reservacionClaseList;
@OneToMany(mappedBy = "claseServicio")
private List<TramoTiempo> tramoTiempoList;
@Column(name = "EQUIVALENCIA_ID")
private String equivalenciaId;
@Column(name = "EQUIVALENCIAELEKTRA_ID")
private String equivalenciaElektraId;
@OneToMany(mappedBy = "claseServicio")
private List<TarifaHist> tarifaHistList;
@OneToMany(mappedBy = "claseServicio")
private List<Corrida> corridaList;
@Column(name = "COEFICIENTETARIFA")
private BigDecimal coeficiente;
@Column(name = "PORCPRICINGSEMELHANTE")
private BigDecimal porcPricingSemelhante;
@Column(name = "INDNAOVENDESEGUROOPCIONAL")
private Boolean indNaoVendeSeguroOpcional;
@Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = {
@Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"),
@Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoClasseServicoBPe"),
@Parameter(name = "sqlType", value = "12")/*Types.VARCHAR*/,
@Parameter(name = "enumName", value = "true")})
@Column(name = "desconto_monitrip")
private com.rjconsultores.ventaboletos.enums.TipoClasseServicoBPe tipoDescontoMonitrip;
@Transient
@NaoAuditar
private ClaseServicio claseServicioClone;
public ClaseServicio() {
}
public ClaseServicio(Integer claseservicioId) {
this.claseservicioId = claseservicioId;
}
public ClaseServicio(Integer claseservicioId, Date fecmodif) {
this.claseservicioId = claseservicioId;
this.fecmodif = fecmodif;
}
public Integer getClaseservicioId() {
return claseservicioId;
}
public void setClaseservicioId(Integer claseservicioId) {
this.claseservicioId = claseservicioId;
}
public String getDescclase() {
return descclase;
}
public void setDescclase(String descclase) {
this.descclase = descclase;
}
public Boolean getActivo() {
return activo;
}
public void setActivo(Boolean 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<CategoriaClase> getCategoriaClaseList() {
List<CategoriaClase> tmp = new ArrayList<CategoriaClase>();
if (categoriaClaseList != null) {
for (CategoriaClase cc : this.categoriaClaseList) {
if (cc.getActivo()) {
tmp.add(cc);
}
}
}
return tmp;
}
public void setCategoriaClaseList(List<CategoriaClase> categoriaClaseList) {
this.categoriaClaseList = categoriaClaseList;
}
public List<ReservacionClase> getReservacionClaseList() {
List<ReservacionClase> tmp = new ArrayList<ReservacionClase>();
for (ReservacionClase rc : this.reservacionClaseList) {
if (rc.getActivo()) {
tmp.add(rc);
}
}
return tmp;
}
public List<Corrida> getCorridaList() {
return corridaList;
}
public void setCorridaList(List<Corrida> corridaList) {
this.corridaList = corridaList;
}
public void setReservacionClaseList(List<ReservacionClase> reservacionClaseList) {
this.reservacionClaseList = reservacionClaseList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (getClaseservicioId() != null ? getClaseservicioId().hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ClaseServicio)) {
return false;
}
ClaseServicio other = (ClaseServicio) object;
if ((this.getClaseservicioId() == null && other.getClaseservicioId() != null) || (this.getClaseservicioId() != null && !this.getClaseservicioId().equals(other.getClaseservicioId()))) {
return false;
}
return true;
}
@Override
public String toString() {
return getDescclase();
}
public List<TramoTiempo> getTramoTiempoList() {
return tramoTiempoList;
}
public void setTramoTiempoList(List<TramoTiempo> tramoTiempoList) {
this.tramoTiempoList = tramoTiempoList;
}
public String getEquivalenciaId() {
return equivalenciaId;
}
public void setEquivalenciaId(String equivalenciaId) {
this.equivalenciaId = equivalenciaId;
}
public List<TarifaHist> getTarifaHistList() {
return tarifaHistList;
}
public void setTarifaHistList(List<TarifaHist> tarifaHistList) {
this.tarifaHistList = tarifaHistList;
}
public String getEquivalenciaElektraId() {
return equivalenciaElektraId;
}
public void setEquivalenciaElektraId(String equivalenciaElektraId) {
this.equivalenciaElektraId = equivalenciaElektraId;
}
public Integer getTipoServicoBPe() {
return tipoServicoBPe;
}
public void setTipoServicoBPe(Integer tipoServicoBPe) {
this.tipoServicoBPe = tipoServicoBPe;
}
public BigDecimal getCoeficiente() {
return coeficiente;
}
public void setCoeficiente(BigDecimal coeficiente) {
this.coeficiente = coeficiente;
}
@Override
public void clonar() throws CloneNotSupportedException {
claseServicioClone = new ClaseServicio();
claseServicioClone = (ClaseServicio) this.clone();
}
@Override
public ClaseServicio getCloneObject() throws CloneNotSupportedException {
return claseServicioClone;
}
@Override
public String getTextoInclusaoExclusao() {
return String.format("ClaseServicioID [%s]", getClaseservicioId());
}
public Boolean getIndNaoVendeSeguroOpcional() {
return indNaoVendeSeguroOpcional != null ? indNaoVendeSeguroOpcional : false;
}
public void setIndNaoVendeSeguroOpcional(Boolean indNaoVendeSeguroOpcional) {
this.indNaoVendeSeguroOpcional = indNaoVendeSeguroOpcional;
}
public TipoClasseServicoBPe getTipoDescontoMonitrip() {
return tipoDescontoMonitrip;
}
public void setTipoDescontoMonitrip(TipoClasseServicoBPe tipoClasseServicoBPe) {
this.tipoDescontoMonitrip = tipoClasseServicoBPe;
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public BigDecimal getPorcPricingSemelhante() {
return porcPricingSemelhante;
}
public void setPorcPricingSemelhante(BigDecimal porcPricingSemelhante) {
this.porcPricingSemelhante = porcPricingSemelhante;
}
}