232 lines
5.5 KiB
Java
232 lines
5.5 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.util.Date;
|
|
|
|
import javax.persistence.Basic;
|
|
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.SequenceGenerator;
|
|
import javax.persistence.Table;
|
|
import javax.persistence.Temporal;
|
|
import javax.persistence.TemporalType;
|
|
import javax.persistence.Transient;
|
|
|
|
import org.hibernate.Hibernate;
|
|
|
|
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
|
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
|
|
|
/**
|
|
*
|
|
* @author Rafius
|
|
*/
|
|
@Entity
|
|
@SequenceGenerator(name = "ESQUEMA_TRAMO_SEQ", sequenceName = "ESQUEMA_TRAMO_SEQ", allocationSize = 1)
|
|
@Table(name = "ESQUEMA_TRAMO")
|
|
public class EsquemaTramo implements Serializable, Comparable<EsquemaTramo>, Auditavel<EsquemaTramo> {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
@Id
|
|
@Basic(optional = false)
|
|
@Column(name = "ESQUEMATRAMO_ID")
|
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_TRAMO_SEQ")
|
|
private Integer esquematramoId;
|
|
|
|
@Column(name = "NUMSECUENCIA")
|
|
private Short numsecuencia;
|
|
|
|
@Column(name = "ACTIVO")
|
|
private Boolean activo;
|
|
|
|
@Column(name = "FECMODIF")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
private Date fecmodif;
|
|
@Column(name = "USUARIO_ID")
|
|
|
|
private Integer usuarioId;
|
|
@Column(name = "TIEMPOESTANCIA")
|
|
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
|
|
private Date tiempoEstancia;
|
|
|
|
@JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID")
|
|
@ManyToOne
|
|
private Tramo tramo;
|
|
|
|
@JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID")
|
|
@ManyToOne
|
|
@NaoAuditar
|
|
private EsquemaCorrida esquemaCorrida;
|
|
|
|
@Column(name = "PLATAFORMA")
|
|
private String plataforma;
|
|
|
|
@Column(name = "EXCEPCIONRECORRIDO")
|
|
private Date excepcionRecorrido;
|
|
|
|
@Column(name = "TIPO_PASSAGEM")
|
|
private String tipoPassagem;
|
|
|
|
@Transient
|
|
@NaoAuditar
|
|
private EsquemaTramo esquemaTramoClone;
|
|
|
|
public Date getTiempoEstancia() {
|
|
return tiempoEstancia;
|
|
}
|
|
|
|
public void setTiempoEstancia(Date tiempoEstancia) {
|
|
this.tiempoEstancia = tiempoEstancia;
|
|
}
|
|
|
|
public EsquemaTramo() {
|
|
}
|
|
|
|
public EsquemaTramo(Integer esquematramoId) {
|
|
this.esquematramoId = esquematramoId;
|
|
}
|
|
|
|
public Integer getEsquematramoId() {
|
|
return esquematramoId;
|
|
}
|
|
|
|
public void setEsquematramoId(Integer esquematramoId) {
|
|
this.esquematramoId = esquematramoId;
|
|
}
|
|
|
|
public Short getNumsecuencia() {
|
|
return numsecuencia;
|
|
}
|
|
|
|
public void setNumsecuencia(Short numsecuencia) {
|
|
this.numsecuencia = numsecuencia;
|
|
}
|
|
|
|
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 Tramo getTramo() {
|
|
return tramo;
|
|
}
|
|
|
|
public void setTramo(Tramo tramo) {
|
|
this.tramo = tramo;
|
|
}
|
|
|
|
public EsquemaCorrida getEsquemaCorrida() {
|
|
return esquemaCorrida;
|
|
}
|
|
|
|
public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) {
|
|
this.esquemaCorrida = esquemaCorrida;
|
|
}
|
|
|
|
public String getPlataforma() {
|
|
return plataforma;
|
|
}
|
|
|
|
public void setPlataforma(String plataforma) {
|
|
this.plataforma = plataforma;
|
|
}
|
|
|
|
public Date getExcepcionRecorrido() {
|
|
return excepcionRecorrido;
|
|
}
|
|
|
|
public void setExcepcionRecorrido(Date excepcionRecorrido) {
|
|
this.excepcionRecorrido = excepcionRecorrido;
|
|
}
|
|
|
|
public String getTipoPassagem() {
|
|
return tipoPassagem;
|
|
}
|
|
|
|
public void setTipoPassagem(String tipoPassagem) {
|
|
this.tipoPassagem = tipoPassagem;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
int hash = 0;
|
|
hash += (getEsquematramoId() != null ? getEsquematramoId().hashCode() : 0);
|
|
return hash;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object object) {
|
|
if (!(object instanceof EsquemaTramo)) {
|
|
return false;
|
|
}
|
|
EsquemaTramo other = (EsquemaTramo) object;
|
|
if ((this.getEsquematramoId() == null && other.getEsquematramoId() != null) || (this.getEsquematramoId() != null && !this.getEsquematramoId().equals(other.getEsquematramoId()))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "com.rjconsultores.ventaboletos.entidad.test.EsquemaTramo[esquematramoId=" + esquematramoId + "]";
|
|
}
|
|
|
|
@Override
|
|
public int compareTo(EsquemaTramo o) {
|
|
if (this.numsecuencia > o.getNumsecuencia()) {
|
|
return 1;
|
|
} else if (this.numsecuencia < o.getNumsecuencia()) {
|
|
return -1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
@Override
|
|
public void clonar() throws CloneNotSupportedException {
|
|
esquemaTramoClone = new EsquemaTramo();
|
|
esquemaTramoClone = (EsquemaTramo) this.clone();
|
|
Hibernate.initialize(esquemaTramoClone.getTramo());
|
|
}
|
|
|
|
@Override
|
|
public EsquemaTramo getCloneObject() throws CloneNotSupportedException {
|
|
return esquemaTramoClone;
|
|
}
|
|
|
|
@Override
|
|
public String getTextoInclusaoExclusao() {
|
|
return String.format("EsquemaTramo - Sequencia [%s] - Origem [%s] - Destino [%s]", getNumsecuencia(),
|
|
getTramo() != null && getTramo().getOrigem() != null ? getTramo().getOrigem().getDescparada() : "",
|
|
getTramo() != null && getTramo().getDestino() != null ? getTramo().getDestino().getDescparada() : "");
|
|
}
|
|
|
|
}
|