當前位置: 首頁>>代碼示例>>Java>>正文


Java ApiOperation類代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:eclipse,項目名稱:keti,代碼行數:23,代碼來源:AttributeConnectorController.java

示例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();
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:29,代碼來源:TenantResource.java

示例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);
    }
}
 
開發者ID:BakkerTom,項目名稱:happy-news,代碼行數:23,代碼來源:AdminPostController.java

示例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));
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:17,代碼來源:DocumentsController.java

示例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;
}
 
開發者ID:egojit8,項目名稱:easyweb,代碼行數:17,代碼來源:MenuController.java

示例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);
}
 
開發者ID:ChangyiHuang,項目名稱:shuzheng,代碼行數:19,代碼來源:UpmsPermissionController.java

示例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));

}
 
開發者ID:hmcts,項目名稱:document-management-store-app,代碼行數:21,代碼來源:StoredDocumentController.java

示例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);
}
 
開發者ID:prestodb,項目名稱:presto-manager,代碼行數:24,代碼來源:ControllerConnectorAPI.java

示例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);
}
 
開發者ID:Eagle-OJ,項目名稱:eagle-oj-api,代碼行數:20,代碼來源:ProblemController.java

示例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));
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:20,代碼來源:ManagerConnectorApis.java

示例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;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:26,代碼來源:ManagerConnectorApis.java

示例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);
}
 
開發者ID:hzwy23,項目名稱:batch-scheduler,代碼行數:23,代碼來源:BatchGroupRelController.java

示例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");
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:29,代碼來源:TaxonomyResource.java

示例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);
}
 
開發者ID:redhat-developer,項目名稱:che-starter,代碼行數:11,代碼來源:WorkspaceController.java

示例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;
}
 
開發者ID:egojit8,項目名稱:easyweb,代碼行數:13,代碼來源:DictController.java


注:本文中的io.swagger.annotations.ApiOperation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。