/* * 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 br.com.rjconsultores.auditador.annotations.NaoAuditar; import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Administrador */ @Entity @SequenceGenerator(name = "CLASE_SERVICIO_SEQ", sequenceName = "CLASE_SERVICIO_SEQ", allocationSize = 1) @Table(name = "CLASE_SERVICIO") public class ClaseServicio implements Serializable, Auditavel { 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 categoriaClaseList; @OneToMany(mappedBy = "claseServicio") private List reservacionClaseList; @OneToMany(mappedBy = "claseServicio") private List tramoTiempoList; @Column(name = "EQUIVALENCIA_ID") private String equivalenciaId; @Column(name = "EQUIVALENCIAELEKTRA_ID") private String equivalenciaElektraId; @OneToMany(mappedBy = "claseServicio") private List tarifaHistList; @OneToMany(mappedBy = "claseServicio") private List corridaList; @Column(name = "COEFICIENTETARIFA") private BigDecimal coeficiente; @Column(name = "INDNAOVENDESEGUROOPCIONAL") private Boolean indNaoVendeSeguroOpcional; @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 getCategoriaClaseList() { List tmp = new ArrayList(); if (categoriaClaseList != null) { for (CategoriaClase cc : this.categoriaClaseList) { if (cc.getActivo()) { tmp.add(cc); } } } return tmp; } public void setCategoriaClaseList(List categoriaClaseList) { this.categoriaClaseList = categoriaClaseList; } public List getReservacionClaseList() { List tmp = new ArrayList(); for (ReservacionClase rc : this.reservacionClaseList) { if (rc.getActivo()) { tmp.add(rc); } } return tmp; } public List getCorridaList() { return corridaList; } public void setCorridaList(List corridaList) { this.corridaList = corridaList; } public void setReservacionClaseList(List 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 getTramoTiempoList() { return tramoTiempoList; } public void setTramoTiempoList(List tramoTiempoList) { this.tramoTiempoList = tramoTiempoList; } public String getEquivalenciaId() { return equivalenciaId; } public void setEquivalenciaId(String equivalenciaId) { this.equivalenciaId = equivalenciaId; } public List getTarifaHistList() { return tarifaHistList; } public void setTarifaHistList(List 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; } }