use of io.swagger.v3.oas.annotations.responses.ApiResponse 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();
}
use of io.swagger.v3.oas.annotations.responses.ApiResponse 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();
}
use of io.swagger.v3.oas.annotations.responses.ApiResponse in project snow-owl by b2ihealthcare.
the class RepositoryRestService method unlockRepository.
@Operation(summary = "Unlock single repository", description = "Releases a previously acquired repository-level lock on the specified repository.")
@ApiResponses({ @ApiResponse(responseCode = "204", description = "Unlock successful"), @ApiResponse(responseCode = "404", description = "Repository not found"), @ApiResponse(responseCode = "400", description = "Unspecified unlock-related issue") })
@ResponseStatus(HttpStatus.NO_CONTENT)
@PostMapping("/{id}/unlock")
public void unlockRepository(@Parameter(description = "The repository id") @PathVariable(value = "id") final String repositoryUuid) {
checkValidRepositoryUuid(repositoryUuid);
final DatastoreLockContext context = new DatastoreLockContext(User.SYSTEM.getUsername(), DatastoreLockContextDescriptions.CREATE_REPOSITORY_BACKUP, DatastoreLockContextDescriptions.CREATE_BACKUP);
final DatastoreLockTarget target = new DatastoreLockTarget(repositoryUuid, null);
doUnlock(context, target);
}
use of io.swagger.v3.oas.annotations.responses.ApiResponse in project snow-owl by b2ihealthcare.
the class RepositoryRestService method lockGlobal.
@Operation(summary = "Lock all repositories", description = "Places a global lock, which prevents other users from making changes to any of the repositories " + "while a backup is created. The call may block up to the specified timeout to acquire the lock; " + "if timeoutMillis is set to 0, it returns immediately.")
@ApiResponses({ @ApiResponse(responseCode = "204", description = "Lock successful"), @ApiResponse(responseCode = "409", description = "Conflicting lock already taken"), @ApiResponse(responseCode = "400", description = "Illegal timeout value, or locking-related issue") })
@ResponseStatus(HttpStatus.NO_CONTENT)
@PostMapping("/lock")
public void lockGlobal(@Parameter(description = "lock timeout in milliseconds") @RequestParam(value = "timeoutMillis", defaultValue = "5000", required = false) final int timeoutMillis) {
checkValidTimeout(timeoutMillis);
final DatastoreLockContext context = new DatastoreLockContext(User.SYSTEM.getUsername(), DatastoreLockContextDescriptions.CREATE_BACKUP);
final DatastoreLockTarget target = DatastoreLockTarget.ALL;
doLock(timeoutMillis, context, target);
}
use of io.swagger.v3.oas.annotations.responses.ApiResponse in project snow-owl by b2ihealthcare.
the class RepositoryRestService method lockRepository.
@Operation(summary = "Lock single repository", description = "Places a repository-level lock, which prevents other users from making changes to the specified repository. " + "The call may block up to the specified timeout to acquire the lock; if timeoutMillis is set to 0, " + "it returns immediately.")
@ApiResponses({ @ApiResponse(responseCode = "204", description = "Lock successful"), @ApiResponse(responseCode = "409", description = "Conflicting lock already taken"), @ApiResponse(responseCode = "404", description = "Repository not found"), @ApiResponse(responseCode = "400", description = "Illegal timeout value, or locking-related issue") })
@ResponseStatus(HttpStatus.NO_CONTENT)
@PostMapping("/{id}/lock")
public void lockRepository(@PathVariable(value = "id") @Parameter(description = "The repository id") final String id, @Parameter(description = "lock timeout in milliseconds") @RequestParam(value = "timeoutMillis", defaultValue = "5000", required = false) final int timeoutMillis) {
checkValidRepositoryUuid(id);
checkValidTimeout(timeoutMillis);
final DatastoreLockContext context = new DatastoreLockContext(User.SYSTEM.getUsername(), DatastoreLockContextDescriptions.CREATE_REPOSITORY_BACKUP, DatastoreLockContextDescriptions.CREATE_BACKUP);
final DatastoreLockTarget target = new DatastoreLockTarget(id, null);
doLock(timeoutMillis, context, target);
}
Aggregations