From 8e46e7b0c141e386408f370aee976adde0f3791e Mon Sep 17 00:00:00 2001 From: walace Date: Tue, 26 Apr 2022 13:24:10 +0000 Subject: [PATCH] fixes bug#24412 qua: dev: Criado os mapeamentos de log de auditorias, para o menu/abas de ponto de venda git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@112005 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../entidad/AliquotaEstadoDestino.java | 32 ++- .../ventaboletos/entidad/Categoria.java | 3 + .../CategoriaBloqueioImpPosterior.java | 33 ++- .../ventaboletos/entidad/CategoriaOrgao.java | 35 ++- .../entidad/CobrancaAdcPuntoVenta.java | 33 ++- .../entidad/CoeficienteTarifa.java | 29 ++- .../ventaboletos/entidad/EmpresaImposto.java | 30 ++- .../entidad/FechamentoParamptovta.java | 24 +- .../ventaboletos/entidad/FormaPago.java | 32 ++- .../ventaboletos/entidad/FormaPagoDet.java | 31 ++- .../entidad/HistoricoPuntoVenta.java | 33 ++- .../entidad/OrgaoCancelacion.java | 30 ++- .../ventaboletos/entidad/OrgaoConcedente.java | 62 ++++- .../ventaboletos/entidad/OrgaoEmpParam.java | 30 ++- .../entidad/ParamRecoleccion.java | 33 ++- .../ventaboletos/entidad/PtoVtaCheckin.java | 32 ++- .../ventaboletos/entidad/PtoVtaSeguro.java | 34 ++- .../entidad/PtoVtaUsuarioBancario.java | 32 ++- .../entidad/PtovtaAntecipacomissao.java | 35 ++- .../entidad/PtovtaAntifraude.java | 33 ++- .../ventaboletos/entidad/PtovtaCatInd.java | 32 ++- .../ventaboletos/entidad/PtovtaComissao.java | 68 ++++-- .../ventaboletos/entidad/PtovtaEmpresa.java | 33 ++- .../entidad/PtovtaEmpresaBloqueada.java | 32 ++- .../ventaboletos/entidad/PtovtaEstoque.java | 37 ++- .../ventaboletos/entidad/PtovtaHorario.java | 36 ++- .../ventaboletos/entidad/PtovtaTitular.java | 55 ++++- .../entidad/ReservacionPuntoVenta.java | 224 ++++++++++-------- .../impl/CoeficienteTarifaServiceImpl.java | 52 +++- .../service/impl/EmpresaServiceImpl.java | 30 ++- .../FechamentoParamptovtaServiceImpl.java | 33 ++- .../service/impl/FormaPagoServiceImpl.java | 54 ++++- .../ImportacaoClientesSrvpServiceImpl.java | 17 +- .../impl/OrgaoConcedenteServiceImpl.java | 42 +++- .../impl/PtovtaComissaoServiceImpl.java | 40 +++- .../impl/PtovtaTitularServiceImpl.java | 10 +- .../service/impl/PuntoVentaServiceImpl.java | 30 ++- 37 files changed, 1273 insertions(+), 188 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/entidad/AliquotaEstadoDestino.java b/src/com/rjconsultores/ventaboletos/entidad/AliquotaEstadoDestino.java index 3617b9c7e..180e9ea2c 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/AliquotaEstadoDestino.java +++ b/src/com/rjconsultores/ventaboletos/entidad/AliquotaEstadoDestino.java @@ -17,11 +17,17 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; @Entity @SequenceGenerator(name = "ALIQUOTAESTADODESTINO_SEQ", sequenceName = "ALIQUOTAESTADODESTINO_SEQ", allocationSize = 1) @Table(name = "ALIQUOTA_ESTADO_DESTINO") -public class AliquotaEstadoDestino implements Serializable { +public class AliquotaEstadoDestino implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -50,6 +56,11 @@ public class AliquotaEstadoDestino implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Transient + @NaoAuditar + private AliquotaEstadoDestino aliquotaEstadoDestinoClone; + @Override @@ -119,5 +130,24 @@ public class AliquotaEstadoDestino implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + @Override + public void clonar() throws CloneNotSupportedException { + aliquotaEstadoDestinoClone = new AliquotaEstadoDestino(); + aliquotaEstadoDestinoClone = (AliquotaEstadoDestino) this.clone(); + Hibernate.initialize(aliquotaEstadoDestinoClone.getEmpresaImposto()); + + } + + @Override + public AliquotaEstadoDestino getCloneObject() throws CloneNotSupportedException { + return aliquotaEstadoDestinoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + // TODO Auto-generated method stub + return null; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java index 4584e5ae6..584566217 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java @@ -29,6 +29,8 @@ import javax.persistence.TemporalType; import com.rjconsultores.ventaboletos.enums.TipoDescontoBPe; import com.rjconsultores.ventaboletos.enums.TipoDescontoMonitrip; +import br.com.rjconsultores.auditador.annotations.AuditarLista; + /** * * @author Administrador @@ -68,6 +70,7 @@ public class Categoria implements Serializable { private GrupoCategoria grupoCategoria; @OneToMany(mappedBy = "categoria", cascade = CascadeType.ALL) + @AuditarLista(auditarEntidades = true, nome = "Categoria Orgao") private List orgaosConcedentes; @Column(name = "INDCONFERENCIAFISICACOMISSAO") diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java index fa34d8b23..704f901ed 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java @@ -10,11 +10,19 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; +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 = "CategoriaBloqueioImpPosterior", tela = "Alteração Ponto de Venda/Categoria/Bloqueio/ImpPosterior") @Entity @SequenceGenerator(name = "CAT_BLOQ_IMPPOSTERIOR_SEQ", sequenceName = "CAT_BLOQ_IMPPOSTERIOR_SEQ", allocationSize = 1) @Table(name = "CATEGORIA_BLOQ_IMPPOSTERIOR") -public class CategoriaBloqueioImpPosterior { +public class CategoriaBloqueioImpPosterior implements Auditavel { @Id @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "CAT_BLOQ_IMPPOSTERIOR_SEQ") @@ -26,6 +34,11 @@ public class CategoriaBloqueioImpPosterior { @ManyToOne() @JoinColumn(name = "CATEGORIA_ID") private Categoria categoria; + + @Transient + @NaoAuditar + private CategoriaBloqueioImpPosterior categoriaBloqueioImpPosteriorClone; + public Integer getCategoriaBloqueioImpPosteriorId() { return categoriaBloqueioImpPosteriorId; } @@ -65,4 +78,22 @@ public class CategoriaBloqueioImpPosterior { } return true; } + + @Override + public void clonar() throws CloneNotSupportedException { + categoriaBloqueioImpPosteriorClone = new CategoriaBloqueioImpPosterior(); + categoriaBloqueioImpPosteriorClone = (CategoriaBloqueioImpPosterior) this.clone(); + Hibernate.initialize(categoriaBloqueioImpPosteriorClone.getPuntoventa()); + + } + + @Override + public CategoriaBloqueioImpPosterior getCloneObject() throws CloneNotSupportedException { + return categoriaBloqueioImpPosteriorClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCategoriaBloqueioImpPosteriorId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java index 7e7e4f71d..6ef82cd36 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java @@ -15,11 +15,20 @@ 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.AuditarEntidade; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "CategoriaOrgao", tela = "Alteração de Categoria Orgao Concedente") @Entity @SequenceGenerator(name = "CATEGORIA_ORGAO_SEQ", sequenceName = "CATEGORIA_ORGAO_SEQ", allocationSize = 1) @Table(name = "CATEGORIA_ORGAO") -public class CategoriaOrgao implements Serializable { +public class CategoriaOrgao implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -36,10 +45,15 @@ public class CategoriaOrgao implements Serializable { private Integer usuarioId; @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") @ManyToOne + @AuditarEntidade private OrgaoConcedente orgao; @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") @ManyToOne private CategoriaCtrl categoriaCtrl; + + @Transient + @NaoAuditar + private CategoriaOrgao categoriaOrgaoClone; public CategoriaOrgao() { } @@ -130,4 +144,23 @@ public class CategoriaOrgao implements Serializable { public String toString() { return "com.rjconsultores.ventaboletos.entidad.CategoriaOrgao[categoriaorgaoId=" + categoriaorgaoId + "]"; } + + @Override + public void clonar() throws CloneNotSupportedException { + + categoriaOrgaoClone = new CategoriaOrgao(); + categoriaOrgaoClone = (CategoriaOrgao) this.clone(); + Hibernate.initialize(categoriaOrgaoClone.getOrgao()); + + } + + @Override + public CategoriaOrgao getCloneObject() throws CloneNotSupportedException { + return categoriaOrgaoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCategoriaorgaoId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java index 7d0d4b9e1..ef43a26ef 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java @@ -17,15 +17,23 @@ 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; /** * @author vjcor * */ +@AuditarClasse(nome = "CobrancaAdcPuntoVenta", tela = "Alteração Cobrança de Ponto de Venda") @Entity @SequenceGenerator(name = "COBRANCA_ADC_SEQ", sequenceName = "COBRANCA_ADC_SEQ", allocationSize = 1) @Table(name = "COBRANCA_ADC_PUNTO_VENTA") -public class CobrancaAdcPuntoVenta implements Serializable { +public class CobrancaAdcPuntoVenta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -103,6 +111,10 @@ public class CobrancaAdcPuntoVenta implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + @Transient + @NaoAuditar + private CobrancaAdcPuntoVenta cobrancaAdcPuntoVentaClone; + private Boolean getBoolean(Boolean valor) { return valor == null ? false : valor; } @@ -315,5 +327,22 @@ public class CobrancaAdcPuntoVenta implements Serializable { return this.getDescricao(); } - + @Override + public void clonar() throws CloneNotSupportedException { + + cobrancaAdcPuntoVentaClone = new CobrancaAdcPuntoVenta(); + cobrancaAdcPuntoVentaClone = (CobrancaAdcPuntoVenta) this.clone(); + Hibernate.initialize(cobrancaAdcPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public CobrancaAdcPuntoVenta getCloneObject() throws CloneNotSupportedException { + return cobrancaAdcPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCobrancaAddPuntoVenta_id()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java b/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java index c25e99f06..1a28ebb08 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java @@ -14,11 +14,17 @@ 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.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "CoeficienteTarifa", tela = "Alteração de Coeficiente Tarifario") @Entity @SequenceGenerator(name = "COEFICIENTE_TARIFA_SEQ", sequenceName = "COEFICIENTE_TARIFA_SEQ", allocationSize = 1) @Table(name = "COEFICIENTE_TARIFA") -public class CoeficienteTarifa implements Serializable { +public class CoeficienteTarifa implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -37,6 +43,10 @@ public class CoeficienteTarifa implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Transient + @NaoAuditar + private CoeficienteTarifa coeficienteTarifaClone; public Integer getCoeficienteId() { return coeficienteId; @@ -85,6 +95,23 @@ public class CoeficienteTarifa implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + @Override + public CoeficienteTarifa getCloneObject() throws CloneNotSupportedException { + return coeficienteTarifaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCoeficienteId()); + } + + @Override + public void clonar() throws CloneNotSupportedException { + coeficienteTarifaClone = new CoeficienteTarifa(); + coeficienteTarifaClone = (CoeficienteTarifa) this.clone(); + + } @Override public String toString() { diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java index c9665c24a..18a9b4a22 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java @@ -24,11 +24,16 @@ 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.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; @Entity @SequenceGenerator(name = "EMPRESA_IMPOSTO_SEQ", sequenceName = "EMPRESA_IMPOSTO_SEQ", allocationSize = 1) @Table(name = "EMPRESA_IMPOSTO") -public class EmpresaImposto implements Serializable { +public class EmpresaImposto implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -161,9 +166,13 @@ public class EmpresaImposto implements Serializable { @Column(name = "PORCFECP") private BigDecimal porcFECP; + @Transient + private EmpresaImposto empresaImpostoClone; + @OneToMany(mappedBy = "empresaImposto", cascade = CascadeType.ALL, orphanRemoval=true) + @NaoAuditar private List lsAliquotaEstadoDestino; @@ -819,4 +828,23 @@ public class EmpresaImposto implements Serializable { public void setLsAliquotaEstadoDestino(List lsAliquotaEstadoDestino) { this.lsAliquotaEstadoDestino = lsAliquotaEstadoDestino; } + + @Override + public void clonar() throws CloneNotSupportedException { + + empresaImpostoClone = new EmpresaImposto(); + empresaImpostoClone = (EmpresaImposto) this.clone(); + + + } + + @Override + public EmpresaImposto getCloneObject() throws CloneNotSupportedException { + return empresaImpostoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getEmpresaImpostoId()); + } } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java index b1cf6508f..d1f462dd8 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java @@ -14,10 +14,16 @@ 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.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "FechamentoParamptovta", tela = "Alteração de Ponto de Venda/Fechamento Conta Corrente") @Entity @Table(name = "FECHAMENTO_PARAMPTOVTA") -public class FechamentoParamptovta implements Serializable { +public class FechamentoParamptovta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -30,6 +36,9 @@ public class FechamentoParamptovta implements Serializable { private Boolean activo; private Integer diasemtransito; private String tipopagamento; + @Transient + @NaoAuditar + private FechamentoParamptovta fechamentoParamptovtaClone; public FechamentoParamptovta() { } @@ -146,7 +155,20 @@ public class FechamentoParamptovta implements Serializable { this.tipopagamento = tipopagamento; } + public void clonar() throws CloneNotSupportedException { + fechamentoParamptovtaClone = new FechamentoParamptovta(); + fechamentoParamptovtaClone = (FechamentoParamptovta) this.clone(); + + } + @Transient + public FechamentoParamptovta getCloneObject() throws CloneNotSupportedException { + return fechamentoParamptovtaClone; + } + @Transient + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getFechamentoparamptovtaId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java index 32ef4d739..9a4b5d103 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java @@ -21,20 +21,26 @@ 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 com.rjconsultores.ventaboletos.enums.TipoCarteiraDigital; import com.rjconsultores.ventaboletos.enums.TipoFormapago; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Administrador */ +@AuditarClasse(nome = "Forma Pagamento", tela = "Forma Pagamento") @Entity @SequenceGenerator(name = "FORMA_PAGO_SEQ", sequenceName = "FORMA_PAGO_SEQ", allocationSize = 1) @Table(name = "FORMA_PAGO") -public class FormaPago implements Serializable { +public class FormaPago implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -61,8 +67,10 @@ public class FormaPago implements Serializable { private String cvePago; @Column(name = "IMPFISCAL") private Boolean impfiscal; + @NaoAuditar @OneToMany(mappedBy = "formaPago") private List configRestriccionPagoList; + @NaoAuditar @OneToMany(mappedBy = "formaPago") private List pricingFormapagoList; @Column(name = "INDCONFERENCIAFISICACOMISSAO") @@ -90,6 +98,10 @@ public class FormaPago implements Serializable { @Column(name = "TIPOEVENTOEXTRA_ID") private Long tipoEventoExtraId; + @Transient + @NaoAuditar + private FormaPago formaPagoClone; + public FormaPago() { super(); } @@ -312,4 +324,22 @@ public class FormaPago implements Serializable { public void setTipoEventoExtraId(Long tipoEventoExtraId) { this.tipoEventoExtraId = tipoEventoExtraId; } + + @Override + public FormaPago getCloneObject() throws CloneNotSupportedException { + return formaPagoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getFormapagoId()); + } + + @Override + public void clonar() throws CloneNotSupportedException { + formaPagoClone = new FormaPago(); + formaPagoClone = (FormaPago) this.clone(); + + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java b/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java index 893b1f596..ed1073907 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java @@ -21,15 +21,23 @@ 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; /** * * @author Administrador */ +@AuditarClasse(nome = "FormaPagoDet", tela = "Alteração de Forma Pago Detalhe Ponto de Venda") @Entity @SequenceGenerator(name = "FORMA_PAGO_DET_SEQ", sequenceName = "FORMA_PAGO_DET_SEQ", allocationSize = 1) @Table(name = "FORMA_PAGO_DET") -public class FormaPagoDet implements Serializable { +public class FormaPagoDet implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -60,6 +68,9 @@ public class FormaPagoDet implements Serializable { private Boolean indTotalBus; @Column(name = "INDEMBARCADA") private Boolean indEmbarcada; + @Transient + @NaoAuditar + private FormaPagoDet formaPagoDetClone; public FormaPagoDet() { } @@ -179,5 +190,23 @@ public class FormaPagoDet implements Serializable { public void setIndEmbarcada(Boolean indEmbarcada) { this.indEmbarcada = indEmbarcada; } + + @Override + public void clonar() throws CloneNotSupportedException { + formaPagoDetClone = new FormaPagoDet(); + formaPagoDetClone = (FormaPagoDet) this.clone(); + Hibernate.initialize(formaPagoDetClone.getPuntoVenta()); + + } + + @Override + public FormaPagoDet getCloneObject() throws CloneNotSupportedException { + return formaPagoDetClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getFormapagodetId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java index be00c9e1a..55e2f9e89 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java @@ -15,11 +15,19 @@ 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 = "HistoricoPuntoVenta", tela = "Alteração Ponto de Venda/Historico") @Entity @SequenceGenerator(name = "HIST_PUNTOVENTA_SEQ", sequenceName = "HIST_PUNTOVENTA_SEQ", allocationSize = 1) @Table(name = "HIST_PUNTOVENTA") -public class HistoricoPuntoVenta implements Serializable { +public class HistoricoPuntoVenta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -35,6 +43,7 @@ public class HistoricoPuntoVenta implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date fecBloqueio; + @NaoAuditar @ManyToOne @JoinColumn(name = "PUNTOVENTA_ID") private PuntoVenta puntoVenta; @@ -49,6 +58,10 @@ public class HistoricoPuntoVenta implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + @Transient + @NaoAuditar + private HistoricoPuntoVenta historicoPuntoVentaClone; + public Integer getHistoricoPuntoVentaId() { return historicoPuntoVentaId; } @@ -105,6 +118,24 @@ public class HistoricoPuntoVenta implements Serializable { this.usuarioId = usuarioId; } + @Override + public void clonar() throws CloneNotSupportedException { + historicoPuntoVentaClone = new HistoricoPuntoVenta(); + historicoPuntoVentaClone = (HistoricoPuntoVenta) this.clone(); + Hibernate.initialize(historicoPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public HistoricoPuntoVenta getCloneObject() throws CloneNotSupportedException { + return historicoPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getHistoricoPuntoVentaId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java index 6e9310aa0..b8bd2884c 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java @@ -16,11 +16,19 @@ 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 = "ORGAO_CANCELACION", tela = "Alteração de Orgao Cancelamento") @Entity @Table(name = "ORGAO_CANCELACION") @SequenceGenerator(name = "ORGAO_CANCELACION_SEQ", sequenceName = "ORGAO_CANCELACION_SEQ", allocationSize = 1) -public class OrgaoCancelacion implements Serializable { +public class OrgaoCancelacion implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -108,6 +116,10 @@ public class OrgaoCancelacion implements Serializable { @Column(name = "INDBLOQUEIOREMARCADO") private Boolean indBloqueioRemarcado; + + @Transient + @NaoAuditar + private OrgaoCancelacion orgaoCancelacionClone; public Integer getOrgaoCancelacionId() { return orgaoCancelacionId; @@ -364,6 +376,22 @@ public class OrgaoCancelacion implements Serializable { public void setIndBloqueioRemarcado(Boolean indBloqueioRemarcado) { this.indBloqueioRemarcado = indBloqueioRemarcado; + } + @Override + public void clonar() throws CloneNotSupportedException { + + orgaoCancelacionClone = new OrgaoCancelacion(); + orgaoCancelacionClone = (OrgaoCancelacion) this.clone(); + Hibernate.initialize(orgaoCancelacionClone.getOrgao()); + + } + @Override + public OrgaoCancelacion getCloneObject() throws CloneNotSupportedException { + return orgaoCancelacionClone; + } + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getOrgaoCancelacionId()); } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java index 382e68628..d81f2ffb0 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java @@ -20,23 +20,34 @@ 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.hibernate.annotations.Where; +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.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "OrgaoConcedente", tela = "Alteração de Orgao Concedente") @Entity @SequenceGenerator(name = "ORGAO_CONCEDENTE_SEQ", sequenceName = "ORGAO_CONCEDENTE_SEQ", allocationSize = 1) @Table(name = "ORGAO_CONCEDENTE") -public class OrgaoConcedente implements Serializable { +public class OrgaoConcedente implements Serializable, Auditavel { private static final long serialVersionUID = 1L; public final static Integer CODIGO_ARTESP = 21; public final static Integer CODIGO_ANTT = 3; + @AuditarID @Id @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_CONCEDENTE_SEQ") @Column(name = "ORGAOCONCEDENTE_ID") private Integer orgaoConcedenteId; + @AuditarAtributo(nome = "DESC ORGAO") @Column(name = "DESCORGAO") private String descOrgao; @Column(name = "INDDEFAULTSEGURO") @@ -50,14 +61,18 @@ public class OrgaoConcedente implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") private Integer usuarioId; + @AuditarLista(auditarEntidades = true, nome = "CategoriaOrgao") @OneToMany(mappedBy = "orgao") private List categoriaOrgaoList; @Column(name = "INDNOMDOCOBLIGATORIO") private Boolean indNomDocObligatorio; + @AuditarLista(auditarEntidades = true, nome = "OrgaoCancelacion") @OneToMany(mappedBy = "orgao") private List orgaoCancelacionList; + @AuditarAtributo(nome = "INDICE PEDADIO") @Column(name = "INDICEPEAJE") private BigDecimal indicePeaje; + @AuditarAtributo(nome = "Idade Idoso") @Column(name = "IDADE_IDOSO") private Integer idadeIdoso; @Column(name = "IDADE_MINIMA") @@ -75,8 +90,10 @@ public class OrgaoConcedente implements Serializable { private Boolean indValDocObligatorioEmbarcada; @OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL) + @NaoAuditar private List classesIndicePeaje; + @AuditarLista(auditarEntidades = true, nome = "OrgaoEmpParam") @OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL) @Where(clause = "activo=1") private List orgaoEmpParams; @@ -92,6 +109,10 @@ public class OrgaoConcedente implements Serializable { @Column(name = "TAXA_CONVENIENCIA_SVI") private BigDecimal taxaConvenienciaSVI; + + @Transient + @NaoAuditar + private OrgaoConcedente orgaoConcedenteClone; public void addParametro(OrgaoCancelacion param) { this.orgaoCancelacionList.add(param); @@ -329,4 +350,43 @@ public class OrgaoConcedente implements Serializable { public void setTaxaConvenienciaSVI(BigDecimal taxaConvenienciaSVI) { this.taxaConvenienciaSVI = taxaConvenienciaSVI; } + + @Override + public void clonar() throws CloneNotSupportedException { + + orgaoConcedenteClone = new OrgaoConcedente(); + orgaoConcedenteClone = (OrgaoConcedente) this.clone(); + + if(this.getCategoriaOrgaoList() != null) { + List lsClones = new ArrayList(); + for (CategoriaOrgao categoriaOrgao : this.getCategoriaOrgaoList()) { + if(BooleanUtils.isTrue(categoriaOrgao.getActivo())) { + categoriaOrgao.clonar(); + lsClones.add(categoriaOrgao.getCloneObject()); + } + } + orgaoConcedenteClone.setCategoriaOrgaoList(lsClones); + } + + if(this.getOrgaoCancelacionList() != null) { + List lsClones = new ArrayList(); + for (OrgaoCancelacion orgaoCancelacion : this.getOrgaoCancelacionList()) { + if(BooleanUtils.isTrue(orgaoCancelacion.getActivo())) { + orgaoCancelacion.clonar(); + lsClones.add(orgaoCancelacion.getCloneObject()); + } + } + orgaoConcedenteClone.setOrgaoCancelacionList(lsClones); + } + } + + @Override + public OrgaoConcedente getCloneObject() throws CloneNotSupportedException { + return orgaoConcedenteClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getOrgaoConcedenteId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java index 20596d9c0..5bc850b39 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java @@ -15,11 +15,18 @@ 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 = "OrgaoEmpParam", tela = "Alteração de Orgao Empresa Parametro") @Entity @SequenceGenerator(name = "ORGAO_EMP_PARAM_SEQ", sequenceName = "ORGAO_EMP_PARAM_SEQ", allocationSize = 1) @Table(name = "ORGAO_EMP_PARAM") -public class OrgaoEmpParam implements Serializable { +public class OrgaoEmpParam implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -59,6 +66,10 @@ public class OrgaoEmpParam implements Serializable { @Column(name = "CODEMPRESAPORORGAO", length=30) private String codEmpresaPorOrgao; + @Transient + @NaoAuditar + private OrgaoEmpParam orgaoEmpParamClone; + public String getCodEmpresaPorOrgao() { return codEmpresaPorOrgao; } @@ -139,6 +150,23 @@ public class OrgaoEmpParam implements Serializable { this.indNaoRestringe2ViaBPe = indNaoRestringe2ViaBPe; } + @Override + public void clonar() throws CloneNotSupportedException { + orgaoEmpParamClone = new OrgaoEmpParam(); + orgaoEmpParamClone = (OrgaoEmpParam) this.clone(); + Hibernate.initialize(orgaoEmpParamClone.getOrgaoConcedente()); + } + + @Override + public OrgaoEmpParam getCloneObject() throws CloneNotSupportedException { + return orgaoEmpParamClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getOrgaoempparamId()); + } + @Override public int hashCode() { final int prime = 31; diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java b/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java index 08a6a6d80..b2abf64a0 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java @@ -19,15 +19,23 @@ 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; /** * * @author Desenvolvimento */ +@AuditarClasse(nome = "ParamRecoleccion", tela = "Alteração de Param Coleccion Pnoto de Venda") @Entity @SequenceGenerator(name = "PARAM_RECOLECCION_SEQ", sequenceName = "PARAM_RECOLECCION_SEQ", allocationSize = 1) @Table(name = "PARAM_RECOLECCION") -public class ParamRecoleccion implements Serializable { +public class ParamRecoleccion implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -49,6 +57,10 @@ public class ParamRecoleccion implements Serializable { @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoVenta; + @Transient + @NaoAuditar + private ParamRecoleccion paramRecoleccionClone; + public ParamRecoleccion() { } @@ -137,4 +149,23 @@ public class ParamRecoleccion implements Serializable { public String toString() { return "com.rjconsultores.ventaboletos.entidad.ParamRecoleccion[paramrecoleccionId=" + paramrecoleccionId + "]"; } + + @Override + public void clonar() throws CloneNotSupportedException { + + paramRecoleccionClone = new ParamRecoleccion(); + paramRecoleccionClone = (ParamRecoleccion) this.clone(); + Hibernate.initialize(paramRecoleccionClone.getPuntoVenta()); + + } + + @Override + public ParamRecoleccion getCloneObject() throws CloneNotSupportedException { + return paramRecoleccionClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getParamrecoleccionId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java index 632948295..a70d68055 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java @@ -20,15 +20,23 @@ 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; /** * * @author RJ */ +@AuditarClasse(nome = "PtoVtaCheckin", tela = "Alteração de Localidades/Permitidas/Checkin Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_CHECKIN_SEQ", sequenceName = "PTOVTA_CHECKIN_SEQ", allocationSize = 1) @Table(name = "PTOVTA_CHECKIN") -public class PtoVtaCheckin implements Serializable { +public class PtoVtaCheckin implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -54,6 +62,10 @@ public class PtoVtaCheckin implements Serializable { @Column(name = "USUARIO_ID") private int usuarioId; + + @Transient + @NaoAuditar + private PtoVtaCheckin ptoVtaCheckinClone; public PtoVtaCheckin() { } @@ -110,6 +122,24 @@ public class PtoVtaCheckin implements Serializable { this.usuarioId = usuarioId; } + @Override + public void clonar() throws CloneNotSupportedException { + ptoVtaCheckinClone = new PtoVtaCheckin(); + ptoVtaCheckinClone = (PtoVtaCheckin) this.clone(); + Hibernate.initialize(ptoVtaCheckinClone.getPuntoventaId()); + + } + + @Override + public PtoVtaCheckin getCloneObject() throws CloneNotSupportedException { + return ptoVtaCheckinClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtoVtaCheckinId()); + } + @Override public int hashCode() { int hash = 0; diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java index 3473fb961..5dc946e4f 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java @@ -19,15 +19,23 @@ 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; /** * * @author RJ */ +@AuditarClasse(nome = "PtoVtaSeguro", tela = "Alteração de Seguro no Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_SEGURO_SEQ", sequenceName = "PTOVTA_SEGURO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_SEGURO") -public class PtoVtaSeguro implements Serializable { +public class PtoVtaSeguro implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -100,6 +108,10 @@ public class PtoVtaSeguro implements Serializable { @Column(name = "INDTAXAEMBARQUEEMBARCADA") private Boolean indTaxaEmbarqueEmbarcada; + @Transient + @NaoAuditar + private PtoVtaSeguro ptoVtaSeguroClone; + public PtoVtaSeguro() { } @@ -267,4 +279,24 @@ public class PtoVtaSeguro implements Serializable { public void setIndTaxaEmbarqueEmbarcada(Boolean indTaxaEmbarqueEmbarcada) { this.indTaxaEmbarqueEmbarcada = indTaxaEmbarqueEmbarcada; } + + @Override + public void clonar() throws CloneNotSupportedException { + + ptoVtaSeguroClone = new PtoVtaSeguro(); + ptoVtaSeguroClone = (PtoVtaSeguro) this.clone(); + Hibernate.initialize(ptoVtaSeguroClone.getPuntoventaId()); + + } + + @Override + public PtoVtaSeguro getCloneObject() throws CloneNotSupportedException { + return ptoVtaSeguroClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtoVtaSeguroId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java index faea97fa4..9c9411c5e 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java @@ -17,14 +17,22 @@ import javax.persistence.ManyToOne; 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; /** * * @author Desenvolvimento */ +@AuditarClasse(nome = "PtoVtaUsuarioBancario", tela = "Alteração Ponto de Venda/Usuario Bancario") @Entity @Table(name = "PTOVTA_USUARIO_BANCARIO") -public class PtoVtaUsuarioBancario implements Serializable { +public class PtoVtaUsuarioBancario implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -48,6 +56,10 @@ public class PtoVtaUsuarioBancario implements Serializable { @JoinColumn(name = "USUARIOBANCARIO_ID", referencedColumnName = "USUARIOBANCARIO_ID") @ManyToOne private UsuarioBancario usuarioBancario; + + @Transient + @NaoAuditar + private PtoVtaUsuarioBancario ptoVtaUsuarioBancarioClone; public PtoVtaUsuarioBancario() { } @@ -107,6 +119,24 @@ public class PtoVtaUsuarioBancario implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptoVtaUsuarioBancarioClone = new PtoVtaUsuarioBancario(); + ptoVtaUsuarioBancarioClone = (PtoVtaUsuarioBancario) this.clone(); + Hibernate.initialize(ptoVtaUsuarioBancarioClone.getPuntoVenta()); + + } + + @Override + public PtoVtaUsuarioBancario getCloneObject() throws CloneNotSupportedException { + return ptoVtaUsuarioBancarioClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaUsuarioBancarioID()); + } @Override public boolean equals(Object obj) { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java index 2761eff60..374393731 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java @@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; + import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; @@ -15,22 +16,28 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; 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; /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaAntecipacomissao", tela = "Alteração Ponto de Venda/Antecipação Comissão") @Entity @SequenceGenerator(name = "PTOVTA_ANTECIPACOMISSAO_SEQ", sequenceName = "PTOVTA_ANTECIPACOMISSAO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_ANTECIPACOMISSAO") -public class PtovtaAntecipacomissao implements Serializable { +public class PtovtaAntecipacomissao implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -61,6 +68,10 @@ public class PtovtaAntecipacomissao implements Serializable { @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoventaId; + + @Transient + @NaoAuditar + private PtovtaAntecipacomissao ptovtaAntecipacomissaoClone; public PtovtaAntecipacomissao() { } @@ -151,6 +162,24 @@ public class PtovtaAntecipacomissao implements Serializable { hash += (ptovtaAntecipaComissaoId != null ? ptovtaAntecipaComissaoId.hashCode() : 0); return hash; } + + @Override + public void clonar() throws CloneNotSupportedException { + + ptovtaAntecipacomissaoClone = new PtovtaAntecipacomissao(); + ptovtaAntecipacomissaoClone = (PtovtaAntecipacomissao) this.clone(); + Hibernate.initialize(ptovtaAntecipacomissaoClone.getPuntoventaId()); + } + + @Override + public PtovtaAntecipacomissao getCloneObject() throws CloneNotSupportedException { + return ptovtaAntecipacomissaoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaAntecipaComissaoId()); + } @Override public boolean equals(Object object) { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java index b24dfce2f..354aac729 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java @@ -17,16 +17,24 @@ 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 com.rjconsultores.ventaboletos.enums.TipoAntifraude; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * @author Wilian */ +@AuditarClasse(nome = "PtovtaAntifraude", tela = "Alteração Ponto de Venda/Antifraude") @Entity @SequenceGenerator(name = "PTOVTA_ANTIFRAUDE_SEQ", sequenceName = "PTOVTA_ANTIFRAUDE_SEQ", allocationSize = 1) @Table(name = "PTOVTA_ANTIFRAUDE") -public class PtovtaAntifraude implements Serializable { +public class PtovtaAntifraude implements Serializable , Auditavel { private static final long serialVersionUID = 1L; @@ -60,6 +68,10 @@ public class PtovtaAntifraude implements Serializable { @Column(name = "USUARIO_ID") private int usuarioId; + + @Transient + @NaoAuditar + private PtovtaAntifraude ptovtaAntifraudeClone; public PtovtaAntifraude() { super(); @@ -159,5 +171,24 @@ public class PtovtaAntifraude implements Serializable { return false; return true; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaAntifraudeClone = new PtovtaAntifraude(); + ptovtaAntifraudeClone = (PtovtaAntifraude) this.clone(); + Hibernate.initialize(ptovtaAntifraudeClone.getPuntoventa()); + + } + + @Override + public PtovtaAntifraude getCloneObject() throws CloneNotSupportedException { + return ptovtaAntifraudeClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaAntifraudeId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java index 0c2a5cc32..0b09b8ab5 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java @@ -15,11 +15,19 @@ 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 = "Alteração de Categoria Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_CAT_IND_SEQ", sequenceName = "PTOVTA_CAT_IND_SEQ", allocationSize = 1) @Table(name = "PTOVTA_CAT_IND") -public class PtovtaCatInd implements Serializable { +public class PtovtaCatInd implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -50,6 +58,10 @@ public class PtovtaCatInd implements Serializable { private Boolean indTotalBus; @Column(name = "INDEMBARCADA") private Boolean indEmbarcada; + + @Transient + @NaoAuditar + private PtovtaCatInd ptovtaCatIndConcedente; public Integer getPtovtaCategoriaId() { return ptovtaCategoriaId; @@ -133,6 +145,24 @@ public class PtovtaCatInd implements Serializable { 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() { + return String.format("ID [%s]", getPtovtaCategoriaId()); + } + @Override public int hashCode() { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java index 6cd9a2b60..d138b008f 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java @@ -23,17 +23,25 @@ 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 com.rjconsultores.ventaboletos.enums.ModeloComissaoImpressaoPosterior; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaComissao", tela = "Alteração Ponto Veda/Comissão") @Entity @SequenceGenerator(name = "PTOVTA_COMISSAO_SEQ", sequenceName = "PTOVTA_COMISSAO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_COMISSAO") -public class PtovtaComissao implements Serializable { +public class PtovtaComissao implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -163,11 +171,15 @@ public class PtovtaComissao implements Serializable { @Column(name = "SEGUROOBRIGATORIOBAIXA") private BigDecimal seguroobrigatorioBaixa; - @Column(name = "RECARGACELULARALTA") - private BigDecimal recargaCelularAlta; - - @Column(name = "RECARGACELULARBAIXA") - private BigDecimal recargaCelularBaixa; +// @Column(name = "RECARGACELULARALTA") +// private BigDecimal recargaCelularAlta; +// +// @Column(name = "RECARGACELULARBAIXA") +// private BigDecimal recargaCelularBaixa; + + @Transient + @NaoAuditar + private PtovtaComissao ptovtaComissaoClone; public PtovtaComissao() { super(); @@ -605,19 +617,45 @@ public class PtovtaComissao implements Serializable { this.seguroobrigatorioBaixa = seguroobrigatorioBaixa; } - public BigDecimal getRecargaCelularAlta() { - return recargaCelularAlta; +// public BigDecimal getRecargaCelularAlta() { +// return recargaCelularAlta; +// } +// +// public void setRecargaCelularAlta(BigDecimal recargaCelularAlta) { +// this.recargaCelularAlta = recargaCelularAlta; +// } +// +// public BigDecimal getRecargaCelularBaixa() { +// return recargaCelularBaixa; +// } +// +// public void setRecargaCelularBaixa(BigDecimal recargaCelularBaixa) { +// this.recargaCelularBaixa = recargaCelularBaixa; +// } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaComissaoClone = new PtovtaComissao(); + ptovtaComissaoClone = (PtovtaComissao) this.clone(); + + if (this.getPuntoventaId() != null) { + if (BooleanUtils.isTrue(getPuntoventaId().getActivo())) { + getPuntoventaId().clonar(); + } + ptovtaComissaoClone.setPuntoventaId(getPuntoventaId()); + } + } - public void setRecargaCelularAlta(BigDecimal recargaCelularAlta) { - this.recargaCelularAlta = recargaCelularAlta; + @Override + public PtovtaComissao getCloneObject() throws CloneNotSupportedException { + return ptovtaComissaoClone; } - public BigDecimal getRecargaCelularBaixa() { - return recargaCelularBaixa; + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaComissaoId()); } - public void setRecargaCelularBaixa(BigDecimal recargaCelularBaixa) { - this.recargaCelularBaixa = recargaCelularBaixa; - } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java index a2b9e67a9..0aedefef5 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java @@ -26,14 +26,21 @@ 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; + /** * * @author Desenvolvimento */ +@AuditarClasse(nome = "PtovtaEmpresa", tela = "Alteração Ponto de Venda/de Empresas/Venda") @Entity @SequenceGenerator(name = "PTOVTA_EMPRESA_SEQ", sequenceName = "PTOVTA_EMPRESA_SEQ", allocationSize = 1) @Table(name = "PTOVTA_EMPRESA") -public class PtovtaEmpresa implements Serializable { +public class PtovtaEmpresa implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @@ -73,6 +80,7 @@ public class PtovtaEmpresa implements Serializable { @Column(name = "NUMSITEF") private String numeroSitef; + @NaoAuditar @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PTOVTAEMPRESA_ID", referencedColumnName = "PTOVTAEMPRESA_ID") private List lsPtovtaEmpresaContaBancaria; @@ -84,9 +92,14 @@ public class PtovtaEmpresa implements Serializable { @Column(name = "INDIMPCOMPCARTAO") private Boolean indImpCompCartao; + @NaoAuditar @Transient private List contasBancaria; + @Transient + @NaoAuditar + private PtovtaEmpresa ptovtaEmpresaClone; + public PtovtaEmpresa() { } @@ -238,6 +251,24 @@ public class PtovtaEmpresa implements Serializable { return null; } + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaEmpresaClone = new PtovtaEmpresa(); + ptovtaEmpresaClone = (PtovtaEmpresa) this.clone(); + Hibernate.initialize(ptovtaEmpresaClone.getPuntoVenta()); + + } + + @Override + public PtovtaEmpresa getCloneObject() throws CloneNotSupportedException { + return ptovtaEmpresaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaempresaId()); + } + @Override public int hashCode() { final int prime = 31; diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java index e9fcac867..3924d7784 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java @@ -15,11 +15,19 @@ 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 = "PtovtaEmpresaBloqueada", tela = "Alteração Ponto de Venda/Empresa Bloqueada ") @Entity @SequenceGenerator(name = "PTOVTA_EMP_BLOQUEADA_SEQ", sequenceName = "PTOVTA_EMP_BLOQUEADA_SEQ", allocationSize = 1) @Table(name = "PTOVTA_EMP_BLOQUEADA") -public class PtovtaEmpresaBloqueada implements Serializable { +public class PtovtaEmpresaBloqueada implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -45,6 +53,10 @@ public class PtovtaEmpresaBloqueada implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Transient + @NaoAuditar + private PtovtaEmpresaBloqueada ptovtaEmpresaBloqueadaClone; public Integer getPtovtaempbloqueadaId() { return ptovtaempbloqueadaId; @@ -105,4 +117,22 @@ public class PtovtaEmpresaBloqueada implements Serializable { } return true; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaEmpresaBloqueadaClone = new PtovtaEmpresaBloqueada(); + ptovtaEmpresaBloqueadaClone = (PtovtaEmpresaBloqueada) this.clone(); + Hibernate.initialize(ptovtaEmpresaBloqueadaClone.getPuntoventaId()); + + } + + @Override + public PtovtaEmpresaBloqueada getCloneObject() throws CloneNotSupportedException { + return ptovtaEmpresaBloqueadaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaempbloqueadaId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java index cad5b11ad..030898493 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java @@ -5,10 +5,7 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Date; -import java.util.List; import javax.persistence.Basic; import javax.persistence.Column; @@ -18,22 +15,28 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; 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; /** * * @author Rafael */ +@AuditarClasse(nome = "PtoVtaUsuarioBancario", tela = "Alteração Estoque Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_ESTOQUE_SEQ ", sequenceName = "PTOVTA_ESTOQUE_SEQ ", allocationSize = 1) @Table(name = "PTOVTA_ESTOQUE") -public class PtovtaEstoque implements Serializable { +public class PtovtaEstoque implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -66,6 +69,10 @@ public class PtovtaEstoque implements Serializable { @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoventaId; + + @Transient + @NaoAuditar + private PtovtaEstoque ptovtaEstoqueClone; public PtovtaEstoque() { } @@ -215,4 +222,22 @@ public class PtovtaEstoque implements Serializable { return "com.rjconsultores.ventaboletos.entidad.PtovtaEstoque[ ptovtaEstoqueId=" + ptovtaEstoqueId + " ]"; } + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaEstoqueClone = new PtovtaEstoque(); + ptovtaEstoqueClone = (PtovtaEstoque) this.clone(); + Hibernate.initialize(ptovtaEstoqueClone.getPuntoventaId()); + + } + + @Override + public PtovtaEstoque getCloneObject() throws CloneNotSupportedException { + return ptovtaEstoqueClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaEstoqueId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java index 129547784..010c7b6bc 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java @@ -15,22 +15,28 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; 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; /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaHorario", tela = "Alteração Ponto Venda/Horario") @Entity @SequenceGenerator(name = "PTOVTA_HORARIO_SEQ", sequenceName = "PTOVTA_HORARIO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_HORARIO") -public class PtovtaHorario implements Serializable { +public class PtovtaHorario implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -56,10 +62,16 @@ public class PtovtaHorario implements Serializable { @Column(name = "USUARIO_ID") private int usuarioId; + + @NaoAuditar @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoventaId; + @Transient + @NaoAuditar + private PtovtaHorario ptovtaHorarioClone; + @Column(name = "INDLUNES") private Boolean indlunes; @Column(name = "INDMARTES") @@ -204,6 +216,24 @@ public class PtovtaHorario implements Serializable { public void setInddomingo(Boolean inddomingo) { this.inddomingo = inddomingo; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaHorarioClone = new PtovtaHorario(); + ptovtaHorarioClone = (PtovtaHorario) this.clone(); + Hibernate.initialize(ptovtaHorarioClone.getPuntoventaId()); + + } + + @Override + public PtovtaHorario getCloneObject() throws CloneNotSupportedException { + return ptovtaHorarioClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaHorarioId()); + } @Override public int hashCode() { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java index 4430adbe6..78e08dd18 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java @@ -5,6 +5,7 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -15,25 +16,31 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; import javax.persistence.Lob; -import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; import javax.persistence.OneToMany; 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 br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaTitular", tela = "Alteração Ponto Veda/Titular/Foto") @Entity @Table(name = "PTOVTA_TITULAR") @SequenceGenerator(name = "PTOVTA_TITULAR_SEQ ", sequenceName = "PTOVTA_TITULAR_SEQ ", allocationSize = 1) -public class PtovtaTitular implements Serializable { +public class PtovtaTitular implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -41,6 +48,7 @@ public class PtovtaTitular implements Serializable { @Column(name = "PTOVTATITULAR_ID") private Integer ptovtaTitularId; + @AuditarAtributo(nome = "NOME TITULAR/FOTO") @Column(name = "NOME") private String nome; @@ -65,9 +73,15 @@ public class PtovtaTitular implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") - private int usuarioId; + private int usuarioId; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "titularId") private List puntoVentaList; + + @Transient + @NaoAuditar + private PtovtaTitular ptovtaTitularClone; public PtovtaTitular() { } @@ -195,4 +209,33 @@ public class PtovtaTitular implements Serializable { return "com.rjconsultores.ventaboletos.entidad.PtovtaTitular[ ptovtaTitularId=" + ptovtaTitularId + " ]"; } + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaTitularClone = new PtovtaTitular(); + ptovtaTitularClone = (PtovtaTitular) this.clone(); + + if(this.getPuntoVentaList() != null) { + List lsClones = new ArrayList(); + for (PuntoVenta puntoVenta : this.getPuntoVentaList()) { + if(BooleanUtils.isTrue(puntoVenta.getActivo())) { + puntoVenta.clonar(); + lsClones.add(puntoVenta.getCloneObject()); + } + } + ptovtaTitularClone.setPuntoVentaList(lsClones); + } + + } + + @Override + public PtovtaTitular getCloneObject() throws CloneNotSupportedException { + return ptovtaTitularClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaTitularId()); + } + + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java index 2afd57bcb..ef36ca540 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java @@ -17,126 +17,160 @@ import javax.persistence.ManyToOne; 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; + import javax.persistence.SequenceGenerator; /** * * @author Rafius */ + +@AuditarClasse(nome = "ReservacionPuntoVenta", tela = "Alteração de Reserva Punto Venta") @Entity -@SequenceGenerator(name = "RESERVACION_PUNTOVENTA_SEQ", sequenceName = "RESERVACION_PUNTOVENTA_SEQ", allocationSize=1) +@SequenceGenerator(name = "RESERVACION_PUNTOVENTA_SEQ", sequenceName = "RESERVACION_PUNTOVENTA_SEQ", allocationSize = 1) @Table(name = "RESERVACION_PUNTOVENTA") -public class ReservacionPuntoVenta implements Serializable { +public class ReservacionPuntoVenta implements Serializable, Auditavel { - private static final long serialVersionUID = 1L; - @Id - @Basic(optional = false) - @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_PUNTOVENTA_SEQ") - @Column(name = "RESERVACIONPTOVTA_ID") - private Integer reservacionptovtaId; - @Column(name = "ACTIVO") - private Boolean activo; - @Column(name = "FECMODIF") - @Temporal(TemporalType.TIMESTAMP) - private Date fecmodif; - @Column(name = "USUARIO_ID") - private Integer usuarioId; - @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") - @ManyToOne - private ReservacionCtrl reservacionCtrl; - @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") - @ManyToOne - private PuntoVenta puntoVenta; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_PUNTOVENTA_SEQ") + @Column(name = "RESERVACIONPTOVTA_ID") + private Integer reservacionptovtaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; - public ReservacionPuntoVenta() { - } + @NaoAuditar + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") - public ReservacionPuntoVenta(Integer reservacionptovtaId) { - this.reservacionptovtaId = reservacionptovtaId; - } + @NaoAuditar + @ManyToOne + private PuntoVenta puntoVenta; - public Integer getReservacionptovtaId() { - return reservacionptovtaId; - } + @Transient + @NaoAuditar + private ReservacionPuntoVenta reservacionPuntoVentaClone; - public void setReservacionptovtaId(Integer reservacionptovtaId) { - this.reservacionptovtaId = reservacionptovtaId; - } + public ReservacionPuntoVenta() { + } - public Boolean getActivo() { - return activo; - } + public ReservacionPuntoVenta(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } - public void setActivo(Boolean activo) { - this.activo = activo; - } + public Integer getReservacionptovtaId() { + return reservacionptovtaId; + } - public Date getFecmodif() { - return fecmodif; - } + public void setReservacionptovtaId(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } - public void setFecmodif(Date fecmodif) { - this.fecmodif = fecmodif; - } + public Boolean getActivo() { + return activo; + } - public Integer getUsuarioId() { - return usuarioId; - } + public void setActivo(Boolean activo) { + this.activo = activo; + } - public void setUsuarioId(Integer usuarioId) { - this.usuarioId = usuarioId; - } + public Date getFecmodif() { + return fecmodif; + } - public ReservacionCtrl getReservacionCtrl() { - return reservacionCtrl; - } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } - public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { - this.reservacionCtrl = reservacionCtrl; - } + public Integer getUsuarioId() { + return usuarioId; + } - public PuntoVenta getPuntoVenta() { - return puntoVenta; - } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } - public void setPuntoVenta(PuntoVenta puntoVenta) { - this.puntoVenta = puntoVenta; - } + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final ReservacionPuntoVenta other = (ReservacionPuntoVenta) obj; - if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { - return false; - } - if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { - return false; - } - if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { - return false; - } - return true; - } + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.activo != null ? this.activo.hashCode() : 0); - hash = 79 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); - hash = 79 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); - return hash; - } + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } - + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } - @Override - public String toString() { - return "com.rjconsultores.ventaboletos.entidad.ReservacionPuntoventa[reservacionptovtaId=" + reservacionptovtaId + "]"; - } + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionPuntoVenta other = (ReservacionPuntoVenta) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 79 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 79 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionPuntoventa[reservacionptovtaId=" + reservacionptovtaId + "]"; + } + + @Override + public void clonar() throws CloneNotSupportedException { + reservacionPuntoVentaClone = new ReservacionPuntoVenta(); + reservacionPuntoVentaClone = (ReservacionPuntoVenta) this.clone(); + Hibernate.initialize(reservacionPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public ReservacionPuntoVenta getCloneObject() throws CloneNotSupportedException { + return reservacionPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getReservacionptovtaId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java index 1eab69bd2..f2a8b94c5 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java @@ -3,6 +3,7 @@ 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; @@ -10,7 +11,11 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.CoeficienteTarifaDAO; import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -21,13 +26,26 @@ public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { private CoeficienteTarifaDAO coeficienteTarifaDAO; @Autowired private OrgaoTramoDAO orgaoTramoDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(OrgaoConcedenteServiceImpl.class); + public List obtenerTodos() { return coeficienteTarifaDAO.obtenerTodos(); } public CoeficienteTarifa obtenerID(Integer id) { - return coeficienteTarifaDAO.obtenerID(id); + + CoeficienteTarifa coeficienteTarifa = coeficienteTarifaDAO.obtenerID(id); + + try { + coeficienteTarifa.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return coeficienteTarifa; + } @Transactional @@ -36,16 +54,33 @@ public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - return coeficienteTarifaDAO.suscribir(entidad); + + entidad = coeficienteTarifaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + return entidad; } @Transactional public CoeficienteTarifa actualizacion(CoeficienteTarifa entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + + + try { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + CoeficienteTarifa originalClone = entidad.getCloneObject(); + entidad = coeficienteTarifaDAO.actualizacion(entidad); + + logAuditoriaService.auditar(originalClone, entidad, null); - return coeficienteTarifaDAO.actualizacion(entidad); + + } catch (Exception e) { + log.error(e); + } + + return entidad; } @Transactional @@ -62,8 +97,9 @@ public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.FALSE); - - coeficienteTarifaDAO.actualizacion(entidad); + + entidad = coeficienteTarifaDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, null); } public List buscar(String nomb) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java index ff4ba511f..0dd8eda14 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java @@ -7,6 +7,8 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Calendar; import java.util.List; +import org.apache.log4j.Logger; +import org.jfree.util.Log; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -21,9 +23,11 @@ import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.MarcaService; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -46,13 +50,25 @@ public class EmpresaServiceImpl implements EmpresaService { @Autowired private EsquemaCorridaDAO esquemaCorridaDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(EmpresaServiceImpl.class); + public List obtenerTodos() { return empresaDAO.obtenerTodos(); } public Empresa obtenerID(Integer id) { - return empresaDAO.obtenerID(id); + + Empresa empresa = empresaDAO.obtenerID(id); + try { + empresa.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return empresa; + } @Transactional @@ -69,11 +85,19 @@ public class EmpresaServiceImpl implements EmpresaService { if (entidad.getEmpresaId() == null) { entidad = empresaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + gerarMarca(entidad); } else { - entidad = empresaDAO.actualizacion(entidad); + try { + Empresa empresaClone = entidad.getCloneObject(); + entidad = empresaDAO.actualizacion(entidad); + logAuditoriaService.auditar(empresaClone, entidad, entidad.getEmpresaId()); + } catch (Exception e) { + log.error(e); + } } if (comEmpConferencia != null) { @@ -107,6 +131,8 @@ public class EmpresaServiceImpl implements EmpresaService { entidad.setActivo(Boolean.FALSE); empresaDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad,null); + } public List buscar(String nombempresa, Boolean indExterna, Short indTipo) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java index d1cc97a96..bcf699a29 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service.impl; 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; @@ -12,12 +13,17 @@ import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.service.FechamentoParamptovtaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; @Service("fechamentoParamptovtaService") public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaService { @Autowired private FechamentoParamptovtaDAO fechamentoParamptovtaDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(FechamentoParamptovtaServiceImpl.class); + @Override public List obtenerTodos() { @@ -26,26 +32,47 @@ public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaSe @Override public FechamentoParamptovta obtenerID(Long id) { - return fechamentoParamptovtaDAO.obtenerID(id); + + FechamentoParamptovta fechamentoParamptovta = fechamentoParamptovtaDAO.obtenerID(id); + try { + fechamentoParamptovta.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return fechamentoParamptovta; + } @Override @Transactional public FechamentoParamptovta suscribir(FechamentoParamptovta entidad) { - return fechamentoParamptovtaDAO.suscribir(entidad); + + fechamentoParamptovtaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + return entidad; } @Override @Transactional public FechamentoParamptovta actualizacion(FechamentoParamptovta entidad) { entidad.setFecmodif(new Date()); - return fechamentoParamptovtaDAO.actualizacion(entidad); + FechamentoParamptovta originalClone = null; + try { + originalClone = entidad.getCloneObject(); + } catch (Exception e) { + log.error("",e); + } + fechamentoParamptovtaDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + return entidad; } @Override @Transactional public void borrar(FechamentoParamptovta entidad) { + fechamentoParamptovtaDAO.borrar(entidad); + logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java index 1dcce15a8..c398a7859 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java @@ -4,16 +4,22 @@ */ package com.rjconsultores.ventaboletos.service.impl; -import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; -import com.rjconsultores.ventaboletos.entidad.FormaPago; -import com.rjconsultores.ventaboletos.service.FormaPagoService; -import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import java.util.Calendar; import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.service.FormaPagoService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + /** * * @author Administrador @@ -25,13 +31,27 @@ public class FormaPagoServiceImpl implements FormaPagoService { @Autowired private FormaPagoDAO formaPagoDAO; + private static Logger log = LoggerFactory.getLogger(PuntoVentaServiceImpl.class); + @Autowired + private LogAuditoriaService logAuditoriaService; + public List obtenerTodos() { return formaPagoDAO.obtenerTodos(); } public FormaPago obtenerID(Short id) { - return formaPagoDAO.obtenerID(id); + + + FormaPago formaPago = formaPagoDAO.obtenerID(id); + + try { + formaPago.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return formaPago; + } @Transactional @@ -39,17 +59,32 @@ public class FormaPagoServiceImpl implements FormaPagoService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - - return formaPagoDAO.suscribir(entidad); + + + formaPagoDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + + return entidad; } @Transactional public FormaPago actualizacion(FormaPago entidad) { + + FormaPago originalClone = null; + try { + originalClone = entidad.getCloneObject(); + } catch (CloneNotSupportedException e) { + log.error(e.getMessage(), e); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - - return formaPagoDAO.actualizacion(entidad); + + formaPagoDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, -1); + + return entidad; } @Transactional @@ -59,6 +94,7 @@ public class FormaPagoServiceImpl implements FormaPagoService { entidad.setActivo(Boolean.FALSE); formaPagoDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, null); } public List buscarPorDescricao(String descpago) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java index 9c042ceb2..8d72ea323 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java @@ -214,9 +214,20 @@ public class ImportacaoClientesSrvpServiceImpl implements ImportacaoClientesSrvp Cell cell = cellIterator.next(); switch (cell.getColumnIndex()) { case 0: - cell.setCellType(Cell.CELL_TYPE_NUMERIC); try { - cliente.setNumfidelidade(new Long(Math.round(cell.getNumericCellValue())).toString()); + if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { + cliente.setNumfidelidade(new Long(Math.round(cell.getNumericCellValue())).toString()); + }else { + if(StringUtils.isNotBlank(cell.getStringCellValue())) { + try { + cliente.setNumfidelidade(new Long(cell.getStringCellValue().trim().replaceAll(" ","")).toString()); + }catch (NumberFormatException e) { + cliente.setTelefone(""); + erros.append(cliente.getNumfidelidade() + " - Numero de Telefone incorreto: " + cell.getStringCellValue().trim().replaceAll(" ","").toString()); + erros.append("\n"); + } + } + } }catch(Exception e) { log.error("Erro na gravação do registro. Favor revisar",e); } @@ -230,7 +241,7 @@ public class ImportacaoClientesSrvpServiceImpl implements ImportacaoClientesSrvp cliente.setTipodoc(cell.getStringCellValue()); break; case 3: - cell.setCellType(Cell.CELL_TYPE_NUMERIC); + cell.setCellType(Cell.CELL_TYPE_STRING); String numDocString = null; try { numDocString = new Long(Math.round(cell.getNumericCellValue())).toString(); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java index 846373d4e..b41760afd 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java @@ -3,12 +3,14 @@ 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.OrgaoConcedenteDAO; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -17,13 +19,24 @@ public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { @Autowired private OrgaoConcedenteDAO orgaoConcedenteDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(OrgaoConcedenteServiceImpl.class); public List obtenerTodos() { return orgaoConcedenteDAO.obtenerTodos(); } public OrgaoConcedente obtenerID(Integer id) { - return orgaoConcedenteDAO.obtenerID(id); + + OrgaoConcedente orgaoConcedente = orgaoConcedenteDAO.obtenerID(id); + try { + orgaoConcedente.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return orgaoConcedente; + } @Transactional @@ -31,17 +44,30 @@ public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - - return orgaoConcedenteDAO.suscribir(entidad); + + orgaoConcedenteDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + + return entidad; } @Transactional public OrgaoConcedente actualizacion(OrgaoConcedente entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + + try { + OrgaoConcedente originalClone = entidad.getCloneObject(); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - return orgaoConcedenteDAO.actualizacion(entidad); + entidad = orgaoConcedenteDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, null); + } catch (Exception e) { + log.error(e); + } + + return entidad; } @Transactional @@ -51,6 +77,8 @@ public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { entidad.setActivo(Boolean.FALSE); orgaoConcedenteDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, null); + } public List buscar(String desc) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java index a482cbd3e..ec7896eae 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java @@ -5,14 +5,18 @@ package com.rjconsultores.ventaboletos.service.impl; import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.PtovtaComissaoService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import java.util.Calendar; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,15 +28,26 @@ import org.springframework.transaction.annotation.Transactional; @Service("ptovtaComissaoService") public class PtovtaComissaoServiceImpl implements PtovtaComissaoService { + private static Logger log = LoggerFactory.getLogger(PtovtaComissaoServiceImpl.class); + @Autowired private PtovtaComissaoDAO ptovtaComissaoDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; public List obtenerTodos() { return ptovtaComissaoDAO.obtenerTodos(); } public PtovtaComissao obtenerID(Integer id) { - return ptovtaComissaoDAO.obtenerID(id); + + PtovtaComissao ptovtaComissao = ptovtaComissaoDAO.obtenerID(id); + try { + ptovtaComissao.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return ptovtaComissao; } @Transactional @@ -41,16 +56,35 @@ public class PtovtaComissaoServiceImpl implements PtovtaComissaoService { entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - return ptovtaComissaoDAO.suscribir(entidad); + ptovtaComissaoDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresaId() != null ? entidad.getEmpresaId().getEmpresaId() : null); + + return entidad; + + } @Transactional public PtovtaComissao actualizacion(PtovtaComissao entidad) { + + + PtovtaComissao originalClone = null; + try { + originalClone = entidad.getCloneObject(); + } catch (Exception e) { + log.error("",e); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); + + ptovtaComissaoDAO.actualizacion(entidad); + + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresaId() != null ? entidad.getEmpresaId().getEmpresaId() : null); + + return entidad; - return ptovtaComissaoDAO.actualizacion(entidad); } @Transactional diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java index 896f21fa1..4eaa9d4cc 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service.impl; import com.rjconsultores.ventaboletos.dao.PtovtaTitularDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; import com.rjconsultores.ventaboletos.service.PtovtaTitularService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -31,7 +32,14 @@ public class PtovtaTitularServiceImpl implements PtovtaTitularService { } public PtovtaTitular obtenerID(Integer id) { - return ptovtaTitularDAO.obtenerID(id); + + PtovtaTitular ptovtaTitular = ptovtaTitularDAO.obtenerID(id); + try { + ptovtaTitular.clonar(); + } catch (Exception e) { + e.printStackTrace(); + } + return ptovtaTitular; } @Transactional diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index b693105f9..47dd51eb9 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -38,6 +38,7 @@ import com.rjconsultores.ventaboletos.exception.IntegracionException; import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; import com.rjconsultores.ventaboletos.service.ConstanteService; import com.rjconsultores.ventaboletos.service.EstacionService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.PuntoVentaService; import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; import com.rjconsultores.ventaboletos.utilerias.CustomEnum; @@ -82,6 +83,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { private UsuarioUbicacionDAO usuarioUbicacionDAO; @Autowired private DataSource dataSource; + @Autowired + private LogAuditoriaService logAuditoriaService; // FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados @Deprecated @@ -90,7 +93,15 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { } public PuntoVenta obtenerID(Integer id) { - return puntoVentaDAO.obtenerID(id); + + PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(id); + + try { + puntoVenta.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return puntoVenta; } @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class}) @@ -161,7 +172,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { throw (IntegracionException) respEx; } } - entidad = puntoVentaDAO.suscribir(entidad); + entidad = puntoVentaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. // Integração AG @@ -418,6 +431,14 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class}) public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { + + PuntoVenta originalClone = null; + try { + originalClone = entidad.getCloneObject(); + originalClone.setTitularId(entidad.getTitularId().getCloneObject()); + } catch (Exception e) { + log.error("",e); + } entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); @@ -475,7 +496,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { } } } + entidad = puntoVentaDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); if (respEx != null) { if (respEx instanceof IntegracionException) { @@ -549,6 +572,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { entidad.setActivo(Boolean.FALSE); puntoVentaDAO.actualizacion(entidad); + + logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + } public List buscaLike(String strEstacion, boolean sinTodos) {