I want to create a REST link for an Employee
entity that will basically be a findByAllFields
query. Of course this should be combined with Pa
The code by @Stackee007 works but the resource won't include self
links. In order to do that, a little more is required.
@Autowired
PagedResourcesAssembler pagedResourcesAssembler;
@RequestMapping(value = "/findTodaysSchedule")
public HttpEntity>> getTodaysSchedule(
PersistentEntityResourceAssembler entityAssembler, Pageable pageable) {
Page todaysSchedule = apptRepo.findByStartTimeBetween(beginningOfDay, endOfDay, pageable);
@SuppressWarnings({ "unchecked", "rawtypes" })
PagedResources> resource = pagedResourcesAssembler.toResource(todaysSchedule,
(ResourceAssembler) entityAssembler);
return new ResponseEntity<>(resource, HttpStatus.OK);
}