javax.validation.constraints.NotNull Java Examples

The following examples show how to use javax.validation.constraints.NotNull. 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: ValidatorFactoryTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testSimpleValidation() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	ValidPerson person = new ValidPerson();
	Set<ConstraintViolation<ValidPerson>> result = validator.validate(person);
	assertEquals(2, result.size());
	for (ConstraintViolation<ValidPerson> cv : result) {
		String path = cv.getPropertyPath().toString();
		if ("name".equals(path) || "address.street".equals(path)) {
			assertTrue(cv.getConstraintDescriptor().getAnnotation() instanceof NotNull);
		}
		else {
			fail("Invalid constraint violation with path '" + path + "'");
		}
	}

	Validator nativeValidator = validator.unwrap(Validator.class);
	assertTrue(nativeValidator.getClass().getName().startsWith("org.hibernate"));
	assertTrue(validator.unwrap(ValidatorFactory.class) instanceof HibernateValidatorFactory);
	assertTrue(validator.unwrap(HibernateValidatorFactory.class) instanceof HibernateValidatorFactory);

	validator.destroy();
}
 
Example #2
Source File: WxGoodsController.java    From dts-shop with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 商品分类类目
 *
 * @param id
 *            分类类目ID
 * @return 商品分类类目
 */
@GetMapping("category")
public Object category(@NotNull Integer id) {
	logger.info("【请求开始】商品分类类目,请求参数,id:{}", id);

	DtsCategory cur = categoryService.findById(id);
	DtsCategory parent = null;
	List<DtsCategory> children = null;

	if (cur.getPid() == 0) {
		parent = cur;
		children = categoryService.queryByPid(cur.getId());
		cur = children.size() > 0 ? children.get(0) : cur;
	} else {
		parent = categoryService.findById(cur.getPid());
		children = categoryService.queryByPid(cur.getPid());
	}
	Map<String, Object> data = new HashMap<>();
	data.put("currentCategory", cur);
	data.put("parentCategory", parent);
	data.put("brotherCategory", children);

	logger.info("【请求结束】商品分类类目,响应结果:{}", JSONObject.toJSONString(data));
	return ResponseUtil.ok(data);
}
 
Example #3
Source File: DriveUploader.java    From Bhadoo-Cloud-Drive with MIT License 6 votes vote down vote up
/**
 * It will upload bytes in range [start,end] to Google drive.
 *
 * @param start
 *            starting byte of range
 * @param end
 *            ending byte of range
 */
void uploadPartially(@NotNull byte[] buffer, long start, long end) {
	String contentRange = "bytes " + start + "-" + end + "/" + downloadFileInfo.getContentLength();

	int statusCode;
	try {
		HttpURLConnection uploadConnection = (HttpURLConnection) createdFileUrl.openConnection();
		uploadConnection.setDoOutput(true);
		uploadConnection.setRequestProperty("User-Agent", USER_AGENT);
		uploadConnection.setRequestProperty("Content-Range", contentRange);
		IOUtils.copy(new ByteArrayInputStream(buffer), uploadConnection.getOutputStream());
		uploadConnection.connect();
		statusCode = uploadConnection.getResponseCode();
	} catch (IOException e) {
		throw new RuntimeException("Error While uploading file.", e);
	}

	// In case of successful upload, status code will be 3** or 2**
	if (statusCode < 400)
		uploadInformation.setUploadedSize(end + 1);
	else if (statusCode == 403) {
		throw new RuntimeException(
				"Google didn't allow us to create file. Your drive might not have enough space.");
	}
}
 
Example #4
Source File: WxGrouponController.java    From mall with MIT License 6 votes vote down vote up
/**
 * 参加团购
 *
 * @param grouponId 团购活动ID
 * @return 操作结果
 */
@GetMapping("join")
public Object join(@NotNull Integer grouponId) {
    LitemallGroupon groupon = grouponService.queryById(grouponId);
    if (groupon == null) {
        return ResponseUtil.badArgumentValue();
    }

    LitemallGrouponRules rules = rulesService.queryById(groupon.getRulesId());
    if (rules == null) {
        return ResponseUtil.badArgumentValue();
    }

    LitemallGoods goods = goodsService.findById(rules.getGoodsId());
    if (goods == null) {
        return ResponseUtil.badArgumentValue();
    }

    Map<String, Object> result = new HashMap<>();
    result.put("groupon", groupon);
    result.put("goods", goods);

    return ResponseUtil.ok(result);
}
 
Example #5
Source File: ValidatorFactoryTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testSimpleValidation() {
	LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
	validator.afterPropertiesSet();

	ValidPerson person = new ValidPerson();
	Set<ConstraintViolation<ValidPerson>> result = validator.validate(person);
	assertEquals(2, result.size());
	for (ConstraintViolation<ValidPerson> cv : result) {
		String path = cv.getPropertyPath().toString();
		if ("name".equals(path) || "address.street".equals(path)) {
			assertTrue(cv.getConstraintDescriptor().getAnnotation() instanceof NotNull);
		}
		else {
			fail("Invalid constraint violation with path '" + path + "'");
		}
	}

	Validator nativeValidator = validator.unwrap(Validator.class);
	assertTrue(nativeValidator.getClass().getName().startsWith("org.hibernate"));
	assertTrue(validator.unwrap(ValidatorFactory.class) instanceof HibernateValidatorFactory);
	assertTrue(validator.unwrap(HibernateValidatorFactory.class) instanceof HibernateValidatorFactory);

	validator.destroy();
}
 
Example #6
Source File: AccountApiClient.java    From XS2A-Sandbox with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Read transaction list of an account", nickname = "getTransactionList", notes = "Read transaction reports or transaction lists of a given account ddressed by \"account-id\", depending on the steering parameter  \"bookingStatus\" together with balances.  For a given account, additional parameters are e.g. the attributes \"dateFrom\" and \"dateTo\".  The ASPSP might add balance information, if transaction lists without balances are not supported. ", response = TransactionsResponse200Json.class, authorizations = {
        @Authorization(value = "BearerAuthOAuth")
}, tags = {})
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "OK", response = TransactionsResponse200Json.class),
        @ApiResponse(code = 400, message = "Bad Request", response = Error400NGAIS.class),
        @ApiResponse(code = 401, message = "Unauthorized", response = Error401NGAIS.class),
        @ApiResponse(code = 403, message = "Forbidden", response = Error403NGAIS.class),
        @ApiResponse(code = 404, message = "Not found", response = Error404NGAIS.class),
        @ApiResponse(code = 405, message = "Method Not Allowed", response = Error405NGAIS.class),
        @ApiResponse(code = 406, message = "Not Acceptable", response = Error406NGAIS.class),
        @ApiResponse(code = 408, message = "Request Timeout"),
        @ApiResponse(code = 415, message = "Unsupported Media Type"),
        @ApiResponse(code = 429, message = "Too Many Requests", response = Error429NGAIS.class),
        @ApiResponse(code = 500, message = "Internal Server Error"),
        @ApiResponse(code = 503, message = "Service Unavailable")})
@RequestMapping(value = "/v1/accounts/{account-id}/transactions/",
        produces = {"application/json", "application/xml", "application/text", "application/problem+json"},
        method = RequestMethod.GET)
ResponseEntity<TransactionsResponse200Json> _getTransactionList(@ApiParam(value = "This identification is denoting the addressed account.  The account-id is retrieved by using a \"Read Account List\" call.  The account-id is the \"id\" attribute of the account structure.  Its value is constant at least throughout the lifecycle of a given consent. ", required = true) @PathVariable("account-id") String accountId, @NotNull @ApiParam(value = "Permitted codes are    * \"booked\",   * \"pending\" and    * \"both\" \"booked\" shall be supported by the ASPSP. To support the \"pending\" and \"both\" feature is optional for the ASPSP,  Error code if not supported in the online banking frontend ", required = true, allowableValues = "booked, pending, both") @Valid @RequestParam(value = "bookingStatus", required = true) String bookingStatus, @ApiParam(value = "ID of the request, unique to the call, as determined by the initiating party.", required = true) @RequestHeader(value = "X-Request-ID", required = true) UUID xRequestID, @ApiParam(value = "This then contains the consentId of the related AIS consent, which was performed prior to this payment initiation. ", required = true) @RequestHeader(value = "Consent-ID", required = true) String consentID, @ApiParam(value = "Conditional: Starting date (inclusive the date dateFrom) of the transaction list, mandated if no delta access is required.  For booked transactions, the relevant date is the booking date.   For pending transactions, the relevant date is the entry date, which may not be transparent  neither in this API nor other channels of the ASPSP. ") @Valid @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) @RequestParam(value = "dateFrom", required = false) LocalDate dateFrom, @ApiParam(value = "End date (inclusive the data dateTo) of the transaction list, is \"now\" if not given.   Might be ignored if a delta function is used.  For booked transactions, the relevant date is the booking date.   For pending transactions, the relevant date is the entry date, which may not be transparent  neither in this API nor other channels of the ASPSP. ") @Valid @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) @RequestParam(value = "dateTo", required = false) LocalDate dateTo, @ApiParam(value = "This data attribute is indicating that the AISP is in favour to get all transactions after  the transaction with identification entryReferenceFrom alternatively to the above defined period.  This is a implementation of a delta access.  If this data element is contained, the entries \"dateFrom\" and \"dateTo\" might be ignored by the ASPSP  if a delta report is supported.  Optional if supported by API provider. ") @Valid @RequestParam(value = "entryReferenceFrom", required = false) String entryReferenceFrom, @ApiParam(value = "This data attribute is indicating that the AISP is in favour to get all transactions after the last report access for this PSU on the addressed account. This is another implementation of a delta access-report. This delta indicator might be rejected by the ASPSP if this function is not supported. Optional if supported by API provider") @Valid @RequestParam(value = "deltaList", required = false) Boolean deltaList, @ApiParam(value = "If contained, this function reads the list of accessible payment accounts including the booking balance,  if granted by the PSU in the related consent and available by the ASPSP.  This parameter might be ignored by the ASPSP.  ") @Valid @RequestParam(value = "withBalance", required = false) Boolean withBalance, @ApiParam(value = "Is contained if and only if the \"Signature\" element is contained in the header of the request.") @RequestHeader(value = "Digest", required = false) String digest, @ApiParam(value = "A signature of the request by the TPP on application level. This might be mandated by ASPSP. ") @RequestHeader(value = "Signature", required = false) String signature, @ApiParam(value = "The certificate used for signing the request, in base64 encoding.  Must be contained if a signature is contained. ") @RequestHeader(value = "TPP-Signature-Certificate", required = false) byte[] tpPSignatureCertificate, @ApiParam(value = "The forwarded IP Address header field consists of the corresponding HTTP request  IP Address field between PSU and TPP.  It shall be contained if and only if this request was actively initiated by the PSU. ") @RequestHeader(value = "PSU-IP-Address", required = false) String psUIPAddress, @ApiParam(value = "The forwarded IP Port header field consists of the corresponding HTTP request IP Port field between PSU and TPP, if available. ") @RequestHeader(value = "PSU-IP-Port", required = false) String psUIPPort, @ApiParam(value = "The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available. ") @RequestHeader(value = "PSU-Accept", required = false) String psUAccept, @ApiParam(value = "The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available. ") @RequestHeader(value = "PSU-Accept-Charset", required = false) String psUAcceptCharset, @ApiParam(value = "The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available. ") @RequestHeader(value = "PSU-Accept-Encoding", required = false) String psUAcceptEncoding, @ApiParam(value = "The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available. ") @RequestHeader(value = "PSU-Accept-Language", required = false) String psUAcceptLanguage, @ApiParam(value = "The forwarded Agent header field of the HTTP request between PSU and TPP, if available. ") @RequestHeader(value = "PSU-User-Agent", required = false) String psUUserAgent, @ApiParam(value = "HTTP method used at the PSU ? TPP interface, if available. Valid values are: * GET * POST * PUT * PATCH * DELETE ", allowableValues = "GET, POST, PUT, PATCH, DELETE") @RequestHeader(value = "PSU-Http-Method", required = false) String psUHttpMethod, @ApiParam(value = "UUID (Universally Unique Identifier) for a device, which is used by the PSU, if available. UUID identifies either a device or a device dependant application installation. In case of an installation identification this ID need to be unaltered until removal from device. ") @RequestHeader(value = "PSU-Device-ID", required = false) UUID psUDeviceID, @ApiParam(value = "The forwarded Geo Location of the corresponding http request between PSU and TPP if available. ") @RequestHeader(value = "PSU-Geo-Location", required = false) String psUGeoLocation);
 
Example #7
Source File: WxTopicController.java    From dts-shop with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 专题详情
 *
 * @param id
 *            专题ID
 * @return 专题详情
 */
@GetMapping("detail")
public Object detail(@NotNull Integer id) {
	logger.info("【请求开始】获取专题详情,请求参数,id:{}", id);

	Map<String, Object> data = new HashMap<>();
	DtsTopic topic = topicService.findById(id);
	data.put("topic", topic);
	List<DtsGoods> goods = new ArrayList<>();
	for (Integer i : topic.getGoods()) {
		DtsGoods good = goodsService.findByIdVO(i);
		if (null != good)
			goods.add(good);
	}
	data.put("goods", goods);

	logger.info("【请求结束】获取专题详情,响应结果:{}", "成功");
	return ResponseUtil.ok(data);
}
 
Example #8
Source File: GoogleOauthController.java    From Bhadoo-Cloud-Drive with MIT License 6 votes vote down vote up
private Token getAccessToken(@NotNull String code) throws IOException {
	// Initialize client
	HttpClient httpClient = HttpClientBuilder.create().build();
	HttpPost httpPost = new HttpPost(TOKEN_URL);

	// add request parameters
	List<NameValuePair> parameters = new ArrayList<>();
	parameters.add(new BasicNameValuePair("code", code));
	parameters.add(new BasicNameValuePair("client_id", CLIENT_ID));
	parameters.add(new BasicNameValuePair("client_secret", CLIENT_SECRET));
	parameters.add(new BasicNameValuePair("redirect_uri", REDIRECT_URI));
	parameters.add(new BasicNameValuePair("grant_type", GRANT_TYPE));
	httpPost.setEntity(new UrlEncodedFormEntity(parameters));

	// send request
	org.apache.http.HttpResponse response = httpClient.execute(httpPost);
	int statusCode = response.getStatusLine().getStatusCode();
	InputStream inputStream = response.getEntity().getContent();

	if (HttpUtilities.success(statusCode))
		return gson.fromJson(new InputStreamReader(inputStream), Token.class);

	throw new ApiException(HttpStatus.valueOf(statusCode));
}
 
Example #9
Source File: WxCommentController.java    From BigDataPlatform with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 评论列表
 *
 * @param type     类型ID。 如果是0,则查询商品评论;如果是1,则查询专题评论。
 * @param valueId  商品或专题ID。如果type是0,则是商品ID;如果type是1,则是专题ID。
 * @param showType 显示类型。如果是0,则查询全部;如果是1,则查询有图片的评论。
 * @param page     分页页数
 * @param limit     分页大小
 * @return 评论列表
 */
@GetMapping("list")
public Object list(@NotNull Byte type,
                   @NotNull Integer valueId,
                   @NotNull Integer showType,
                   @RequestParam(defaultValue = "1") Integer page,
                   @RequestParam(defaultValue = "10") Integer limit) {
    List<LitemallComment> commentList = commentService.query(type, valueId, showType, page, limit);

    List<Map<String, Object>> commentVoList = new ArrayList<>(commentList.size());
    for (LitemallComment comment : commentList) {
        Map<String, Object> commentVo = new HashMap<>();
        commentVo.put("addTime", comment.getAddTime());
        commentVo.put("content", comment.getContent());
        commentVo.put("picList", comment.getPicUrls());

        UserInfo userInfo = userInfoService.getInfo(comment.getUserId());
        commentVo.put("userInfo", userInfo);

        String reply = commentService.queryReply(comment.getId());
        commentVo.put("reply", reply);

        commentVoList.add(commentVo);
    }
    return ResponseUtil.okList(commentVoList, commentList);
}
 
Example #10
Source File: WxAddressController.java    From mall with MIT License 5 votes vote down vote up
/**
 * 收货地址详情
 *
 * @param userId 用户ID
 * @param id     收货地址ID
 * @return 收货地址详情
 */
@GetMapping("detail")
public Object detail(@LoginUser Integer userId, @NotNull Integer id) {
	if (userId == null) {
		return ResponseUtil.unlogin();
	}

	LitemallAddress address = addressService.findById(id);
	if (address == null) {
		return ResponseUtil.badArgumentValue();
	}

	Map<Object, Object> data = new HashMap<Object, Object>();
	data.put("id", address.getId());
	data.put("name", address.getName());
	data.put("provinceId", address.getProvinceId());
	data.put("cityId", address.getCityId());
	data.put("areaId", address.getAreaId());
	data.put("mobile", address.getMobile());
	data.put("address", address.getAddress());
	data.put("isDefault", address.getIsDefault());
	String pname = regionService.findById(address.getProvinceId()).getName();
	data.put("provinceName", pname);
	String cname = regionService.findById(address.getCityId()).getName();
	data.put("cityName", cname);
	String dname = regionService.findById(address.getAreaId()).getName();
	data.put("areaName", dname);
	return ResponseUtil.ok(data);
}
 
Example #11
Source File: SchemaSummary.java    From apicurio-registry with Apache License 2.0 5 votes vote down vote up
/**
 * Set to false if the schema is disabled. If the schema is disabled, all the schema versions are disabled.
 **/

@JsonProperty("enabled")
@NotNull
public boolean isEnabled() {
    return enabled;
}
 
Example #12
Source File: AdminCouponController.java    From dts-shop with GNU Lesser General Public License v3.0 5 votes vote down vote up
@RequiresPermissions("admin:coupon:read")
@RequiresPermissionsDesc(menu = { "推广管理", "优惠券管理" }, button = "详情")
@GetMapping("/read")
public Object read(@NotNull Integer id) {
	logger.info("【请求开始】推广管理->优惠券管理->详情,请求参数,id:{}", id);

	DtsCoupon coupon = couponService.findById(id);

	logger.info("【请求结束】推广管理->优惠券管理->详情,响应结果:{}", JSONObject.toJSONString(coupon));
	return ResponseUtil.ok(coupon);
}
 
Example #13
Source File: StateModification.java    From apicurio-registry with Apache License 2.0 5 votes vote down vote up
/**
 *
 **/

@JsonProperty("value")
@NotNull
public SchemaState getValue() {
    return value;
}
 
Example #14
Source File: StateModification.java    From apicurio-registry with Apache License 2.0 5 votes vote down vote up
/**
 *
 **/

@JsonProperty("op")
@NotNull
public OpEnum getOp() {
    return op;
}
 
Example #15
Source File: AdminCategoryController.java    From mall with MIT License 5 votes vote down vote up
@RequiresPermissions("admin:category:read")
@RequiresPermissionsDesc(menu={"商场管理" , "类目管理"}, button="详情")
@GetMapping("/read")
public Object read(@NotNull Integer id) {
    LitemallCategory category = categoryService.findById(id);
    return ResponseUtil.ok(category);
}
 
Example #16
Source File: NewSchemaVersion.java    From apicurio-registry with Apache License 2.0 5 votes vote down vote up
/**
 * The name to give this version of the schema
 **/

@JsonProperty("version")
@NotNull
public String getVersion() {
    return version;
}
 
Example #17
Source File: HiveConfig.java    From presto with Apache License 2.0 5 votes vote down vote up
@MinDataSize("1B")
@MaxDataSize("1GB")
@NotNull
public DataSize getTextMaxLineLength()
{
    return textMaxLineLength;
}
 
Example #18
Source File: DefaultAlexaSkillBuilder.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
 public AlexaSkill<RequestEnvelope, ResponseEnvelope> buildSkill(@Nonnull @NotNull SkillBuilder<?> skillBuilder,
                                                                 @Nullable AlexaSkillConfiguration alexaSkillConfiguration) {

    SkillBeans skillBeans = alexaSkillConfiguration == null ? unqualifiedSkillBeans : this.skillBeans.get(alexaSkillConfiguration.getName());
    skillBeans.getRequestHandlers()
            .stream()
            .sorted(OrderUtil.COMPARATOR)
            .forEach(skillBuilder::addRequestHandler);

    skillBeans.getExceptionHandlers()
            .stream()
            .sorted(OrderUtil.COMPARATOR)
            .forEach(skillBuilder::addExceptionHandler);

    skillBeans.getRequestInterceptors()
            .stream()
            .sorted(OrderUtil.COMPARATOR)
            .forEach(skillBuilder::addRequestInterceptor);

    skillBeans.getResponseInterceptors()
            .stream()
            .sorted(OrderUtil.COMPARATOR)
            .forEach(skillBuilder::addResponseInterceptor);

    if (alexaSkillConfiguration != null) {
        skillBuilder = skillBuilder.withSkillId(alexaSkillConfiguration.getSkillId());
    }
    return skillBuilder.build();
}
 
Example #19
Source File: StoragePluginsHandlerService.java    From Bats with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to identify the enabled status for new storage plugins config. If this status is absent in the updater
 * file, the status is kept from the configs, which are going to be updated
 *
 * @param oldPluginConfig current storage plugin config from Persistent Store or bootstrap config file
 * @param newPluginConfig new storage plugin config
 * @return new storage plugin config with updated enabled status
 */
private StoragePluginConfig updatePluginStatus(@Nullable StoragePluginConfig oldPluginConfig,
                                               @NotNull StoragePluginConfig newPluginConfig) {
  if (!newPluginConfig.isEnabledStatusPresent()) {
    boolean newStatus = oldPluginConfig != null && oldPluginConfig.isEnabled();
    newPluginConfig.setEnabled(newStatus);
  }
  return newPluginConfig;
}
 
Example #20
Source File: Food.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
public Food(
        @Size(max = 36) @NotNull String key,
        @Size(max = 9999) @NotNull int carbohydrates,
        @Size(max = 9999) @NotNull int portionGrams,
        @Nullable Meal meal) {
    this.key = key;
    this.carbohydrates = carbohydrates;
    this.portionGrams = portionGrams;
    this.meal = meal;
}
 
Example #21
Source File: WxBrandController.java    From mall with MIT License 5 votes vote down vote up
/**
 * 品牌详情
 *
 * @param id 品牌ID
 * @return 品牌详情
 */
@GetMapping("detail")
public Object detail(@NotNull Integer id) {
    LitemallBrand entity = brandService.findById(id);
    if (entity == null) {
        return ResponseUtil.badArgumentValue();
    }

    Map<String, Object> data = new HashMap<String, Object>();
    data.put("brand", entity);
    return ResponseUtil.ok(data);
}
 
Example #22
Source File: ArticlesResource.java    From realworld-api-quarkus with MIT License 5 votes vote down vote up
@DELETE
@Path("/{slug}/comments/{id}")
@Secured({Role.ADMIN, Role.USER})
@Produces(MediaType.APPLICATION_JSON)
public Response deleteComment(
    @PathParam("slug") @NotBlank(message = ValidationMessages.SLUG_MUST_BE_NOT_BLANK) String slug,
    @PathParam("id") @NotNull(message = ValidationMessages.COMMENT_ID_MUST_BE_NOT_NULL) Long id,
    @Context SecurityContext securityContext) {
  Long loggedUserId = getLoggedUserId(securityContext);
  articlesService.deleteComment(slug, id, loggedUserId);
  return Response.ok().build();
}
 
Example #23
Source File: BackupConfig.java    From presto with Apache License 2.0 5 votes vote down vote up
@NotNull
@MinDuration("1s")
@MaxDuration("1h")
public Duration getTimeout()
{
    return timeout;
}
 
Example #24
Source File: PostgresDeviceLogPluginSettingsDAO.java    From hmdm-server with Apache License 2.0 5 votes vote down vote up
@Override
@Transactional
public void savePluginSettingsRule(@NotNull DeviceLogRule rule) {
    PostgresDeviceLogPluginSettings postgresSettings = (PostgresDeviceLogPluginSettings) getPluginSettings();
    if (postgresSettings != null) {
        PostgresDeviceLogRule postgresRule = (PostgresDeviceLogRule) rule;

        postgresRule.setSettingId(postgresSettings.getId());

        if (postgresRule.getId() == null) {
            this.mapper.insertPluginSettingsRule(postgresRule);
        } else {
            this.mapper.updatePluginSettingsRule(postgresRule);
        }


        this.mapper.deletePluginSettingsRuleDevices(postgresRule.getId());
        if (postgresRule.getDevices() != null && !postgresRule.getDevices().isEmpty()) {
            final List<Integer> deviceIds = postgresRule.getDevices()
                    .stream()
                    .map(LookupItem::getId)
                    .collect(Collectors.toList());
            this.mapper.insertPluginSettingsRuleDevices(postgresRule.getId(), deviceIds);
        }

    } else {
        throw new IllegalStateException("Device Log Plugin settings record is required to be created prior " +
                "to saving the rule: " + rule);
    }
}
 
Example #25
Source File: ElasticsearchConfig.java    From presto with Apache License 2.0 4 votes vote down vote up
@NotNull
public int getMaxHttpConnections()
{
    return maxHttpConnections;
}
 
Example #26
Source File: HiveConfig.java    From presto with Apache License 2.0 4 votes vote down vote up
@NotNull
public Duration getRecordingDuration()
{
    return recordingDuration;
}
 
Example #27
Source File: MethodValidationTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@MyValid
@Async void myValidAsyncMethod(@NotNull(groups = OtherGroup.class) String arg1, @Max(10) int arg2);
 
Example #28
Source File: PluginManagerConfig.java    From presto with Apache License 2.0 4 votes vote down vote up
@NotNull
public List<String> getMavenRemoteRepository()
{
    return mavenRemoteRepository;
}
 
Example #29
Source File: JavaxValidationModuleTest.java    From jsonschema-generator with Apache License 2.0 4 votes vote down vote up
@NotNull(groups = Test.class)
public Double getNotNullOnGetterNumber() {
    return this.notNullOnGetterNumber;
}
 
Example #30
Source File: VerifierConfig.java    From presto with Apache License 2.0 4 votes vote down vote up
@NotNull
public String getQueryDatabase()
{
    return queryDatabase;
}