Search in sources :

Example 1 with VersionedObjectResponseData

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);
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) VersionedEhrStatus(com.nedap.archie.rm.ehr.VersionedEhrStatus) VersionedEhrStatus(com.nedap.archie.rm.ehr.VersionedEhrStatus) EhrStatus(com.nedap.archie.rm.ehr.EhrStatus) VersionedObjectResponseData(org.ehrbase.response.openehr.VersionedObjectResponseData) ObjectNotFoundException(org.ehrbase.api.exception.ObjectNotFoundException) UUID(java.util.UUID) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with VersionedObjectResponseData

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);
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) Composition(com.nedap.archie.rm.composition.Composition) VersionedComposition(com.nedap.archie.rm.ehr.VersionedComposition) VersionedObjectResponseData(org.ehrbase.response.openehr.VersionedObjectResponseData) UUID(java.util.UUID) VersionedComposition(com.nedap.archie.rm.ehr.VersionedComposition) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

UUID (java.util.UUID)2 VersionedObjectResponseData (org.ehrbase.response.openehr.VersionedObjectResponseData)2 HttpHeaders (org.springframework.http.HttpHeaders)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 Composition (com.nedap.archie.rm.composition.Composition)1 EhrStatus (com.nedap.archie.rm.ehr.EhrStatus)1 VersionedComposition (com.nedap.archie.rm.ehr.VersionedComposition)1 VersionedEhrStatus (com.nedap.archie.rm.ehr.VersionedEhrStatus)1 ObjectNotFoundException (org.ehrbase.api.exception.ObjectNotFoundException)1