292 lines
6.9 KiB
Java
292 lines
6.9 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.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.Table;
|
|
import javax.persistence.Temporal;
|
|
import javax.persistence.TemporalType;
|
|
import javax.persistence.SequenceGenerator;
|
|
|
|
import org.hibernate.LazyInitializationException;
|
|
import org.jfree.util.Log;
|
|
|
|
/**
|
|
*
|
|
* @author Administrador
|
|
*/
|
|
@Entity
|
|
@SequenceGenerator(name = "TRAMO_SEQ", sequenceName = "TRAMO_SEQ", allocationSize = 1)
|
|
@Table(name = "TRAMO")
|
|
public class Tramo implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
@Id
|
|
@Basic(optional = false)
|
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_SEQ")
|
|
@Column(name = "TRAMO_ID")
|
|
private Integer tramoId;
|
|
@Column(name = "DESCTRAMO")
|
|
private String desctramo;
|
|
@Column(name = "ACTIVO")
|
|
private Boolean activo;
|
|
@Column(name = "FECMODIF")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
private Date fecmodif;
|
|
@Column(name = "USUARIO_ID")
|
|
private Integer usuarioId;
|
|
@JoinColumn(name = "VIA_ID", referencedColumnName = "VIA_ID")
|
|
@ManyToOne
|
|
private Via via;
|
|
@JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID")
|
|
@ManyToOne
|
|
private Parada origem;
|
|
@JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID")
|
|
@ManyToOne
|
|
private Parada destino;
|
|
@OneToMany(mappedBy = "tramo")
|
|
private List<RutaSecuencia> rutaSecuenciaList;
|
|
@OneToMany(mappedBy = "tramo")
|
|
private List<RutaCombinacion> rutaCombinacionList;
|
|
@OneToMany(cascade = CascadeType.ALL)
|
|
@JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID")
|
|
private List<TramoTiempo> lsTramoTiempo;
|
|
@OneToMany(cascade = CascadeType.ALL)
|
|
@JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID")
|
|
private List<TramoServicio> tramoServicioList;
|
|
@Column(name = "CANTKMPAGOCONDUCTOR")
|
|
private BigDecimal kmPagoConductor;
|
|
@Column(name = "CANTKMREAL")
|
|
private BigDecimal kmReal;
|
|
@OneToMany(cascade = CascadeType.ALL)
|
|
@JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID")
|
|
private List<TramoKm> tramoKms;
|
|
@OneToMany(cascade = CascadeType.ALL)
|
|
@JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID")
|
|
private List<OrgaoTramo> lsOrgaoTramo;
|
|
|
|
public Tramo() {
|
|
}
|
|
|
|
public Tramo(Integer tramoId) {
|
|
this.tramoId = tramoId;
|
|
}
|
|
|
|
public Integer getTramoId() {
|
|
return tramoId;
|
|
}
|
|
|
|
public void setTramoId(Integer tramoId) {
|
|
this.tramoId = tramoId;
|
|
}
|
|
|
|
public String getDesctramo() {
|
|
return desctramo;
|
|
}
|
|
|
|
public void setDesctramo(String desctramo) {
|
|
this.desctramo = desctramo;
|
|
}
|
|
|
|
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 Via getVia() {
|
|
return via;
|
|
}
|
|
|
|
public void setVia(Via via) {
|
|
this.via = via;
|
|
}
|
|
|
|
public Parada getDestino() {
|
|
return destino;
|
|
}
|
|
|
|
public void setDestino(Parada destino) {
|
|
this.destino = destino;
|
|
}
|
|
|
|
public Parada getOrigem() {
|
|
return origem;
|
|
}
|
|
|
|
public void setOrigem(Parada origem) {
|
|
this.origem = origem;
|
|
}
|
|
|
|
public List<RutaSecuencia> getRutaSecuenciaList() {
|
|
List<RutaSecuencia> lsRutaSecuencia = new ArrayList<RutaSecuencia>();
|
|
for (RutaSecuencia rSecuencia : this.rutaSecuenciaList) {
|
|
if (rSecuencia.getActivo()) {
|
|
lsRutaSecuencia.add(rSecuencia);
|
|
}
|
|
}
|
|
|
|
this.rutaSecuenciaList = lsRutaSecuencia;
|
|
|
|
return lsRutaSecuencia;
|
|
}
|
|
|
|
public void setRutaSecuenciaList(List<RutaSecuencia> rutaSecuenciaList) {
|
|
this.rutaSecuenciaList = rutaSecuenciaList;
|
|
}
|
|
|
|
public List<RutaCombinacion> getRutaCombinacionList() {
|
|
List<RutaCombinacion> lsRutaCombinacion = new ArrayList<RutaCombinacion>();
|
|
for (RutaCombinacion rCombinacion : this.rutaCombinacionList) {
|
|
if (rCombinacion.getActivo()) {
|
|
lsRutaCombinacion.add(rCombinacion);
|
|
}
|
|
}
|
|
|
|
this.rutaCombinacionList = lsRutaCombinacion;
|
|
|
|
return lsRutaCombinacion;
|
|
}
|
|
|
|
public void setRutaCombinacionList(List<RutaCombinacion> rutaCombinacionList) {
|
|
this.rutaCombinacionList = rutaCombinacionList;
|
|
}
|
|
|
|
public List<TramoServicio> getTramoServicioList() {
|
|
List<TramoServicio> lsTramoServicio = new ArrayList<TramoServicio>();
|
|
try{
|
|
for (TramoServicio tramoServicio : this.tramoServicioList) {
|
|
if (tramoServicio.getActivo()) {
|
|
lsTramoServicio.add(tramoServicio);
|
|
}
|
|
}
|
|
|
|
this.tramoServicioList = lsTramoServicio;
|
|
} catch (LazyInitializationException le){
|
|
Log.error("", le);
|
|
}
|
|
return lsTramoServicio;
|
|
}
|
|
|
|
public void setTramoServicioList(List<TramoServicio> tramoServicioList) {
|
|
this.tramoServicioList = tramoServicioList;
|
|
}
|
|
|
|
public List<TramoTiempo> getLsTramoTiempo() {
|
|
List<TramoTiempo> lsTmp = new ArrayList<TramoTiempo>();
|
|
for (TramoTiempo tramoAtributo : this.lsTramoTiempo) {
|
|
if (tramoAtributo.getActivo()) {
|
|
lsTmp.add(tramoAtributo);
|
|
}
|
|
}
|
|
|
|
this.lsTramoTiempo = lsTmp;
|
|
|
|
return lsTmp;
|
|
}
|
|
|
|
public void setLsTramoTiempo(List<TramoTiempo> lsTramoTiempo) {
|
|
this.lsTramoTiempo = lsTramoTiempo;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
int hash = 0;
|
|
hash += (tramoId != null ? tramoId.hashCode() : 0);
|
|
return hash;
|
|
}
|
|
|
|
public BigDecimal getKmPagoConductor() {
|
|
return kmPagoConductor;
|
|
}
|
|
|
|
public void setKmPagoConductor(BigDecimal kmPagoConductor) {
|
|
this.kmPagoConductor = kmPagoConductor;
|
|
}
|
|
|
|
public BigDecimal getKmReal() {
|
|
return kmReal;
|
|
}
|
|
|
|
public void setKmReal(BigDecimal kmReal) {
|
|
this.kmReal = kmReal;
|
|
}
|
|
|
|
public List<OrgaoTramo> getLsOrgaoTramo() {
|
|
List<OrgaoTramo> tmp = new ArrayList<OrgaoTramo>();
|
|
for (OrgaoTramo orgaoTramo : this.lsOrgaoTramo) {
|
|
if (orgaoTramo.getActivo()) {
|
|
tmp.add(orgaoTramo);
|
|
}
|
|
}
|
|
|
|
this.lsOrgaoTramo = tmp;
|
|
|
|
return tmp;
|
|
}
|
|
|
|
public void setLsOrgaoTramo(List<OrgaoTramo> lsOrgaoTramo) {
|
|
this.lsOrgaoTramo = lsOrgaoTramo;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object object) {
|
|
if (!(object instanceof Tramo)) {
|
|
return false;
|
|
}
|
|
Tramo other = (Tramo) object;
|
|
if ((this.tramoId == null && other.tramoId != null) || (this.tramoId != null && !this.tramoId.equals(other.tramoId))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public List<TramoKm> getTramoKms() {
|
|
return tramoKms;
|
|
}
|
|
|
|
public void setTramoKms(List<TramoKm> tramoKms) {
|
|
this.tramoKms = tramoKms;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return getDesctramo().concat(" - ").concat(this.getVia().getNombvia());
|
|
}
|
|
}
|