Search in sources :

Example 1 with SnomedRelationshipRestInput

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

the class SnomedRelationshipRestService method create.

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

Aggregations

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