Search in sources :

Example 1 with SnomedRefSetRestInput

use of com.b2international.snowowl.snomed.core.rest.domain.SnomedRefSetRestInput in project snow-owl by b2ihealthcare.

the class SnomedReferenceSetRestService method create.

@Operation(summary = "Create a reference set", description = "Creates a new reference set directly on a path. Creates the corresponding identifier concept as well based on the given JSON body." + "<p>Reference Set type and referenced component type properties are immutable and cannot be modified, " + "thus there is no update endpoint for reference sets. " + "To update the corresponding identifier concept properties, use the concept update endpoint.</p>")
@ApiResponses({ @ApiResponse(responseCode = "201", description = "Created"), @ApiResponse(responseCode = "404", description = "Branch not found") })
@PostMapping(consumes = { AbstractRestService.JSON_MEDIA_TYPE })
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<Void> create(@Parameter(description = "The resource path", required = true) @PathVariable(value = "path") final String path, @Parameter(description = "Reference set parameters") @RequestBody final SnomedResourceRequest<SnomedRefSetRestInput> body, @RequestHeader(value = X_AUTHOR, required = false) final String author) {
    final SnomedRefSetRestInput change = body.getChange();
    final String commitComment = body.getCommitComment();
    final String defaultModuleId = body.getDefaultModuleId();
    final String createdRefSetId = change.toRequestBuilder().commit().setDefaultModuleId(defaultModuleId).setAuthor(author).setCommitComment(commitComment).build(path).execute(getBus()).getSync(COMMIT_TIMEOUT, TimeUnit.MINUTES).getResultAs(String.class);
    return ResponseEntity.created(getResourceLocationURI(path, createdRefSetId)).build();
}
Also used : SnomedRefSetRestInput(com.b2international.snowowl.snomed.core.rest.domain.SnomedRefSetRestInput) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Aggregations

SnomedRefSetRestInput (com.b2international.snowowl.snomed.core.rest.domain.SnomedRefSetRestInput)1 Operation (io.swagger.v3.oas.annotations.Operation)1 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)1