/** * Get detail of message identified by its id. * * @param id the id of message. * @return message detail. */ @GetMapping(path = "/{id}", produces = {"application/xml", "application/json"}) public ResponseEntity<MessageRpc> detail(@PathVariable final Long id) { LOG.trace("Fetch detail of message with id [{}].", id); return Optional.ofNullable(messageService.findEagerMessageById(id)) .map(message -> new ResponseEntity<>( MessageRpc.fromMessage().convert(message), HttpStatus.OK) ) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); }