fixes bug#20776
fixes bug#20777 dev:wilian qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@104232 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
0e562fcb43
commit
e1ca30e4f9
11
pom.xml
11
pom.xml
|
@ -306,6 +306,17 @@
|
|||
<artifactId>jboss-logging</artifactId>
|
||||
<version>3.0.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>Auditador</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.LogAuditoria;
|
||||
|
||||
public interface LogAuditoriaDAO extends GenericDAO<LogAuditoria, Long> {
|
||||
|
||||
public List<String> listarTodasAsTelas();
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.LogAuditoriaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.LogAuditoria;
|
||||
|
||||
@Repository("LogAuditoriaDAO")
|
||||
public class LogAuditoriaHibernateDAO extends GenericHibernateDAO<LogAuditoria, Long> implements LogAuditoriaDAO {
|
||||
|
||||
@Autowired
|
||||
public LogAuditoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<String> listarTodasAsTelas() {
|
||||
Query query = getSession().createSQLQuery("select tela from log_auditoria where activo = 1 group by tela");
|
||||
List<String> lista = query.list();
|
||||
return lista;
|
||||
}
|
||||
|
||||
}
|
|
@ -22,6 +22,10 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,7 +34,7 @@ import javax.persistence.TemporalType;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "AUTOBUS_SEQ", sequenceName = "AUTOBUS_SEQ", allocationSize = 1)
|
||||
@Table(name = "AUTOBUS")
|
||||
public class Autobus implements Serializable {
|
||||
public class Autobus implements Serializable, Auditavel<Autobus> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
|
@ -38,6 +42,7 @@ public class Autobus implements Serializable {
|
|||
@Column(name = "AUTOBUS_ID")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTOBUS_SEQ")
|
||||
private Integer autobusId;
|
||||
|
||||
@Column(name = "NUMAUTOBUS")
|
||||
private String numautobus;
|
||||
@Column(name = "CANTPARADOS")
|
||||
|
@ -88,6 +93,10 @@ public class Autobus implements Serializable {
|
|||
@Column(name = "NUMVAGON")
|
||||
private String numvagon;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private Autobus autobusClone;
|
||||
|
||||
public Autobus() {
|
||||
}
|
||||
|
||||
|
@ -242,7 +251,7 @@ public class Autobus implements Serializable {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (autobusId != null ? autobusId.hashCode() : 0);
|
||||
hash += (getAutobusId() != null ? getAutobusId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@ -285,7 +294,7 @@ public class Autobus implements Serializable {
|
|||
return false;
|
||||
}
|
||||
Autobus other = (Autobus) object;
|
||||
if ((this.autobusId == null && other.autobusId != null) || (this.autobusId != null && !this.autobusId.equals(other.autobusId))) {
|
||||
if ((this.getAutobusId() == null && other.getAutobusId() != null) || (this.getAutobusId() != null && !this.getAutobusId().equals(other.getAutobusId()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -303,4 +312,19 @@ public class Autobus implements Serializable {
|
|||
public void setNumvagon(String numvagon) {
|
||||
this.numvagon = numvagon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
autobusClone = (Autobus) this.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Autobus getCloneObject() throws CloneNotSupportedException {
|
||||
return autobusClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("AutobusID [%s]", getAutobusId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ 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;
|
||||
|
@ -19,9 +20,13 @@ 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
|
||||
|
@ -29,7 +34,7 @@ import org.hibernate.annotations.GenericGenerator;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "CLASE_SERVICIO_SEQ", sequenceName = "CLASE_SERVICIO_SEQ", allocationSize = 1)
|
||||
@Table(name = "CLASE_SERVICIO")
|
||||
public class ClaseServicio implements Serializable {
|
||||
public class ClaseServicio implements Serializable, Auditavel<ClaseServicio> {
|
||||
|
||||
public final static short TODOS = -1;
|
||||
|
||||
|
@ -40,6 +45,7 @@ public class ClaseServicio implements Serializable {
|
|||
@GeneratedValue(generator = "claseservicioIdgen")
|
||||
@Column(name = "CLASESERVICIO_ID")
|
||||
private Integer claseservicioId;
|
||||
|
||||
@Column(name = "DESCCLASE")
|
||||
private String descclase;
|
||||
@Column(name = "TIPOSERVICOBPE")
|
||||
|
@ -69,6 +75,10 @@ public class ClaseServicio implements Serializable {
|
|||
@Column(name = "COEFICIENTETARIFA")
|
||||
private BigDecimal coeficiente;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private ClaseServicio claseServicioClone;
|
||||
|
||||
public ClaseServicio() {
|
||||
}
|
||||
|
||||
|
@ -164,7 +174,7 @@ public class ClaseServicio implements Serializable {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (claseservicioId != null ? claseservicioId.hashCode() : 0);
|
||||
hash += (getClaseservicioId() != null ? getClaseservicioId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@ -175,7 +185,7 @@ public class ClaseServicio implements Serializable {
|
|||
return false;
|
||||
}
|
||||
ClaseServicio other = (ClaseServicio) object;
|
||||
if ((this.claseservicioId == null && other.claseservicioId != null) || (this.claseservicioId != null && !this.claseservicioId.equals(other.claseservicioId))) {
|
||||
if ((this.getClaseservicioId() == null && other.getClaseservicioId() != null) || (this.getClaseservicioId() != null && !this.getClaseservicioId().equals(other.getClaseservicioId()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -234,4 +244,20 @@ public class ClaseServicio implements Serializable {
|
|||
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());
|
||||
}
|
||||
|
||||
}
|
|
@ -15,11 +15,15 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name = "DIVISION_SEQ", sequenceName = "DIVISION_SEQ", allocationSize = 1)
|
||||
@Table(name = "DIVISION")
|
||||
public class Division implements Serializable {
|
||||
public class Division implements Serializable, Auditavel<Division> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
|
@ -27,6 +31,7 @@ public class Division implements Serializable {
|
|||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "DIVISION_SEQ")
|
||||
@Column(name = "DIVISION_ID")
|
||||
private Integer divisionId;
|
||||
|
||||
@Column(name = "NOMBDIVISION")
|
||||
private String nombDivion;
|
||||
@OneToOne
|
||||
|
@ -40,6 +45,10 @@ public class Division implements Serializable {
|
|||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private Division divisionClone;
|
||||
|
||||
public Division() {
|
||||
|
||||
}
|
||||
|
@ -111,13 +120,13 @@ public class Division implements Serializable {
|
|||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
if (!(obj instanceof Division))
|
||||
return false;
|
||||
Division other = (Division) obj;
|
||||
if (divisionId == null) {
|
||||
if (other.divisionId != null)
|
||||
if (getDivisionId() == null) {
|
||||
if (other.getDivisionId() != null)
|
||||
return false;
|
||||
} else if (!divisionId.equals(other.divisionId))
|
||||
} else if (!getDivisionId().equals(other.getDivisionId()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -127,4 +136,20 @@ public class Division implements Serializable {
|
|||
return this.getNombDivion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
divisionClone = new Division();
|
||||
divisionClone = (Division) this.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Division getCloneObject() {
|
||||
return divisionClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s]", getDivisionId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
|
@ -33,6 +34,10 @@ import org.hibernate.annotations.Where;
|
|||
|
||||
import com.rjconsultores.ventaboletos.enums.TipoCstGratuidade;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarID;
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rafius
|
||||
|
@ -41,14 +46,16 @@ import com.rjconsultores.ventaboletos.enums.TipoCstGratuidade;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "EMPRESA_SEQ", sequenceName = "EMPRESA_SEQ", allocationSize = 1)
|
||||
@Table(name = "EMPRESA")
|
||||
public class Empresa implements Serializable {
|
||||
public class Empresa implements Serializable, Auditavel<Empresa> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_SEQ")
|
||||
@Column(name = "EMPRESA_ID")
|
||||
@AuditarID
|
||||
private Integer empresaId;
|
||||
|
||||
@Column(name = "NOMBEMPRESA")
|
||||
private String nombempresa;
|
||||
@Column(name = "ACTIVO")
|
||||
|
@ -349,6 +356,10 @@ public class Empresa implements Serializable {
|
|||
@Column(name = "URLBASESEGURO")
|
||||
private String urlBaseEmpresaSeguro;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private Empresa empresaClone;
|
||||
|
||||
public Empresa() {
|
||||
super();
|
||||
}
|
||||
|
@ -1299,4 +1310,20 @@ public class Empresa implements Serializable {
|
|||
this.urlBaseEmpresaSeguro = urlBaseEmpresaSeguro;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
empresaClone = new Empresa();
|
||||
empresaClone = (Empresa) this.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Empresa getCloneObject() throws CloneNotSupportedException {
|
||||
return empresaClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s]", getEmpresaId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,10 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -29,7 +33,7 @@ import javax.persistence.TemporalType;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "ESQUEMA_ASIENTO_SEQ", sequenceName = "ESQUEMA_ASIENTO_SEQ", allocationSize = 1)
|
||||
@Table(name = "ESQUEMA_ASIENTO")
|
||||
public class EsquemaAsiento implements Serializable {
|
||||
public class EsquemaAsiento implements Serializable, Auditavel<EsquemaAsiento> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
|
@ -37,6 +41,7 @@ public class EsquemaAsiento implements Serializable {
|
|||
@Column(name = "ESQUEMAASIENTO_ID")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_ASIENTO_SEQ")
|
||||
private Integer esquemaasientoId;
|
||||
|
||||
@Column(name = "NUMASIENTO")
|
||||
private String numasiento;
|
||||
@Column(name = "INDVENDIBLE")
|
||||
|
@ -53,8 +58,10 @@ public class EsquemaAsiento implements Serializable {
|
|||
@JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID")
|
||||
@ManyToOne
|
||||
private Parada parada;
|
||||
|
||||
@JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID")
|
||||
@ManyToOne(cascade = CascadeType.MERGE)
|
||||
@NaoAuditar
|
||||
private EsquemaCorrida esquemaCorrida;
|
||||
@Column(name = "MOTIVOBLOQUEO")
|
||||
private String motivobloqueo;
|
||||
|
@ -62,6 +69,10 @@ public class EsquemaAsiento implements Serializable {
|
|||
@JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID")
|
||||
private Parada destino;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private EsquemaAsiento esquemaAsientoClone;
|
||||
|
||||
public EsquemaAsiento() {
|
||||
}
|
||||
|
||||
|
@ -160,7 +171,7 @@ public class EsquemaAsiento implements Serializable {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (esquemaasientoId != null ? esquemaasientoId.hashCode() : 0);
|
||||
hash += (getEsquemaasientoId() != null ? getEsquemaasientoId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@ -171,7 +182,7 @@ public class EsquemaAsiento implements Serializable {
|
|||
return false;
|
||||
}
|
||||
EsquemaAsiento other = (EsquemaAsiento) object;
|
||||
if ((this.esquemaasientoId == null && other.esquemaasientoId != null) || (this.esquemaasientoId != null && !this.esquemaasientoId.equals(other.esquemaasientoId))) {
|
||||
if ((this.getEsquemaasientoId() == null && other.getEsquemaasientoId() != null) || (this.getEsquemaasientoId() != null && !this.getEsquemaasientoId().equals(other.getEsquemaasientoId()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -181,4 +192,23 @@ public class EsquemaAsiento implements Serializable {
|
|||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.test.EsquemaAsiento[esquemaasientoId=" + esquemaasientoId + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
esquemaAsientoClone = new EsquemaAsiento();
|
||||
esquemaAsientoClone = (EsquemaAsiento) this.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsquemaAsiento getCloneObject() throws CloneNotSupportedException {
|
||||
return esquemaAsientoClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s] - ASSENTOS [%s] - Localidade [%s]", getEsquemaasientoId(),
|
||||
getNumasiento(),
|
||||
getParada() != null ? getParada().getDescparada() : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,9 +20,19 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.apache.commons.lang.BooleanUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarAtributo;
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarEntidade;
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarID;
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarLista;
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rafius
|
||||
|
@ -30,103 +40,154 @@ import org.apache.commons.lang.StringUtils;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "ESQUEMA_CORRIDA_SEQ", sequenceName = "ESQUEMA_CORRIDA_SEQ", allocationSize = 1)
|
||||
@Table(name = "ESQUEMA_CORRIDA")
|
||||
public class EsquemaCorrida implements Serializable {
|
||||
@AuditarClasse(nome = "ESQUEMA_CORRIDA", campoEmpresa = "empresa", tela = "Configuração de Serviços")
|
||||
public class EsquemaCorrida implements Serializable, Auditavel<EsquemaCorrida> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@Column(name = "ESQUEMACORRIDA_ID")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_CORRIDA_SEQ")
|
||||
@AuditarID
|
||||
private Integer esquemacorridaId;
|
||||
|
||||
@Column(name = "HORASALIDA")
|
||||
@Temporal(TemporalType.TIME)
|
||||
@AuditarAtributo(pattern = "HH:mm")
|
||||
private Date horasalida;
|
||||
|
||||
@Column(name = "INDPISOEXTRA")
|
||||
private Boolean pisoExtra;
|
||||
|
||||
@Column(name = "INDLUNES")
|
||||
private Boolean indlunes;
|
||||
|
||||
@Column(name = "INDMARTES")
|
||||
private Boolean indmartes;
|
||||
|
||||
@Column(name = "INDMIERCOLES")
|
||||
private Boolean indmiercoles;
|
||||
|
||||
@Column(name = "INDJUEVES")
|
||||
private Boolean indjueves;
|
||||
|
||||
@Column(name = "INDVIERNES")
|
||||
private Boolean indviernes;
|
||||
|
||||
@Column(name = "INDSABADO")
|
||||
private Boolean indsabado;
|
||||
|
||||
@Column(name = "INDDOMINGO")
|
||||
private Boolean inddomingo;
|
||||
|
||||
@Column(name = "CANTPARADOS")
|
||||
private Integer cantparados;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
@NaoAuditar
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@NaoAuditar
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
@NaoAuditar
|
||||
private Integer usuarioId;
|
||||
|
||||
@Column(name = "DIAGRAMAAUTOBUS_ID")
|
||||
private Integer diagramaAutobusId;
|
||||
|
||||
@Column(name = "STATUSCORRIDA")
|
||||
private String statusCorrida;
|
||||
|
||||
@JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID")
|
||||
@ManyToOne
|
||||
private Ruta ruta;
|
||||
|
||||
@JoinColumn(name = "ROLOPERATIVO_ID", referencedColumnName = "ROLOPERATIVO_ID")
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
private RolOperativo rolOperativo;
|
||||
|
||||
@JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID")
|
||||
@ManyToOne
|
||||
private Marca marca;
|
||||
|
||||
@JoinColumn(name = "ESQUEMAOPERACIONAL_ID", referencedColumnName = "ESQUEMAOPERACIONAL_ID")
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
@AuditarEntidade
|
||||
private EsquemaOperacional esquemaOperacional;
|
||||
|
||||
@JoinColumn(name = "EMPRESACORRIDA_ID", referencedColumnName = "EMPRESA_ID")
|
||||
@ManyToOne
|
||||
private Empresa empresa;
|
||||
|
||||
@JoinColumn(name = "EMPRESAINGRESO_ID", referencedColumnName = "EMPRESA_ID")
|
||||
@ManyToOne
|
||||
private Empresa empresa1;
|
||||
|
||||
@JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID")
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
private ClaseServicio claseServicio;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID")
|
||||
@AuditarLista(auditarEntidades = true, nome = "Localidade")
|
||||
private List<EsquemaTramo> esquemaTramoList;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID")
|
||||
@AuditarLista(auditarEntidades = true, nome = "Cotas")
|
||||
private List<EsquemaAsiento> esquemaAsientoList;
|
||||
|
||||
@Column(name = "tipocorrida")
|
||||
private String tipocorrida;
|
||||
|
||||
@JoinColumn(name = "ESQUEMAREBOTE_ID", referencedColumnName = "ESQUEMACORRIDA_ID")
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
private EsquemaCorrida esquemaCorridaRebote;
|
||||
|
||||
@JoinColumn(name = "DIVISION_ID", referencedColumnName = "DIVISION_ID")
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
private Division division;
|
||||
|
||||
@Column(name = "NUMCORRIDA")
|
||||
private Integer numCorrida;
|
||||
|
||||
@Column(name = "NUMCORRIDAPISOEXTRA")
|
||||
private Integer numCorridaPisoExtra;
|
||||
|
||||
@Column(name = "INDGENERAFERIADO")
|
||||
private String indGeneraFeriado;
|
||||
|
||||
@Column(name = "CANTDIASGENERACION")
|
||||
private Integer cantDiasGeneracion;
|
||||
|
||||
@Column(name = "ESQUEMAAGRUPACION_ID")
|
||||
private Integer esquemaAgrupacionId;
|
||||
|
||||
@Column(name = "INFOCORRIDA")
|
||||
private String infoCorrida;
|
||||
|
||||
@Column(name = "INDCORRIDAEXTRA")
|
||||
private Boolean indCorridaExtra;
|
||||
|
||||
@Column(name = "INDDIASIMDIANAO")
|
||||
private Boolean indDiaSimDiaNao;
|
||||
|
||||
@JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID")
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
private Autobus autoBus;
|
||||
|
||||
@OneToMany(mappedBy = "esquemaCorrida", cascade = CascadeType.ALL)
|
||||
@AuditarLista(auditarEntidades = true, nome = "Embarque/Desembarque")
|
||||
private List<EsquemaCorridaEmbarqueDesembarque> lsEsquemaCorridaEmbarqueDesembarque;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private EsquemaCorrida esquemaCorridaClone;
|
||||
|
||||
public enum GerarFeriado {
|
||||
// Declaração dos enum
|
||||
GERARSEMPRE("GERAR SEMPRE", "S"),
|
||||
|
@ -559,7 +620,7 @@ public class EsquemaCorrida implements Serializable {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (esquemacorridaId != null ? esquemacorridaId.hashCode() : 0);
|
||||
hash += (getEsquemacorridaId() != null ? getEsquemacorridaId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@ -571,7 +632,7 @@ public class EsquemaCorrida implements Serializable {
|
|||
return false;
|
||||
}
|
||||
EsquemaCorrida other = (EsquemaCorrida) object;
|
||||
if ((this.esquemacorridaId == null && other.esquemacorridaId != null) || (this.esquemacorridaId != null && !this.esquemacorridaId.equals(other.esquemacorridaId))) {
|
||||
if ((this.getEsquemacorridaId() == null && other.getEsquemacorridaId() != null) || (this.getEsquemacorridaId() != null && !this.getEsquemacorridaId().equals(other.getEsquemacorridaId()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -598,4 +659,104 @@ public class EsquemaCorrida implements Serializable {
|
|||
this.lsEsquemaCorridaEmbarqueDesembarque = lsEsquemaCorridaEmbarqueDesembarque;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
esquemaCorridaClone = new EsquemaCorrida();
|
||||
esquemaCorridaClone = (EsquemaCorrida) this.clone();
|
||||
|
||||
if(this.getAutoBus() != null) {
|
||||
this.getAutoBus().clonar();
|
||||
esquemaCorridaClone.setAutoBus(this.getAutoBus().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getClaseServicio() != null) {
|
||||
this.getClaseServicio().clonar();
|
||||
esquemaCorridaClone.setClaseServicio(this.getClaseServicio().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getDivision() != null) {
|
||||
this.getDivision().clonar();
|
||||
esquemaCorridaClone.setDivision(this.getDivision().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getEmpresa() != null) {
|
||||
this.getEmpresa().clonar();
|
||||
esquemaCorridaClone.setEmpresa(this.getEmpresa().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getEmpresa1() != null) {
|
||||
this.getEmpresa1().clonar();
|
||||
esquemaCorridaClone.setEmpresa1(this.getEmpresa1().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getMarca() != null) {
|
||||
this.getMarca().clonar();
|
||||
esquemaCorridaClone.setMarca(this.getMarca().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getEsquemaCorridaRebote() != null) {
|
||||
this.getEsquemaCorridaRebote().clonar();
|
||||
esquemaCorridaClone.setEsquemaCorridaRebote(this.getEsquemaCorridaRebote().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getEsquemaOperacional() != null) {
|
||||
this.getEsquemaOperacional().clonar();
|
||||
esquemaCorridaClone.setEsquemaOperacional(this.getEsquemaOperacional().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getRolOperativo() != null) {
|
||||
this.getRolOperativo().clonar();
|
||||
esquemaCorridaClone.setRolOperativo(this.getRolOperativo().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getRuta() != null) {
|
||||
this.getRuta().clonar();
|
||||
esquemaCorridaClone.setRuta(this.getRuta().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getEsquemaAsientoList() != null) {
|
||||
List<EsquemaAsiento> lsClones = new ArrayList<EsquemaAsiento>();
|
||||
for (EsquemaAsiento esquemaAsiento : this.getEsquemaAsientoList()) {
|
||||
if(BooleanUtils.isTrue(esquemaAsiento.getActivo())) {
|
||||
esquemaAsiento.clonar();
|
||||
lsClones.add(esquemaAsiento.getCloneObject());
|
||||
}
|
||||
}
|
||||
esquemaCorridaClone.setEsquemaAsientoList(lsClones);
|
||||
}
|
||||
|
||||
if(this.getEsquemaTramoList() != null) {
|
||||
List<EsquemaTramo> lsClones = new ArrayList<EsquemaTramo>();
|
||||
for (EsquemaTramo esquemaTramo : this.getEsquemaTramoList()) {
|
||||
if(BooleanUtils.isTrue(esquemaTramo.getActivo())) {
|
||||
esquemaTramo.clonar();
|
||||
lsClones.add(esquemaTramo.getCloneObject());
|
||||
}
|
||||
}
|
||||
esquemaCorridaClone.setEsquemaTramoList(lsClones);
|
||||
}
|
||||
|
||||
if(this.getLsEsquemaCorridaEmbarqueDesembarque() != null) {
|
||||
List<EsquemaCorridaEmbarqueDesembarque> lsClones = new ArrayList<EsquemaCorridaEmbarqueDesembarque>();
|
||||
for (EsquemaCorridaEmbarqueDesembarque esquemaCorridaEmbarqueDesembarque : this.getLsEsquemaCorridaEmbarqueDesembarque()) {
|
||||
if(BooleanUtils.isTrue(esquemaCorridaEmbarqueDesembarque.getActivo())) {
|
||||
esquemaCorridaEmbarqueDesembarque.clonar();
|
||||
lsClones.add(esquemaCorridaEmbarqueDesembarque.getCloneObject());
|
||||
}
|
||||
}
|
||||
esquemaCorridaClone.setLsEsquemaCorridaEmbarqueDesembarque(lsClones);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsquemaCorrida getCloneObject() throws CloneNotSupportedException {
|
||||
return esquemaCorridaClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s] - Número Serviço [%s]", getEsquemacorridaId(), getNumCorrida());
|
||||
}
|
||||
|
||||
}
|
|
@ -15,11 +15,15 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name = "ESQUEMA_CORRIDA_EMB_DESEM_SEQ", sequenceName = "ESQUEMA_CORRIDA_EMB_DESEM_SEQ", allocationSize = 1)
|
||||
@Table(name = "ESQUEMA_CORRIDA_EMBRQ_DESEMBRQ")
|
||||
public class EsquemaCorridaEmbarqueDesembarque implements java.io.Serializable {
|
||||
public class EsquemaCorridaEmbarqueDesembarque implements java.io.Serializable, Auditavel<EsquemaCorridaEmbarqueDesembarque> {
|
||||
|
||||
private static final long serialVersionUID = -6308295160991190414L;
|
||||
|
||||
|
@ -31,6 +35,7 @@ public class EsquemaCorridaEmbarqueDesembarque implements java.io.Serializable {
|
|||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "ESQUEMACORRIDA_ID", nullable = false)
|
||||
@NaoAuditar
|
||||
private EsquemaCorrida esquemaCorrida;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
|
@ -57,6 +62,10 @@ public class EsquemaCorridaEmbarqueDesembarque implements java.io.Serializable {
|
|||
@JoinColumn(name = "PARADA_EMB_DES_ID")
|
||||
private Parada localDesembarqueEmbarque;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private EsquemaCorridaEmbarqueDesembarque esquemaCorridaEmbarqueDesembarqueClone;
|
||||
|
||||
public EsquemaCorridaEmbarqueDesembarque() {
|
||||
}
|
||||
|
||||
|
@ -154,4 +163,55 @@ public class EsquemaCorridaEmbarqueDesembarque implements java.io.Serializable {
|
|||
this.localDesembarqueEmbarque = localDesembarqueEmbarque;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getEsquemaCorridaEmbarqueDesembarqueId() == null) ? 0 : getEsquemaCorridaEmbarqueDesembarqueId().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (!(obj instanceof EsquemaCorridaEmbarqueDesembarque))
|
||||
return false;
|
||||
EsquemaCorridaEmbarqueDesembarque other = (EsquemaCorridaEmbarqueDesembarque) obj;
|
||||
if (getEsquemaCorridaEmbarqueDesembarqueId() == null) {
|
||||
if (other.getEsquemaCorridaEmbarqueDesembarqueId() != null)
|
||||
return false;
|
||||
} else if (!getEsquemaCorridaEmbarqueDesembarqueId().equals(other.getEsquemaCorridaEmbarqueDesembarqueId()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
esquemaCorridaEmbarqueDesembarqueClone = new EsquemaCorridaEmbarqueDesembarque();
|
||||
esquemaCorridaEmbarqueDesembarqueClone = (EsquemaCorridaEmbarqueDesembarque) this.clone();
|
||||
|
||||
if(this.getParada() != null) {
|
||||
esquemaCorridaEmbarqueDesembarqueClone.setParada(this.getParada().getCloneObject());
|
||||
}
|
||||
|
||||
if(this.getLocalDesembarqueEmbarque() != null) {
|
||||
esquemaCorridaEmbarqueDesembarqueClone.setLocalDesembarqueEmbarque(this.getLocalDesembarqueEmbarque().getCloneObject());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsquemaCorridaEmbarqueDesembarque getCloneObject() throws CloneNotSupportedException {
|
||||
return esquemaCorridaEmbarqueDesembarqueClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s] - Embarque [%s] - Desemb. [%s]",
|
||||
getEsquemaCorridaEmbarqueDesembarqueId(), getParada() != null ? getParada().getDescparada() : "",
|
||||
getEsquemaCorridaEmbarqueDesembarqueId(), getLocalDesembarqueEmbarque() != null ? getLocalDesembarqueEmbarque().getDescparada() : "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -17,10 +18,15 @@ import javax.persistence.GeneratedValue;
|
|||
import javax.persistence.GenerationType;
|
||||
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.SequenceGenerator;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarAtributo;
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -29,7 +35,7 @@ import javax.persistence.SequenceGenerator;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "ESQUEMA_OPERACIONAL_SEQ", sequenceName = "ESQUEMA_OPERACIONAL_SEQ", allocationSize = 1)
|
||||
@Table(name = "ESQUEMA_OPERACIONAL")
|
||||
public class EsquemaOperacional implements Serializable {
|
||||
public class EsquemaOperacional implements Serializable, Auditavel<EsquemaOperacional> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
|
@ -37,22 +43,38 @@ public class EsquemaOperacional implements Serializable {
|
|||
@Column(name = "ESQUEMAOPERACIONAL_ID")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_OPERACIONAL_SEQ")
|
||||
private Integer esquemaoperacionalId;
|
||||
|
||||
@Column(name = "FECNICIOVIGENCIA")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@AuditarAtributo(pattern = "dd/MM/yyyy", nome = "Inicio Vigencia")
|
||||
private Date fecniciovigencia;
|
||||
|
||||
@Column(name = "FECFINVIGENCIA")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@AuditarAtributo(pattern = "dd/MM/yyyy", nome = "Fim Vigencia")
|
||||
private Date fecfinvigencia;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
@NaoAuditar
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
@NaoAuditar
|
||||
private Integer usuarioId;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@NaoAuditar
|
||||
private Date fecmodif;
|
||||
|
||||
@OneToMany(mappedBy = "esquemaOperacional")
|
||||
@NaoAuditar
|
||||
private List<EsquemaCorrida> esquemaCorridaList;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private EsquemaOperacional esquemaOperacionalClone;
|
||||
|
||||
public EsquemaOperacional() {
|
||||
}
|
||||
|
||||
|
@ -147,7 +169,7 @@ public class EsquemaOperacional implements Serializable {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (esquemaoperacionalId != null ? esquemaoperacionalId.hashCode() : 0);
|
||||
hash += (getEsquemaoperacionalId() != null ? getEsquemaoperacionalId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@ -158,7 +180,7 @@ public class EsquemaOperacional implements Serializable {
|
|||
return false;
|
||||
}
|
||||
EsquemaOperacional other = (EsquemaOperacional) object;
|
||||
if ((this.esquemaoperacionalId == null && other.esquemaoperacionalId != null) || (this.esquemaoperacionalId != null && !this.esquemaoperacionalId.equals(other.esquemaoperacionalId))) {
|
||||
if ((this.getEsquemaoperacionalId() == null && other.getEsquemaoperacionalId() != null) || (this.getEsquemaoperacionalId() != null && !this.getEsquemaoperacionalId().equals(other.getEsquemaoperacionalId()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -168,4 +190,21 @@ public class EsquemaOperacional implements Serializable {
|
|||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.test.EsquemaOperacional[esquemaoperacionalId=" + esquemaoperacionalId + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
esquemaOperacionalClone = new EsquemaOperacional();
|
||||
esquemaOperacionalClone = (EsquemaOperacional) this.clone();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsquemaOperacional getCloneObject() throws CloneNotSupportedException {
|
||||
return esquemaOperacionalClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s]", getEsquemaoperacionalId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ 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;
|
||||
|
@ -14,10 +15,16 @@ 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.SequenceGenerator;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -26,7 +33,7 @@ import javax.persistence.SequenceGenerator;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "ESQUEMA_TRAMO_SEQ", sequenceName = "ESQUEMA_TRAMO_SEQ", allocationSize = 1)
|
||||
@Table(name = "ESQUEMA_TRAMO")
|
||||
public class EsquemaTramo implements Serializable, Comparable<EsquemaTramo> {
|
||||
public class EsquemaTramo implements Serializable, Comparable<EsquemaTramo>, Auditavel<EsquemaTramo> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
|
@ -57,6 +64,7 @@ public class EsquemaTramo implements Serializable, Comparable<EsquemaTramo> {
|
|||
|
||||
@JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID")
|
||||
@ManyToOne
|
||||
@NaoAuditar
|
||||
private EsquemaCorrida esquemaCorrida;
|
||||
|
||||
@Column(name = "PLATAFORMA")
|
||||
|
@ -68,6 +76,10 @@ public class EsquemaTramo implements Serializable, Comparable<EsquemaTramo> {
|
|||
@Column(name = "TIPO_PASSAGEM")
|
||||
private String tipoPassagem;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private EsquemaTramo esquemaTramoClone;
|
||||
|
||||
public Date getTiempoEstancia() {
|
||||
return tiempoEstancia;
|
||||
}
|
||||
|
@ -166,7 +178,7 @@ public class EsquemaTramo implements Serializable, Comparable<EsquemaTramo> {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (esquematramoId != null ? esquematramoId.hashCode() : 0);
|
||||
hash += (getEsquematramoId() != null ? getEsquematramoId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@ -176,7 +188,7 @@ public class EsquemaTramo implements Serializable, Comparable<EsquemaTramo> {
|
|||
return false;
|
||||
}
|
||||
EsquemaTramo other = (EsquemaTramo) object;
|
||||
if ((this.esquematramoId == null && other.esquematramoId != null) || (this.esquematramoId != null && !this.esquematramoId.equals(other.esquematramoId))) {
|
||||
if ((this.getEsquematramoId() == null && other.getEsquematramoId() != null) || (this.getEsquematramoId() != null && !this.getEsquematramoId().equals(other.getEsquematramoId()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -196,4 +208,24 @@ public class EsquemaTramo implements Serializable, Comparable<EsquemaTramo> {
|
|||
}
|
||||
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() : "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
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;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name = "LOG_AUDITORIA_SEQ", sequenceName = "LOG_AUDITORIA_SEQ", allocationSize = 1)
|
||||
@Table(name = "LOG_AUDITORIA")
|
||||
public class LogAuditoria implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "LOG_AUDITORIA_SEQ")
|
||||
@Column(name = "LOGAUDITORIA_ID")
|
||||
private Long logauditoriaId;
|
||||
|
||||
@Column(name = "ID_AUDITADO")
|
||||
private Long idAuditado;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "EMPRESA_ID")
|
||||
private Empresa empresa;
|
||||
|
||||
@Column(name = "VALOR_ANTERIOR")
|
||||
private String valorAnterior;
|
||||
|
||||
@Column(name = "VALOR_NOVO")
|
||||
private String valorNovo;
|
||||
|
||||
@Column(name = "CAMPO_ALTERADO")
|
||||
private String campoAlterado;
|
||||
|
||||
@Column(name = "CLASSE_ALTERADA")
|
||||
private String classeAlterada;
|
||||
|
||||
@Column(name = "CLASSE_PRINCIPAL")
|
||||
private String classePrincipal;
|
||||
|
||||
@Column(name = "TELA")
|
||||
private String tela;
|
||||
|
||||
@Column(name = "TIPO_ALTERACAO")
|
||||
private String tipoAlteracao;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "USUARIO_ID")
|
||||
private Usuario usuario;
|
||||
|
||||
public Long getLogauditoriaId() {
|
||||
return logauditoriaId;
|
||||
}
|
||||
|
||||
public void setLogauditoriaId(Long logauditoriaId) {
|
||||
this.logauditoriaId = logauditoriaId;
|
||||
}
|
||||
|
||||
public Empresa getEmpresa() {
|
||||
return empresa;
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
|
||||
public String getValorAnterior() {
|
||||
return valorAnterior;
|
||||
}
|
||||
|
||||
public void setValorAnterior(String valorAnterior) {
|
||||
this.valorAnterior = valorAnterior;
|
||||
}
|
||||
|
||||
public String getValorNovo() {
|
||||
return valorNovo;
|
||||
}
|
||||
|
||||
public void setValorNovo(String valorNovo) {
|
||||
this.valorNovo = valorNovo;
|
||||
}
|
||||
|
||||
public String getCampoAlterado() {
|
||||
return campoAlterado;
|
||||
}
|
||||
|
||||
public void setCampoAlterado(String campoAlterado) {
|
||||
this.campoAlterado = campoAlterado;
|
||||
}
|
||||
|
||||
public String getClasseAlterada() {
|
||||
return classeAlterada;
|
||||
}
|
||||
|
||||
public void setClasseAlterada(String classeAlterada) {
|
||||
this.classeAlterada = classeAlterada;
|
||||
}
|
||||
|
||||
public String getClassePrincipal() {
|
||||
return classePrincipal;
|
||||
}
|
||||
|
||||
public void setClassePrincipal(String classePrincipal) {
|
||||
this.classePrincipal = classePrincipal;
|
||||
}
|
||||
|
||||
public String getTela() {
|
||||
return tela;
|
||||
}
|
||||
|
||||
public void setTela(String tela) {
|
||||
this.tela = tela;
|
||||
}
|
||||
|
||||
public String getTipoAlteracao() {
|
||||
return tipoAlteracao;
|
||||
}
|
||||
|
||||
public void setTipoAlteracao(String tipoAlteracao) {
|
||||
this.tipoAlteracao = tipoAlteracao;
|
||||
}
|
||||
|
||||
public boolean isActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getLogauditoriaId() == null) ? 0 : getLogauditoriaId().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (!(obj instanceof LogAuditoria))
|
||||
return false;
|
||||
LogAuditoria other = (LogAuditoria) obj;
|
||||
if (getLogauditoriaId() == null) {
|
||||
if (other.getLogauditoriaId() != null)
|
||||
return false;
|
||||
} else if (!getLogauditoriaId().equals(other.getLogauditoriaId()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public Usuario getUsuario() {
|
||||
return usuario;
|
||||
}
|
||||
|
||||
public void setUsuario(Usuario usuario) {
|
||||
this.usuario = usuario;
|
||||
}
|
||||
|
||||
public Long getIdAuditado() {
|
||||
return idAuditado;
|
||||
}
|
||||
|
||||
public void setIdAuditado(Long idAuditado) {
|
||||
this.idAuditado = idAuditado;
|
||||
}
|
||||
|
||||
}
|
|
@ -23,10 +23,14 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.hibernate.annotations.Fetch;
|
||||
import org.hibernate.annotations.FetchMode;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrador
|
||||
|
@ -34,7 +38,7 @@ import org.hibernate.annotations.FetchMode;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "MARCA_SEQ", sequenceName = "MARCA_SEQ", allocationSize = 1)
|
||||
@Table(name = "MARCA")
|
||||
public class Marca implements Serializable {
|
||||
public class Marca implements Serializable, Auditavel<Marca> {
|
||||
|
||||
public final static short TODOS = -1;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -43,8 +47,10 @@ public class Marca implements Serializable {
|
|||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "MARCA_SEQ")
|
||||
@Column(name = "MARCA_ID")
|
||||
private Short marcaId;
|
||||
|
||||
@Column(name = "DESCMARCA")
|
||||
private String descmarca;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "EMPRESA_ID")
|
||||
private Empresa empresa;
|
||||
|
@ -76,6 +82,10 @@ public class Marca implements Serializable {
|
|||
@Fetch(FetchMode.SELECT)
|
||||
private List<Corrida> corridaList;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private Marca marcaClone;
|
||||
|
||||
public Marca() {
|
||||
}
|
||||
|
||||
|
@ -207,7 +217,7 @@ public class Marca implements Serializable {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (marcaId != null ? marcaId.hashCode() : 0);
|
||||
hash += (getMarcaId() != null ? getMarcaId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@ -218,7 +228,7 @@ public class Marca implements Serializable {
|
|||
return false;
|
||||
}
|
||||
Marca other = (Marca) object;
|
||||
if ((this.marcaId == null && other.marcaId != null) || (this.marcaId != null && !this.marcaId.equals(other.marcaId))) {
|
||||
if ((this.getMarcaId() == null && other.getMarcaId() != null) || (this.getMarcaId() != null && !this.getMarcaId().equals(other.getMarcaId()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -244,4 +254,20 @@ public class Marca implements Serializable {
|
|||
public void setTarifaHistList(List<TarifaHist> tarifaHistList) {
|
||||
this.tarifaHistList = tarifaHistList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
marcaClone = new Marca();
|
||||
marcaClone = (Marca) this.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Marca getCloneObject() throws CloneNotSupportedException {
|
||||
return marcaClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s]", getMarcaId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,10 +24,14 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.hibernate.annotations.Fetch;
|
||||
import org.hibernate.annotations.FetchMode;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrador
|
||||
|
@ -35,7 +39,7 @@ import org.hibernate.annotations.FetchMode;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "PARADA_SEQ", sequenceName = "PARADA_SEQ", allocationSize = 1)
|
||||
@Table(name = "PARADA")
|
||||
public class Parada implements Serializable {
|
||||
public class Parada implements Serializable, Auditavel<Parada> {
|
||||
public static Integer ID_PARADA_TODOS = -1;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -100,6 +104,10 @@ public class Parada implements Serializable {
|
|||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
private List<ParadaCodOrgaoConcedente> codigosOrgaosConcedentes = new ArrayList<ParadaCodOrgaoConcedente>();
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private Parada paradaClone;
|
||||
|
||||
public Parada() {
|
||||
super();
|
||||
}
|
||||
|
@ -337,4 +345,24 @@ public class Parada implements Serializable {
|
|||
public void setIndVisibleInternet(Boolean indVisibleInternet) {
|
||||
this.indVisibleInternet = indVisibleInternet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
paradaClone = new Parada();
|
||||
paradaClone = (Parada) this.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parada getCloneObject() throws CloneNotSupportedException {
|
||||
// if(paradaClone == null) {
|
||||
// this.clonar();
|
||||
// }
|
||||
return paradaClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("EsquemaAsientoID [%s]", getParadaId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.entidad;
|
|||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -15,10 +16,14 @@ import javax.persistence.Id;
|
|||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -27,7 +32,7 @@ import javax.persistence.SequenceGenerator;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "ROL_OPERATIVO_SEQ", sequenceName = "ROL_OPERATIVO_SEQ", allocationSize=1)
|
||||
@Table(name = "ROL_OPERATIVO")
|
||||
public class RolOperativo implements Serializable {
|
||||
public class RolOperativo implements Serializable, Auditavel<RolOperativo> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
|
@ -52,6 +57,10 @@ public class RolOperativo implements Serializable {
|
|||
@ManyToOne
|
||||
private DiagramaAutobus diagramaAutobus;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private RolOperativo rolOperativoClone;
|
||||
|
||||
public RolOperativo() {
|
||||
}
|
||||
|
||||
|
@ -137,7 +146,7 @@ public class RolOperativo implements Serializable {
|
|||
return false;
|
||||
}
|
||||
RolOperativo other = (RolOperativo) object;
|
||||
if ((this.roloperativoId == null && other.roloperativoId != null) || (this.roloperativoId != null && !this.roloperativoId.equals(other.roloperativoId))) {
|
||||
if ((this.getRoloperativoId() == null && other.getRoloperativoId() != null) || (this.getRoloperativoId() != null && !this.getRoloperativoId().equals(other.getRoloperativoId()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -147,4 +156,21 @@ public class RolOperativo implements Serializable {
|
|||
public String toString() {
|
||||
return this.getDescroloperativo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
rolOperativoClone = new RolOperativo();
|
||||
rolOperativoClone = (RolOperativo) this.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RolOperativo getCloneObject() throws CloneNotSupportedException {
|
||||
return rolOperativoClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s]", getRoloperativoId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ import javax.persistence.Transient;
|
|||
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rafius
|
||||
|
@ -36,7 +39,7 @@ import org.hibernate.annotations.Where;
|
|||
@SequenceGenerator(name = "RUTA_SEQ", sequenceName = "RUTA_SEQ", allocationSize = 1)
|
||||
@org.hibernate.annotations.Entity(dynamicUpdate = true)
|
||||
@Table(name = "RUTA")
|
||||
public class Ruta implements Serializable, Comparable<Ruta> {
|
||||
public class Ruta implements Serializable, Comparable<Ruta>, Auditavel<Ruta> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -156,6 +159,10 @@ public class Ruta implements Serializable, Comparable<Ruta> {
|
|||
@Column(name = "indnumfidelidadobligatorio")
|
||||
private Boolean indNumFidelidadObligatorio;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private Ruta rutaClone;
|
||||
|
||||
public Ruta() {
|
||||
super();
|
||||
indRutaCancelada = false;
|
||||
|
@ -602,6 +609,22 @@ public class Ruta implements Serializable, Comparable<Ruta> {
|
|||
this.lsRutaIcmsExcepcions = lsRutaIcmsExcepcions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
rutaClone = new Ruta();
|
||||
rutaClone = (Ruta) this.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ruta getCloneObject() throws CloneNotSupportedException {
|
||||
return rutaClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s]", getRutaId());
|
||||
}
|
||||
|
||||
public Boolean getIndPrecioPorDemanda() {
|
||||
return indPrecioPorDemanda;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,14 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarAtributo;
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarID;
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
import br.com.rjconsultores.auditador.interfaces.AuditavelTelaAlternativa;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -32,73 +40,131 @@ import javax.persistence.TemporalType;
|
|||
@Entity
|
||||
@SequenceGenerator(name = "TARIFA_SEQ", sequenceName = "TARIFA_SEQ", allocationSize = 1)
|
||||
@Table(name = "TARIFA")
|
||||
public class Tarifa implements Serializable {
|
||||
@AuditarClasse(nome = "TARIFA", tela = "Alteração de Preço", campoEmpresa = "empresaId")
|
||||
public class Tarifa implements Serializable, Auditavel<Tarifa>, AuditavelTelaAlternativa {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_SEQ")
|
||||
@Column(name = "TARIFA_ID")
|
||||
@AuditarID
|
||||
private Integer tarifaId;
|
||||
|
||||
@Column(name = "PRECIO")
|
||||
@AuditarAtributo(nome = "Tarifa")
|
||||
private BigDecimal precio;
|
||||
|
||||
@Column(name = "IMPORTETAXAEMBARQUE")
|
||||
@AuditarAtributo(nome = "Taxa de Embarque")
|
||||
private BigDecimal importetaxaembarque;
|
||||
|
||||
@Column(name = "IMPORTEPEDAGIO")
|
||||
@AuditarAtributo(nome = "Pedagio")
|
||||
private BigDecimal importepedagio;
|
||||
|
||||
@Column(name = "IMPORTEOUTROS")
|
||||
@AuditarAtributo(nome = "Outros")
|
||||
private BigDecimal importeoutros;
|
||||
|
||||
@Column(name = "IMPORTESEGURO")
|
||||
@AuditarAtributo(nome = "Seguro")
|
||||
private BigDecimal importeseguro;
|
||||
|
||||
@Column(name = "IMPORTETPP")
|
||||
@AuditarAtributo(nome = "Tarifa TPP")
|
||||
private BigDecimal importeTPP;
|
||||
|
||||
@Column(name = "PRECIOORIGINAL")
|
||||
@AuditarAtributo(nome = "Tarifa Original")
|
||||
private BigDecimal preciooriginal;
|
||||
|
||||
@Column(name = "STATUSTARIFA")
|
||||
@AuditarAtributo(nome = "Status Tarifa")
|
||||
private String statustarifa;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
@NaoAuditar
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@NaoAuditar
|
||||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
@NaoAuditar
|
||||
private Integer usuarioId;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "TRAMO_ID")
|
||||
@NaoAuditar
|
||||
private Tramo tramo;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "MARCA_ID")
|
||||
@NaoAuditar
|
||||
private Marca marca;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "CLASESERVICIO_ID")
|
||||
@NaoAuditar
|
||||
private ClaseServicio claseServicio;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "MONEDA_ID")
|
||||
@NaoAuditar
|
||||
private Moneda moneda;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "VIGENCIATARIFA_ID")
|
||||
@NaoAuditar
|
||||
private VigenciaTarifa vigenciaTarifa;
|
||||
|
||||
@Column(name = "PRECIOREDABIERTO")
|
||||
@AuditarAtributo(nome = "Tarifa volta em aberto")
|
||||
private BigDecimal precioredabierto;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID")
|
||||
@NaoAuditar
|
||||
private List<TarifaTipoptovta> lsTarifaTipoptovta;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID")
|
||||
@NaoAuditar
|
||||
private List<TarifaCategoria> lsTarifaCategoria;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "ORIGEN_ID")
|
||||
@NaoAuditar
|
||||
private Parada origen;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "DESTINO_ID")
|
||||
@NaoAuditar
|
||||
private Parada destino;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "RUTA_ID")
|
||||
@NaoAuditar
|
||||
private Ruta ruta;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "ORGAOCONCEDENTE_ID")
|
||||
@NaoAuditar
|
||||
private OrgaoConcedente orgaoConcedente;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private Tarifa tarifaClone;
|
||||
|
||||
@NaoAuditar
|
||||
@Transient
|
||||
private String telaAlternativa;
|
||||
|
||||
@Transient
|
||||
private Integer empresaId;
|
||||
|
||||
public Tarifa() {
|
||||
}
|
||||
|
||||
|
@ -344,4 +410,39 @@ public class Tarifa implements Serializable {
|
|||
public void setImporteseguro(BigDecimal importeseguro) {
|
||||
this.importeseguro = importeseguro;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
tarifaClone = new Tarifa();
|
||||
tarifaClone = (Tarifa) this.clone();
|
||||
tarifaClone.setEmpresaId(this.getMarca() != null && this.getMarca().getEmpresa() != null ? this.getMarca().getEmpresa().getEmpresaId() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tarifa getCloneObject() throws CloneNotSupportedException {
|
||||
return tarifaClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s]", getTarifaId());
|
||||
}
|
||||
|
||||
public Integer getEmpresaId() {
|
||||
return empresaId;
|
||||
}
|
||||
|
||||
public void setEmpresaId(Integer empresaId) {
|
||||
this.empresaId = empresaId;
|
||||
}
|
||||
|
||||
public void setTelaAlternativa(String telaAlternativa) {
|
||||
this.telaAlternativa = telaAlternativa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTelaAlternativa() {
|
||||
return telaAlternativa;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,71 +16,129 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarAtributo;
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
|
||||
import br.com.rjconsultores.auditador.annotations.AuditarID;
|
||||
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name = "TARIFA_OFICIAL_SEQ", sequenceName = "TARIFA_OFICIAL_SEQ", allocationSize = 1)
|
||||
@Table(name = "TARIFA_OFICIAL")
|
||||
public class TarifaOficial implements Serializable {
|
||||
@AuditarClasse(nome = "TARIFA", tela = "Alteração de Preço / Tarifa Oficial", campoEmpresa = "empresaId")
|
||||
public class TarifaOficial implements Serializable, Auditavel<TarifaOficial> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_OFICIAL_SEQ")
|
||||
@Column(name = "TARIFAOFICIAL_ID")
|
||||
@AuditarID
|
||||
private Integer tarifaOficialId;
|
||||
|
||||
@Column(name = "PRECIO")
|
||||
@AuditarAtributo(nome = "Tarifa")
|
||||
private BigDecimal precio;
|
||||
|
||||
@Column(name = "PRECIOORIGINAL")
|
||||
@AuditarAtributo(nome = "Tarifa Original")
|
||||
private BigDecimal preciooriginal;
|
||||
|
||||
@Column(name = "IMPORTETAXAEMBARQUE")
|
||||
@AuditarAtributo(nome = "Taxa de Embarque")
|
||||
private BigDecimal importetaxaembarque;
|
||||
|
||||
@Column(name = "IMPORTEPEDAGIO")
|
||||
@AuditarAtributo(nome = "Pedagio")
|
||||
private BigDecimal importepedagio;
|
||||
|
||||
@Column(name = "IMPORTEOUTROS")
|
||||
@AuditarAtributo(nome = "Outros")
|
||||
private BigDecimal importeoutros;
|
||||
|
||||
@Column(name = "IMPORTESEGURO")
|
||||
@AuditarAtributo(nome = "Seguro")
|
||||
private BigDecimal importeseguro;
|
||||
|
||||
@Column(name = "IMPORTETPP")
|
||||
@AuditarAtributo(nome = "Tarifa TPP")
|
||||
private BigDecimal importetpp;
|
||||
|
||||
@Column(name = "STATUSTARIFA")
|
||||
@AuditarAtributo(nome = "Status Tarifa")
|
||||
private String statustarifa;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
@NaoAuditar
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@NaoAuditar
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
@NaoAuditar
|
||||
private Integer usuarioId;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "TRAMO_ID")
|
||||
@NaoAuditar
|
||||
private Tramo tramo;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "MARCA_ID")
|
||||
@NaoAuditar
|
||||
private Marca marca;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "CLASESERVICIO_ID")
|
||||
@NaoAuditar
|
||||
private ClaseServicio claseServicio;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "MONEDA_ID")
|
||||
@NaoAuditar
|
||||
private Moneda moneda;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "VIGENCIATARIFA_ID")
|
||||
@NaoAuditar
|
||||
private VigenciaTarifa vigenciaTarifa;
|
||||
|
||||
@Column(name = "PRECIOREDABIERTO")
|
||||
@AuditarAtributo(nome = "Tarifa volta em aberto")
|
||||
private BigDecimal precioredabierto;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "ORIGEN_ID")
|
||||
@NaoAuditar
|
||||
private Parada origen;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "DESTINO_ID")
|
||||
@NaoAuditar
|
||||
private Parada destino;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "RUTA_ID")
|
||||
@NaoAuditar
|
||||
private Ruta ruta;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "ORGAOCONCEDENTE_ID")
|
||||
@NaoAuditar
|
||||
private OrgaoConcedente orgaoConcedente;
|
||||
|
||||
@Transient
|
||||
@NaoAuditar
|
||||
private TarifaOficial tarifaOficialClone;
|
||||
|
||||
@Transient
|
||||
private Integer empresaId;
|
||||
|
||||
public TarifaOficial() {
|
||||
}
|
||||
|
||||
|
@ -283,4 +341,30 @@ public class TarifaOficial implements Serializable {
|
|||
public void setImporteseguro(BigDecimal importeseguro) {
|
||||
this.importeseguro = importeseguro;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clonar() throws CloneNotSupportedException {
|
||||
tarifaOficialClone = new TarifaOficial();
|
||||
tarifaOficialClone = (TarifaOficial) this.clone();
|
||||
tarifaOficialClone.setEmpresaId(this.getMarca() != null && this.getMarca().getEmpresa() != null ? this.getMarca().getEmpresa().getEmpresaId() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TarifaOficial getCloneObject() throws CloneNotSupportedException {
|
||||
return tarifaOficialClone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextoInclusaoExclusao() {
|
||||
return String.format("ID [%s]", getTarifaOficialId());
|
||||
}
|
||||
|
||||
public Integer getEmpresaId() {
|
||||
return empresaId;
|
||||
}
|
||||
|
||||
public void setEmpresaId(Integer empresaId) {
|
||||
this.empresaId = empresaId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.LogAuditoria;
|
||||
|
||||
import br.com.rjconsultores.auditador.model.AuditadorObjects;
|
||||
|
||||
public interface LogAuditoriaService extends GenericService<LogAuditoria, Long> {
|
||||
|
||||
public void auditar(Object objetoOriginal, Object objetoNovo);
|
||||
|
||||
public void auditarExclusao(Object objeto);
|
||||
|
||||
public List<String> listarTodasAsTelas();
|
||||
|
||||
public void suscribir(List<AuditadorObjects> lsObjects);
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -29,7 +30,9 @@ import com.rjconsultores.ventaboletos.entidad.ParadaEsquema;
|
|||
import com.rjconsultores.ventaboletos.entidad.RolOperativo;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||
import com.rjconsultores.ventaboletos.service.EsquemaAsientoService;
|
||||
import com.rjconsultores.ventaboletos.service.EsquemaCorridaService;
|
||||
import com.rjconsultores.ventaboletos.service.LogAuditoriaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
|
@ -40,19 +43,32 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
|||
@Service("esquemaCorridaService")
|
||||
public class EsquemaCorridaServiceImpl implements EsquemaCorridaService {
|
||||
|
||||
private static Logger log = Logger.getLogger(EsquemaCorridaServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private EsquemaCorridaDAO esquemaCorridaDAO;
|
||||
@Autowired
|
||||
private RutaCombinacionDAO rutaCombinacionDAO;
|
||||
@Autowired
|
||||
private EsquemaTramoDAO esquemaTramoDAO;
|
||||
@Autowired
|
||||
private EsquemaAsientoService esquemaAsientoService;
|
||||
|
||||
@Autowired
|
||||
private LogAuditoriaService logAuditoriaService;
|
||||
|
||||
public List<EsquemaCorrida> obtenerTodos() {
|
||||
return esquemaCorridaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public EsquemaCorrida obtenerID(Integer id) {
|
||||
return esquemaCorridaDAO.obtenerID(id);
|
||||
EsquemaCorrida esquemaCorrida = esquemaCorridaDAO.obtenerID(id);
|
||||
try {
|
||||
esquemaCorrida.clonar();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return esquemaCorrida;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,16 +102,45 @@ public class EsquemaCorridaServiceImpl implements EsquemaCorridaService {
|
|||
entidad.setClaseServicio(c);
|
||||
entidad.setRolOperativo(r);
|
||||
|
||||
return esquemaCorridaDAO.actualizacion(entidad);
|
||||
entidad = esquemaCorridaDAO.actualizacion(entidad);
|
||||
|
||||
logAuditoriaService.auditar(null, entidad);
|
||||
|
||||
return entidad;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public EsquemaCorrida actualizacion(EsquemaCorrida entidad) {
|
||||
try {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return esquemaCorridaDAO.actualizacion(entidad);
|
||||
EsquemaCorrida clone = entidad.getCloneObject();
|
||||
|
||||
entidad = esquemaCorridaDAO.actualizacion(entidad);
|
||||
entidad.clonar();
|
||||
EsquemaCorrida novoClone = entidad.getCloneObject();
|
||||
|
||||
novoClone.setEsquemaAsientoList(null);
|
||||
List<EsquemaAsiento> lsAsientos = esquemaAsientoService.obtenerPorCorrida(entidad);
|
||||
if(lsAsientos != null) {
|
||||
List<EsquemaAsiento> lsNovoAsientos = new ArrayList<EsquemaAsiento>();
|
||||
for (EsquemaAsiento esquemaAsiento : lsAsientos) {
|
||||
esquemaAsiento.clonar();
|
||||
lsNovoAsientos.add(esquemaAsiento.getCloneObject());
|
||||
}
|
||||
novoClone.setEsquemaAsientoList(lsNovoAsientos);
|
||||
}
|
||||
|
||||
logAuditoriaService.auditar(clone, entidad.getCloneObject());
|
||||
|
||||
return entidad;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -117,6 +162,8 @@ public class EsquemaCorridaServiceImpl implements EsquemaCorridaService {
|
|||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
logAuditoriaService.auditarExclusao(entidad);
|
||||
|
||||
esquemaCorridaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
|
@ -140,7 +187,15 @@ public class EsquemaCorridaServiceImpl implements EsquemaCorridaService {
|
|||
@Transactional
|
||||
public void actualizaEsquemaTramo(List<ParadaEsquema> listParadaEsquema, EsquemaCorrida ec) {
|
||||
|
||||
try {
|
||||
|
||||
ec = this.obtenerID(ec.getEsquemacorridaId());
|
||||
ec.clonar();
|
||||
EsquemaCorrida originalClone = ec.getCloneObject();
|
||||
ec.clonar();
|
||||
EsquemaCorrida novoClone = ec.getCloneObject();
|
||||
List<EsquemaTramo> lsTramosNovo = new ArrayList<EsquemaTramo>();
|
||||
|
||||
if (ec.getEsquemaTramoList() != null) {
|
||||
for (EsquemaTramo et : ec.getEsquemaTramoList()) {
|
||||
et.setActivo(Boolean.FALSE);
|
||||
|
@ -187,6 +242,16 @@ public class EsquemaCorridaServiceImpl implements EsquemaCorridaService {
|
|||
throw new RuntimeException("No es possible suscribir tramos duplicados.");
|
||||
}
|
||||
esquemaTramoDAO.suscribir(et);
|
||||
|
||||
lsTramosNovo.add(et);
|
||||
}
|
||||
novoClone.setEsquemaTramoList(lsTramosNovo);
|
||||
|
||||
logAuditoriaService.auditar(originalClone, novoClone);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.LogAuditoriaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.LogAuditoria;
|
||||
import com.rjconsultores.ventaboletos.service.LogAuditoriaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
import br.com.rjconsultores.auditador.auditadores.Auditador;
|
||||
import br.com.rjconsultores.auditador.enums.AuditadorTipoAlteracao;
|
||||
import br.com.rjconsultores.auditador.model.AuditadorObjects;
|
||||
|
||||
@Service("LogAuditoriaService")
|
||||
public class LogAuditoriaServiceImpl implements LogAuditoriaService {
|
||||
|
||||
private static Logger log = Logger.getLogger(LogAuditoriaServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private LogAuditoriaDAO logAuditoriaDAO;
|
||||
|
||||
@Override
|
||||
public List<LogAuditoria> obtenerTodos() {
|
||||
return logAuditoriaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogAuditoria obtenerID(Long id) {
|
||||
return logAuditoriaDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public LogAuditoria suscribir(LogAuditoria entidad) {
|
||||
entidad.setUsuario(UsuarioLogado.getUsuarioLogado());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return logAuditoriaDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public LogAuditoria actualizacion(LogAuditoria entidad) {
|
||||
entidad.setUsuario(UsuarioLogado.getUsuarioLogado());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return logAuditoriaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void borrar(LogAuditoria entidad) {
|
||||
entidad.setUsuario(UsuarioLogado.getUsuarioLogado());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
logAuditoriaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void auditar(Object original, Object novo) {
|
||||
try {
|
||||
log.info(String.format(":: Iniciando gravação registros de auditoria classe: %s", novo.getClass().toString()));
|
||||
Integer totalRegistrosAuditados = 0;
|
||||
List<AuditadorObjects> lista = Auditador.getInstance().auditar(original, novo);
|
||||
if(lista != null && !lista.isEmpty()) {
|
||||
suscribir(lista);
|
||||
totalRegistrosAuditados = lista.size();
|
||||
}
|
||||
log.info(String.format(":: Iniciando gravação registros de auditoria classe: %s - Total Registros auditados: %d", novo.getClass().toString(), totalRegistrosAuditados));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private LogAuditoria convertToLogAuditoria(AuditadorObjects log) {
|
||||
LogAuditoria logAuditoria = new LogAuditoria();
|
||||
logAuditoria.setUsuario(UsuarioLogado.getUsuarioLogado());
|
||||
logAuditoria.setFecmodif(Calendar.getInstance().getTime());
|
||||
logAuditoria.setActivo(Boolean.TRUE);
|
||||
logAuditoria.setCampoAlterado(log.getCampoAlterado() != null ? log.getCampoAlterado().toUpperCase() : null);
|
||||
logAuditoria.setClasseAlterada(log.getClasseAlterada());
|
||||
logAuditoria.setClassePrincipal(log.getClassePrincipal());
|
||||
logAuditoria.setTela(log.getTela());
|
||||
logAuditoria.setTipoAlteracao(log.getTipoAlteracao() != null ? log.getTipoAlteracao().toString() : AuditadorTipoAlteracao.ALTERACAO.toString());
|
||||
logAuditoria.setValorAnterior(log.getValorAnterior() != null ? log.getValorAnterior().toUpperCase() : null);
|
||||
logAuditoria.setValorNovo(log.getValorNovo() != null ? log.getValorNovo().toUpperCase() : null);
|
||||
logAuditoria.setIdAuditado(log.getIdAuditado());
|
||||
|
||||
if(log.getEmpresaId() != null) {
|
||||
logAuditoria.setEmpresa(new Empresa(log.getEmpresaId()));
|
||||
}
|
||||
return logAuditoria;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void auditarExclusao(Object objeto) {
|
||||
try {
|
||||
log.info(String.format(":: Iniciando gravação registros de auditoria de exclusao classe: %s", objeto.getClass().getSimpleName()));
|
||||
Integer totalRegistrosAuditados = 0;
|
||||
List<AuditadorObjects> lista = Auditador.getInstance().auditarExclusao(objeto);
|
||||
if(lista != null && !lista.isEmpty()) {
|
||||
suscribir(lista);
|
||||
totalRegistrosAuditados = lista.size();
|
||||
}
|
||||
log.info(String.format(":: Iniciando gravação registros de auditoria de exclusao classe: %s - Total Registros auditados: %d", objeto.getClass().getSimpleName(), totalRegistrosAuditados));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listarTodasAsTelas() {
|
||||
return logAuditoriaDAO.listarTodasAsTelas();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void suscribir(List<AuditadorObjects> lsObjects) {
|
||||
for (AuditadorObjects auditado : lsObjects) {
|
||||
LogAuditoria logAuditoria = convertToLogAuditoria(auditado);
|
||||
suscribir(logAuditoria);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -26,6 +26,7 @@ import com.rjconsultores.ventaboletos.entidad.Tramo;
|
|||
import com.rjconsultores.ventaboletos.entidad.Via;
|
||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.LogAuditoriaService;
|
||||
import com.rjconsultores.ventaboletos.service.TarifaOficialService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO;
|
||||
|
@ -44,6 +45,9 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
|||
@Autowired
|
||||
private OrgaoConcedenteDAO orgaoConcedenteDAO;
|
||||
|
||||
@Autowired
|
||||
private LogAuditoriaService logAuditoriaService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer gerarTarifaPorCoeficiente(Integer rutaId, OrgaoConcedente orgaoConcedente, List<Integer> idsEmpresas) {
|
||||
|
@ -245,18 +249,34 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
|||
@Override
|
||||
@Transactional
|
||||
public void actualizacion(TarifaOficial tarifaOficial) {
|
||||
try {
|
||||
TarifaOficial originalClone = tarifaOficial.getCloneObject();
|
||||
tarifaOficialDAO.actualizacion(tarifaOficial);
|
||||
tarifaOficial.setEmpresaId(tarifaOficial.getMarca() != null && tarifaOficial.getMarca().getEmpresa() != null ? tarifaOficial.getMarca().getEmpresa().getEmpresaId() : null);
|
||||
logAuditoriaService.auditar(originalClone, tarifaOficial);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TarifaOficial obtenerID(Integer tarifaOficialId) {
|
||||
return tarifaOficialDAO.obtenerID(tarifaOficialId);
|
||||
TarifaOficial tarifaOficial = tarifaOficialDAO.obtenerID(tarifaOficialId);
|
||||
try {
|
||||
tarifaOficial.clonar();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return tarifaOficial;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void borrar(TarifaOficial tarifaOficial) {
|
||||
tarifaOficialDAO.borrar(tarifaOficial);
|
||||
tarifaOficial.setEmpresaId(tarifaOficial.getMarca() != null && tarifaOficial.getMarca().getEmpresa() != null ? tarifaOficial.getMarca().getEmpresa().getEmpresaId() : null);
|
||||
logAuditoriaService.auditarExclusao(tarifaOficial);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.rjconsultores.ventaboletos.entidad.Tramo;
|
|||
import com.rjconsultores.ventaboletos.entidad.Via;
|
||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.LogAuditoriaService;
|
||||
import com.rjconsultores.ventaboletos.service.MonedaService;
|
||||
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||
import com.rjconsultores.ventaboletos.service.TarifaHistService;
|
||||
|
@ -61,6 +62,10 @@ public class TarifaServiceImpl implements TarifaService {
|
|||
private TarifaMinimaService tarifaMinimaService;
|
||||
@Autowired
|
||||
private RutaService rutaService;
|
||||
|
||||
@Autowired
|
||||
private LogAuditoriaService logAuditoriaService;
|
||||
|
||||
private static Logger log = Logger.getLogger(TarifaServiceImpl.class);
|
||||
|
||||
public List<Tarifa> obtenerTodos() {
|
||||
|
@ -69,7 +74,13 @@ public class TarifaServiceImpl implements TarifaService {
|
|||
|
||||
@Transactional(readOnly = true)
|
||||
public Tarifa obtenerID(Integer id) {
|
||||
return tarifaDAO.obtenerID(id);
|
||||
Tarifa tarifa = tarifaDAO.obtenerID(id);
|
||||
try {
|
||||
tarifa.clonar();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return tarifa;
|
||||
}
|
||||
|
||||
private void cadastrarTarifaHistorico(Tarifa entidad) {
|
||||
|
@ -104,11 +115,18 @@ public class TarifaServiceImpl implements TarifaService {
|
|||
}
|
||||
cadastrarTarifaHistorico(entidad);
|
||||
|
||||
entidad.setEmpresaId(entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null);
|
||||
|
||||
logAuditoriaService.auditar(null, entidad);
|
||||
|
||||
return tarifaDAO.suscribir(entidad);
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Tarifa actualizacion(Tarifa entidad) {
|
||||
try {
|
||||
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
@ -131,8 +149,22 @@ public class TarifaServiceImpl implements TarifaService {
|
|||
|
||||
cadastrarTarifaHistorico(entidad);
|
||||
// cadastrarTarifaMonedaEstrangeira(entidad);
|
||||
|
||||
|
||||
Tarifa originalClone = entidad.getCloneObject();
|
||||
|
||||
tarifaDAO.updateTarifa(entidad);
|
||||
|
||||
entidad.setEmpresaId(entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null);
|
||||
|
||||
logAuditoriaService.auditar(originalClone, entidad);
|
||||
|
||||
return entidad;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -155,6 +187,10 @@ public class TarifaServiceImpl implements TarifaService {
|
|||
|
||||
cadastrarTarifaHistorico(entidad);
|
||||
|
||||
entidad.setEmpresaId(entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null);
|
||||
|
||||
logAuditoriaService.auditarExclusao(entidad);
|
||||
|
||||
tarifaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
|
@ -253,6 +289,10 @@ public class TarifaServiceImpl implements TarifaService {
|
|||
+ " Marca " + marca + " Vigencia: " + vigencia);
|
||||
|
||||
tarifa = tarifaDAO.suscribir(tarifa);
|
||||
|
||||
tarifa.setEmpresaId(tarifa.getMarca() != null && tarifa.getMarca().getEmpresa() != null ? tarifa.getMarca().getEmpresa().getEmpresaId() : null);
|
||||
|
||||
logAuditoriaService.auditar(null, tarifa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue