Java Code Examples for io.swagger.annotations.ApiOperation

The following are top voted examples for showing how to use io.swagger.annotations.ApiOperation. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: keti   File: AttributeConnectorController.java   Source Code and License 19 votes vote down vote up
@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);
    }
}
 
Example 2
Project: nifi-registry   File: TenantResource.java   Source Code and License 8 votes vote down vote up
/**
 * 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();
}
 
Example 3
Project: happy-news   File: AdminPostController.java   Source Code and License 7 votes vote down vote up
/**
 * 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);
    }
}
 
Example 4
Project: cmc-claim-store   File: DocumentsController.java   Source Code and License 7 votes vote down vote up
@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));
}
 
Example 5
Project: presto-manager   File: ControllerConnectorAPI.java   Source Code and License 7 votes vote down vote up
@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);
}
 
Example 6
Project: osc-core   File: ManagerConnectorApis.java   Source Code and License 7 votes vote down vote up
@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;
}
 
Example 7
Project: Equella   File: TaxonomyResource.java   Source Code and License 7 votes vote down vote up
/**
 * 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");
	}
}
 
Example 8
Project: che-starter   File: WorkspaceController.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 9
Project: easyweb   File: DictController.java   Source Code and License 6 votes vote down vote up
/**
 * 获取所有机构列表
 * @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;
}
 
Example 10
Project: app-ms   File: SecureHelloResource.java   Source Code and License 6 votes vote down vote up
@ApiOperation(value = "displays hello world after a given amount of seconds seconds")
@GET
@Path("/suspend/{seconds}")
@Produces(MediaType.TEXT_PLAIN)
public void suspend(@Suspended final AsyncResponse asyncResponse,
    @PathParam("seconds") final int seconds) throws InterruptedException {

    Thread.sleep(seconds * 1000L);
    asyncResponse.resume(Response.ok("hello").build());
}
 
Example 11
Project: digag-server   File: EntryController.java   Source Code and License 6 votes vote down vote up
@ApiOperation(value = "更新单条条目")
@PreAuthorize("hasRole('USER')")
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public JsonResult<Entry> updateEntry(@PathVariable @ApiParam(value = "条目id", required = true) String id,
                                     @ApiParam(value = "条目对象", required = true) @RequestBody Entry entry) {
    entry.setId(id);
    return entryService.save(entry);
}
 
Example 12
Project: osc-core   File: VirtualizationConnectorApis.java   Source Code and License 6 votes vote down vote up
@ApiOperation(value = "Lists Security Group Members",
        notes = "Lists Security Group Member owned by Security Group and Virtualization Connector provided.",
        response = SecurityGroupMemberItemDto.class,
        responseContainer = "Set")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{vcId}/securityGroups/{sgId}/members")
@GET
public Set<SecurityGroupMemberItemDto> getSecurityGroupMembers(@Context HttpHeaders headers,
        @ApiParam(value = "The Virtualization Connector Id") @PathParam("vcId") Long vcId,
        @ApiParam(value = "The Security Group Id") @PathParam("sgId") Long sgId) {
    logger.info("Listing Members for Security Group - " + sgId);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));
    GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest();
    getDtoRequest.setEntityId(sgId);
    getDtoRequest.setEntityName("SecurityGroup");
    GetDtoFromEntityServiceApi<SecurityGroupDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(SecurityGroupDto.class);
    SecurityGroupDto dto = this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto();

    this.apiUtil.validateParentIdMatches(dto, vcId, "SecurityGroup");

    @SuppressWarnings("unchecked")
    SetResponse<SecurityGroupMemberItemDto> memberList = (SetResponse<SecurityGroupMemberItemDto>) this.apiUtil
    .getSetResponse(this.listSecurityGroupMembersBySgService, new BaseIdRequest(sgId));

    return memberList.getSet();
}
 
Example 13
Project: easyweb   File: MenuController.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 14
Project: shuzheng   File: UpmsPermissionController.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 15
Project: document-management-store-app   File: StoredDocumentController.java   Source Code and License 6 votes vote down vote up
@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));

}
 
Example 16
Project: eagle-oj-api   File: ProblemController.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 17
Project: osc-core   File: ManagerConnectorApis.java   Source Code and License 6 votes vote down vote up
@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));
}
 
Example 18
Project: batch-scheduler   File: BatchGroupRelController.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 19
Project: swaggy-jenkins   File: BlueOceanApi.java   Source Code and License 5 votes vote down vote up
@GET
@Path("/blue/rest/organizations/{organization}/pipelines/")
@Produces({ "application/json" })
@ApiOperation(value = "", tags={  })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "Successfully retrieved pipelines details", response = Pipelines.class),
    @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = .class),
    @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = .class) })
public Pipelines getPipelines(@PathParam("organization") String organization);
 
Example 20
Project: nifi-registry   File: BucketFlowResource.java   Source Code and License 5 votes vote down vote up
@GET
@Path("{flowId}/versions/latest")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get the latest version of a flow",
        response = VersionedFlowSnapshot.class
)
@ApiResponses({
        @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 getLatestFlowVersion(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
            final String bucketId,
        @PathParam("flowId")
        @ApiParam("The flow identifier")
            final String flowId) {

    authorizeBucketAccess(RequestAction.READ, bucketId);

    final VersionedFlowSnapshotMetadata latest = registryService.getLatestFlowSnapshotMetadata(bucketId, flowId);
    if (latest == null) {
        throw new ResourceNotFoundException("No flow versions found for flow with id " + flowId);
    }

    final VersionedFlowSnapshot lastSnapshot = registryService.getFlowSnapshot(bucketId, flowId, latest.getVersion());
    populateLinksAndPermissions(lastSnapshot);

    return Response.status(Response.Status.OK).entity(lastSnapshot).build();
}
 
Example 21
Project: cf-mta-deploy-service   File: FilesApi.java   Source Code and License 5 votes vote down vote up
@GET

    @Consumes({ "application/json" })
    @Produces({ "application/json" })
    @ApiOperation(value = "", notes = "Retrieves all Multi-Target Application files ", response = FileMetadata.class, responseContainer = "List", authorizations = {
        @Authorization(value = "oauth2", scopes = {

        }) }, tags = {})
    @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = FileMetadata.class, responseContainer = "List") })
    public Response getMtaFiles() {
        return delegate.getMtaFiles(securityContext, spaceGuid);
    }
 
Example 22
Project: bird-java   File: SiteController.java   Source Code and License 5 votes vote down vote up
@ApiOperation("保存模块")
@PostMapping(value = "/saveModule")
public OperationResult save(@RequestBody ModuleDTO dto){
    moduleService.saveModule(dto);

    return OperationResult.Success("保存成功", null);
}
 
Example 23
Project: shuzheng   File: CmsPageController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "删除单页")
@RequiresPermissions("cms:page:delete")
@RequestMapping(value = "/delete/{ids}",method = RequestMethod.GET)
@ResponseBody
public Object delete(@PathVariable("ids") String ids) {
	int count = cmsPageService.deleteByPrimaryKeys(ids);
	return new CmsResult(CmsResultConstant.SUCCESS, count);
}
 
Example 24
Project: osc-core   File: VirtualSystemApis.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "Retrieves the Deployment Specification",
        notes = "Retrieves a Deployment Specification specified by its owning Virtual System and Deployment Spec Id",
        response = ApplianceManagerConnectorDto.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{vsId}/deploymentSpecs/{dsId}")
@GET
public DeploymentSpecDto getDeploymentSpec(@Context HttpHeaders headers,
        @ApiParam(value = "The Virtual System Id") @PathParam("vsId") Long vsId,
        @ApiParam(value = "The Deployment Specification Id") @PathParam("dsId") Long dsId) {
    logger.info("getting Deployment Spec " + dsId);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));
    GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest();
    getDtoRequest.setEntityId(dsId);
    getDtoRequest.setEntityName("DeploymentSpec");
    GetDtoFromEntityServiceApi<DeploymentSpecDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(DeploymentSpecDto.class);
    DeploymentSpecDto dto = this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto();

    this.apiUtil.validateParentIdMatches(dto, vsId, "SecurityGroup");

    return dto;
}
 
Example 25
Project: opencps-v2   File: ApplicantManagement.java   Source Code and License 5 votes vote down vote up
@PUT
@Path("/{id}/profile/{key}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Get the profile of applicant", response = JSONObject.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the profile of applicant", response = JSONObject.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updateApplicantProfile(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("key") String key,
		@BeanParam ProfileInputModel input);
 
Example 26
Project: xmall   File: ContentCatController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/content/cat/list",method = RequestMethod.GET)
@ApiOperation(value = "获得分类列表")
public List<ZTreeNode> getContentByCid(@RequestParam(name="id", defaultValue="0") Long parentId){

    List<ZTreeNode> list=contentCatService.getContentCatList(parentId);
    return list;
}
 
Example 27
Project: GoPush   File: ApisDeviceController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "设备选择链接节点", notes = "设备选择链接节点")
@RequestMapping(value = "/select", method = RequestMethod.GET)
public ResponseEntity<BaseResp<LoadbanceNode>> selectNode() {
    Map<String, NodeServerInfo> maps = new HashMap<>(nodeServerDiscoveryService.nodeServerPool());
    if (!CollectionUtils.isEmpty(maps)) {
        NodeServerInfo info = maps.values().stream()
                .min(Comparator.comparingInt(e -> e.getNodeLoaderInfo().getOnlineDeviceCounter()))
                .get();
        return ResponseEntity.ok(
                BaseResp.ok(
                        LoadbanceNode.builder()
                                .ip(info.getInternetIp())
                                .port(info.getDevicePort())
                                .readInterval(IdleEnum.READ_IDLE.getValue())
                                .writeInterval(IdleEnum.WRITE_IDLE.getValue())
                                .allInterval(IdleEnum.ALL_IDLE.getValue())
                                .build()
                ));
    }
    return ResponseEntity.ok(BaseResp.fail(400, "无可链接节点"));
}
 
Example 28
Project: continuous-performance-testing   File: SampleResource.java   Source Code and License 5 votes vote down vote up
@ApiOperation("Delete a sample")
@DELETE
@Path("{id}")
@Timed
public Sample delete(@PathParam("id") Long id) {
  return sampleDao.deleteSample(id);
}
 
Example 29
Project: swaggy-jenkins   File: RemoteAccessApi.java   Source Code and License 5 votes vote down vote up
@GET
@Path("/crumbIssuer/api/json")
@Produces({ "application/json" })
@ApiOperation(value = "", tags={  })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "Successfully retrieved CSRF protection token", response = DefaultCrumbIssuer.class),
    @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = .class),
    @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = .class) })
public DefaultCrumbIssuer getCrumb();
 
Example 30
Project: opencps-v2   File: DossierTemplateManagement.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{id}/parts/{partno}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Remove a DossierPart of a DossierTemplate", response = DossierPartInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierPart was removed", response = DossierPartInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response removeDossierParts(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("partno") String partNo);
 
Example 31
Project: JAVA-   File: SysUserController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "修改密码")
@PostMapping(value = "/update/password")
public Object updatePassword(ModelMap modelMap, @RequestBody SysUser param) {
	Assert.isNotBlank(param.getOldPassword(), "OLDPASSWORD");
	Assert.isNotBlank(param.getPassword(), "PASSWORD");
	Long userId = getCurrUser();
	String encryptPassword = SecurityUtil.encryptPassword(param.getOldPassword());
	Parameter parameter = new Parameter(getService(), "queryById").setId(userId);
	logger.info("{} execute queryById start...", parameter.getNo());
	SysUser sysUser = (SysUser) provider.execute(parameter).getModel();
	logger.info("{} execute queryById end.", parameter.getNo());
	Assert.notNull(sysUser, "USER", param.getId());
	if (!sysUser.getPassword().equals(encryptPassword)) {
		throw new UnauthorizedException("原密码错误.");
	}
	param.setPassword(encryptPassword);
	param.setUpdateBy(getCurrUser());
	return super.update(modelMap, param);
}
 
Example 32
Project: shuzheng   File: CmsSettingController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "修改设置")
@RequiresPermissions("cms:setting:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, CmsSetting cmsSetting) {
	ComplexResult result = FluentValidator.checkAll()
			.on(cmsSetting.getSettingKey(), new LengthValidator(1, 20, "键"))
			.doValidate()
			.result(ResultCollectors.toComplex());
	if (!result.isSuccess()) {
		return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
	}
	cmsSetting.setSettingId(id);
	int count = cmsSettingService.updateByPrimaryKeySelective(cmsSetting);
	return new CmsResult(CmsResultConstant.SUCCESS, count);
}
 
Example 33
Project: swagger-dubbo   File: DubboReaderExtension.java   Source Code and License 5 votes vote down vote up
@Override
public void applyExtensions(ReaderContext context, Operation operation, Method method) {
	final ApiOperation apiOperation = method.getAnnotation(ApiOperation.class);
	if (apiOperation != null) {
		operation.getVendorExtensions()
				.putAll(BaseReaderUtils.parseExtensions(apiOperation.extensions()));
	}

}
 
Example 34
Project: comms-router   File: UserContextResource.java   Source Code and License 5 votes vote down vote up
@POST
@ApiOperation("Updates/Creates keys in the user context")
@ApiResponses(
    @ApiResponse(code = 204, message = "Successful operation"))
public void updateContext(UpdateTaskContext taskContext)
    throws CommsRouterException {

  taskService.updateContext(taskContext, routerObjectId);
}
 
Example 35
Project: comms-router   File: AgentResource.java   Source Code and License 5 votes vote down vote up
@POST
@ApiOperation(
    value = "Add new Agent",
    notes = "Add new Agent and associate it with a Router")
@ApiResponses({
    @ApiResponse(code = 201, message = "Successful operation", response = ApiObjectRef.class)})
public Response create(CreateAgentArg agentArg) throws CommsRouterException {

  LOGGER.debug("Creating agent {}", agentArg);

  ApiObjectRef agent = agentService.create(agentArg, routerRef);

  return createResponse(agent);
}
 
Example 36
Project: danyuan-application   File: SysOrganizationController.java   Source Code and License 5 votes vote down vote up
/**
 * 方法名: sysOrganizationEdit
 * 功 能: 修改数据
 * 参 数: @param info
 * 参 数: @return
 * 返 回: String
 * 作 者 : Tenghui.Wang
 * @throws
 */
@ApiOperation(value = "修改数据", notes = "")
@RequestMapping(path = "/sysOrganizationEdit", method = RequestMethod.POST)
@ResponseBody
public String sysOrganizationEdit(@RequestBody SysOrganizationInfo info) {
	System.out.println(info.toString());
	logger.info("sysOrganizationEdit", SysOrganizationController.class);
	try {
		sysOrganizationService.sysOrganizationEdit(info);
		return "1";
	} catch (Exception e) {
		return "0";
	}
}
 
Example 37
Project: Your-Microservice   File: AuthenticationController.java   Source Code and License 5 votes vote down vote up
/**
 * authenticationRequest
 * Authentication Request to acquire an Access Token, to then in turn use this Token to access a
 * protected resource within the Your Microservice Eco-System.
 *
 * @param authenticationRequest Incoming Authentication Request DTO
 * @param request               Incoming Request
 * @return ResponseEntity If successful Authentication, Response Entity will Contain the JWT to be used for accessing
 * subsequent Protected resources within the Your Microservice Eco-System.
 * @throws AuthenticationException Thrown when Failure Occurs, Handlers will Response Accordingly.
 */
@ApiOperation(value="Authentication to obtain Access Token using Swagger Console",
        httpMethod = "POST", hidden = false)
@RequestMapping(value="/", method = RequestMethod.POST, consumes = {"application/json", "application/json;charset=UTF8"})
public ResponseEntity<?> swaggerAuthenticationRequest(@RequestBody AuthenticationRequest authenticationRequest,
                                               HttpServletRequest request) throws AuthenticationException {
    /**
     * Perform Authentication Request for Consumer to Obtain Access Token.
     */
    LOGGER.info("Performing Authentication of '{}' from '{}'", authenticationRequest.getUsername(), "swagger");
    Authentication authentication = this.authenticationManager.authenticate(
            new UsernamePasswordAuthenticationToken(
                    authenticationRequest.getUsername(),
                    authenticationRequest.getPassword()
            )
    );
    SecurityContextHolder.getContext().setAuthentication(authentication);
    // Reload password post-authentication so we can generate token
    UserDetails userDetails = this.userDetailsService.loadUserByUsername(authenticationRequest.getUsername());
    String token = this.yourMicroserviceToken.generateToken(userDetails.getUsername(), "unknown");
    /**
     * Publish Authentication Notification...
     */
    try {
        publishAuthenticationEvents(request, (YourMicroserviceUserDetails)userDetails,
                YourEntityEventHistory.EntityEventTagNames.LAST_LOGIN);
    } catch (Exception e) {
        LOGGER.warn("Unable to perform Publishing of Personal Event History for Last Login: {}",
                e.getMessage());
    }
    /**
     * Persist our new Token Entity to our History.
     */
    saveTokenHistory(token);
    /**
     * Return the Successful response with our Generated Access Token.
     */
    return ResponseEntity.ok(new AuthenticationResponse(token, TOKEN_EXPIRATION_IN_SECONDS.intValue()));
}
 
Example 38
Project: -Spring-SpringMVC-Mybatis-   File: UpmsPermissionController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "删除权限")
@RequiresPermissions("upms:permission:delete")
@RequestMapping(value = "/delete/{ids}",method = RequestMethod.GET)
@ResponseBody
public Object delete(@PathVariable("ids") String ids) {
    int count = upmsPermissionService.deleteByPrimaryKeys(ids);
    return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
 
Example 39
Project: danyuan-application   File: SysTableController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "条件查询全部数据库表管理信息", notes = "")
@RequestMapping(path = "/findAllBySysTableInfo", method = RequestMethod.POST)
public List<SysTableInfo> findAllBySysTableInfo(@RequestBody SysTableInfo sysTableInfo) {
	logger.error(sysTableInfo.toString());
	logger.info("findAll", SysTableController.class);
	return sysTableService.findAll(sysTableInfo);
}
 
Example 40
Project: batch-scheduler   File: StaticPageController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/v1/dispatch/batchAndGroup/page", method = RequestMethod.GET)
@ApiOperation(value = "批次域任务组配置管理页面")
public String getBatchGroupPage(HttpServletRequest request, Map<String, Object> map) {
    String batchId = request.getParameter("batchId");
    String batchDesc = request.getParameter("batchDesc");
    String domainId = JoinCode.getFirst(batchId);
    logger.debug("domain id is:{},batch id is:{},batch desc is:{}", domainId, batchId, batchDesc);
    map.put("batchId", batchId);
    map.put("batchDesc", batchDesc);
    map.put("domainId", domainId);
    return "dispatch/batch_group";
}
 
Example 41
Project: X-mall   File: ProductController.java   Source Code and License 5 votes vote down vote up
@ApiOperation("产品列表")
@PostMapping("/list")
@ResponseBody
public ServerResponse<PageInfo> list(@RequestParam(value = "keyword", required = false) String keyword,
                                     @RequestParam(value = "categoryId", required = false) Integer categoryId,
                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
                                     @RequestParam(value = "orderBy", defaultValue = "") String orderBy) {
    return iProductService.getProductByKeywordCategory(keyword, categoryId, pageNum, pageSize, orderBy);
}
 
Example 42
Project: SpringBootDemoApp   File: UserAccountController.java   Source Code and License 5 votes vote down vote up
/**
 * POST /account : update the current user information.
 *
 * @param userDTO
 *            the current user information
 * @return the ResponseEntity with status 200 (OK), or status 400 (Bad
 *         Request) or 500 (Internal Server Error) if the user couldn't be
 *         updated
 */
@ApiOperation(value = "saveAccount",notes = "save Account")
@PostMapping("/account")
public ResponseEntity saveAccount(@Valid @RequestBody UserDTO userDTO) {
    final String userLogin = SecurityUtils.getCurrentUserLogin();
    Optional<User> existingUser = userRepository.findOneByEmail(userDTO.getEmail());
    if (existingUser.isPresent() && (!existingUser.get()
        .getLogin()
        .equalsIgnoreCase(userLogin))) {
        return ResponseEntity.badRequest()
            .headers(HeaderUtil.createFailureAlert("user-management", "emailexists", "Email already in use"))
            .body(null);
    }
    return userRepository.findOneByLogin(userLogin)
        .map(u -> {
            userService.updateUser(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(), userDTO.getLangKey(), userDTO.getImageUrl());
            return new ResponseEntity(HttpStatus.OK);
        })
        .orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));
}
 
Example 43
Project: swaggy-jenkins   File: BlueOceanApi.java   Source Code and License 5 votes vote down vote up
@GET
@Path("/blue/rest/organizations/{organization}/scm/{scm}/organizations")
@Produces({ "application/json" })
@ApiOperation(value = "", tags={ "blueOcean",  })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "Successfully retrieved SCM organizations details", response = ScmOrganisations.class),
    @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password"),
    @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password") })
public ScmOrganisations getSCMOrganisations(@PathParam("organization") String organization, @PathParam("scm") String scm, @QueryParam("credentialId") String credentialId);
 
Example 44
Project: istio-ola   File: OlaController.java   Source Code and License 5 votes vote down vote up
@CrossOrigin
@RequestMapping(method = RequestMethod.GET, value = "/ola", produces = "text/plain")
@ApiOperation("Returns the greeting in Portuguese")
public String ola(HttpServletRequest request) {
  String hostname = System.getenv().getOrDefault("HOSTNAME", "Unknown");
  Enumeration<String> headerNames = request.getHeaderNames();

  StringBuffer headerMsg = new StringBuffer("{");

  while (headerNames.hasMoreElements()) {
    String headerName = headerNames.nextElement();
    String headerValue = request.getHeader(headerName);
    if (headerValue != null) {
      headerMsg.append(String.format("{\"%s\":\"%s\"}", headerName, headerValue));
      headerMsg.append(",");
    }
  }

  headerMsg.append("}");

  log.info("Request Headers:{}", headerMsg);
  return String.format("Olá de %s", hostname);
}
 
Example 45
Project: FCat   File: TGroupController.java   Source Code and License 5 votes vote down vote up
/**
 * 通过groupTypeId获取组织列表
 * @return
 * @throws RuntimeException
 */
@ApiOperation(value = "通过menuId获取元素列表" )
@RequestMapping(value = "groupTypeId/{groupTypeId}", method = RequestMethod.GET)
public JSONObject getByMenuId(@PathVariable Integer groupTypeId)throws Exception{
    List<TGroup> result = bsi.getListBygroupTypeId(groupTypeId);
    return JsonUtil.getSuccessJsonObject(result);
}
 
Example 46
Project: shuzheng   File: UpmsUserController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "用户列表")
@RequiresPermissions("upms:user:read")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object list(
        @RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
        @RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
        @RequestParam(required = false, defaultValue = "", value = "search") String search,
        @RequestParam(required = false, value = "sort") String sort,
        @RequestParam(required = false, value = "order") String order) {
    UpmsUserExample upmsUserExample = new UpmsUserExample();
    if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
        upmsUserExample.setOrderByClause(sort + " " + order);
    }
    if (StringUtils.isNotBlank(search)) {
        upmsUserExample.or()
                .andRealnameLike("%" + search + "%");
        upmsUserExample.or()
                .andUsernameLike("%" + search + "%");
    }
    List<UpmsUser> rows = upmsUserService.selectByExampleForOffsetPage(upmsUserExample, offset, limit);
    long total = upmsUserService.countByExample(upmsUserExample);
    Map<String, Object> result = new HashMap<>();
    result.put("rows", rows);
    result.put("total", total);
    return result;
}
 
Example 47
Project: nifi-registry   File: BucketFlowResource.java   Source Code and License 5 votes vote down vote up
@GET
@Path("{flowId}/versions/latest/metadata")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get the metadata for the latest version of a flow",
        response = VersionedFlowSnapshotMetadata.class
)
@ApiResponses({
        @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 getLatestFlowVersionMetadata(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
        final String bucketId,
        @PathParam("flowId")
        @ApiParam("The flow identifier")
        final String flowId) {

    authorizeBucketAccess(RequestAction.READ, bucketId);

    final VersionedFlowSnapshotMetadata latest = registryService.getLatestFlowSnapshotMetadata(bucketId, flowId);
    if (latest == null) {
        throw new ResourceNotFoundException("No flow versions found for flow with id " + flowId);
    }

    linkService.populateSnapshotLinks(latest);

    return Response.status(Response.Status.OK).entity(latest).build();
}
 
Example 48
Project: che-starter   File: WorkspaceController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "Delete an existing workspace")
@DeleteMapping("/workspace/oso/{name}")
public void deleteExistingWorkspaceOnOpenShift(@PathVariable String name, @RequestParam String masterUrl,
        @RequestParam String namespace,
        @ApiParam(value = "OpenShift token", required = true) @RequestHeader("Authorization") String openShiftToken)
        throws JsonProcessingException, IOException, KeycloakException, RouteNotFoundException, WorkspaceNotFound {

    deleteWorkspace(masterUrl, namespace, openShiftToken, name, null);
}
 
Example 49
Project: opencps-v2   File: DeliverablesManagement.java   Source Code and License 5 votes vote down vote up
@GET
@Path("/deliverables/{id}/formscript")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Get info formscript for deliverable id")
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not Found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access defined", response = ExceptionModel.class) })
public Response getFormScript(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
		@ApiParam(value = "id of Deliverable", required = true) @PathParam("id") Long id);
 
Example 50
Project: xmall   File: UserController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/user/stop/{id}",method = RequestMethod.PUT)
@ApiOperation(value = "停用用户")
public Result<Object> stopUser(@PathVariable Long id){

    userService.changeUserState(id,0);
    return new ResultUtil<Object>().setData(null);
}
 
Example 51
Project: c4sg-services   File: SkillController.java   Source Code and License 5 votes vote down vote up
@CrossOrigin
@RequestMapping(value="/user",produces = {"application/json"}, method = RequestMethod.GET)
@ApiOperation(value = "Get skills for an user by id", notes = "Returns a collection of skills for an user by id")
public List<String> getSkillsForUser(
		@ApiParam(value = "ID of user to return", required = true) @RequestParam Integer id) {
	
	System.out.println("************** UserController.getSkillsForUser()" 
            + ": id=" + id                
            + " **************");
	
    return skillService.findSkillsForUser(id);
}
 
Example 52
Project: iBase4J   File: SysAuthorizeController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "修改角色操作权限")
@PostMapping(value = "/role/update/permission")
@RequiresPermissions("sys.permisson.role.update")
public Object updateRolePermission(ModelMap modelMap, @RequestBody List<SysRoleMenu> list) {
	sysAuthorizeService.updateRolePermission(list);
	return setSuccessModelMap(modelMap);
}
 
Example 53
Project: acmeair   File: CouponREST.java   Source Code and License 5 votes vote down vote up
@GET
@Path("/{customername}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "query all available coupon.", notes = "query all available coupon.", produces = MediaType.APPLICATION_JSON)
@ApiResponses(value = {@ApiResponse(code = 403, message = "Invalid user information"),
    @ApiResponse(code = 500, message = "CustomerService Internal Server Error")})
public List<CouponImpl> query(
    @ApiParam(value = "customer name", required = true) @PathParam("customername") String customername) {
  try {
    return couponService.getCoupons(customername);
  } catch (Exception e) {
    logger.warn("Failed get", e);
    throw new InvocationException(Response.Status.INTERNAL_SERVER_ERROR, "Internal Server Error");
  }
}
 
Example 54
Project: happy-news   File: AdminPostController.java   Source Code and License 5 votes vote down vote up
/**
 * Delete a post by its UUID.
 *
 * @param uuid The UUID.
 */
@ApiOperation("Delete a post")
@RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Post> deletePost(@PathVariable String uuid) {
    if (postRepository.exists(uuid)) {
        postRepository.delete(uuid);
        return ResponseEntity
            .ok()
            .build();
    } else {
        return ResponseEntity
            .notFound()
            .build();
    }
}
 
Example 55
Project: batch-scheduler   File: BatchDefineController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/stop", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "停止批次")
public String stop(HttpServletResponse response, HttpServletRequest request) {
    String batchId = request.getParameter("batch_id");
    RetMsg retMsg = batchDefineService.setStatus(batchId, 4);
    if (SysStatus.SUCCESS_CODE != retMsg.getCode()) {
        response.setStatus(422);
        return Hret.error(retMsg);
    }
    return Hret.success(retMsg);
}
 
Example 56
Project: plumdo-work   File: FormInstanceResource.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value="查询表单实例详情", notes="根据表单实例的id来获取指定对象")
   @ApiImplicitParam(name = "id", value = "表单实例ID", required = true, dataType = "Long",paramType="path")
@RequestMapping(value = "/form-instances/{id}", method = RequestMethod.GET, produces = "application/json")
@ResponseStatus(value = HttpStatus.OK)
public FormInstanceResponse getFormInstance(@PathVariable Long id) {
	FormInstance formInstance = getFormInstanceFromRequest(id);
	return responseFactory.createFormInstanceResponse(formInstance);
}
 
Example 57
Project: opencps-v2   File: DossierTemplateManagement.java   Source Code and License 5 votes vote down vote up
@PUT
@Path("/{id}/parts/{partno}/sampledata")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Update sampledata of a DossierPart", response = DossierPartContentInputUpdateModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the sampledata was updated", response = DossierPartContentInputUpdateModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response updateSampleDate(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("partno") String partNo,
		@BeanParam DossierPartContentInputUpdateModel input);
 
Example 58
Project: iBase4J   File: ScheduledController.java   Source Code and License 5 votes vote down vote up
@PostMapping("/open")
@ApiOperation(value = "启动任务")
@RequiresPermissions("sys.task.scheduled.open")
public Object open(@RequestBody TaskScheduled scheduled, ModelMap modelMap) {
	Assert.notNull(scheduled.getTaskGroup(), "TASKGROUP");
	Assert.notNull(scheduled.getTaskName(), "TASKNAME");
	scheduledService.openTask(scheduled);
	return setSuccessModelMap(modelMap);
}
 
Example 59
Project: mumu-swagger   File: UserController.java   Source Code and License 5 votes vote down vote up
/**
 * Put user string.
 *
 * @param id   the id
 * @param user the user
 * @return the string
 */
@ApiOperation(value = "更新用户详细信息", notes = "根据url的id来指定更新对象,并根据传过来的user信息来更新用户详细信息")
@ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "long"),
        @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "User")
})
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public String putUser(@PathVariable long id, @RequestBody User user) {
    User u = users.get(id);
    u.setName(user.getName());
    u.setAge(user.getAge());
    users.put(id, u);
    return "success";
}
 
Example 60
Project: opencps-v2   File: ServiceProcessManagement.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{id}/actions/{actionid}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Remove the ProcessAction of a ServiceProcess", response = ProcessActionInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a ProcessAction was removed", response = ProcessActionInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response removeProcessAction(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("actionid") long actionid);