spring-projects / spring-projects/spring-data-rest
Provide HATEOAS support for history.Revisions [DATAREST-1158]
Open
@odrotbohm is already working on this.
Since Dec 31, 2020.
type: enhancement
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Daniele Renda opened DATAREST-1158 and commented
I'm using Envers, Spring Data REST, HATEOAS in my application.
I'm using Spring facilities to access to envers revisions via RevisionRepository.
I created my own REST controller like this:
@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "/licensePlates/{id}/change/{changeid}", method = RequestMethod.GET)
public ResponseEntity<Resource<?>> findRevision(@PathVariable(value = "id") Long id,@PathVariable(value = "changeid") Integer changeId,
Pageable pageable) {
if (id != null) {
LicensePlate licensePlate = licensePlateRepository.findRevision(id, changeId).getEntity();
return new ResponseEntity<>(new Resource<>(licensePlate), HttpStatus.OK);
} else {
throw new ResourceNotFoundException();
}
}
Unfortunately the entity received is not HATEOAS compliant and so I loose all links to external entities.
Would be convenient that the entity was HATEOAS compliant like the one returned from a normal JpaRepository
Affects: 3.0.1 (Kay SR1)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.