Search in sources :

Example 71 with ApiResponse

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();
}
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)

Example 72 with ApiResponse

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();
}
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)

Example 73 with ApiResponse

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);
}
Also used : DatastoreLockTarget(com.b2international.snowowl.core.internal.locks.DatastoreLockTarget) DatastoreLockContext(com.b2international.snowowl.core.internal.locks.DatastoreLockContext) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 74 with ApiResponse

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);
}
Also used : DatastoreLockTarget(com.b2international.snowowl.core.internal.locks.DatastoreLockTarget) DatastoreLockContext(com.b2international.snowowl.core.internal.locks.DatastoreLockContext) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 75 with ApiResponse

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);
}
Also used : DatastoreLockTarget(com.b2international.snowowl.core.internal.locks.DatastoreLockTarget) DatastoreLockContext(com.b2international.snowowl.core.internal.locks.DatastoreLockContext) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Aggregations

Operation (io.swagger.v3.oas.annotations.Operation)113 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)99 ApiResponse (io.swagger.v3.oas.models.responses.ApiResponse)85 Test (org.testng.annotations.Test)53 Operation (io.swagger.v3.oas.models.Operation)51 OpenAPI (io.swagger.v3.oas.models.OpenAPI)48 ProtectedApi (org.gluu.oxtrust.service.filter.ProtectedApi)48 ApiResponses (io.swagger.v3.oas.models.responses.ApiResponses)44 PathItem (io.swagger.v3.oas.models.PathItem)41 Schema (io.swagger.v3.oas.models.media.Schema)38 MediaType (io.swagger.v3.oas.models.media.MediaType)31 Path (javax.ws.rs.Path)30 ObjectSchema (io.swagger.v3.oas.models.media.ObjectSchema)29 IntegerSchema (io.swagger.v3.oas.models.media.IntegerSchema)27 StringSchema (io.swagger.v3.oas.models.media.StringSchema)27 Content (io.swagger.v3.oas.models.media.Content)26 ArraySchema (io.swagger.v3.oas.models.media.ArraySchema)25 ArrayList (java.util.ArrayList)25 Components (io.swagger.v3.oas.models.Components)19 Parameter (io.swagger.v3.oas.models.parameters.Parameter)19