本文整理汇总了Java中io.swagger.annotations.ApiOperation类的典型用法代码示例。如果您正苦于以下问题:Java ApiOperation类的具体用法?Java ApiOperation怎么用?Java ApiOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApiOperation类属于io.swagger.annotations包,在下文中一共展示了ApiOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putResourceConnector
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@ApiOperation(value = "Creates or updates connector configuration for external resource attributes for the given "
+ "zone.", tags = { "Attribute Connector Management" })
@ApiResponses(value = {
@ApiResponse(code = 201, message = "Connector configuration for the given zone is successfully created.") })
@RequestMapping(method = PUT, value = V1 + AcsApiUriTemplates.RESOURCE_CONNECTOR_URL,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> putResourceConnector(
@ApiParam(value = "New or updated connector configuration for external resource attributes",
required = true) @RequestBody final AttributeConnector connector) {
try {
boolean connectorCreated = this.service.upsertResourceConnector(connector);
if (connectorCreated) {
// return 201 with empty response body
return created(V1 + AcsApiUriTemplates.RESOURCE_CONNECTOR_URL, false);
}
// return 200 with empty response body
return ok();
} catch (AttributeConnectorException e) {
throw new RestApiException(HttpStatus.UNPROCESSABLE_ENTITY, e.getMessage(), e);
}
}
示例2: getUserGroups
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
/**
* Retrieves all the of user groups in this NiFi.
*
* @return a list of all user groups in this NiFi.
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("user-groups")
@ApiOperation(
value = "Gets all user groups",
notes = NON_GUARANTEED_ENDPOINT,
response = UserGroup.class,
responseContainer = "List"
)
@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 getUserGroups() {
verifyAuthorizerIsManaged();
authorizeAccess(RequestAction.READ);
final List<UserGroup> userGroups = authorizationService.getUserGroups();
return generateOkResponse(userGroups).build();
}
示例3: addPost
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
/**
* Create a new post. The post will be validated using {@link PostValidator}.
*
* @param post The post to create.
* @return The newly created post.
*/
@ApiOperation("Create a new post")
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Post> addPost(@Valid @RequestBody Post post) {
post.setUuid(null);
try {
Post saved = postRepository.save(post);
return ResponseEntity
.created(URI.create("/admin/posts/" + saved.getUuid()))
.body(saved);
} catch (Exception e) {
logger.error("Could not create post.", e);
throw new PostCreationException("Could not create post.", e);
}
}
示例4: claimIssueReceipt
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@ApiOperation("Returns a Claim Issue receipt for a given claim external id")
@GetMapping(
value = "/claimIssueReceipt/{externalId}",
produces = MediaType.APPLICATION_PDF_VALUE
)
public ResponseEntity<ByteArrayResource> claimIssueReceipt(
@ApiParam("Claim external id")
@PathVariable("externalId") @NotBlank String externalId
) {
byte[] pdfDocument = documentsService.generateClaimIssueReceipt(externalId);
return ResponseEntity
.ok()
.contentLength(pdfDocument.length)
.body(new ByteArrayResource(pdfDocument));
}
示例5: edit
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@ApiOperation(value = "菜单管理-编辑接口")
@PostMapping("/edit")
@ResponseBody
public BaseResult edit(SysMenu model){
BaseResult result=new BaseResult(BaseResultCode.SUCCESS,"成功");
SysUser curentUser= UserUtils.getUser();
if(StringUtils.isEmpty(model.getId())){
model.setCreateBy(curentUser.getId());
model.setUpdateBy(curentUser.getId());
service.insert(model);
}else {
model.setUpdateBy(curentUser.getId());
service.updateByPrimaryKeySelective(model);
}
return result;
}
示例6: create
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@ApiOperation(value = "新增权限")
@RequiresPermissions("upms:permission:create")
@ResponseBody
@RequestMapping(value = "/create", method = RequestMethod.POST)
public Object create(UpmsPermission upmsPermission) {
ComplexResult result = FluentValidator.checkAll()
.on(upmsPermission.getName(), new LengthValidator(1, 20, "名称"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new UpmsResult(UpmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
upmsPermission.setCtime(time);
upmsPermission.setOrders(time);
int count = upmsPermissionService.insertSelective(upmsPermission);
return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
示例7: getPreviewThumbnail
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@GetMapping(value = "{id}/thumbnail")
@ApiOperation("Streams contents of the most recent Document Content Version associated with the Stored Document.")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Returns thumbnail of a file")
})
@Transactional(readOnly = true)
public ResponseEntity<Resource> getPreviewThumbnail(@PathVariable UUID id) {
DocumentContentVersion documentContentVersion =
documentContentVersionService.findMostRecentDocumentContentVersionByStoredDocumentId(id);
if (documentContentVersion == null || documentContentVersion.getStoredDocument().isDeleted()) {
return ResponseEntity.notFound().build();
}
return ResponseEntity.ok()
.contentType(MediaType.IMAGE_JPEG)
.body(documentThumbnailService.generateThumbnail(documentContentVersion));
}
示例8: setConnectorFileByURL
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@POST
@Path("/{file}")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Replace this file with the file at the given URL")
@ApiResponses(value = {
@ApiResponse(code = 207, message = "Multiple responses available"),
@ApiResponse(code = 400, message = "Request contains invalid parameters")})
public Response setConnectorFileByURL(
String url,
@PathParam("file") String file,
@QueryParam("scope") String scope,
@QueryParam("nodeId") List<String> nodeId)
{
ApiRequester apiRequester = requesterBuilder(ControllerConnectorAPI.class)
.pathMethod("setConnectorFileByURL")
.httpMethod(POST)
.resolveTemplate("file", file)
.accept(MediaType.TEXT_PLAIN)
.entity(Entity.entity(url, MediaType.TEXT_PLAIN))
.build();
return forwardRequest(scope, apiRequester, nodeId);
}
示例9: addProblemTestCase
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@ApiOperation("添加一道题目的一个测试用例")
@RequiresAuthentication
@PostMapping("/{pid}/test_cases")
public ResponseEntity addProblemTestCase(
@PathVariable("pid") int pid,
@RequestBody @Valid AddProblemTestCaseFormat format) {
ProblemEntity problemEntity = problemService.getProblemByPid(pid);
haveProblem(problemEntity);
havePermission(problemEntity);
// 添加test_case
int tid = testCasesService.addTestCase(pid, format.getStdin(), format.getStdout(), format.getStrength());
if (tid == 0) {
throw new WebErrorException("添加失败");
}
return new ResponseEntity("添加成功", tid);
}
示例10: deleteApplianceManagerConnector
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@ApiOperation(value = "Deletes an Manager Connector",
notes = "Deletes an Appliance Manager Connector if not referenced by any Distributed Appliances",
response = BaseJobResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
@ApiResponse(code = 400,
message = "In case of any error or if the Manager connector is referenced by a Distributed Appliance",
response = ErrorCodeDto.class) })
@Path("/{applianceManagerConnectorId}")
@DELETE
public Response deleteApplianceManagerConnector(@Context HttpHeaders headers,
@ApiParam(value = "Id of the Appliance Manager Connector",
required = true) @PathParam("applianceManagerConnectorId") Long amcId) {
logger.info("Deleting Appliance Manager Connector " + amcId);
this.userContext.setUser(OscAuthFilter.getUsername(headers));
return this.apiUtil.getResponseForBaseRequest(this.deleteApplianceManagerConnectorService,
new BaseIdRequest(amcId));
}
示例11: updateApplianceManagerConnector
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@ApiOperation(
value = "Updates an Manager Connector. If we are unable to connect to the endpoint(IP) using the credentials provided, this call will fail.",
notes = "Creates an Manager Connector and sync's it immediately. "
+ "If we are unable to connect to the manager using the credentials provided, this call will fail."
+ "To skip validation of IP and credentials 'skipRemoteValidation' flag can be used.",
response = BaseJobResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400,
message = "In case of any error validating the information",
response = ErrorCodeDto.class) })
@Path("/{applianceManagerConnectorId}")
@PUT
public Response updateApplianceManagerConnector(@Context HttpHeaders headers,
@ApiParam(value = "Id of the Appliance Manager Connector",
required = true) @PathParam("applianceManagerConnectorId") Long amcId,
@ApiParam(required = true) ApplianceManagerConnectorRequest amcRequest) {
logger.info("Updating Appliance Manager Connector " + amcId);
this.userContext.setUser(OscAuthFilter.getUsername(headers));
this.apiUtil.setIdOrThrow(amcRequest, amcId, "Appliance Manager Connector");
Response responseForBaseRequest = this.apiUtil.getResponseForBaseRequest(this.updateService,
new DryRunRequest<>(amcRequest, amcRequest.isSkipRemoteValidation()));
return responseForBaseRequest;
}
示例12: addGroup
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@RequestMapping(value = "/v1/dispatch/batch/define/group", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "在批次中添加任务组")
public String addGroup(HttpServletResponse response, HttpServletRequest request) {
String batchId = request.getParameter("batch_id");
String domainId = request.getParameter("domain_id");
String json = request.getParameter("JSON");
List<BatchGroupDto> list = new GsonBuilder().create().fromJson(json, new TypeToken<List<BatchGroupDto>>() {
}.getType());
for (BatchGroupDto m : list) {
m.setDomainId(domainId);
m.setBatchId(batchId);
}
RetMsg retMsg = batchGroupService.addGroup(list);
if (!retMsg.checkCode()) {
response.setStatus(retMsg.getCode());
return Hret.error(retMsg);
}
return Hret.success(retMsg);
}
示例13: getTermByUuid
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
/**
* Returns terms
*
* @return Response encapsulating TermBeans
*/
@GET
@Path("/{uuid}/term/{termUuid}")
@Produces("application/json")
@ApiOperation(value = "Get term by UUID")
public Response getTermByUuid(
@ApiParam(value = "Taxonomy uuid", required = false) @PathParam("uuid") String taxonomyUuid,
@ApiParam(value = "term uuid", required = true) @PathParam("termUuid") String termUuid)
{
final Taxonomy taxonomy = ensureTaxonomy(taxonomyUuid, PrivCheck.VIEW);
TermResult term = taxonomyService.getTermResultByUuid(taxonomyUuid, termUuid);
TermBean bean = null;
if( term != null )
{
bean = beanFromTaxonomyTerm(term, taxonomyUuid);
return Response.ok(bean).build();
}
else
{
throw new WebException(Status.NOT_FOUND.getStatusCode(), Status.NOT_FOUND.getReasonPhrase(),
"termUuid given is not valid");
}
}
示例14: workspaces
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
@ApiOperation(value = "Create and start a new workspace. Stop all other workspaces (only one workspace can be running at a time)")
@PostMapping("/workspace/oso")
public Workspace createOnOpenShift(@RequestParam String masterUrl, @RequestParam String namespace,
@RequestBody WorkspaceCreateParams params,
@ApiParam(value = "OpenShift token", required = true) @RequestHeader("Authorization") String openShiftToken)
throws IOException, URISyntaxException, RouteNotFoundException, StackNotFoundException,
GitHubOAthTokenException, ProjectCreationException, WorkspaceNotFound {
return createWorkspace(masterUrl, namespace, openShiftToken, null, null, params);
}
示例15: getByParentId
import io.swagger.annotations.ApiOperation; //导入依赖的package包/类
/**
* 获取所有机构列表
* @return
*/
@ApiOperation(value = "字典管理-树层级结构接口")
@PostMapping("/get_by_parentid")
@ResponseBody
public BaseResult getByParentId(SysDict model) {
BaseResult result=new BaseResult(BaseResultCode.SUCCESS,"成功");
result.setData(tree(model));
return result;
}