generator-jhipster-entity-audit
generator-jhipster-entity-audit copied to clipboard
[JaVers] wrong audited entities types returned by REST endpoint
I've enabled entity aduting on my existing JHipster project.
My entities names all ends with the Entity suffix (e.g. TimelogEntity), but the JaversEntityAuditResource seems to not take care of it.
Generated code:
/**
* fetches all the audited entity types
*
* @return
*/
@RequestMapping(value = "/audits/entity/all",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")")
public List<String> getAuditedEntities() {
return Arrays.asList("Timelog");
}
This results in the following exception being thrown when trying to load the change list of an entity from the UI:
java.lang.ClassNotFoundException: it.blutec.bludesk.domain.Timelog
Suggested fix: consider the presence of the suffix in the code generation process.
/**
* fetches all the audited entity types
*
* @return
*/
@RequestMapping(value = "/audits/entity/all",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")")
public List<String> getAuditedEntities() {
return Arrays.asList("TimelogEntity");
}