io.swagger.annotations.ApiResponse源码实例Demo

类io.swagger.annotations.ApiResponse源码实例Demo

下面列出了怎么用io.swagger.annotations.ApiResponse的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: pravega   文件: ApiV1.java
@PUT
@Path("/{scopeName}/streams/{streamName}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "", notes = "", response = StreamProperty.class, tags = {  })
@ApiResponses(value = {
        @ApiResponse(
                code = 200,
                message = "Successfully updated the stream configuration",
                response = StreamProperty.class),

        @ApiResponse(
                code = 404, message = "Scope or stream not found", response = StreamProperty.class),

        @ApiResponse(
                code = 500, message = "Server error", response = StreamProperty.class) })
void updateStream(@ApiParam(value = "Scope name", required = true) @PathParam("scopeName") String scopeName,
        @ApiParam(value = "Stream name", required = true) @PathParam("streamName") String streamName,
        @ApiParam(value = "The new stream configuration", required = true)
                          UpdateStreamRequest updateStreamRequest,
        @Context SecurityContext securityContext, @Suspended final AsyncResponse asyncResponse);
 
源代码2 项目: pulsar-manager   文件: RoleBindingController.java
@ApiOperation(value = "Delete a role binding")
@ApiResponses({
        @ApiResponse(code = 200, message = "ok"),
        @ApiResponse(code = 404, message = "Not found"),
        @ApiResponse(code = 500, message = "Internal server error")
})
@RequestMapping(value = "/role-binding", method =  RequestMethod.DELETE)
public ResponseEntity<Map<String, Object>> deleteRoleBinding(@RequestBody RoleBindingEntity roleBindingEntity) {
    Map<String, Object> result = Maps.newHashMap();
    HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
    String token = request.getHeader("token");
    Map<String, String> stringMap = roleBindingService.validateCurrentUser(token, roleBindingEntity);
    if (stringMap.get("error") != null) {
        result.put("error", stringMap.get("error"));
        return ResponseEntity.ok(result);
    }
    Optional<RoleBindingEntity> roleBindingEntityOptional = roleBindingRepository.findByUserIdAndRoleId(
            roleBindingEntity.getUserId(), roleBindingEntity.getRoleId());
    if (!roleBindingEntityOptional.isPresent()) {
        result.put("error", "This role binding no exist");
        return ResponseEntity.ok(result);
    }
    roleBindingRepository.delete(roleBindingEntity.getRoleId(), roleBindingEntity.getUserId());
    result.put("message", "Delete role binding success");
    return ResponseEntity.ok(result);
}
 
源代码3 项目: hawkular-apm   文件: ConfigurationHandler.java
@GET
@Path("transaction/full/{name}")
@ApiOperation(value = "Retrieve the transaction configuration for the specified name", response = TransactionConfig.class)
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Success"),
        @ApiResponse(code = 500, message = "Internal server error") })
public Response getBusinessTxnConfiguration(@BeanParam NamedTransactionRequest request) {
    return withErrorHandler(() -> {
        log.tracef("Get transaction configuration for name [%s]", request.getName());
        TransactionConfig config = configService.getTransaction(getTenant(request), request.getName());
        log.tracef("Got transaction configuration for name [%s] config=[%s]", request.getName(), config);

        return Response
                .status(Response.Status.OK)
                .entity(config)
                .type(APPLICATION_JSON_TYPE)
                .build();
    });
}
 
源代码4 项目: commerce-cif-api   文件: CartApi.java
@POST
@Path("/")
@ApiOperation(value = "Creates an empty cart. For convenience it also adds a cart entry when product variant id " +
    "and quantity are provided.")
@ApiResponses(value = {
    @ApiResponse(code = HTTP_CREATED, message = HTTP_CREATED_MESSAGE, response = Cart.class,
            responseHeaders = @ResponseHeader(name = "Location", description = "Location of the newly created cart.", response = String.class)),
    @ApiResponse(code = HTTP_BAD_REQUEST, message = HTTP_BAD_REQUEST_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_FORBIDDEN, message = HTTP_FORBIDDEN_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_NOT_FOUND, message = HTTP_NOT_FOUND_MESSAGE, response = ErrorResponse.class)
})
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
Cart postCart(
    @ApiParam(value = "Three-digit currency code.", required = true)
    @FormParam("currency") String currency,

    @ApiParam(value = "The product variant id to be added to the cart entry.")
    @FormParam("productVariantId") String productVariantId,

    @ApiParam(value = "The quantity for the product variant.")
    @FormParam("quantity") int quantity,

    @ApiParam(value = ACCEPT_LANGUAGE_DESC)
    @HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage);
 
源代码5 项目: pulsar   文件: NonPersistentTopics.java
@PUT
@Path("/{property}/{cluster}/{namespace}/{topic}/partitions")
@ApiOperation(hidden = true, value = "Create a partitioned topic.", notes = "It needs to be called before creating a producer on a partitioned topic.")
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"),
        @ApiResponse(code = 406, message = "The number of partitions should be more than 0 and less than or equal to maxNumPartitionsPerPartitionedTopic"),
        @ApiResponse(code = 409, message = "Partitioned topic already exist") })
public void createPartitionedTopic(@Suspended final AsyncResponse asyncResponse, @PathParam("property") String property, @PathParam("cluster") String cluster,
        @PathParam("namespace") String namespace, @PathParam("topic") @Encoded String encodedTopic,
        int numPartitions) {
    try {
        validateTopicName(property, cluster, namespace, encodedTopic);
        internalCreatePartitionedTopic(asyncResponse, numPartitions);
    } catch (Exception e) {
        log.error("[{}] Failed to create partitioned topic {}", clientAppId(), topicName, e);
        resumeAsyncResponseExceptionally(asyncResponse, e);
    }
}
 
@DELETE
@ApiOperation(value = "Delete a scope",
        notes = "User must have the DOMAIN_SCOPE[DELETE] permission on the specified domain " +
                "or DOMAIN_SCOPE[DELETE] permission on the specified environment " +
                "or DOMAIN_SCOPE[DELETE] permission on the specified organization")
@ApiResponses({
        @ApiResponse(code = 204, message = "Scope successfully deleted"),
        @ApiResponse(code = 500, message = "Internal server error")})
public void delete(
        @PathParam("organizationId") String organizationId,
        @PathParam("environmentId") String environmentId,
        @PathParam("domain") String domain,
        @PathParam("scope") String scope,
        @Suspended final AsyncResponse response) {
    final User authenticatedUser = getAuthenticatedUser();

    checkAnyPermission(organizationId, environmentId, domain, Permission.DOMAIN_SCOPE, Acl.DELETE)
            .andThen(scopeService.delete(scope, false, authenticatedUser))
            .subscribe(() -> response.resume(Response.noContent().build()), response::resume);
}
 
源代码7 项目: che   文件: PermissionsService.java
@POST
@Consumes(APPLICATION_JSON)
@ApiOperation("Store given permissions")
@ApiResponses({
  @ApiResponse(code = 200, message = "The permissions successfully stored"),
  @ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"),
  @ApiResponse(code = 404, message = "Domain of permissions is not supported"),
  @ApiResponse(
      code = 409,
      message = "New permissions removes last 'setPermissions' of given instance"),
  @ApiResponse(
      code = 409,
      message = "Given domain requires non nullable value for instance but it is null"),
  @ApiResponse(code = 500, message = "Internal server error occurred during permissions storing")
})
public void storePermissions(
    @ApiParam(value = "The permissions to store", required = true) PermissionsDto permissionsDto)
    throws ServerException, BadRequestException, ConflictException, NotFoundException {
  checkArgument(permissionsDto != null, "Permissions descriptor required");
  checkArgument(!isNullOrEmpty(permissionsDto.getUserId()), "User required");
  checkArgument(!isNullOrEmpty(permissionsDto.getDomainId()), "Domain required");
  instanceValidator.validate(permissionsDto.getDomainId(), permissionsDto.getInstanceId());
  checkArgument(!permissionsDto.getActions().isEmpty(), "One or more actions required");

  permissionsManager.storePermission(permissionsDto);
}
 
源代码8 项目: openhab-core   文件: ThingResource.java
@GET
@RolesAllowed({ Role.USER, Role.ADMIN })
@Path("/{thingUID}/status")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Gets thing's status.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = String.class),
        @ApiResponse(code = 404, message = "Thing not found.") })
public Response getStatus(
        @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") @Nullable String language,
        @PathParam("thingUID") @ApiParam(value = "thing") String thingUID) throws IOException {
    ThingUID thingUIDObject = new ThingUID(thingUID);

    // Check if the Thing exists, 404 if not
    Thing thing = thingRegistry.get(thingUIDObject);
    if (thing == null) {
        logger.info("Received HTTP GET request for thing config status at '{}' for the unknown thing '{}'.",
                uriInfo.getPath(), thingUID);
        return getThingNotFoundResponse(thingUID);
    }

    ThingStatusInfo thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing,
            localeService.getLocale(language));
    return Response.ok().entity(thingStatusInfo).build();
}
 
@DELETE
@ApiOperation(value = "Delete the sharding tag",
        notes = "User must have the ORGANIZATION_TAG[DELETE] permission on the specified organization")
@ApiResponses({
        @ApiResponse(code = 204, message = "Sharding tag successfully deleted"),
        @ApiResponse(code = 500, message = "Internal server error")})
public void delete(
        @PathParam("organizationId") String organizationId,
        @PathParam("tag") String tag,
        @Suspended final AsyncResponse response) {
    final User authenticatedUser = getAuthenticatedUser();

    checkPermission(ReferenceType.ORGANIZATION, organizationId, Permission.ORGANIZATION_TAG, Acl.DELETE)
            .andThen(tagService.delete(tag, organizationId, authenticatedUser))
            .subscribe(() -> response.resume(Response.noContent().build()), response::resume);
}
 
源代码10 项目: molgenis   文件: IdentitiesApiController.java
@PostMapping(GROUP_END_POINT)
@ApiOperation(value = "Create a new group", response = ResponseEntity.class)
@Transactional
@ApiResponses({
  @ApiResponse(code = 201, message = "New group created", response = ResponseEntity.class),
  @ApiResponse(code = 400, message = "Group name not available", response = ResponseEntity.class)
})
public ResponseEntity createGroup(@RequestBody GroupCommand group) {
  GroupValue groupValue =
      groupValueFactory.createGroup(
          group.getName(), group.getLabel(), GroupService.DEFAULT_ROLES, group.getName());

  if (!groupService.isGroupNameAvailable(groupValue)) {
    throw new GroupNameNotAvailableException(group.getName());
  }

  groupService.persist(groupValue);

  URI location =
      ServletUriComponentsBuilder.fromCurrentRequest()
          .path("/{name}")
          .buildAndExpand(groupValue.getName())
          .toUri();

  return ResponseEntity.created(location).build();
}
 
源代码11 项目: pulsar   文件: Namespaces.java
@POST
@Path("/{tenant}/{namespace}/offloadPolicies")
@ApiOperation(value = " Set offload configuration on a namespace.")
@ApiResponses(value = {
        @ApiResponse(code = 403, message = "Don't have admin permission"),
        @ApiResponse(code = 404, message = "Namespace does not exist"),
        @ApiResponse(code = 409, message = "Concurrent modification"),
        @ApiResponse(code = 412, message = "OffloadPolicies is empty or driver is not supported or bucket is not valid") })
public void setOffloadPolicies(@PathParam("tenant") String tenant, @PathParam("namespace") String namespace,
        @ApiParam(value = "Offload policies for the specified namespace", required = true) OffloadPolicies offload,
        @Suspended final AsyncResponse asyncResponse) {
    try {
        validateNamespaceName(tenant, namespace);
        internalSetOffloadPolicies(asyncResponse, offload);
    } catch (WebApplicationException wae) {
        asyncResponse.resume(wae);
    } catch (Exception e) {
        asyncResponse.resume(new RestException(e));
    }
}
 
源代码12 项目: AuTe-Framework   文件: RestScenarioController.java
@ApiOperation(
        value = "Updates scenario",
        notes = "If scenario wasn`t exist, new empty scenario will be created and updated with given data",
        nickname = "saveOne",
        consumes = MediaType.APPLICATION_JSON_VALUE,
        produces = MediaType.APPLICATION_JSON_VALUE
)
@ApiResponses({
        @ApiResponse(code = 200, message = "Updated scenario"),
        @ApiResponse(code = 404, message = "Updated scenario haven`t been loaded"),
        @ApiResponse(code = 500, message = "Server error. Cannot read old scenario from file, empty scenario name or troubles while saving")
})
@RequestMapping(value = { "{scenarioCode:.+}", "{scenarioGroup:.+}/{scenarioCode:.+}" }, method = RequestMethod.PUT)
public ScenarioRo saveOne(
        @PathVariable String projectCode,
        @PathVariable(required = false) String scenarioGroup,
        @PathVariable String scenarioCode,
        @RequestBody ScenarioRo scenarioRo) throws IOException {
    String scenarioPath = (StringUtils.isEmpty(scenarioGroup) ? "" : scenarioGroup + "/") + scenarioCode + "/";
    ScenarioRo savedScenario = scenarioService.updateScenarioFormRo(projectCode, scenarioPath, scenarioRo);
    if (savedScenario == null) {
        throw new ResourceNotFoundException();
    }
    return savedScenario;
}
 
源代码13 项目: openhab-core   文件: ExtensionResource.java
@POST
@Path("/url/{url}/install")
@ApiOperation(value = "Installs the extension from the given URL.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK"),
        @ApiResponse(code = 400, message = "The given URL is malformed or not valid.") })
public Response installExtensionByURL(
        final @PathParam("url") @ApiParam(value = "extension install URL") String url) {
    try {
        URI extensionURI = new URI(url);
        String extensionId = getExtensionId(extensionURI);
        installExtension(extensionId);
    } catch (URISyntaxException | IllegalArgumentException e) {
        logger.error("Exception while parsing the extension URL '{}': {}", url, e.getMessage());
        return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "The given URL is malformed or not valid.");
    }

    return Response.ok(null, MediaType.TEXT_PLAIN).build();
}
 
源代码14 项目: che   文件: FactoryService.java
@POST
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create a new factory based on configuration")
@ApiResponses({
  @ApiResponse(code = 200, message = "Factory successfully created"),
  @ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"),
  @ApiResponse(code = 403, message = "User does not have rights to create factory"),
  @ApiResponse(code = 409, message = "When factory with given name and creator already exists"),
  @ApiResponse(code = 500, message = "Internal server error occurred")
})
public FactoryDto saveFactory(FactoryDto factory)
    throws BadRequestException, ServerException, ForbiddenException, ConflictException,
        NotFoundException {
  requiredNotNull(factory, "Factory configuration");
  factoryBuilder.checkValid(factory);
  processDefaults(factory);
  createValidator.validateOnCreate(factory);
  return injectLinks(asDto(factoryManager.saveFactory(factory)));
}
 
源代码15 项目: dependency-track   文件: CweResource.java
@GET
@Path("/{cweId}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Returns a specific CWE",
        response = Cwe.class
)
@ApiResponses(value = {
        @ApiResponse(code = 401, message = "Unauthorized"),
        @ApiResponse(code = 404, message = "The CWE could not be found")
})
public Response getCwe(
        @ApiParam(value = "The CWE ID of the CWE to retrieve", required = true)
        @PathParam("cweId") int cweId) {
    try (QueryManager qm = new QueryManager()) {
        final Cwe cwe = qm.getCweById(cweId);
        if (cwe != null) {
            return Response.ok(cwe).build();
        } else {
            return Response.status(Response.Status.NOT_FOUND).entity("The CWE could not be found.").build();
        }
    }
}
 
源代码16 项目: ballerina-message-broker   文件: ScopesApi.java
@PUT
@Path("/{name}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Update a scope", notes = "Update given scope", response = ScopeUpdateResponse.class, authorizations = {
    @Authorization(value = "basicAuth")
}, tags={  })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "Scope updated", response = ScopeUpdateResponse.class),
    @ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.", response = Error.class),
    @ApiResponse(code = 401, message = "Authentication Data is missing or invalid", response = Error.class),
    @ApiResponse(code = 404, message = "Scope key not found", response = Error.class),
    @ApiResponse(code = 415, message = "Unsupported media type. The entity of the request was in a not supported format.", response = Error.class) })
public Response updateScope(@Context Request request, @PathParam("name") @ApiParam("Name of the scope needs to update") String name, @Valid ScopeUpdateRequest body) {
    return Response.ok().entity("magic!").build();
}
 
源代码17 项目: proctor   文件: TestMatrixApiController.java
@ApiOperation(
        value = "Show histories of all tests",
        response = TestHistoriesResponseModel.class,
        produces = "application/json"
)
@ApiResponses(value = {
        @ApiResponse(code = 404, message = "Branch not found")
})
@GetMapping("/{branch}/matrix/testHistories")
public JsonView getTestHistories(
        @ApiParam(allowableValues = "trunk,qa,production", required = true) @PathVariable final String branch,
        @ApiParam(value = "number of tests to show, -1 for unlimited") @RequestParam(required = false, value = "limit", defaultValue = "100") final int limit
) throws StoreException, ResourceNotFoundException {
    final Environment environment = Environment.fromName(branch);
    if (environment == null) {
        throw new ResourceNotFoundException("Branch " + branch + " is not a correct branch name. It must be one of (trunk, qa, production).");
    }
    final Map<String, List<Revision>> histories = queryHistories(environment);
    return new JsonView(new TestHistoriesResponseModel(histories, limit));
}
 
源代码18 项目: flowable-engine   文件: ContentItemQueryResource.java
@ApiOperation(value = "Query for content items", tags = {"Content item", "Query" },
        notes = "All supported JSON parameter fields allowed are exactly the same as the parameters found for getting a collection of content items, but passed in as JSON-body arguments rather than URL-parameters to allow for more advanced querying and preventing errors with request-uri’s that are too long.")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Indicates request was successful and the content items are returned."),
        @ApiResponse(code = 400, message = "Indicates a parameter was passed in the wrong format. The status-message contains additional information.")
})
@PostMapping(value = "/query/content-items", produces = "application/json")
public DataResponse<ContentItemResponse> getQueryResult(@RequestBody ContentItemQueryRequest request, @ApiParam(hidden = true) @RequestParam Map<String, String> requestParams, HttpServletRequest httpRequest) {

    return getContentItemsFromQueryRequest(request, requestParams);
}
 
源代码19 项目: james-project   文件: UserMailboxesRoutes.java
@DELETE
@ApiImplicitParams({
        @ApiImplicitParam(required = true, dataType = "string", name = "username", paramType = "path")
})
@ApiOperation(value = "Deleting user mailboxes.")
@ApiResponses(value = {
        @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "The user does not have any mailbox", response = String.class),
        @ApiResponse(code = HttpStatus.UNAUTHORIZED_401, message = "Unauthorized. The user is not authenticated on the platform"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The user name does not exist."),
        @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server error - Something went bad on the server side.")
})
public void defineDeleteUserMailboxes() {
    service.delete(USER_MAILBOXES_BASE, (request, response) -> {
        try {
            userMailboxesService.deleteMailboxes(getUsernameParam(request));
            return Responses.returnNoContent(response);
        } catch (IllegalStateException e) {
            LOGGER.info("Invalid delete on user mailboxes", e);
            throw ErrorResponder.builder()
                .statusCode(HttpStatus.NOT_FOUND_404)
                .type(ErrorType.NOT_FOUND)
                .message("Invalid delete on user mailboxes")
                .cause(e)
                .haltError();
        }
    });
}
 
@ApiOperation(value = "POST Reload References", nickname = "postReloadReferences", tags = {"content-settings-controller"})
@ApiResponses(value = {
        @ApiResponse(code = 201, message = "Created"),
        @ApiResponse(code = 401, message = "Unauthorized")})
@PostMapping("/plugins/cms/contentSettings/reloadReferences")
@RestAccessControl(permission = Permission.SUPERUSER)
public ResponseEntity<SimpleRestResponse<Map>> reloadReferences() {
    logger.debug("REST request - reload references");
    service.reloadContentsReference();
    return ResponseEntity.ok(new SimpleRestResponse<>(new HashMap()));
}
 
@ApiOperation("Update R group repository")
@ApiResponses(value = {
    @ApiResponse(code = 204, message = REPOSITORY_UPDATED),
    @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED),
    @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS)
})
@PUT
@Path("/{repositoryName}")
@Validate
@Override
public Response updateRepository(
    final RGroupRepositoryApiRequest request,
    @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) {
  return super.updateRepository(request, repositoryName);
}
 
@ApiOperation(value = " Delete a historic process instance", tags = { "History Process" }, nickname = "deleteHistoricProcessInstance")
@ApiResponses(value = {
        @ApiResponse(code = 204, message = "Indicates that the historic process instance was deleted."),
        @ApiResponse(code = 404, message = "Indicates that the historic process instance could not be found.") })
@DeleteMapping(value = "/history/historic-process-instances/{processInstanceId}")
public void deleteProcessInstance(@ApiParam(name = "processInstanceId") @PathVariable String processInstanceId, HttpServletResponse response) {
    HistoricProcessInstance processInstance = getHistoricProcessInstanceFromRequest(processInstanceId);
    
    if (restApiInterceptor != null) {
        restApiInterceptor.deleteHistoricProcess(processInstance);
    }
    
    historyService.deleteHistoricProcessInstance(processInstanceId);
    response.setStatus(HttpStatus.NO_CONTENT.value());
}
 
源代码23 项目: pulsar   文件: Namespaces.java
@GET
@Path("/{property}/{cluster}/{namespace}/maxConsumersPerSubscription")
@ApiOperation(value = "Get maxConsumersPerSubscription config on a namespace.")
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"),
        @ApiResponse(code = 404, message = "Namespace does not exist") })
public int getMaxConsumersPerSubscription(@PathParam("property") String property, @PathParam("cluster") String cluster,
        @PathParam("namespace") String namespace) {
    validateNamespaceName(property, cluster, namespace);
    return internalGetMaxConsumersPerSubscription();
}
 
源代码24 项目: nifi-registry   文件: BucketFlowResource.java
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get bucket flows",
        notes = "Retrieves all flows in the given bucket.",
        response = VersionedFlow.class,
        responseContainer = "List",
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getFlows(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
        final String bucketId) {

    final List<VersionedFlow> flows = serviceFacade.getFlows(bucketId);
    return Response.status(Response.Status.OK).entity(flows).build();
}
 
源代码25 项目: brooklyn-server   文件: EntityApi.java
@GET
@ApiOperation(value = "Fetch the list of children entities directly under the root of an application",
        response = org.apache.brooklyn.rest.domain.EntitySummary.class,
        responseContainer = "List")
@ApiResponses(value = {
        @ApiResponse(code = 404, message = "Application not found")
})
public List<EntitySummary> list(
        @ApiParam(value = "Application ID or name", required = true)
        @PathParam("application") final String application);
 
源代码26 项目: flowable-engine   文件: TaskResource.java
@ApiOperation(value = "Tasks actions", tags = { "Tasks" }, notes = "")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Indicates the action was executed."),
        @ApiResponse(code = 400, message = "When the body contains an invalid value or when the assignee is missing when the action requires it."),
        @ApiResponse(code = 404, message = "Indicates the requested task was not found."),
        @ApiResponse(code = 409, message = "Indicates the action cannot be performed due to a conflict. Either the task was updates simultaneously or the task was claimed by another user, in case of the claim action.")
})
@PostMapping(value = "/runtime/tasks/{taskId}")
@ResponseStatus(value = HttpStatus.OK)
public void executeTaskAction(@ApiParam(name = "taskId") @PathVariable String taskId, @RequestBody TaskActionRequest actionRequest) {
    if (actionRequest == null) {
        throw new FlowableException("A request body was expected when executing a task action.");
    }

    Task task = getTaskFromRequest(taskId);
    
    if (restApiInterceptor != null) {
        restApiInterceptor.executeTaskAction(task, actionRequest);
    }

    if (TaskActionRequest.ACTION_COMPLETE.equals(actionRequest.getAction())) {
        completeTask(task, actionRequest);

    } else if (TaskActionRequest.ACTION_CLAIM.equals(actionRequest.getAction())) {
        claimTask(task, actionRequest);

    } else if (TaskActionRequest.ACTION_DELEGATE.equals(actionRequest.getAction())) {
        delegateTask(task, actionRequest);

    } else if (TaskActionRequest.ACTION_RESOLVE.equals(actionRequest.getAction())) {
        resolveTask(task, actionRequest);

    } else {
        throw new FlowableIllegalArgumentException("Invalid action: '" + actionRequest.getAction() + "'.");
    }
}
 
源代码27 项目: openapi-generator   文件: UserApi.java
/**
 * Delete user
 *
 * This can only be done by the logged in user.
 *
 */
@DELETE
@Path("/user/{username}")
@ApiOperation(value = "Delete user", tags={ "user",  })
@ApiResponses(value = { 
    @ApiResponse(code = 400, message = "Invalid username supplied"),
    @ApiResponse(code = 404, message = "User not found") })
public void deleteUser(@PathParam("username") String username);
 
源代码28 项目: brooklyn-server   文件: EntityApi.java
@POST
@ApiOperation(
        value = "Rename an entity"
)
@ApiResponses(value = {
        @ApiResponse(code = 404, message = "Undefined application or entity")
})
@Path("/{entity}/name")
public Response rename(
        @ApiParam(value = "Application ID or name", required = true) @PathParam("application") final String applicationId, 
        @ApiParam(value = "Entity ID or name", required = true) @PathParam("entity") final String entityId, 
        @ApiParam(value = "New name for this entity", required = true) @QueryParam("name") final String name);
 
@ApiOperation(value = "Query for historic milestone instances", tags = {"History Milestone", "Query"}, nickname = "queryHistoricMilestoneInstance",
        notes = "All supported JSON parameter fields allowed are exactly the same as the parameters found for getting a collection of historic milestone instances, but passed in as JSON-body arguments rather than URL-parameters to allow for more advanced querying and preventing errors with request-uri’s that are too long.")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Indicates request was successful and the milestone instances are returned"),
        @ApiResponse(code = 400, message = "Indicates an parameter was passed in the wrong format. The status-message contains additional information.")})
@PostMapping(value = "/cmmn-query/historic-milestone-instances", produces = "application/json")
public DataResponse<HistoricMilestoneInstanceResponse> queryMilestoneInstances(@RequestBody HistoricMilestoneInstanceQueryRequest queryRequest, @ApiParam(hidden = true) @RequestParam Map<String, String> allRequestParams, HttpServletRequest request) {
    return getQueryResponse(queryRequest, allRequestParams);
}
 
源代码30 项目: Spring-5.0-By-Example   文件: CategoryResource.java
@GetMapping(value = "/{id}")
@ApiOperation(value = "Find category",notes = "Find the Category by ID")
@ApiResponses(value = {
    @ApiResponse(code = 200,message = "Category found"),
    @ApiResponse(code = 404,message = "Category not found"),
})
public ResponseEntity<Category> findOne(@PathVariable("id") String id){
  return ResponseEntity.ok(new Category());
}