Package org.ehrbase.rest.openehr
Class OpenehrCompositionController
- java.lang.Object
-
- org.ehrbase.rest.BaseController
-
- org.ehrbase.rest.openehr.OpenehrCompositionController
-
- All Implemented Interfaces:
CompositionApiSpecification
@RestController @RequestMapping(path="${openehr-api.context-path:/rest/openehr}/v1/ehr", produces={"application/json","application/xml"}) public class OpenehrCompositionController extends BaseController implements CompositionApiSpecificationController for /composition resource as part of the EHR sub-API of the openEHR REST API- Since:
- 1.0.0
- Author:
- Stefan Spiska, Jake Smolka
-
-
Field Summary
-
Fields inherited from class org.ehrbase.rest.BaseController
ACCEPT, COMPOSITION, CONTENT_TYPE, CONTRIBUTION, DEFINITION, DIRECTORY, EHR, EHR_STATUS, ETAG, IF_MATCH, IF_NONE_MATCH, LAST_MODIFIED, LOCATION, OPENEHR_AUDIT_DETAILS, OPENEHR_VERSION, PREFER, QUERY, REQ_ACCEPT, REQ_CONTENT_TYPE, REQ_CONTENT_TYPE_BODY, REQ_OPENEHR_AUDIT, REQ_OPENEHR_VERSION, REQ_PREFER, RESP_CONTENT_TYPE_DESC, RESP_ETAG_DESC, RESP_LAST_MODIFIED_DESC, RESP_LOCATION_DESC, RESP_NOT_ACCEPTABLE_DESC, RESP_UNSUPPORTED_MEDIA_DESC, REST_OPERATION, RETURN_MINIMAL, RETURN_REPRESENTATION
-
-
Constructor Summary
Constructors Constructor Description OpenehrCompositionController(CompositionService compositionService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntitycreateComposition(String openehrVersion, String openehrAuditDetails, String contentType, String accept, String prefer, String ehrIdString, String composition, javax.servlet.http.HttpServletRequest request)org.springframework.http.ResponseEntitydeleteComposition(String openehrVersion, String openehrAuditDetails, String ehrIdString, String precedingVersionUid, javax.servlet.http.HttpServletRequest request)org.springframework.http.ResponseEntitygetCompositionByTime(String accept, String ehrIdString, String versionedObjectUid, String versionAtTime, javax.servlet.http.HttpServletRequest request)This mapping combines both GETs "/{ehr_id}/composition/{version_uid}" (via overlapping path) and "/{ehr_id}/composition/{versioned_object_uid}{?version_at_time}" (here).org.springframework.http.ResponseEntity<org.ehrbase.response.openehr.CompositionResponseData>getCompositionByVersionId(String accept, String ehrIdString, String versionUid, String versionAtTime, javax.servlet.http.HttpServletRequest request)Acts as overloaded function and calls the overlapping and more specific method getCompositionByTime.org.springframework.http.ResponseEntityupdateComposition(String openehrVersion, String openehrAuditDetails, String contentType, String accept, String prefer, String ifMatch, String ehrIdString, String versionedObjectUidString, String composition, javax.servlet.http.HttpServletRequest request)-
Methods inherited from class org.ehrbase.rest.BaseController
add2MetaMap, encodePath, enrichRequestAttribute, extractCompositionFormat, extractVersionedObjectUidFromVersionUid, extractVersionFromVersionUid, getBaseEnvLinkURL, getCompositionVersionedObjectUidString, getContributionVersionedObjectUidString, getEhrUuid, getVersionAtTimeParam, resolveContentType, resolveContentType
-
-
-
-
Constructor Detail
-
OpenehrCompositionController
@Autowired public OpenehrCompositionController(CompositionService compositionService)
-
-
Method Detail
-
createComposition
@PostMapping(value="/{ehr_id}/composition", consumes={"application/xml","application/json"}) @PreAuthorize("checkAbacPre(@openehrCompositionController.COMPOSITION, @ehrService.getSubjectExtRef(#ehrIdString), #composition, #contentType)") @ResponseStatus(CREATED) public org.springframework.http.ResponseEntity createComposition(@RequestHeader(value="openEHR-VERSION",required=false) String openehrVersion, @RequestHeader(value="openEHR-AUDIT_DETAILS",required=false) String openehrAuditDetails, @RequestHeader("Content-Type") String contentType, @RequestHeader(value="Accept",required=false) String accept, @RequestHeader(value="Prefer",required=false) String prefer, @PathVariable("ehr_id") String ehrIdString, @RequestBody String composition, javax.servlet.http.HttpServletRequest request)- Specified by:
createCompositionin interfaceCompositionApiSpecification
-
updateComposition
@PutMapping("/{ehr_id}/composition/{versioned_object_uid}") @PreAuthorize("checkAbacPre(@openehrCompositionController.COMPOSITION, @ehrService.getSubjectExtRef(#ehrIdString), #composition, #contentType)") public org.springframework.http.ResponseEntity updateComposition(String openehrVersion, @RequestHeader(value="openEHR-AUDIT_DETAILS",required=false) String openehrAuditDetails, @RequestHeader(value="Content-Type",required=false) String contentType, @RequestHeader(value="Accept",required=false) String accept, @RequestHeader(value="Prefer",required=false) String prefer, @RequestHeader("If-Match") String ifMatch, @PathVariable("ehr_id") String ehrIdString, @PathVariable("versioned_object_uid") String versionedObjectUidString, @RequestBody String composition, javax.servlet.http.HttpServletRequest request)- Specified by:
updateCompositionin interfaceCompositionApiSpecification
-
deleteComposition
@DeleteMapping("/{ehr_id}/composition/{preceding_version_uid}") @PreAuthorize("checkAbacPre(@openehrCompositionController.COMPOSITION, @ehrService.getSubjectExtRef(#ehrIdString), #precedingVersionUid, null)") @ResponseStatus(NO_CONTENT) public org.springframework.http.ResponseEntity deleteComposition(@RequestHeader(value="openEHR-VERSION",required=false) String openehrVersion, @RequestHeader(value="openEHR-AUDIT_DETAILS",required=false) String openehrAuditDetails, @PathVariable("ehr_id") String ehrIdString, @PathVariable("preceding_version_uid") String precedingVersionUid, javax.servlet.http.HttpServletRequest request)- Specified by:
deleteCompositionin interfaceCompositionApiSpecification
-
getCompositionByVersionId
@GetMapping("/{ehr_id}/composition/{version_uid}") @PostAuthorize("checkAbacPost(@openehrCompositionController.COMPOSITION, @ehrService.getSubjectExtRef(#ehrIdString), returnObject, #accept)") public org.springframework.http.ResponseEntity<org.ehrbase.response.openehr.CompositionResponseData> getCompositionByVersionId(@RequestHeader(value="Accept",required=false) String accept, @PathVariable("ehr_id") String ehrIdString, @PathVariable("version_uid") String versionUid, @RequestParam(value="version_at_time",required=false) String versionAtTime, javax.servlet.http.HttpServletRequest request)Acts as overloaded function and calls the overlapping and more specific method getCompositionByTime. Catches both "/{ehr_id}/composition/{version_uid}" and "/{ehr_id}/composition/{versioned_object_uid}" which works because their processing is the same. "{?version_at_time}" is hidden in swagger-ui, it only is here to be piped through.- Specified by:
getCompositionByVersionIdin interfaceCompositionApiSpecification
-
getCompositionByTime
@GetMapping("/{ehr_id}/composition/{versioned_object_uid}{?version_at_time}") @PostAuthorize("checkAbacPost(@openehrCompositionController.COMPOSITION, @ehrService.getSubjectExtRef(#ehrIdString), returnObject, #accept)") public org.springframework.http.ResponseEntity getCompositionByTime(@RequestHeader(value="Accept",required=false) String accept, @PathVariable("ehr_id") String ehrIdString, @PathVariable("versioned_object_uid") String versionedObjectUid, @RequestParam(value="version_at_time",required=false) String versionAtTime, javax.servlet.http.HttpServletRequest request)This mapping combines both GETs "/{ehr_id}/composition/{version_uid}" (via overlapping path) and "/{ehr_id}/composition/{versioned_object_uid}{?version_at_time}" (here). This is necessary because of the overlapping paths. Both mappings are specified to behave almost the same, so this solution works in this case.- Specified by:
getCompositionByTimein interfaceCompositionApiSpecification
-
-