io.swagger.annotations.ApiResponses Java Examples

The following examples show how to use io.swagger.annotations.ApiResponses. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CartApi.java    From commerce-cif-api with Apache License 2.0 7 votes vote down vote up
@POST
@Path("/{id}/payments")
@ApiOperation(value = "Adds a payment to this shopping cart.")
@ApiResponses(value = {
    @ApiResponse(code = HTTP_OK, message = HTTP_OK_MESSAGE, response = Cart.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_JSON)
Cart postCartPayment(
    @ApiParam(value = "The ID of the cart for which the payment will be set.", required = true)
    @PathParam("id") String id,

    @ApiParam(value = "The payment to create. If the cart belongs to a customer, the customer id must be set.", required = true)
    PaymentWrapper paymentWrapper,

    @ApiParam(value = ACCEPT_LANGUAGE_DESC)
    @HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage);
 
Example #2
Source File: RolesController.java    From pulsar-manager with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Get resource type")
@ApiResponses({
        @ApiResponse(code = 200, message = "ok"),
        @ApiResponse(code = 404, message = "Not found"),
        @ApiResponse(code = 500, message = "Internal server error")
})
@RequestMapping(value = "/role/resourceType", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> getResourceType() {
    Map<String, Object> result = Maps.newHashMap();
    Set<String> resourceTypeList = Sets.newHashSet();
    resourceTypeList.add(ResourceType.NAMESPACES.name());
    resourceTypeList.add(ResourceType.TOPICS.name());
    resourceTypeList.add(ResourceType.SCHEMAS.name());
    resourceTypeList.add(ResourceType.FUNCTIONS.name());
    result.put("resourceType", resourceTypeList);
    return ResponseEntity.ok(result);
}
 
Example #3
Source File: SpellcheckController.java    From customized-symspell with MIT License 6 votes vote down vote up
/**
 *
 * @param sourceWord
 * @param targetWord
 * @param maxEd
 * @return
 */
@ApiOperation(
    value = "API for calculating the Edit  Distance",
    notes =
        "For given source and target String calculate the Edit Distance",
    code = 200,
    response = Response.class)
@ApiResponses(
    value = {
        @ApiResponse(
            code = 400,
            message = "SpellCheckExceptions",
            response = Response.class),
        @ApiResponse(code = 200, response = Response.class, message = "")
    })
@GetMapping("/spellcheck/")
public Response getEditDistance(
    @Valid @RequestParam(name = "source") String sourceWord,
    @Valid @RequestParam(name = "target") String targetWord,
    @RequestParam(name = "maxED", required = false) Double maxEd) {
  if (maxEd != null) {
    return service.getEditDistance(sourceWord, targetWord, maxEd);
  }
  return service.getEditDistance(sourceWord, targetWord);
}
 
Example #4
Source File: StatusController.java    From Bhadoo-Cloud-Drive with MIT License 6 votes vote down vote up
@GetMapping
@ApiOperation(value = "gives array of upload information of current user.", response = UploadInformation[].class)
@ApiResponses({
		@ApiResponse(code = 500, message = "There is something wrong at server side. Please contact developers.", response = ApiError.class) })
public List<UploadInformation> handleStatusRequest() {

	@SuppressWarnings("unchecked")
	List<String> uploads = (List<String>) session.getAttribute("uploads");
	List<UploadInformation> uploadInformations = new ArrayList<>();

	if (uploads != null)
		uploads.forEach((id) -> uploadInformations.add(UploadManager.getUploadManager().getUploadInformation(id)));

	Collections.reverse(uploadInformations);
	return uploadInformations;
}
 
Example #5
Source File: SuccessPlugin.java    From BlogManagePlatform with Apache License 2.0 6 votes vote down vote up
@Override
public void apply(OperationContext context) {
	//TODO:这样做屏蔽了@ResponseHeader的功能,因为没有了该注解。
	//由于本项目header为统一配置,故未实现替代功能。有必要的话需要提供一个替代实现。
	if (context.findAnnotation(ApiResponses.class).isPresent()) {
		return;
	}
	Optional<Success> annotation = context.findAnnotation(Success.class);
	if (!annotation.isPresent()) {
		context.operationBuilder().responseMessages(okResponses);
		return;
	}
	ResponseMessageBuilder messageBuilder = new ResponseMessageBuilder();
	messageBuilder.code(HttpStatus.OK.value());
	messageBuilder.message(okMessage);
	ModelReference model = resolveModel(context, annotation.get());
	messageBuilder.responseModel(model);
	context.operationBuilder().responseMessages(Set.of(messageBuilder.build()));
}
 
Example #6
Source File: ShoppingListApi.java    From commerce-cif-api with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/")
@ApiOperation(value = "Gets a users shopping lists.",
              notes = "The entries property is empty for all shopping lists in the response. To retrieve entries, query a single shopping list.")
@ApiResponses(value = {
    @ApiResponse(code = HTTP_BAD_REQUEST, message = HTTP_BAD_REQUEST_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_UNAUTHORIZED, message = HTTP_UNAUTHORIZED_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_NOT_FOUND, message = HTTP_NOT_FOUND_MESSAGE, response = ErrorResponse.class)
})
PagedResponse<ShoppingList> getShoppingLists(
    @ApiParam(value = "Defines the number of shopping lists to skip.")
    @QueryParam(value = "offset")
    @Min(value = 0)
    Integer offset,

    @ApiParam(value = "Defines the maximum number of shopping lists to be returned.")
    @QueryParam(value = "limit")
    @Min(value = 0)
    Integer limit,

    @ApiParam(value = ACCEPT_LANGUAGE_DESC)
    @HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage
);
 
Example #7
Source File: CartApi.java    From commerce-cif-api with Apache License 2.0 6 votes vote down vote up
@DELETE
@Path("/{id}/entries/{cartEntryId}")
@ApiOperation(value = "Removes a cart entry from the cart.")
@ApiResponses(value = {
    @ApiResponse(code = HTTP_OK, message = HTTP_OK_MESSAGE, response = Cart.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)
})
Cart deleteCartEntry(
    @ApiParam(value = "The ID of the cart.", required = true)
    @PathParam("id") String id,

    @ApiParam(value = "The cart entry id to be removed.", required = true)
    @PathParam("cartEntryId") String cartEntryId,

    @ApiParam(value = ACCEPT_LANGUAGE_DESC)
    @HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage);
 
Example #8
Source File: ProductCompositeService.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 6 votes vote down vote up
/**
 * Sample usage: curl $HOST:$PORT/product-composite/1
 *
 * @param productId
 * @return the composite product info, if found, else null
 */
@ApiOperation(
    value = "${api.product-composite.get-composite-product.description}",
    notes = "${api.product-composite.get-composite-product.notes}")
@ApiResponses(value = {
    @ApiResponse(code = 400, message = "Bad Request, invalid format of the request. See response message for more information."),
    @ApiResponse(code = 404, message = "Not found, the specified id does not exist."),
    @ApiResponse(code = 422, message = "Unprocessable entity, input parameters caused the processing to fail. See response message for more information.")
})
@GetMapping(
    value    = "/product-composite/{productId}",
    produces = "application/json")
Mono<ProductAggregate> getCompositeProduct(
    @PathVariable int productId,
    @RequestParam(value = "delay", required = false, defaultValue = "0") int delay,
    @RequestParam(value = "faultPercent", required = false, defaultValue = "0") int faultPercent
);
 
Example #9
Source File: TaskResource.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Delete a task", tags = {"Tasks"})
@ApiResponses(value = {
    @ApiResponse(code = 204, message =  "Indicates the task was found and has been deleted. Response-body is intentionally empty."),
    @ApiResponse(code = 403, message = "Indicates the requested task cannot be deleted because it’s part of a workflow."),
    @ApiResponse(code = 404, message = "Indicates the requested task was not found.")
})	  
@RequestMapping(value = "/runtime/tasks/{taskId}", method = RequestMethod.DELETE)
public void deleteTask(@ApiParam(name="taskId", value="The id of the task to delete.") @PathVariable String taskId,@ApiParam(hidden=true) @RequestParam(value = "cascadeHistory", required = false) Boolean cascadeHistory,
    @ApiParam(hidden=true) @RequestParam(value = "deleteReason", required = false) String deleteReason, HttpServletResponse response) {

  Task taskToDelete = getTaskFromRequest(taskId);
  if (taskToDelete.getExecutionId() != null) {
    // Can't delete a task that is part of a process instance
    throw new ActivitiForbiddenException("Cannot delete a task that is part of a process-instance.");
  }

  if (cascadeHistory != null) {
    // Ignore delete-reason since the task-history (where the reason is
    // recorded) will be deleted anyway
    taskService.deleteTask(taskToDelete.getId(), cascadeHistory);
  } else {
    // Delete with delete-reason
    taskService.deleteTask(taskToDelete.getId(), deleteReason);
  }
  response.setStatus(HttpStatus.NO_CONTENT.value());
}
 
Example #10
Source File: ShoppingListApi.java    From commerce-cif-api with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/{id}/entries")
@ApiOperation(value = "Gets all entries from a shopping list.")
@ApiResponses(value = {
    @ApiResponse(code = HTTP_BAD_REQUEST, message = HTTP_BAD_REQUEST_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_UNAUTHORIZED, message = HTTP_UNAUTHORIZED_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_NOT_FOUND, message = HTTP_NOT_FOUND_MESSAGE, response = ErrorResponse.class)
})
PagedResponse<ShoppingListEntry> getShoppingListEntries(
    @ApiParam(value = "The id of the shopping list to return entries from.", required = true)
    @PathParam("id")
    String id,

    @ApiParam(value = "Defines the number of entries to skip.")
    @QueryParam(value = "offset")
    @Min(value = 0)
    Integer offset,

    @ApiParam(value = "Defines the maximum number of entries to be returned.")
    @QueryParam(value = "limit")
    @Min(value = 0)
    Integer limit,

    @ApiParam(value = ACCEPT_LANGUAGE_DESC)
    @HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage
);
 
Example #11
Source File: ProcessDefinitionIdentityLinkResource.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Delete a candidate starter from a process definition", tags = {"Process Definitions"})
@ApiResponses(value = {
    @ApiResponse(code = 204, message = "Indicates the process definition was found and the identity link was removed. The response body is intentionally empty."),
    @ApiResponse(code = 404, message = "Indicates the requested process definition was not found or the process definition doesn’t have an identity-link that matches the url.")
})
@RequestMapping(value = "/repository/process-definitions/{processDefinitionId}/identitylinks/{family}/{identityId}", method = RequestMethod.DELETE)
public void deleteIdentityLink(@ApiParam(name = "processDefinitionId", value="The id of the process definition.")  @PathVariable("processDefinitionId") String processDefinitionId,@ApiParam(name = "family", value="Either users or groups, depending on the type of identity link.") @PathVariable("family") String family,@ApiParam(name = "identityId", value="Either the user or group of the identity to remove as candidate starter.") @PathVariable("identityId") String identityId,
    HttpServletResponse response) {

  ProcessDefinition processDefinition = getProcessDefinitionFromRequest(processDefinitionId);

  validateIdentityLinkArguments(family, identityId);

  // Check if identitylink to delete exists
  IdentityLink link = getIdentityLink(family, identityId, processDefinition.getId());
  if (link.getUserId() != null) {
    repositoryService.deleteCandidateStarterUser(processDefinition.getId(), link.getUserId());
  } else {
    repositoryService.deleteCandidateStarterGroup(processDefinition.getId(), link.getGroupId());
  }

  response.setStatus(HttpStatus.NO_CONTENT.value());
}
 
Example #12
Source File: ShoppingListApi.java    From commerce-cif-api with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/{id}")
@ApiOperation(value = "Gets a users shopping list with a given id.")
@ApiResponses(value = {
    @ApiResponse(code = HTTP_BAD_REQUEST, message = HTTP_BAD_REQUEST_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_UNAUTHORIZED, message = HTTP_UNAUTHORIZED_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_NOT_FOUND, message = HTTP_NOT_FOUND_MESSAGE, response = ErrorResponse.class)
})
ShoppingList getShoppingList(
    @ApiParam(value = "The id of the shopping list to return.", required = true)
    @PathParam("id")
    String id,

    @ApiParam(value = ACCEPT_LANGUAGE_DESC)
    @HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage
);
 
Example #13
Source File: NamespacesController.java    From pulsar-manager with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Query list by the name of tenant or namespace, support paging, the default is 10 per page")
@ApiResponses({
        @ApiResponse(code = 200, message = "ok"),
        @ApiResponse(code = 500, message = "Internal server error")
})
@RequestMapping(value = "/namespaces/{tenantOrNamespace}", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> getNamespacesByTenant(
        @ApiParam(value = "The name of tenant or namespace.")
        @Size(min = 1, max = 255)
        @PathVariable String tenantOrNamespace,
        @ApiParam(value = "page_num", defaultValue = "1", example = "1")
        @RequestParam(name = "page_num", defaultValue = "1")
        @Min(value = 1, message = "page_num is incorrect, should be greater than 0.")
                Integer pageNum,
        @ApiParam(value = "page_size", defaultValue = "10", example = "10")
        @RequestParam(name="page_size", defaultValue = "10")
        @Range(min = 1, max = 1000, message = "page_size is incorrect, should be greater than 0 and less than 1000.")
        Integer pageSize) {
    String requestHost = environmentCacheService.getServiceUrl(request);
    Map<String, Object> result = namespacesService.getNamespaceList(pageNum, pageSize, tenantOrNamespace, requestHost);
    return ResponseEntity.ok(result);
}
 
Example #14
Source File: JobExceptionStacktraceResource.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Get the exception stacktrace for a suspended job", tags = {"Jobs"})
@ApiResponses(value = {
    @ApiResponse(code = 200, message = "Indicates the requested job was not found and the stacktrace has been returned. The response contains the raw stacktrace and always has a Content-type of text/plain."),
    @ApiResponse(code = 404, message = "Indicates the requested job was not found or the job doesn’t have an exception stacktrace. Status-description contains additional information about the error.")
})
@RequestMapping(value = "/management/suspended-jobs/{jobId}/exception-stacktrace", method = RequestMethod.GET)
public String getSuspendedJobStacktrace(@ApiParam(name = "jobId") @PathVariable String jobId, HttpServletResponse response) {
  Job job = managementService.createSuspendedJobQuery().jobId(jobId).singleResult();
  if (job == null) {
    throw new ActivitiObjectNotFoundException("Could not find a job with id '" + jobId + "'.", Job.class);
  }

  String stackTrace = managementService.getSuspendedJobExceptionStacktrace(job.getId());

  if (stackTrace == null) {
    throw new ActivitiObjectNotFoundException("Suspended job with id '" + job.getId() + "' doesn't have an exception stacktrace.", String.class);
  }

  response.setContentType("text/plain");
  return stackTrace;
}
 
Example #15
Source File: ShoppingListApi.java    From commerce-cif-api with Apache License 2.0 6 votes vote down vote up
@PUT
@Path("/{id}")
@ApiOperation(value = "Replaces a shopping list with the given one.")
@ApiResponses(value = {
    @ApiResponse(code = HTTP_BAD_REQUEST, message = HTTP_BAD_REQUEST_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_UNAUTHORIZED, message = HTTP_UNAUTHORIZED_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_NOT_FOUND, message = HTTP_NOT_FOUND_MESSAGE, response = ErrorResponse.class)
})
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
ShoppingList putShoppingList(
    @ApiParam(value = "The id of the shopping list to replace.", required = true)
    @PathParam("id")
    String id,

    @ApiParam(value = "Name of the shopping list.", required = true)
    @FormParam("name")
    String name,

    @ApiParam(value = "Description of the shopping list.")
    @FormParam("description")
    String description,

    @ApiParam(value = ACCEPT_LANGUAGE_DESC)
    @HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage
);
 
Example #16
Source File: DeploymentResourceCollectionResource.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "List resources in a deployment", tags = {"Deployment"}, notes="The dataUrl property in the resulting JSON for a single resource contains the actual URL to use for retrieving the binary resource.")
@ApiResponses(value = {
    @ApiResponse(code = 200, message = "Indicates the deployment was found and the resource list has been returned."),
    @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.")
})
@RequestMapping(value = "/repository/deployments/{deploymentId}/resources", method = RequestMethod.GET, produces = "application/json")
public List<DeploymentResourceResponse> getDeploymentResources(@ApiParam(name = "deploymentId", value = "The id of the deployment to get the resources for.") @PathVariable String deploymentId, HttpServletRequest request) {
  // Check if deployment exists
  Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
  if (deployment == null) {
    throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class);
  }

  List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);

  return restResponseFactory.createDeploymentResourceResponseList(deploymentId, resourceList, contentTypeResolver);
}
 
Example #17
Source File: RestProjectController.java    From AuTe-Framework with Apache License 2.0 6 votes vote down vote up
@ApiOperation(
        value = "Gets project by its code",
        nickname = "findOne",
        produces = MediaType.APPLICATION_JSON_VALUE
)
@ApiResponses({
        @ApiResponse(code = 200, message = "Project data"),
        @ApiResponse(code = 404, message = "Project with given code not found")
})
@RequestMapping(value = "{projectCode}", method = RequestMethod.GET)
public ProjectRo findOne(@PathVariable String projectCode) {
    Project project = projectService.findOne(projectCode);
    if (project != null) {
        return projectRoMapper.projectToProjectRo(project);
    }
    throw new ResourceNotFoundException();
}
 
Example #18
Source File: RestScenarioController.java    From AuTe-Framework with Apache License 2.0 6 votes vote down vote up
@ApiOperation(
        value = "Gets scenario by given code",
        notes = "If scenario doesn`t exist, new empty scenario will be created",
        nickname = "findOne",
        produces = MediaType.APPLICATION_JSON_VALUE
)
@ApiResponses({
        @ApiResponse(code = 200, message = "Scenario"),
        @ApiResponse(code = 404, message = "Scenario haven`t been loaded"),
        @ApiResponse(code = 500, message = "Server error. Cannot read scenario from file")
})
@RequestMapping(value = { "{scenarioCode:.+}", "{scenarioGroup:.+}/{scenarioCode:.+}" }, method = RequestMethod.GET)
public ScenarioRo findOne(
        @PathVariable String projectCode,
        @PathVariable(required = false) String scenarioGroup,
        @PathVariable String scenarioCode) throws IOException {
    String scenarioPath = (StringUtils.isEmpty(scenarioGroup) ? "" : scenarioGroup + "/") + scenarioCode;
    Scenario scenario = scenarioService.findOne(projectCode, scenarioPath);
    if (scenario != null) {
        // TODO Set projectName
        return projectRoMapper.scenarioToScenarioRo(projectCode, scenario);
    }
    throw new ResourceNotFoundException();
}
 
Example #19
Source File: ProductCompositeService.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
/**
 * Sample usage:
 *
 * curl -X DELETE $HOST:$PORT/product-composite/1
 *
 * @param productId
 */
@ApiOperation(
    value = "${api.product-composite.delete-composite-product.description}",
    notes = "${api.product-composite.delete-composite-product.notes}")
@ApiResponses(value = {
    @ApiResponse(code = 400, message = "Bad Request, invalid format of the request. See response message for more information."),
    @ApiResponse(code = 422, message = "Unprocessable entity, input parameters caused the processing to fail. See response message for more information.")
})
@DeleteMapping(value = "/product-composite/{productId}")
Mono<Void> deleteCompositeProduct(@PathVariable int productId);
 
Example #20
Source File: PetApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Finds Pets by status
 *
 * Multiple status values can be provided with comma separated strings
 *
 */
@GET
@Path("/pet/findByStatus")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Finds Pets by status", tags={ "pet",  })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
    @ApiResponse(code = 400, message = "Invalid status value") })
public List<Pet> findPetsByStatus(@QueryParam("status") @NotNull  List<String> status);
 
Example #21
Source File: PetApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * uploads an image (required)
 *
 */
@POST
@Path("/fake/{petId}/uploadImageWithRequiredFile")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
@ApiOperation(value = "uploads an image (required)", tags={ "pet" })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
public ModelApiResponse uploadFileWithRequiredFile(@PathParam("petId") Long petId,  @Multipart(value = "requiredFile" ) Attachment requiredFileDetail, @Multipart(value = "additionalMetadata", required = false)  String additionalMetadata);
 
Example #22
Source File: ProductCompositeService.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
/**
 * Sample usage:
 *
 * curl -X POST $HOST:$PORT/product-composite \
 *   -H "Content-Type: application/json" --data \
 *   '{"productId":123,"name":"product 123","weight":123}'
 *
 * @param body
 */
@ApiOperation(
    value = "${api.product-composite.create-composite-product.description}",
    notes = "${api.product-composite.create-composite-product.notes}")
@ApiResponses(value = {
    @ApiResponse(code = 400, message = "Bad Request, invalid format of the request. See response message for more information."),
    @ApiResponse(code = 422, message = "Unprocessable entity, input parameters caused the processing to fail. See response message for more information.")
})
@PostMapping(
    value    = "/product-composite",
    consumes = "application/json")
Mono<Void> createCompositeProduct(@RequestBody ProductAggregate body);
 
Example #23
Source File: CategoryResource.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@PutMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiOperation(value = "Update category",notes = "It permits to update a category")
@ApiResponses(value = {
    @ApiResponse(code = 200,message = "Category update successfully"),
    @ApiResponse(code = 404,message = "Category not found"),
    @ApiResponse(code = 400,message = "Invalid request")
})
public ResponseEntity<Category> updateCategory(@PathVariable("id") String id,CategoryRequest category){
  return new ResponseEntity<>(new Category(), HttpStatus.OK);
}
 
Example #24
Source File: HistoricDetailQueryResource.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "Query for historic details", tags = { "History" }, notes = "All supported JSON parameter fields allowed are exactly the same as the parameters found for getting a collection of historic process 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 historic details are returned"),
    @ApiResponse(code = 400, message = "Indicates an parameter was passed in the wrong format. The status-message contains additional information.") })
@RequestMapping(value = "/query/historic-detail", method = RequestMethod.POST, produces = "application/json")
public DataResponse queryHistoricDetail(@RequestBody HistoricDetailQueryRequest queryRequest,@ApiParam(hidden=true) @RequestParam Map<String, String> allRequestParams, HttpServletRequest request) {

  return getQueryResponse(queryRequest, allRequestParams);
}
 
Example #25
Source File: FakeApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * To test \&quot;client\&quot; model
 *
 * To test \&quot;client\&quot; model
 *
 */
@PATCH
@Path("/fake")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test \"client\" model", tags={ "fake",  })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "successful operation", response = Client.class) })
public Client testClientModel(@Valid Client body);
 
Example #26
Source File: TaskVariableCollectionResource.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "Delete all local variables on a task", tags = {"Tasks"})
@ApiResponses(value = {
    @ApiResponse(code = 204, message = "Indicates all local task variables have been deleted. Response-body is intentionally empty."),
    @ApiResponse(code = 404, message = "Indicates the requested task was not found.")
})
@RequestMapping(value = "/runtime/tasks/{taskId}/variables", method = RequestMethod.DELETE)
public void deleteAllLocalTaskVariables(@ApiParam(name="taskId", value="The id of the task the variable to delete belongs to.") @PathVariable String taskId, HttpServletResponse response) {
  Task task = getTaskFromRequest(taskId);
  Collection<String> currentVariables = taskService.getVariablesLocal(task.getId()).keySet();
  taskService.removeVariablesLocal(task.getId(), currentVariables);

  response.setStatus(HttpStatus.NO_CONTENT.value());
}
 
Example #27
Source File: GoogleCloudBlobstoreApiResourceDoc.java    From nexus-blobstore-google-cloud with Eclipse Public License 1.0 5 votes vote down vote up
@ApiOperation("Create a Google Cloud blob store")
@ApiResponses(value = {
    @ApiResponse(code = 201, message = "Google Cloud blob store created"),
    @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED),
    @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS)
})
GoogleCloudBlobstoreApiModel create(@Valid GoogleCloudBlobstoreApiModel blobstoreApiModel) throws Exception;
 
Example #28
Source File: CategoryResource.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@PostMapping
@ApiOperation(value = "Create category",notes = "It permits to create a new category")
@ApiResponses(value = {
    @ApiResponse(code = 201,message = "Category created successfully"),
    @ApiResponse(code = 400,message = "Invalid request")
})
public ResponseEntity<Category> newCategory(@RequestBody CategoryRequest category){
  return new ResponseEntity<>(this.categoryService.create(category), HttpStatus.CREATED);
}
 
Example #29
Source File: ProcessInstanceDiagramResource.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "Get diagram for a process instance", tags = { "Process Instances" })
@ApiResponses(value = {
    @ApiResponse(code = 200, message = "Indicates the process instance was found and the diagram was returned."),
    @ApiResponse(code = 400, message = "Indicates the requested process instance was not found but the process doesn’t contain any graphical information (BPMN:DI) and no diagram can be created."),
    @ApiResponse(code = 404, message = "Indicates the requested process instance was not found.")
})
@RequestMapping(value = "/runtime/process-instances/{processInstanceId}/diagram", method = RequestMethod.GET)
public ResponseEntity<byte[]> getProcessInstanceDiagram(@ApiParam(name = "processInstanceId", value="The id of the process instance to get the diagram for.") @PathVariable String processInstanceId, HttpServletResponse response) {
  ProcessInstance processInstance = getProcessInstanceFromRequest(processInstanceId);

  ProcessDefinition pde = repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());

  if (pde != null && pde.hasGraphicalNotation()) {
    BpmnModel bpmnModel = repositoryService.getBpmnModel(pde.getId());
    ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
    InputStream resource = diagramGenerator.generateDiagram(bpmnModel, "png", runtimeService.getActiveActivityIds(processInstance.getId()), Collections.<String> emptyList(),
        processEngineConfiguration.getActivityFontName(), processEngineConfiguration.getLabelFontName(), 
        processEngineConfiguration.getAnnotationFontName(), processEngineConfiguration.getClassLoader(), 1.0);

    HttpHeaders responseHeaders = new HttpHeaders();
    responseHeaders.set("Content-Type", "image/png");
    try {
      return new ResponseEntity<byte[]>(IOUtils.toByteArray(resource), responseHeaders, HttpStatus.OK);
    } catch (Exception e) {
      throw new ActivitiIllegalArgumentException("Error exporting diagram", e);
    }

  } else {
    throw new ActivitiIllegalArgumentException("Process instance with id '" + processInstance.getId() + "' has no graphical notation defined.");
  }
}
 
Example #30
Source File: RestVersionController.java    From AuTe-Framework with Apache License 2.0 5 votes vote down vote up
@ApiOperation(
        value = "Gets application version",
        nickname = "managerVersion",
        produces = MediaType.APPLICATION_JSON_VALUE
)
@ApiResponses({
        @ApiResponse(code = 200, message = "Version of the application"),
})
@RequestMapping(value = "/application", method = RequestMethod.GET)
public Version managerVersion() {
    return versionService.getApplicationVersion();
}