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

231 lines
6.4 KiB
Java

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.AuditarClasse;
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
import br.com.rjconsultores.auditador.interfaces.Auditavel;
@AuditarClasse(nome = "PtovtaCatInd", tela = "auditarClasse.PtovtaCatInd")
@Entity
@SequenceGenerator(name = "PTOVTA_CAT_IND_SEQ", sequenceName = "PTOVTA_CAT_IND_SEQ", allocationSize = 1)
@Table(name = "PTOVTA_CAT_IND")
public class PtovtaCatInd implements Serializable, Auditavel<PtovtaCatInd> {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_CAT_IND_SEQ")
@Column(name = "PTOVTACATEGORIA_ID")
private Integer ptovtaCategoriaId;
@Column(name = "ACTIVO")
private Boolean activo;
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
@JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID")
@ManyToOne
private Categoria categoria;
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
@ManyToOne
private PuntoVenta puntoVenta;
@JoinColumn(name = "USUARIOBLOQUEADO_ID", referencedColumnName = "USUARIO_ID")
@ManyToOne
private Usuario usuarioBloqueado;
@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
@ManyToOne
private Empresa empresa;
@Column(name = "INDTOTALBUS")
private Boolean indTotalBus;
@Column(name = "INDEMBARCADA")
private Boolean indEmbarcada;
@Transient
@NaoAuditar
private PtovtaCatInd ptovtaCatIndConcedente;
public Integer getPtovtaCategoriaId() {
return ptovtaCategoriaId;
}
public void setPtovtaCategoriaId(Integer ptovtaCategoriaId) {
this.ptovtaCategoriaId = ptovtaCategoriaId;
}
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 Categoria getCategoria() {
return categoria;
}
public void setCategoria(Categoria categoria) {
this.categoria = categoria;
}
public PuntoVenta getPuntoVenta() {
return puntoVenta;
}
public void setPuntoVenta(PuntoVenta puntoVenta) {
this.puntoVenta = puntoVenta;
}
public Usuario getUsuarioBloqueado() {
return usuarioBloqueado;
}
public void setUsuarioBloqueado(Usuario usuarioBloqueado) {
this.usuarioBloqueado = usuarioBloqueado;
}
public Empresa getEmpresa() {
return empresa;
}
public void setEmpresa(Empresa empresa) {
this.empresa = empresa;
}
public Boolean getIndTotalBus() {
return indTotalBus;
}
public void setIndTotalBus(Boolean indTotalBus) {
this.indTotalBus = indTotalBus;
}
public Boolean getIndEmbarcada() {
return indEmbarcada;
}
public void setIndEmbarcada(Boolean indEmbarcada) {
this.indEmbarcada = indEmbarcada;
}
@Override
public void clonar() throws CloneNotSupportedException {
ptovtaCatIndConcedente = new PtovtaCatInd();
ptovtaCatIndConcedente = (PtovtaCatInd) this.clone();
Hibernate.initialize(ptovtaCatIndConcedente.getPuntoVenta());
}
@Override
public PtovtaCatInd getCloneObject() throws CloneNotSupportedException {
return ptovtaCatIndConcedente;
}
@Override
public String getTextoInclusaoExclusao() {
String totalbus = Boolean.TRUE.equals(getIndTotalBus()) ? "Totalbus : Sim" : "Totalbus : Não";
String embarcada = Boolean.TRUE.equals(getIndEmbarcada()) ? "Embarcada : Sim" : "Embarcada : Não";
return String.format("ID [%s]", getCategoria().getDesccategoria()+ "-"+totalbus+ "-"+embarcada);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((activo == null) ? 0 : activo.hashCode());
result = prime * result + ((categoria == null) ? 0 : categoria.hashCode());
result = prime * result + ((fecmodif == null) ? 0 : fecmodif.hashCode());
result = prime * result + ((ptovtaCategoriaId == null) ? 0 : ptovtaCategoriaId.hashCode());
result = prime * result + ((puntoVenta == null) ? 0 : puntoVenta.hashCode());
result = prime * result + ((usuarioId == null) ? 0 : usuarioId.hashCode());
result = prime * result + ((empresa == null) ? 0 : empresa.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PtovtaCatInd other = (PtovtaCatInd) obj;
if (activo == null) {
if (other.activo != null)
return false;
} else if (!activo.equals(other.activo))
return false;
if (categoria == null) {
if (other.categoria != null)
return false;
} else if (!categoria.equals(other.categoria))
return false;
if (fecmodif == null) {
if (other.fecmodif != null)
return false;
} else if (!fecmodif.equals(other.fecmodif))
return false;
if (ptovtaCategoriaId == null) {
if (other.ptovtaCategoriaId != null)
return false;
} else if (!ptovtaCategoriaId.equals(other.ptovtaCategoriaId))
return false;
if (puntoVenta == null) {
if (other.puntoVenta != null)
return false;
} else if (!puntoVenta.equals(other.puntoVenta))
return false;
if (usuarioId == null) {
if (other.usuarioId != null)
return false;
} else if (!usuarioId.equals(other.usuarioId))
return false;
if (empresa == null) {
if (other.empresa != null)
return false;
} else if (!empresa.equals(other.empresa))
return false;
return true;
}
}