io.swagger.annotations.ApiParam Java Examples

The following examples show how to use io.swagger.annotations.ApiParam. 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: FormattingDateAPI.java    From singleton with Eclipse Public License 2.0 6 votes vote down vote up
/**
    * Get localized date by specific locale and pattern
    *
    * @param locale
    *        A string specified by the product to represent a specific locale, in [language]_[country (region)] format. e.g. ja_JP, zh_CN.
    * @param longDate
    *        The time stamp of java format. e.g. 1472728030290.
    * @param pattern
    *        The pattern specified by the product. e.g. [YEAR = "y",QUARTER = "QQQQ"], ABBR_QUARTER =
 *        "QQQ",YEAR_QUARTER = "yQQQQ",YEAR_ABBR_QUARTER = "yQQQ" and so on. 
    * @param request
    *        Extends the ServletRequest interface to provide request information for HTTP servlets.
    * @return APIResponseDTO 
    *         The object which represents response status.
    */
   @ApiOperation(value = APIOperation.FORMAT_DATE_GET_VALUE, notes = APIOperation.FORMAT_DATE_GET_NOTES)
/*   @ApiImplicitParams({
       @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string", paramType = "header"),  
       @ApiImplicitParam(name = "sessionid", value = "sessionid", required = true, dataType = "string", paramType = "header")
   })*/
   @RequestMapping(value = APIV2.LOCALIZED_DATE, method = RequestMethod.GET, produces = { API.API_CHARSET })
@ResponseStatus(HttpStatus.OK)
   public APIResponseDTO formatDate(
           @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale,
           @ApiParam(name = APIParamName.LONGDATE, required = true, value = APIParamValue.LONGDATE) @RequestParam(value = APIParamName.LONGDATE, required = true) String longDate,
           @ApiParam(name = APIParamName.PATTERN, required = true, value = APIParamValue.PATTERN) @RequestParam(value = APIParamName.PATTERN, required = true) String pattern,
           HttpServletRequest request) throws Exception{
       DateDTO dateDTO = new DateDTO();
       String formattedDate = dateFormatService.formatDate(locale, Long.parseLong(longDate),
               pattern);
       dateDTO.setLongDate(longDate);
       dateDTO.setformattedDate(formattedDate);
       dateDTO.setLocale(locale);
       dateDTO.setPattern(pattern);
       return super.handleResponse(APIResponseStatus.OK, dateDTO);
   }
 
Example #2
Source File: RoleController.java    From sophia_scaffolding with Apache License 2.0 6 votes vote down vote up
@SysLog("分配角色权限")
@PostMapping("/web/permission/save/{id}")
@ApiOperation("分配该角色选择的权限-后端管理角色管理")
public ApiResponse savePermissionAndRole(@ApiParam("角色id") @PathVariable String id, @RequestBody String ids){
    if (StringUtils.isBlank(id)) {
        return fail("角色id不能为空");
    }
    if (StringUtils.isBlank(ids)) {
        return fail("参数不能为空");
    }
    List<String> idList = JSON.parseArray(((JSONArray) JSON.parseObject(ids).get("ids")).toJSONString(), String.class);
    if (permissionService.savePermissionAndRole(id,idList)){
        return success("分配成功");
    }else {
        return fail("分配失败");
    }
}
 
Example #3
Source File: ConnectionResource.java    From flair-engine with Apache License 2.0 6 votes vote down vote up
/**
 * GET  /connections : get all the connections.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of connections in body
 */
@GetMapping("/connectionsIdAndName")
@Timed
public ResponseEntity<List<ConnectionDTO>> getAllConnectionsByIdAndNames(@ApiParam Pageable pageable) {
    log.debug("REST request to get a page of Connections filter the id and names only");
    Page<ConnectionDTO> page = connectionService.findAll(pageable);

    List<ConnectionDTO> filteredList = new ArrayList<>();

    for (ConnectionDTO c : page.getContent()) {
        ConnectionDTO dto = new ConnectionDTO();
        dto.setId(c.getId());
        dto.setName(c.getName());

        filteredList.add(dto);
    }


    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/connectionsIdAndName");
    return new ResponseEntity<>(filteredList, headers, HttpStatus.OK);
}
 
Example #4
Source File: PointController.java    From hyena with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "获取时间段内总共增加的积分数量")
@GetMapping(value = "/getIncreasedPoint")
public ObjectResponse<BigDecimal> getIncreasedPoint(
        HttpServletRequest request,
        @ApiParam(value = "积分类型", example = "score") @RequestParam(defaultValue = "default") String type,
        @ApiParam(value = "用户ID") @RequestParam(required = false) String uid,
        @ApiParam(value = "开始时间", example = "2019-03-25 18:35:21") @RequestParam(required = false, value = "start") String strStart,
        @ApiParam(value = "结束时间", example = "2019-04-26 20:15:31") @RequestParam(required = false, value = "end") String strEnd) {
    logger.info(LoggerHelper.formatEnterLog(request));
    try {
        Calendar calStart = DateUtils.fromYyyyMmDdHhMmSs(strStart);
        Calendar calEnd = DateUtils.fromYyyyMmDdHhMmSs(strEnd);
        var ret = this.pointRecDs.getIncreasedPoint(type, uid, calStart.getTime(), calEnd.getTime());

        ObjectResponse<BigDecimal> res = new ObjectResponse<>(ret);
        logger.info(LoggerHelper.formatLeaveLog(request) + " ret = {}", ret);
        return res;
    } catch (ParseException e) {
        logger.warn(e.getMessage(), e);
        throw new HyenaParameterException("参数错误, 时间格式无法解析");
    }
}
 
Example #5
Source File: RoleController.java    From sophia_scaffolding with Apache License 2.0 6 votes vote down vote up
@SysLog("删除角色")
@DeleteMapping(value = "/web/del/{id}")
@ApiOperation(value = "删除角色管理-后端管理角色管理", notes = "删除角色管理-后端管理角色管理")
public ApiResponse deleteRole(@ApiParam(value = "角色id",required = true)@PathVariable String id){
    if(StringUtils.isBlank(id)){
        return fail("id不能为空");
    }
    Map<String, Object> map = roleService.deleteRole(id);
    boolean flag = (boolean) map.get("flag");
    String msg = (String) map.get("msg");
    if (flag){
        return success(msg);
    }else {
        return fail(msg);
    }
}
 
Example #6
Source File: TranslationComponentAPI.java    From singleton with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Get translation based on single component.
 *
 */
//@ApiIgnore
@ApiOperation(value = APIOperation.COMPONENT_TRANSLATION_VALUE, notes = APIOperation.COMPONENT_TRANSLATION_NOTES)
@RequestMapping(value = APIV1.TRANS_COMPONENT, method = RequestMethod.GET, produces = {
        API.API_CHARSET })
@ResponseStatus(HttpStatus.OK)
public APIResponseDTO getSingleComponentTranslation(
        @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName,
        @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version,
        @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @RequestParam(value = APIParamName.COMPONENT, required = true) String component,
        @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale,
        @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO)
        @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo,
        HttpServletRequest request)  throws Exception {
    ComponentMessagesDTO componentMessagesDTO = new ComponentMessagesDTO();
    componentMessagesDTO.setProductName(productName);
    componentMessagesDTO.setComponent(component == null ? ConstantsKeys.DEFAULT : component);
    componentMessagesDTO.setVersion(version);
    componentMessagesDTO.setLocale(locale == null ? ConstantsUnicode.EN : locale);
    componentMessagesDTO.setPseudo(new Boolean(pseudo));
    ComponentMessagesDTO dto = singleComponentService
            .getComponentTranslation(componentMessagesDTO);
    return super.handleResponse(APIResponseStatus.OK, dto);
}
 
Example #7
Source File: ChallengesApi.java    From identity-api-server with Apache License 2.0 6 votes vote down vote up
@PATCH
@Path("/{challenge-set-id}")
@Consumes({ "application/json" })

@io.swagger.annotations.ApiOperation(value = "Add a challenge question to a set", notes = "Add new challenge question to an existing set.\n\n  <b>Permission required:</b>\n    * /permission/admin/manage/identity/challenge/update\n", response = void.class)
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "OK"),
    
    @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid input request"),
    
    @io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized"),
    
    @io.swagger.annotations.ApiResponse(code = 404, message = "The specified resource is not found"),
    
    @io.swagger.annotations.ApiResponse(code = 500, message = "Internal Server Error") })

public Response addChallengeQuestionToASet(@ApiParam(value = "Challenge Question set ID",required=true ) @PathParam("challenge-set-id")  String challengeSetId,
@ApiParam(value = "A challenge question to add."  ) ChallengeQuestionPatchDTO challengeQuestion)
{
return delegate.addChallengeQuestionToASet(challengeSetId,challengeQuestion);
}
 
Example #8
Source File: FormattingNumberAPI.java    From singleton with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Get localized number by specific locale and scale
 *
 * @param locale
 *            A string specified by the product to represent a specific
 *            locale, in [language]_[country (region)] format. e.g. ja_JP,
 *            zh_CN.
 * @param number
 *            The digits.
 * @param scale
 *            Digital precision, decimal digits
 * @return APIResponseDTO The object which represents response status.
 */
@ApiOperation(value = APIOperation.FORMAT_NUMBER_GET_VALUE, notes = APIOperation.FORMAT_NUMBER_GET_NOTES)
@RequestMapping(value = APIV2.LOCALIZED_NUMBER, method = RequestMethod.GET, produces = { API.API_CHARSET })
@ResponseStatus(HttpStatus.OK)
public APIResponseDTO formatDate(
		@ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale,
		@ApiParam(name = APIParamName.NUMBER, required = true, value = APIParamValue.NUMBER) @RequestParam(value = APIParamName.NUMBER, required = true) String number,
		@ApiParam(name = APIParamName.SCALE, required = false, value = APIParamValue.SCALE) @RequestParam(value = APIParamName.SCALE, required = false) Integer scale,
		HttpServletRequest request) {
	int s = scale == null ? 0 : scale.intValue();
	String localeNumber = numberFormatService.formatNumber(locale, number,
			s);
	NumberDTO numberDTO = new NumberDTO();
	numberDTO.setFormattedNumber(localeNumber);
	numberDTO.setLocale(locale);
	numberDTO.setScale(new Integer(s).toString());
	numberDTO.setNumber(number);
	return super.handleResponse(APIResponseStatus.OK, numberDTO);
}
 
Example #9
Source File: TranslationProductComponentKeyAPI.java    From singleton with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Provide translation based on String
 *
 */
@ApiIgnore
@ApiOperation(value = APIOperation.KEY_TRANSLATION_GET_VALUE, notes = APIOperation.KEY_TRANSLATION_GET_NOTES)
@RequestMapping(value = APIV2.KEY_TRANSLATION_GET, method = RequestMethod.GET, produces = { API.API_CHARSET })
@ResponseStatus(HttpStatus.OK)
public APIResponseDTO getTranslationByGet(
		@ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName,
		@ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version,
		@ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale,
		@ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component,
		@ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key,
		@ApiParam(name = APIParamName.SOURCE, required = true, value = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE , required = true) String source,
		@ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource,
		@ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat,
		@ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource,
		@ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo,
		HttpServletRequest request) throws L3APIException {
	
	return super.getTransByGet(productName, version, locale, component, key, source, commentForSource, sourceFormat, collectSource, pseudo, request);
}
 
Example #10
Source File: ClaimManagementApi.java    From identity-api-server with Apache License 2.0 6 votes vote down vote up
@GET


@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "Retrieve claim dialects.", notes = "Retrieve claim dialects.", response = ClaimDialectResDTO.class, responseContainer = "List")
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "Claim dialects."),
    
    @io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized."),
    
    @io.swagger.annotations.ApiResponse(code = 500, message = "Internal Server Error."),
    
    @io.swagger.annotations.ApiResponse(code = 501, message = "Not Implemented.") })

public Response getClaimDialects(@ApiParam(value = "maximum number of records to return") @QueryParam("limit")  Integer limit,
@ApiParam(value = "number of records to skip for pagination") @QueryParam("offset")  Integer offset,
@ApiParam(value = "Condition to filter the retrival of records.") @QueryParam("filter")  String filter,
@ApiParam(value = "Define the order how the retrieved records should be sorted.") @QueryParam("sort")  String sort)
{
return delegate.getClaimDialects(limit,offset,filter,sort);
}
 
Example #11
Source File: LocaleAPI.java    From singleton with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Get the supported language list from CLDR by display language
 *
 * @param productName
 *            product name
 * @param version
 *            product translation version
 * @param displayLanguage
 *            to be displayed language
 * @return APIResponseDTO
 * @throws Exception
 */
@ApiOperation(value = APIOperation.LOCALE_SUPPORTED_LANGUAGE_LIST_VALUE, notes = APIOperation.LOCALE_SUPPORTED_LANGUAGE_LIST_NOTES)
@RequestMapping(value = APIV2.SUPPORTED_LANGUAGE_LIST, method = RequestMethod.GET, produces = { API.API_CHARSET })
@ResponseStatus(HttpStatus.OK)
public APIResponseDTO getDisplayLanguagesList(
		@ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName,
		@ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version,
		@ApiParam(name = APIParamName.DISPLAY_LANGUAGE, required = false, value = APIParamValue.DISPLAY_LANGUAGE) @RequestParam(value = APIParamName.DISPLAY_LANGUAGE, required = false) String displayLanguage)
		throws Exception {
	Map<String, Object> data = new HashMap<String, Object>();
	String newVersion = super.getAvailableVersion(productName, version);
	data.put(ConstantsKeys.LANGUAGES, this.localeService.getDisplayNamesFromCLDR(productName, newVersion, displayLanguage));
	data.put(ConstantsKeys.VERSION, newVersion);
	data.put(ConstantsKeys.PRODUCTNAME, productName);
	data.put(ConstantsKeys.DISPLAY_LANGUAGE, StringUtils.isEmpty(displayLanguage) ? "" : displayLanguage);
	return super.handleVersionFallbackResponse(version, newVersion, data);
}
 
Example #12
Source File: CmsAspspPiisClient.java    From XS2A-Sandbox with Apache License 2.0 6 votes vote down vote up
@GetMapping(path = "/")
@ApiOperation(value = "Returns a list of PIIS Consent objects by PSU ID")
@ApiResponses(value = {
    @ApiResponse(code = 200, message = "OK"),
    @ApiResponse(code = 404, message = "Not Found")})
ResponseEntity<List<PiisConsent>> getConsentsForPsu(
    @ApiParam(value = "Client ID of the PSU in the ASPSP client interface. Might be mandated in the ASPSP's documentation. Is not contained if an OAuth2 based authentication was performed in a pre-step or an OAuth2 based SCA was performed in an preceeding AIS service in the same session. ")
    @RequestHeader(value = "psu-id", required = false) String psuId,
    @ApiParam(value = "Type of the PSU-ID, needed in scenarios where PSUs have several PSU-IDs as access possibility. ")
    @RequestHeader(value = "psu-id-type", required = false) String psuIdType,
    @ApiParam(value = "Might be mandated in the ASPSP's documentation. Only used in a corporate context. ")
    @RequestHeader(value = "psu-corporate-id", required = false) String psuCorporateId,
    @ApiParam(value = "Might be mandated in the ASPSP's documentation. Only used in a corporate context. ")
    @RequestHeader(value = "psu-corporate-id-type", required = false) String psuCorporateIdType,
    @ApiParam(value = "ID of the particular service instance")
    @RequestHeader(value = "instance-id", required = false, defaultValue = DEFAULT_SERVICE_INSTANCE_ID) String instanceId);
 
Example #13
Source File: AdminRestApi.java    From mogu_blog_v2 with Apache License 2.0 6 votes vote down vote up
@AuthorityVerify
@OperationLogger(value = "强退用户")
@ApiOperation(value = "强退用户", notes = "强退用户", response = String.class)
@PostMapping(value = "/forceLogout")
public String forceLogout(@ApiParam(name = "tokenList", value = "tokenList", required = false) @RequestBody List<String> tokenList) {
    if(tokenList == null || tokenList.size() == 0) {
        return ResultUtil.result(SysConf.ERROR, MessageConf.PARAM_INCORRECT);
    }
    List<String> keyList = new ArrayList<>();
    String keyPrefix = RedisConf.LOGIN_TOKEN_KEY + RedisConf.SEGMENTATION;
    for (String token : tokenList) {
        keyList.add(keyPrefix + token);
    }
    redisUtil.delete(keyList);
    return ResultUtil.result(SysConf.SUCCESS, MessageConf.OPERATION_SUCCESS);
}
 
Example #14
Source File: AdminRestApi.java    From mogu_blog_v2 with Apache License 2.0 6 votes vote down vote up
@AuthorityVerify
@OperationLogger(value = "重置用户密码")
@ApiOperation(value = "重置用户密码", notes = "重置用户密码")
@PostMapping("/restPwd")
public String restPwd(HttpServletRequest request,
                      @ApiParam(name = "uid", value = "管理员uid", required = true) @RequestParam(name = "uid", required = false) String uid) {

    if (StringUtils.isEmpty(uid)) {
        return ResultUtil.result(SysConf.ERROR, MessageConf.PARAM_INCORRECT);
    }

    Admin admin = adminService.getById(uid);
    PasswordEncoder encoder = new BCryptPasswordEncoder();
    admin.setPassWord(encoder.encode(DEFAULE_PWD));
    admin.setUpdateTime(new Date());
    admin.updateById();

    return ResultUtil.result(SysConf.SUCCESS, MessageConf.UPDATE_SUCCESS);
}
 
Example #15
Source File: ChallengesApi.java    From identity-api-server with Apache License 2.0 6 votes vote down vote up
@DELETE
@Path("/{challenge-set-id}/questions/{question-id}")


@io.swagger.annotations.ApiOperation(value = "Remove a challenge question in a set.", notes = "Removes a specific question from an existing challenge question set. By specifying the locale query parameter, locale specific challenge question entry for the question can be deleted.\n\n  <b>Permission required:</b>\n    * /permission/admin/manage/identity/challenge/delete\n", response = void.class)
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 204, message = "No Content."),
    
    @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid input request"),
    
    @io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized"),
    
    @io.swagger.annotations.ApiResponse(code = 500, message = "Internal Server Error") })

public Response deleteChallengeQuestion(@ApiParam(value = "Challenge Question ID",required=true ) @PathParam("question-id")  String questionId,
@ApiParam(value = "Challenge Question set ID",required=true ) @PathParam("challenge-set-id")  String challengeSetId,
@ApiParam(value = "An optional search string to look-up challenge-questions based on locale.\n") @QueryParam("locale")  String locale)
{
return delegate.deleteChallengeQuestion(questionId,challengeSetId,locale);
}
 
Example #16
Source File: CmsPsuPiisClient.java    From XS2A-Sandbox with Apache License 2.0 6 votes vote down vote up
@GetMapping(path = "/{consent-id}")
@ApiOperation(value = "Returns PIIS Consent object by its ID.")
@ApiResponses(value = {
    @ApiResponse(code = 200, message = "OK", response = PiisConsent.class),
    @ApiResponse(code = 404, message = "Not Found")})
ResponseEntity<PiisConsent> getConsent(
    @ApiParam(name = "consent-id", value = "PIIS consent identification assigned to the created PIIS consent.", example = "bf489af6-a2cb-4b75-b71d-d66d58b934d7")
    @PathVariable("consent-id") String consentId,
    @ApiParam(value = "Client ID of the PSU in the ASPSP client interface. Might be mandated in the ASPSP's documentation. Is not contained if an OAuth2 based authentication was performed in a pre-step or an OAuth2 based SCA was performed in an preceeding PIIS service in the same session. ")
    @RequestHeader(value = "psu-id", required = false) String psuId,
    @ApiParam(value = "Type of the PSU-ID, needed in scenarios where PSUs have several PSU-IDs as access possibility. ")
    @RequestHeader(value = "psu-id-type", required = false) String psuIdType,
    @ApiParam(value = "Might be mandated in the ASPSP's documentation. Only used in a corporate context. ")
    @RequestHeader(value = "psu-corporate-id", required = false) String psuCorporateId,
    @ApiParam(value = "Might be mandated in the ASPSP's documentation. Only used in a corporate context. ")
    @RequestHeader(value = "psu-corporate-id-type", required = false) String psuCorporateIdType,
    @RequestHeader(value = "instance-id", required = false, defaultValue = DEFAULT_SERVICE_INSTANCE_ID) String instanceId);
 
Example #17
Source File: SignUpController.java    From cola with MIT License 6 votes vote down vote up
@RequestMapping("/signUp")
@ApiOperation(("账号密码注册"))
public Result<String> signUp(@RequestBody @Valid @ApiParam(name = "注册参数") UsernamePasswordSignUpDto usernamePasswordSignUpDto) {

	//验证确认密码是否匹配
	if (StringUtils.equals(usernamePasswordSignUpDto.getPassword(), usernamePasswordSignUpDto.getConfirmPassword())) {
		throw new ServiceException(UserErrorMessage.CONFIRM_PASSWORD_NOT_MATCHED);
	}

	UserAddDto userDto = UserAddDto.builder()
			.name(usernamePasswordSignUpDto.getName())
			.username(usernamePasswordSignUpDto.getUsername())
			.password(usernamePasswordSignUpDto.getPassword())
			.build();
	userService.add(userDto);
	return Result.success();
}
 
Example #18
Source File: FilesResource.java    From hmdm-server with Apache License 2.0 6 votes vote down vote up
@ApiOperation(
        value = "Get applications",
        notes = "Gets the list of applications using the file",
        response = Application.class,
        responseContainer = "List"
)
@GET
@Path("/apps/{url}")
@Produces(MediaType.APPLICATION_JSON)
public Response getApplicationsForFile(@PathParam("url") @ApiParam("An URL referencing the file") String url) {
    try {
        String decodedUrl = URLDecoder.decode(url, "UTF-8");
        return Response.OK(this.applicationDAO.getAllApplicationsByUrl(decodedUrl));
    } catch (Exception e) {
        logger.error("Unexpected error when getting the list of applications by URL", e);
        return Response.INTERNAL_ERROR();
    }
}
 
Example #19
Source File: TranslationProductComponentKeyAPI.java    From singleton with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create source with post data, especially it's used for creating long
 * source
 * 
 */
@ApiOperation(value = APIOperation.SOURCE_TRANSLATION_POST_VALUE, notes = APIOperation.SOURCE_TRANSLATION_POST_NOTES)
@RequestMapping(value = APIV1.KEY2_POST, method = RequestMethod.POST, produces = { API.API_CHARSET })
@ResponseStatus(HttpStatus.OK)
public APIResponseDTO getTranslationByPost(
		@PathVariable(APIParamName.PRODUCT_NAME) String productName,
		@ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version,
		@PathVariable(APIParamName.COMPONENT) String component,
		@PathVariable(APIParamName.KEY) String key,
		@ApiParam(value = APIParamValue.SOURCE, required = false) String source,
		@ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource,
		@ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale,
		@ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat,
		@ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource,
		@ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo,
		HttpServletRequest request, HttpServletResponse response)
		throws L3APIException, IOException {
	return super.getTransByPost(productName, version, locale, component, key, source, commentForSource, sourceFormat, collectSource, pseudo, "false", "false", request, response);
}
 
Example #20
Source File: ApiParamReader.java    From swagger-more with Apache License 2.0 6 votes vote down vote up
@Override
public void apply(ParameterContext context) {
    ResolvedType resolvedType = context.resolvedMethodParameter().getParameterType();
    Class erasedType = resolvedType.getErasedType();
    if (isGeneratedType(erasedType)) {
        context.parameterBuilder()
                .parameterType("body").name(erasedType.getSimpleName())
                .description("Not a real parameter, it is a parameter generated after assembly.");
        return;
    }
    Optional<ApiParam> optional = readApiParam(context);
    if (optional.isPresent()) {
        ApiParam apiParam = optional.get();
        List<VendorExtension> extensions = buildExtensions(resolvedType);
        context.parameterBuilder().name(emptyToNull(apiParam.name()))
                .description(emptyToNull(resolver.resolve(apiParam.value())))
                .parameterType(TypeUtils.isComplexObjectType(erasedType) ? "body" : "query")
                .order(SWAGGER_PLUGIN_ORDER)
                .hidden(false)
                .parameterAccess(emptyToNull(apiParam.access()))
                .defaultValue(emptyToNull(apiParam.defaultValue()))
                .allowMultiple(apiParam.allowMultiple())
                .allowEmptyValue(apiParam.allowEmptyValue())
                .required(apiParam.required())
                .scalarExample(new Example(apiParam.example()))
                .complexExamples(examples(apiParam.examples()))
                .collectionFormat(apiParam.collectionFormat())
                .vendorExtensions(extensions);
    }
}
 
Example #21
Source File: TranslationProductComponentKeyAPI.java    From singleton with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * get translation by string
 *
 */
@ApiOperation(value = APIOperation.KEY_TRANSLATION_GET_VALUE, notes = APIOperation.KEY_TRANSLATION_GET_NOTES)
@RequestMapping(value = APIV1.KEY2_GET, method = RequestMethod.GET, produces = { API.API_CHARSET })
@ResponseStatus(HttpStatus.OK)
public APIResponseDTO getTranslationByGet(
		@ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName,
		@ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component,
		@ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version,
		@ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key,
		@ApiParam(name = APIParamName.SOURCE, required = false, value = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false) String source,
		@ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource,
		@ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale,
		@ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat,
		@ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource,
		@ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo,
		HttpServletRequest request) throws L3APIException {
	return super.getTransByGet(productName, version, locale, component,
			key, source, commentForSource, sourceFormat, collectSource,
			pseudo, request);
}
 
Example #22
Source File: RoleController.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@GetMapping("/web/permission/{id}")
@ApiOperation("获取该角色拥有的权限-后端管理角色管理")
public ApiResponse getPermissionByRoleId(@ApiParam("角色id") @PathVariable String id){
    if (StringUtils.isBlank(id)) {
        return fail("id不能为空");
    }
    return success(permissionService.getPermissionByRoleId(id));
}
 
Example #23
Source File: IndexRestApi.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
@RequestLimit(amount = 200, time = 60000)
@ApiOperation(value = "通过推荐等级获取博客列表", notes = "通过推荐等级获取博客列表")
@GetMapping("/getBlogByLevel")
public String getBlogByLevel(HttpServletRequest request,
                             @ApiParam(name = "level", value = "推荐等级", required = false) @RequestParam(name = "level", required = false, defaultValue = "0") Integer level,
                             @ApiParam(name = "currentPage", value = "当前页数", required = false) @RequestParam(name = "currentPage", required = false, defaultValue = "1") Long currentPage,
                             @ApiParam(name = "useSort", value = "使用排序", required = false) @RequestParam(name = "useSort", required = false, defaultValue = "0") Integer useSort) {

    return ResultUtil.result(SysConf.SUCCESS, blogService.getBlogPageByLevel(level, currentPage, useSort));
}
 
Example #24
Source File: ApplicationResource.java    From hmdm-server with Apache License 2.0 5 votes vote down vote up
@ApiOperation(
        value = "Get application configurations",
        notes = "Gets the list of configurations using requested application",
        response = ApplicationConfigurationLink.class,
        responseContainer = "List"
)
@GET
@Path("/configurations/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response getApplicationConfigurations(@PathParam("id") @ApiParam("Application ID") Integer id) {
    return Response.OK(this.applicationDAO.getApplicationConfigurations(id));
}
 
Example #25
Source File: SortRestApi.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
@BussinessLog(value = "点击归档", behavior = EBehavior.VISIT_SORT)
@ApiOperation(value = "通过月份获取文章", notes = "通过月份获取文章")
@GetMapping("/getArticleByMonth")
public String getArticleByMonth(@ApiParam(name = "monthDate", value = "归档的日期", required = false) @RequestParam(name = "monthDate", required = false) String monthDate) {
    log.info("通过月份获取文章列表");
    return blogService.getArticleByMonth(monthDate);
}
 
Example #26
Source File: UserController.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@GetMapping("/web/judge/{id}")
@ApiOperation(value = "判断用户原密码是否正确-后台管理用户管理", notes = "判断用户原密码是否正确-后台管理用户管理")
public ApiResponse judgePassword(@RequestParam String password, @ApiParam("用户id") @PathVariable String id) {
    if (StringUtils.isBlank(id)) {
        return fail("id不能为空");
    }
    if (StringUtils.isBlank(password)) {
        return fail("密码不能为空");
    }
    if (userService.judgePassword(id, password)) {
        return success("填写成功");
    } else {
        return fail("填写正确的密码");
    }
}
 
Example #27
Source File: PmsBrandController.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
@ApiOperation("分页查询品牌列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> listBrand(@RequestParam(value = "pageNum", defaultValue = "1")
                                                    @ApiParam("页码") Integer pageNum,
                                                    @RequestParam(value = "pageSize", defaultValue = "3")
                                                    @ApiParam("每页数量") Integer pageSize) {
    List<PmsBrand> brandList = brandService.listBrand(pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(brandList));
}
 
Example #28
Source File: PmsBrandController.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
@ApiOperation("分页查询品牌列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> listBrand(@RequestParam(value = "pageNum", defaultValue = "1")
                                                    @ApiParam("页码") Integer pageNum,
                                                    @RequestParam(value = "pageSize", defaultValue = "3")
                                                    @ApiParam("每页数量") Integer pageSize) {
    List<PmsBrand> brandList = brandService.listBrand(pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(brandList));
}
 
Example #29
Source File: SwaggerMoreDoclet.java    From swagger-more with Apache License 2.0 5 votes vote down vote up
private static void annotateApiMethodAnn(ApiMethodInfo methodInfo, AnnotationsAttribute attr, ConstPool constPool) {
    Annotation apiMethodAnn = attr.getAnnotation(ApiMethod.class.getTypeName());
    MemberValue value;
    if (isNull(apiMethodAnn)) {
        apiMethodAnn = new Annotation(ApiMethod.class.getName(), constPool);
    }
    if (isNull(value = apiMethodAnn.getMemberValue(ApiMethodInfo.VALUE)) || StringUtils.isEmpty(((StringMemberValue) value).getValue())) {
        apiMethodAnn.addMemberValue(ApiMethodInfo.VALUE, new StringMemberValue(methodInfo.value(), constPool));
    }
    if (isNull(value = apiMethodAnn.getMemberValue(HIDDEN)) || !((BooleanMemberValue) value).getValue()) {
        apiMethodAnn.addMemberValue(HIDDEN, new BooleanMemberValue(methodInfo.hidden(), constPool));
    }
    if (isNull(value = apiMethodAnn.getMemberValue(NOTES)) || StringUtils.isEmpty(((StringMemberValue) value).getValue())) {
        apiMethodAnn.addMemberValue(NOTES, new StringMemberValue(methodInfo.notes(), constPool));
    }
    ArrayMemberValue arrayMemberValue = (ArrayMemberValue) apiMethodAnn.getMemberValue("params");
    if (isNull(arrayMemberValue)) {
        arrayMemberValue = new ArrayMemberValue(constPool);
        arrayMemberValue.setValue(new MemberValue[methodInfo.parameterCount()]);
    }
    AnnotationMemberValue annotationMemberValue;
    for (int i = 0; i < methodInfo.parameterCount(); i++) {
        if (isNull(annotationMemberValue = (AnnotationMemberValue) arrayMemberValue.getValue()[i])) {
            annotationMemberValue = new AnnotationMemberValue(new Annotation(ApiParam.class.getName(), constPool), constPool);
        }
        Annotation apiParamAnn = annotationMemberValue.getValue();
        if (isNull(value = apiParamAnn.getMemberValue(NAME)) || StringUtils.isEmpty(((StringMemberValue) value).getValue())) {
            apiParamAnn.addMemberValue(NAME, new StringMemberValue(methodInfo.param(i).name(), constPool));
        }
        if (isNull(value = apiParamAnn.getMemberValue(ApiMethodInfo.VALUE)) || StringUtils.isEmpty(((StringMemberValue) value).getValue())) {
            apiParamAnn.addMemberValue(ApiMethodInfo.VALUE, new StringMemberValue(methodInfo.param(i).value(), constPool));
        }
        arrayMemberValue.getValue()[i] = annotationMemberValue;

    }
    apiMethodAnn.addMemberValue(PARAMS, arrayMemberValue);
    attr.addAnnotation(apiMethodAnn);
}
 
Example #30
Source File: PermissionController.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@GetMapping(value = "/web/info/{id}")
@ApiOperation(value = "获取权限-后端管理权限管理", notes = "获取权限-后端管理权限管理")
public ApiResponse getPermission(@ApiParam(value = "权限id",required = true)@PathVariable String id){
    if(StringUtils.isBlank(id)){
        return fail("id不能为空");
    }
    PermissionVo permission = permissionService.queryPermissionById(id);
    if (null == permission){
        return fail("未查找到该权限");
    }else{
        return success(permission);
    }
}