Search in sources :

Example 1 with SnomedConceptRestInput

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

the class SnomedConceptRestService method create.

@Operation(summary = "Create Concept", description = "Creates a new Concept directly on a path.")
@ApiResponses({ @ApiResponse(responseCode = "201", description = "Concept created on task"), @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 = "Concept parameters") @RequestBody final SnomedResourceRequest<SnomedConceptRestInput> body, @RequestHeader(value = X_AUTHOR, required = false) final String author) {
    final SnomedConceptRestInput change = body.getChange();
    final String commitComment = body.getCommitComment();
    final String defaultModuleId = body.getDefaultModuleId();
    final String createdConceptId = 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, createdConceptId)).build();
}
Also used : SnomedConceptRestInput(com.b2international.snowowl.snomed.core.rest.domain.SnomedConceptRestInput) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Aggregations

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