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

243 lines
5.6 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.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.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author Rafius
*/
@Entity
@SequenceGenerator(name = "RUTA_SEQ", sequenceName = "RUTA_SEQ", allocationSize = 1)
@org.hibernate.annotations.Entity(dynamicUpdate = true)
@Table(name = "RUTA")
public class Ruta implements Serializable {
public OrgaoConcedente getOrgaoConcedente() {
return orgaoConcedente;
}
public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) {
this.orgaoConcedente = orgaoConcedente;
}
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_SEQ")
@Column(name = "RUTA_ID")
private Integer rutaId;
@Column(name = "DESCRUTA")
private String descruta;
@Column(name = "ACTIVO")
private Boolean activo;
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
@JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID")
@ManyToOne
private ClaseServicio claseServicio;
@OneToMany(mappedBy = "ruta")
private List<RutaSecuencia> rutaSecuenciaList;
@OneToMany(mappedBy = "ruta")
private List<RutaCombinacion> rutaCombinacionList;
@Column(name = "indnombreobligatorio")
private Boolean indNombreObligatorio;
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID")
private List<RutaEmpresa> lsRutaEmpresa;
@Column(name = "INDVENTAOFFLINE")
private Boolean ventaOffLine;
@Column(name = "PREFIXO")
private String prefixo;
@Column(name = "PREFIXOAUXILIAR")
private String prefixoAuxiliar;
@OneToOne
@JoinColumn(name = "ORGAOCONCEDENTE_ID")
private OrgaoConcedente orgaoConcedente;
public Boolean getIndNombreObligatorio() {
return indNombreObligatorio;
}
public void setIndNombreObligatorio(Boolean indNombreObligatorio) {
this.indNombreObligatorio = indNombreObligatorio;
}
public Ruta() {
}
public Ruta(Integer rutaId) {
this.rutaId = rutaId;
}
public Integer getRutaId() {
return rutaId;
}
public void setRutaId(Integer rutaId) {
this.rutaId = rutaId;
}
public String getDescruta() {
return descruta;
}
public void setDescruta(String descruta) {
this.descruta = descruta;
}
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<RutaSecuencia> getRutaSecuenciaList() {
List<RutaSecuencia> rsList = new ArrayList<RutaSecuencia>();
for (RutaSecuencia rs : this.rutaSecuenciaList) {
if (rs.getActivo() == Boolean.TRUE) {
rsList.add(rs);
}
}
return rsList;
}
public void setRutaSecuenciaList(List<RutaSecuencia> rutaSecuenciaList) {
this.rutaSecuenciaList = rutaSecuenciaList;
}
public ClaseServicio getClaseServicio() {
return claseServicio;
}
public void setClaseServicio(ClaseServicio claseServicio) {
this.claseServicio = claseServicio;
}
public List<RutaCombinacion> getRutaCombinacionList() {
List<RutaCombinacion> rcList = new ArrayList<RutaCombinacion>();
if (this.rutaCombinacionList == null) {
return rcList;
}
for (RutaCombinacion rc : this.rutaCombinacionList) {
if (rc.getActivo() == Boolean.TRUE) {
rcList.add(rc);
}
}
return rcList;
}
public void setRutaCombinacionList(List<RutaCombinacion> rutaCombinacionList) {
this.rutaCombinacionList = rutaCombinacionList;
}
public List<RutaEmpresa> getLsRutaEmpresa() {
List<RutaEmpresa> rsList = new ArrayList<RutaEmpresa>();
for (RutaEmpresa rs : this.lsRutaEmpresa) {
if (rs.getActivo() == Boolean.TRUE) {
rsList.add(rs);
}
}
return rsList;
}
public void setLsRutaEmpresa(List<RutaEmpresa> lsRutaEmpresa) {
this.lsRutaEmpresa = lsRutaEmpresa;
}
public Boolean getVentaOffLine() {
return ventaOffLine;
}
public void setVentaOffLine(Boolean ventaOffLine) {
this.ventaOffLine = ventaOffLine;
}
public String getPrefixo() {
return prefixo;
}
public void setPrefixo(String prefixo) {
this.prefixo = prefixo;
}
public String getPrefixoAuxiliar() {
return prefixoAuxiliar;
}
public void setPrefixoAuxiliar(String prefixoAuxiliar) {
this.prefixoAuxiliar = prefixoAuxiliar;
}
@Override
public int hashCode() {
int hash = 0;
hash += (rutaId != null ? rutaId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof Ruta)) {
return false;
}
Ruta other = (Ruta) object;
if ((this.rutaId == null && other.rutaId != null) || (this.rutaId != null && !this.rutaId.equals(other.rutaId))) {
return false;
}
return true;
}
@Override
public String toString() {
return this.getDescruta() + " - " + this.getRutaId();
}
}