use of org.ehrbase.response.openehr.RevisionHistoryResponseData in project ehrbase by ehrbase.
the class OpenehrVersionedEhrStatusController method retrieveVersionedEhrStatusRevisionHistoryByEhr.
@GetMapping(path = "/revision_history")
@Override
public ResponseEntity<RevisionHistoryResponseData> retrieveVersionedEhrStatusRevisionHistoryByEhr(@RequestHeader(value = HttpHeaders.ACCEPT, required = false) String accept, @PathVariable(value = "ehr_id") String ehrIdString) {
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");
}
RevisionHistory revisionHistory = ehrService.getRevisionHistoryOfVersionedEhrStatus(ehrId);
RevisionHistoryResponseData response = new RevisionHistoryResponseData(revisionHistory);
HttpHeaders respHeaders = new HttpHeaders();
respHeaders.setContentType(resolveContentType(accept));
return ResponseEntity.ok().headers(respHeaders).body(response);
}
use of org.ehrbase.response.openehr.RevisionHistoryResponseData in project openEHR_SDK by ehrbase.
the class DefaultRestVersionedCompositionEndpoint method findRevisionHistory.
@Override
public List<RevisionHistoryItem> findRevisionHistory(UUID versionedObjectUid) {
URI uri = defaultRestClient.getConfig().getBaseUri().resolve(EHR_PATH + ehrId + VERSIONED_COMPOSITION_PATH + versionedObjectUid + REVISION_HISTORY_PATH);
Optional<RevisionHistoryResponseData> result = defaultRestClient.httpGet(uri, RevisionHistoryResponseData.class);
if (result.isEmpty()) {
return new ArrayList<>();
} else {
return result.get().getRevisionHistoryItems();
}
}
use of org.ehrbase.response.openehr.RevisionHistoryResponseData in project ehrbase by ehrbase.
the class OpenehrVersionedCompositionController method retrieveVersionedCompositionRevisionHistoryByEhr.
@GetMapping(path = "/{versioned_object_uid}/revision_history")
@Override
public ResponseEntity<RevisionHistoryResponseData> retrieveVersionedCompositionRevisionHistoryByEhr(@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);
RevisionHistory revisionHistory = compositionService.getRevisionHistoryOfVersionedComposition(versionedCompoUid);
RevisionHistoryResponseData response = new RevisionHistoryResponseData(revisionHistory);
HttpHeaders respHeaders = new HttpHeaders();
respHeaders.setContentType(resolveContentType(accept));
return ResponseEntity.ok().headers(respHeaders).body(response);
}
Aggregations