jhipster / generator-jhipster-entity-audit

JHipster module to enable entity audit and audit log page
Apache License 2.0
136 stars 77 forks source link

Duplicated code after regenerating application with entity-audit enabled #186

Closed nitram84 closed 2 years ago

nitram84 commented 2 years ago

If an application with entity-audit enabled is regenerated some code in domain/AbstractAuditingEntity.java and TechnicalStructureTest.java gets duplicated each execution. I suggest additional checks before replacing like here: https://github.com/nitram84/generator-jhipster-entity-audit/commit/5d776fcfd781e6e1cfd6418270fcf45a8fdd7642

Steps to reproduce:

run 'jhipster import-jdl [path to jdl with audited entities] --blueprints entity-audit' multiple times an and accept any change. Tested with latest git version and jhipster 7.9.3

In [package name].domain/AbstractAuditingEntity.java imports and annotation are replicated: "import [package name].audit.EntityAuditEventListener;" and e.g. "@EntityListeners({ { AuditingEntityListener.class, EntityAuditEventListener.class }, EntityAuditEventListener.class })" after the second run. This results in compilation issues.

In [package name].TechnicalStructureTest.java imports and calls to ignoreDependency are replicated but the generated code still compiles.

DanielFran commented 2 years ago

Closed with https://github.com/hipster-labs/generator-jhipster-entity-audit/pull/187