use of com.b2international.snowowl.snomed.core.rest.request.RestRequest in project snow-owl by b2ihealthcare.
the class SnomedReferenceSetMemberRestService method executeAction.
@Operation(summary = "Executes an action", description = "Executes an action specified via the request body on a reference set member." + "<p>Supported actions are:" + "• 'sync' - Executes sync action on a query type member" + "• 'create|update|delete' - allowed (mainly resolved and used in bulk requests), but in case of single member action use the dedicated endpoints instead" + "</p>")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "Action execution successful"), @ApiResponse(responseCode = "204", description = "No content"), @ApiResponse(responseCode = "404", description = "Branch or member not found") })
@PostMapping(value = "/{id}/actions", consumes = { AbstractRestService.JSON_MEDIA_TYPE }, produces = { AbstractRestService.JSON_MEDIA_TYPE })
@ResponseBody
public Object executeAction(@Parameter(description = "The resource path", required = true) @PathVariable(value = "path") final String path, @Parameter(description = "The reference set member identifier") @PathVariable(value = "id") final String memberId, @Parameter(description = "Reference set member action") @RequestBody final SnomedResourceRequest<RestRequest> body, @RequestHeader(value = X_AUTHOR, required = false) final String author) {
final RequestResolver<TransactionContext> resolver = new RefSetMemberRequestResolver();
final RestRequest change = body.getChange();
final String commitComment = body.getCommitComment();
final String defaultModuleId = body.getDefaultModuleId();
change.setSource("memberId", memberId);
return SnomedRequests.prepareCommit().setDefaultModuleId(defaultModuleId).setAuthor(author).setBody(change.resolve(resolver)).setCommitComment(commitComment).build(path).execute(getBus()).getSync();
}
Aggregations