类org.hibernate.validator.constraints.NotBlank源码实例Demo

下面列出了怎么用org.hibernate.validator.constraints.NotBlank的API类实例代码及写法,或者点击链接到github查看源代码。

@RequestMapping(value="/groupsum", method={RequestMethod.POST, RequestMethod.GET})
public @ResponseBody Map<Integer, BigDecimal> groupsum(@NotBlank @RequestParam String indName, 
        @RequestParam(required=false) String filterDims,
        @RequestParam String groupbyDim,
        @NotBlank @RequestParam String... timeSeries) throws Throwable {
    
    LOGGER.info("Try to sum {} on {} with filter {}.", indName, ObjectUtils.getDisplayString(timeSeries), filterDims);
    long timing = System.currentTimeMillis();
    Map<String, List<Integer>> filter = (filterDims == null || "".equals(filterDims)) ? null
            : objectMapper.readValue(filterDims, new TypeReference<Map<String, List<Integer>>>() {});
    Map<Integer, BigDecimal> sum = manager.aggs(timeSeries).sum(indName, groupbyDim, filter);
    LOGGER.info("Sucess to sum {} on {} result size is {} using {}ms.", indName, timeSeries, sum.size(), System.currentTimeMillis() - timing);
    LOGGER.debug("Sucess to sum {} on {} result is {}.", indName, timeSeries, sum);
    
    return sum;
}
 
@RequestMapping(value="/groupcount", method={RequestMethod.POST, RequestMethod.GET})
public @ResponseBody Map<Integer, Long> groupcount(@NotBlank @RequestParam String indName, 
        @RequestParam(required=false) String filterDims,
        @RequestParam String groupbyDim,
        @NotBlank @RequestParam String... timeSeries) throws Throwable {
    
    LOGGER.info("Try to count {} on {} with filter {}.", indName, ObjectUtils.getDisplayString(timeSeries), filterDims);
    long timing = System.currentTimeMillis();
    Map<String, List<Integer>> filter = (filterDims == null || "".equals(filterDims)) ? null
            : objectMapper.readValue(filterDims, new TypeReference<Map<String, List<Integer>>>() {});
    Map<Integer, Long> count = manager.aggs(timeSeries).count(indName, groupbyDim, filter);
    LOGGER.info("Sucess to count {} on {} result size is {} using {}ms.", indName, timeSeries, count.size(), System.currentTimeMillis() - timing);
    LOGGER.debug("Sucess to count {} on {} result is {}.", indName, timeSeries, count);
    
    return count;
}
 
源代码3 项目: pay-publicapi   文件: ViolationExceptionMapper.java
@Override
public Response toResponse(JerseyViolationException exception) {
    LOGGER.info(exception.getMessage());
    ConstraintViolation<?> firstException = exception.getConstraintViolations().iterator().next();
    String fieldName = getApiFieldName(firstException.getPropertyPath());
    
    PaymentError paymentError;
    if (firstException.getConstraintDescriptor() != null &&
            firstException.getConstraintDescriptor().getAnnotation() != null &&
            firstException.getConstraintDescriptor().getAnnotation().annotationType() == NotBlank.class ||
            firstException.getConstraintDescriptor().getAnnotation().annotationType() == NotEmpty.class ||
            firstException.getConstraintDescriptor().getAnnotation().annotationType() == NotNull.class) {
        paymentError = PaymentError.aPaymentError(fieldName, CREATE_PAYMENT_MISSING_FIELD_ERROR);
    } else {
        paymentError = PaymentError.aPaymentError(fieldName, CREATE_PAYMENT_VALIDATION_ERROR, firstException.getMessage());
    }
    
    return Response.status(422)
            .entity(paymentError)
            .build();
}
 
源代码4 项目: osiris   文件: SearchResourceImpl.java
@Override			
@Path("/room")
@GET
@ValidationRequired(processor = RestViolationProcessor.class)
@ApiOperation(value = "Get room according to indoor location", httpMethod="GET",response=RoomDTO.class)
@ApiResponses(value = {
		@ApiResponse(code = 200, message = "Room belongs to location", response=RoomDTO.class),
		@ApiResponse(code = 400, message = "Invalid input parameter"),
		@ApiResponse(code = 404, message = "Room not found"),
		@ApiResponse(code = 500, message = "Problem in the system")})
public Response getRoomByLocation(@Auth BasicAuth principal,
		@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 			
		@ApiParam(value="Longitude of location", required=true) @Min(-180) @Max(180) @NotNull @QueryParam("longitude") Double longitude,
		@ApiParam(value="Latitude of location", required=true) @Min(-90) @Max(90) @NotNull @QueryParam("latitude") Double latitude,
		@ApiParam(value = "Floor of location", required = true) @NotNull  @QueryParam("floor") Integer floor) throws AssemblyException, RoomNotFoundException{
	validations.checkIsNotNullAndNotBlank(appIdentifier);
	validations.checkMin(-180.0, longitude);
	validations.checkMax(180.0, longitude);
	validations.checkMin(-90.0, latitude);
	validations.checkMax(90.0, latitude);
	validations.checkIsNotNull(floor);
	
	Feature room=searchManager.getRoomByLocation(appIdentifier, longitude, latitude, floor);			
	RoomDTO roomDTO=roomAssembler.createDataTransferObject(room);				
	return Response.ok(roomDTO).build();		
}
 
@RequestMapping(value="/distinctcount", method={RequestMethod.POST, RequestMethod.GET})
public @ResponseBody Map<Integer, Integer> distinctCount(@NotBlank @RequestParam String indName,
        @NotBlank @RequestParam(required=false) Boolean isDim,
        @RequestParam(required=false) String filterDims,
        @RequestParam String groupbyDim,
        @NotBlank @RequestParam String... timeSeries) throws Throwable {
    
    LOGGER.info("Try to distinct-count {} on {} with filter {}.", indName, ObjectUtils.getDisplayString(timeSeries), filterDims);
    long timing = System.currentTimeMillis();
    Map<String, List<Integer>> filter = (filterDims == null || "".equals(filterDims)) ? null
            : objectMapper.readValue(filterDims, new TypeReference<Map<String, List<Integer>>>() {});
    Map<Integer, Integer> distinct = manager.aggs(timeSeries).discnt(indName, isDim == null ? true : isDim, groupbyDim, filter);
    LOGGER.info("Sucess to distinct-count {} on {} result size is {} using {}ms.", indName, timeSeries, distinct.size(), System.currentTimeMillis() - timing);
    LOGGER.debug("Sucess to distinct-count {} on {} result is {}.", indName, timeSeries, distinct);
    
    return distinct;
}
 
源代码6 项目: osiris   文件: FeatureResourceImpl.java
@Override
@POST		
@ValidationRequired(processor = RestViolationProcessor.class)
@ApiOperation(value = "Store a feature", httpMethod="POST", response=FeatureDTO.class)
@ApiResponses(value = {
		@ApiResponse(code = 200, message = "Feature was stored", response=FeatureDTO.class),
		@ApiResponse(code = 400, message = "Latitude range out of index"),
		@ApiResponse(code = 400, message = "Longitude range out of index"),
		@ApiResponse(code = 400, message = "Geometry is invalid"),
		@ApiResponse(code = 400, message = "Mongo GeoJSON format is not correct"),
		@ApiResponse(code = 400, message = "Invalid input parameter (header)")})
public Response storeFeature(@Auth BasicAuth principal,
		@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier,
		@ApiParam(required=true, value="Feature") @Valid @NotNull FeatureDTO featureDTO) throws AssemblyException, MongoGeospatialException {
	validations.checkIsNotNullAndNotBlank(appIdentifier);
	validations.checkIsNotNull(featureDTO);
	Feature feature = featureManager.storeFeature(appIdentifier, featureAssembler.createDomainObject(featureDTO));		
	FeatureDTO featureResponseDTO=featureAssembler.createDataTransferObject(feature);		
	return Response.ok(featureResponseDTO).build();
}
 
源代码7 项目: osiris   文件: FeatureResourceImpl.java
@Override
@Path("/{idFeature}")
@DELETE
@ValidationRequired(processor = RestViolationProcessor.class)
@ApiOperation(value = "Delete a feature", httpMethod="DELETE")
@ApiResponses(value = {
		@ApiResponse(code = 204, message = "Feature was deleted"),
		@ApiResponse(code = 400, message = "Invalid input parameter (header)"),
		@ApiResponse(code = 404, message = "Feature was not found")})
public Response deleteFeature(@Auth BasicAuth principal,
		@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 
		@ApiParam(required=true, value="Feature identifier") @NotBlank @NotNull @PathParam("idFeature") String idFeature) throws FeatureNotExistException {
	// TODO Auto-generated method stub
	validations.checkIsNotNullAndNotBlank(appIdentifier,idFeature);
	featureManager.deleteFeature(appIdentifier, idFeature);
	return Response.noContent().build();
}
 
源代码8 项目: osiris   文件: FeatureResourceImpl.java
@Override
@Path("/{idFeature}")
@GET
@ValidationRequired(processor = RestViolationProcessor.class)
@ApiOperation(value = "Get a feature by id", httpMethod="GET", response=FeatureDTO.class)
@ApiResponses(value = {
		@ApiResponse(code = 200, message = "Feature was found", response=FeatureDTO.class),
		@ApiResponse(code = 400, message = "Invalid input parameter (header)"),
		@ApiResponse(code = 404, message = "Feature was not found")})
public Response getFeatureByID(@Auth BasicAuth principal,
		@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 
		@ApiParam(required=true, value="Feature identifier") @NotBlank @NotNull @PathParam("idFeature") String idFeature) throws AssemblyException, FeatureNotExistException {
	// TODO Auto-generated method stub
	validations.checkIsNotNullAndNotBlank(appIdentifier,idFeature);
	Feature feature = featureManager.getFeatureByID(appIdentifier,idFeature);
	FeatureDTO featureDTO=featureAssembler.createDataTransferObject(feature);
	return Response.ok(featureDTO).build();
}
 
源代码9 项目: osiris   文件: MapFileResourceImpl.java
@Override
@GET
@ValidationRequired(processor = RestViolationProcessor.class)
@ApiOperation(value = "Get .map file", httpMethod="GET", response=InputStream.class)
@ApiResponses(value = {
  @ApiResponse(code = 200, message = ".map file was found", response=InputStream.class),
  @ApiResponse(code = 400, message = "Invalid input parameter (header)"),
  @ApiResponse(code = 404, message = ".map file was not found")})
public Response getMapFile(@Auth BasicAuth principal,
  @ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier) throws MapFileNotExistsException{
 validations.checkIsNotNullAndNotBlank(appIdentifier);
 InputStream mapFile=mapFileManager.getMapFile(appIdentifier);
 return Response.ok(mapFile).build();
}
 
源代码10 项目: osiris   文件: SearchResourceImpl.java
@Override		
@POST	
@ValidationRequired(processor = RestViolationProcessor.class)
@ApiOperation(value = "Get features according to query", httpMethod="POST", response=FeatureDTO.class, responseContainer = "List")
@ApiResponses(value = {
		@ApiResponse(code = 200, message = "Features were found", response=FeatureDTO.class),
		@ApiResponse(code = 400, message = "Invalid input parameter (header)"),
		@ApiResponse(code = 400, message = "Query is not correct")})
public Response getFeaturesByQuery(@Auth BasicAuth principal,
		@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 
		@ApiParam(value = "Query", required = true) @NotBlank @NotNull String query, 
		@ApiParam(required=false,value="Layer",allowableValues="ALL,MAP,FEATURES",defaultValue="ALL") @QueryParam("layer") @DefaultValue("ALL") LayerDTO layer,
		@ApiParam(required=false,value="Index of page",defaultValue="0") @QueryParam("pageIndex") @DefaultValue("0") Integer pageIndex, 
		@ApiParam(required=false,value="Size of page",defaultValue="20") @QueryParam("pageSize") @DefaultValue("20") Integer pageSize,
		@ApiParam(required=false,value="Order field") @QueryParam("orderField") String orderField, 
		@ApiParam(required=false,value="Order",allowableValues="ASC,DESC") @DefaultValue("ASC") @QueryParam("order") String order) throws AssemblyException, QueryException {
					
	validations.checkIsNotNullAndNotBlank(appIdentifier,query);
	validations.checkIsNotNull(layer);
	validations.checkMin(0, pageIndex);
	validations.checkMin(1, pageSize);
	
	Collection<Feature>  features = null;
	
	if(StringUtils.isEmpty(orderField)){
		features =  searchManager.getFeaturesByQuery(appIdentifier, query, layer, pageIndex, pageSize);				
	}else{
		features =  searchManager.getFeaturesByQuery(appIdentifier, query, layer, pageIndex, pageSize, orderField, order);
	}
	
	Collection<FeatureDTO> collectionFeatureDTO=featureAssembler.createDataTransferObjects(features);
	return Response.ok(collectionFeatureDTO).build();
}
 
源代码11 项目: frpMgr   文件: Post.java
@NotBlank(message="岗位名称不能为空")
@Length(min=0, max=100, message="岗位名称长度不能超过 100 个字符")
public String getPostName() {
	return postName;
}
 
源代码12 项目: frpMgr   文件: Company.java
@NotBlank(message="公司代码不能为空")
@Pattern(regexp="[a-zA-Z0-9_]{0,30}", message="代码长度不能大于 30 个字符,并且只能包含字母、数字、下划线")
public String getViewCode() {
	return viewCode;
}
 
源代码13 项目: frpMgr   文件: Company.java
@NotBlank(message="公司名称不能为空")
@Length(min=0, max=200, message="公司名称长度不能超过 200 个字符")
public String getCompanyName() {
	return companyName;
}
 
源代码14 项目: frpMgr   文件: Area.java
@NotBlank(message="类型不能为空")
@Length(min=0, max=1, message="类型长度不能超过 1 个字符")
public String getAreaType() {
	return areaType;
}
 
源代码15 项目: frpMgr   文件: Log.java
@NotBlank(message="日志类型不能为空")
@Length(min=0, max=1, message="日志类型长度不能超过 1 个字符")
public String getLogType() {
	return logType;
}
 
源代码16 项目: cm_ext   文件: UserDescriptor.java
@NotBlank
String getLongname();
 
源代码17 项目: frpMgr   文件: Log.java
@NotBlank(message="操作IP地址不能为空")
@Length(min=0, max=255, message="操作IP地址长度不能超过 255 个字符")
public String getRemoteAddr() {
	return remoteAddr;
}
 
源代码18 项目: cm_ext   文件: RoleDescriptor.java
@NotBlank
String getLabel();
 
源代码19 项目: entando-core   文件: PermissionRequest.java
@Override
@Size(max = 30, message = "string.size.invalid")
@NotBlank(message = "permission.code.notBlank")
public String getCode() {
    return super.getCode();
}
 
源代码20 项目: frpMgr   文件: Office.java
@NotBlank(message="机构名称不能为空")
@Length(min=0, max=100, message="机构名称长度不能超过 100 个字符")
public String getOfficeName() {
	return officeName;
}
 
源代码21 项目: frpMgr   文件: Office.java
@NotBlank(message="机构全称不能为空")
@Length(min=0, max=200, message="机构全称长度不能超过 200 个字符")
public String getFullName() {
	return fullName;
}
 
源代码22 项目: cm_ext   文件: CreateHdfsDirDescriptor.java
/** The path in HDFS to create. */
@NotBlank
@AvailableSubstitutions(type={PARAMETERS, USER, GROUP, PRINCIPAL})
String getPath();
 
源代码23 项目: Mario   文件: User.java
@NotBlank(message = "登录名不能为空")
public String getLoginName() {
    return loginName;
}
 
源代码24 项目: restdocs-raml   文件: TagInput.java
@JsonCreator
public TagInput(@NotBlank @JsonProperty("name") String name) {
	this.name = name;
}
 
源代码25 项目: Mario   文件: Mario_zk_info.java
/**
*
* get方法
*
*/
@NotNull(message = "必须填写ZooKeeper名字")
@NotBlank(message = "必须填写ZooKeeper名字")
public String getzk_name(){
    return this.zk_name;
}
 
源代码26 项目: hsweb-framework   文件: ValidatorTests.java
@NotBlank
public String getString() {

    return "";
}
 
源代码27 项目: hsweb-framework   文件: OAuth2AccessToken.java
@NotBlank
String getClientId();
 
源代码28 项目: hsweb-framework   文件: OAuth2AccessToken.java
@NotBlank
String getAccessToken();
 
源代码29 项目: hsweb-framework   文件: OAuth2AccessToken.java
@NotBlank
String getRefreshToken();
 
源代码30 项目: hsweb-framework   文件: DynamicFormEntity.java
/**
 * @return 表单名称
 */
@ApiModelProperty(value = "表单名称", required = true, example = "测试表单")
@NotBlank(groups = CreateGroup.class)
String getName();
 
 类所在包
 同包方法