use of org.ehrbase.response.openehr.VersionedObjectResponseData in project ehrbase by ehrbase.
the class OpenehrVersionedEhrStatusController method retrieveVersionedEhrStatusByEhr.
@GetMapping
@Override
public ResponseEntity<VersionedObjectResponseData<EhrStatus>> retrieveVersionedEhrStatusByEhr(@PathVariable(value = "ehr_id") String ehrIdString, @RequestHeader(value = HttpHeaders.ACCEPT, required = false) String accept) {
UUID ehrId = getEhrUuid(ehrIdString);
// check if EHR is valid
if (!ehrService.hasEhr(ehrId)) {
throw new ObjectNotFoundException("ehr", "No EHR with this ID can be found");
}
VersionedEhrStatus versionedEhrStatus = ehrService.getVersionedEhrStatus(ehrId);
VersionedObjectResponseData<EhrStatus> response = new VersionedObjectResponseData<>(versionedEhrStatus);
HttpHeaders respHeaders = new HttpHeaders();
respHeaders.setContentType(resolveContentType(accept));
return ResponseEntity.ok().headers(respHeaders).body(response);
}
use of org.ehrbase.response.openehr.VersionedObjectResponseData in project ehrbase by ehrbase.
the class OpenehrVersionedCompositionController method retrieveVersionedCompositionByVersionedObjectUid.
@GetMapping(path = "/{versioned_object_uid}")
@Override
public ResponseEntity<VersionedObjectResponseData<Composition>> retrieveVersionedCompositionByVersionedObjectUid(@RequestHeader(value = HttpHeaders.ACCEPT, required = false) String accept, @PathVariable(value = "ehr_id") String ehrIdString, @PathVariable(value = "versioned_object_uid") String versionedObjectUid) {
UUID ehrId = getEhrUuid(ehrIdString);
UUID versionedCompoUid = getCompositionVersionedObjectUidString(versionedObjectUid);
// check if parameters are valid
checkForValidEhrAndCompositionParameter(ehrId, versionedCompoUid);
VersionedComposition versionedComposition = compositionService.getVersionedComposition(ehrId, versionedCompoUid);
VersionedObjectResponseData<Composition> response = new VersionedObjectResponseData<>(versionedComposition);
HttpHeaders respHeaders = new HttpHeaders();
respHeaders.setContentType(resolveContentType(accept));
return ResponseEntity.ok().headers(respHeaders).body(response);
}
Aggregations