Java 类javax.validation.constraints.Min 实例源码

项目:REST-Web-Services    文件:MoviePersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateOtherTitle(
        @NotNull @Valid final OtherTitle otherTitle,
        @Min(1) final Long otherTitleId,
        @NotNull final MovieEntity movie
) throws ResourceConflictException {
    log.info("Called with otherTitle {}, otherTitleId {}, movie {}", otherTitle, otherTitleId, movie);

    this.existsOtherTile(movie.getOtherTitles()
            .stream()
            .filter(ot -> ot.getStatus() == DataStatus.ACCEPTED)
            .collect(Collectors.toList()), otherTitle);

    final MovieOtherTitleEntity movieOtherTitle = this.entityManager.find(MovieOtherTitleEntity.class, otherTitleId);
    movieOtherTitle.setTitle(otherTitle.getTitle());
    movieOtherTitle.setCountry(otherTitle.getCountry());
}
项目:REST-Web-Services    文件:MoviePersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateReleaseDate(
        @NotNull @Valid final ReleaseDate releaseDate,
        @Min(1) final Long releaseDateId,
        @NotNull final MovieEntity movie
) throws ResourceConflictException {
    log.info("Called with releaseDate {}, releaseDateId {}, movie {}", releaseDate, releaseDateId, movie);

    this.existsReleaseDate(movie.getReleaseDates()
            .stream()
            .filter(rd -> rd.getStatus() == DataStatus.ACCEPTED)
            .collect(Collectors.toList()), releaseDate);

    final MovieReleaseDateEntity movieReleaseDate = this.entityManager.find(MovieReleaseDateEntity.class, releaseDateId);
    movieReleaseDate.setDate(releaseDate.getDate());
    movieReleaseDate.setCountry(releaseDate.getCountry());
}
项目:REST-Web-Services    文件:MoviePersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateStoryline(
        @NotNull @Valid final Storyline storyline,
        @Min(1) final Long storylineId,
        @NotNull final MovieEntity movie
) throws ResourceConflictException {
    log.info("Called with storyline {}, storylineId {}, movie {}", storyline, storylineId, movie);

    this.existsStoryline(movie.getStorylines()
            .stream()
            .filter(s -> s.getStatus() == DataStatus.ACCEPTED)
            .collect(Collectors.toList()), storyline);

    final MovieStorylineEntity movieStoryline = this.entityManager.find(MovieStorylineEntity.class, storylineId);
    movieStoryline.setStoryline(storyline.getStoryline());
}
项目:REST-Web-Services    文件:MoviePersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateBoxOffice(
        @NotNull @Valid final BoxOffice boxOffice,
        @Min(1) final Long boxOfficeId,
        @NotNull final MovieEntity movie
) throws ResourceConflictException {
    log.info("Called with boxOffice {}, boxOfficeId {}, movie {}", boxOffice, boxOfficeId, movie);

    this.existsBoxOffice(movie.getBoxOffices()
            .stream()
            .filter(bo -> bo.getStatus() == DataStatus.ACCEPTED)
            .collect(Collectors.toList()), boxOffice);

    final MovieBoxOfficeEntity movieBoxOffice = this.entityManager.find(MovieBoxOfficeEntity.class, boxOfficeId);
    movieBoxOffice.setBoxOffice(boxOffice.getBoxOffice());
    movieBoxOffice.setCountry(boxOffice.getCountry());
}
项目:REST-Web-Services    文件:MoviePersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateCountry(
        @NotNull @Valid final Country country,
        @Min(1) final Long countryId,
        @NotNull final MovieEntity movie
) throws ResourceConflictException {
    log.info("Called with country {}, countryId {}, movie {}", country, countryId, movie);

    this.existsCountry(movie.getCountries()
            .stream()
            .filter(c -> c.getStatus() == DataStatus.ACCEPTED)
            .collect(Collectors.toList()), country);

    final MovieCountryEntity movieCountry = this.entityManager.find(MovieCountryEntity.class, countryId);
    movieCountry.setCountry(country.getCountry());
}
项目:REST-Web-Services    文件:MoviePersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateLanguage(
        @NotNull @Valid final Language language,
        @Min(1) final Long languageId,
        @NotNull final MovieEntity movie
) throws ResourceConflictException {
    log.info("Called with language {}, languageId {}, movie {}", language, languageId, movie);

    this.existsLanguage(movie.getLanguages()
            .stream()
            .filter(l -> l.getStatus() == DataStatus.ACCEPTED)
            .collect(Collectors.toList()), language);

    final MovieLanguageEntity movieLanguage = this.entityManager.find(MovieLanguageEntity.class, languageId);
    movieLanguage.setLanguage(language.getLanguage());
}
项目:REST-Web-Services    文件:MoviePersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateReview(
        @NotNull @Valid final Review review,
        @Min(1) final Long reviewId,
        @NotNull final MovieEntity movie
) throws ResourceConflictException {
    log.info("Called with review {}, reviewId {}, movie {}", review, reviewId, movie);

    this.existsReview(movie.getReviews()
            .stream()
            .filter(r -> r.getStatus() == DataStatus.ACCEPTED)
            .collect(Collectors.toList()), review);

    final MovieReviewEntity movieReview = this.entityManager.find(MovieReviewEntity.class, reviewId);
    movieReview.setTitle(review.getTitle());
    movieReview.setReview(review.getReview());
}
项目:REST-Web-Services    文件:MovieSearchServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public Set<OtherTitle> getTitles(
        @Min(1) final Long id
) throws ResourceNotFoundException {
    log.info("Called with id {}", id);

    return this.findMovie(id).getOtherTitles()
            .stream()
            .filter(title -> title.getStatus() == DataStatus.ACCEPTED)
            .map(ServiceUtils::toOtherTitleDto)
            .collect(Collectors.toSet());
}
项目:REST-Web-Services    文件:MovieSearchServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public Set<ReleaseDate> getReleaseDates(
        @Min(1) final Long id
) throws ResourceNotFoundException {
    log.info("Called with id {}", id);

    return this.findMovie(id).getReleaseDates()
            .stream()
            .filter(releaseDate -> releaseDate.getStatus() == DataStatus.ACCEPTED)
            .map(ServiceUtils::toReleaseDateDto)
            .collect(Collectors.toSet());
}
项目:randomito-all    文件:MinMaxAnnotationPostProcessor.java   
@Override
public Object process(AnnotationInfo ctx, Object value) throws Exception {
    if (!ctx.isAnnotationPresent(Min.class)
            && !ctx.isAnnotationPresent(Max.class)) {
        return value;
    }
    long minValue = 1;
    if (ctx.isAnnotationPresent(Min.class)) {
        minValue = ctx.getAnnotation(Min.class).value();
    }
    long maxValue = 50;
    if (ctx.isAnnotationPresent(Max.class)) {
        maxValue = ctx.getAnnotation(Max.class).value();
    }
    if (Number.class.isAssignableFrom(value.getClass())) {
        return range(String.valueOf(minValue), String.valueOf(maxValue), value.getClass());
    } else if (value instanceof String) {
        String strVal = (String) value;
        if (strVal.length() < minValue) {
            strVal += RandomStringUtils.randomAlphabetic((int) minValue - strVal.length());
        } else if (strVal.length() > maxValue) {
            strVal = strVal.substring(0, (int) maxValue);
        }
        return strVal;
    }
    return value;
}
项目:dubbox-hystrix    文件:UserRestServiceImpl.java   
@Override
    public User getUser(@Min(value = 1L, message = "User ID must be greater than 1") @PathParam("id") Long id) {
        // test context injection
//        System.out.println("Client address from @Context injection: " + (request != null ? request.getRemoteAddr() : ""));
//        System.out.println("Client address from RpcContext: " + RpcContext.getContext().getRemoteAddressString());
        if (RpcContext.getContext().getRequest(HttpServletRequest.class) != null) {
            System.out.println("Client IP address from RpcContext: " + RpcContext.getContext().getRequest(HttpServletRequest.class).getRemoteAddr());
        }
        if (RpcContext.getContext().getResponse(HttpServletResponse.class) != null) {
            System.out.println("Response object from RpcContext: " + RpcContext.getContext().getResponse(HttpServletResponse.class));
        }
        return userService.getUser(id);
    }
项目:REST-Web-Services    文件:MovieSearchServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public Set<Site> getSites(
        @Min(1) final Long id
) throws ResourceNotFoundException {
    log.info("Called with id {}", id);

    return this.findMovie(id).getSites()
            .stream()
            .filter(site -> site.getStatus() == DataStatus.ACCEPTED)
            .map(ServiceUtils::toSiteDto)
            .collect(Collectors.toSet());
}
项目:REST-Web-Services    文件:MovieSearchServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public Set<Country> getCountries(
        @Min(1) final Long id
) throws ResourceNotFoundException {
    log.info("Called with id {}", id);

    return this.findMovie(id).getCountries()
            .stream()
            .filter(review -> review.getStatus() == DataStatus.ACCEPTED)
            .map(ServiceUtils::toCountryDto)
            .collect(Collectors.toSet());
}
项目:REST-Web-Services    文件:MovieSearchServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public Set<Genre> getGenres(
        @Min(1) final Long id
) throws ResourceNotFoundException {
    log.info("Called with id {}", id);

    return this.findMovie(id).getGenres()
            .stream()
            .filter(review -> review.getStatus() == DataStatus.ACCEPTED)
            .map(ServiceUtils::toGenreDto)
            .collect(Collectors.toSet());
}
项目:REST-Web-Services    文件:MovieSearchServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public Set<ImageResponse> getPosters(
        @Min(1) final Long id
) throws ResourceNotFoundException {
    log.info("Called with id {}", id);

    return this.findMovie(id).getPosters()
            .stream()
            .filter(poster -> poster.getStatus() == DataStatus.ACCEPTED)
            .map(ServiceUtils::toImageResponseDto)
            .collect(Collectors.toSet());
}
项目:REST-Web-Services    文件:MovieContributionPersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateContributionStatus(
        @Min(1) final Long contributionId,
        @NotBlank final String userId,
        @NotNull final VerificationStatus status,
        final String comment
) throws ResourceForbiddenException, ResourceNotFoundException {
    log.info("Called with contributionId {}, userId {}, status {}, comment {}", contributionId, userId, status, comment);

    final UserEntity user = this.findUser(userId);
    final ContributionEntity contribution = this.findContribution(contributionId, DataStatus.WAITING);

    if(!CollectionUtils.containsAny(user.getPermissions(), contribution.getField().getNecessaryPermissions())) {
        throw new ResourceForbiddenException("No permissions");
    }

    contribution.setVerificationComment(comment);
    contribution.setVerificationDate(new Date());
    contribution.setVerificationUser(user);
    contribution.setStatus(status.getDataStatus());

    if(status == VerificationStatus.ACCEPT) {
        this.acceptContribution(contribution);
    } else if(status == VerificationStatus.REJECT) {
        this.rejectContribution(contribution);
    }
}
项目:dubbocloud    文件:UserRestServiceImpl.java   
@Override
    public User getUser(@Min(value = 1L, message = "User ID must be greater than 1") @PathParam("id") Long id) {
        // test context injection
//        System.out.println("Client address from @Context injection: " + (request != null ? request.getRemoteAddr() : ""));
//        System.out.println("Client address from RpcContext: " + RpcContext.getContext().getRemoteAddressString());
        if (RpcContext.getContext().getRequest(HttpServletRequest.class) != null) {
            System.out.println("Client IP address from RpcContext: " + RpcContext.getContext().getRequest(HttpServletRequest.class).getRemoteAddr());
        }
        if (RpcContext.getContext().getResponse(HttpServletResponse.class) != null) {
            System.out.println("Response object from RpcContext: " + RpcContext.getContext().getResponse(HttpServletResponse.class));
        }
        return userService.getUser(id);
    }
项目:REST-Web-Services    文件:MovieContributionPersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateReleaseDateContribution(
        @NotNull @Valid final ContributionUpdate<ReleaseDate> contribution,
        @Min(1) final Long contributionId,
        @NotBlank final String userId
) throws ResourceNotFoundException, ResourceConflictException {
    log.info("Called with contribution {}, contributionId {}, userId {}",
            contribution, contributionId, userId);

    final UserEntity user = this.findUser(userId);
    final ContributionEntity contributionEntity = this.findContribution(contributionId, DataStatus.WAITING, user, MovieField.RELEASE_DATE);

    this.validIds(contributionEntity, contribution);
    this.cleanUp(contributionEntity, contribution, contributionEntity.getMovie().getReleaseDates());

    contribution.getElementsToAdd().forEach((key, value) -> {
        this.moviePersistenceService.updateReleaseDate(value, key, contributionEntity.getMovie());
    });
    contribution.getElementsToUpdate().forEach((key, value) -> {
        this.moviePersistenceService.updateReleaseDate(value, key, contributionEntity.getMovie());
    });
    contribution.getNewElementsToAdd()
            .forEach(releaseDate -> {
                final Long id = this.moviePersistenceService.createReleaseDate(releaseDate, contributionEntity.getMovie());
                contributionEntity.getIdsToAdd().add(id);
            });

    contributionEntity.setSources(contribution.getSources());
    Optional.ofNullable(contribution.getComment()).ifPresent(contributionEntity::setUserComment);
}
项目:dubbox-hystrix    文件:UserRestServiceImpl.java   
@Override
    public User getUser(@Min(value = 1L, message = "User ID must be greater than 1") @PathParam("id") Long id) {
        // test context injection
//        System.out.println("Client address from @Context injection: " + (request != null ? request.getRemoteAddr() : ""));
//        System.out.println("Client address from RpcContext: " + RpcContext.getContext().getRemoteAddressString());
        if (RpcContext.getContext().getRequest(HttpServletRequest.class) != null) {
            System.out.println("Client IP address from RpcContext: " + RpcContext.getContext().getRequest(HttpServletRequest.class).getRemoteAddr());
        }
        if (RpcContext.getContext().getResponse(HttpServletResponse.class) != null) {
            System.out.println("Response object from RpcContext: " + RpcContext.getContext().getResponse(HttpServletResponse.class));
        }
        return userService.getUser(id);
    }
项目:REST-Web-Services    文件:MovieContributionPersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateLanguageContribution(
        @NotNull @Valid final ContributionUpdate<Language> contribution,
        @Min(1) final Long contributionId,
        @NotBlank final String userId
) throws ResourceNotFoundException, ResourceConflictException {
    log.info("Called with contribution {}, contributionId {}, userId {}",
            contribution, contributionId, userId);

    final UserEntity user = this.findUser(userId);
    final ContributionEntity contributionEntity = this.findContribution(contributionId, DataStatus.WAITING, user, MovieField.LANGUAGE);

    this.validIds(contributionEntity, contribution);
    this.cleanUp(contributionEntity, contribution, contributionEntity.getMovie().getLanguages());

    contribution.getElementsToAdd().forEach((key, value) -> {
        this.moviePersistenceService.updateLanguage(value, key, contributionEntity.getMovie());
    });
    contribution.getElementsToUpdate().forEach((key, value) -> {
        this.moviePersistenceService.updateLanguage(value, key, contributionEntity.getMovie());
    });
    contribution.getNewElementsToAdd()
            .forEach(language -> {
                final Long id = this.moviePersistenceService.createLanguage(language, contributionEntity.getMovie());
                contributionEntity.getIdsToAdd().add(id);
            });

    contributionEntity.setSources(contribution.getSources());
    Optional.ofNullable(contribution.getComment()).ifPresent(contributionEntity::setUserComment);
}
项目:REST-Web-Services    文件:MovieContributionPersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updateGenreContribution(
        @NotNull @Valid final ContributionUpdate<Genre> contribution,
        @Min(1) final Long contributionId,
        @NotBlank final String userId
) throws ResourceNotFoundException, ResourceConflictException {
    log.info("Called with contribution {}, contributionId {}, userId {}",
            contribution, contributionId, userId);

    final UserEntity user = this.findUser(userId);
    final ContributionEntity contributionEntity = this.findContribution(contributionId, DataStatus.WAITING, user, MovieField.GENRE);

    this.validIds(contributionEntity, contribution);
    this.cleanUp(contributionEntity, contribution, contributionEntity.getMovie().getGenres());

    contribution.getElementsToAdd().forEach((key, value) -> {
        this.moviePersistenceService.updateGenre(value, key, contributionEntity.getMovie());
    });
    contribution.getElementsToUpdate().forEach((key, value) -> {
        this.moviePersistenceService.updateGenre(value, key, contributionEntity.getMovie());
    });
    contribution.getNewElementsToAdd()
            .forEach(genre -> {
                final Long id = this.moviePersistenceService.createGenre(genre, contributionEntity.getMovie());
                contributionEntity.getIdsToAdd().add(id);
            });

    contributionEntity.setSources(contribution.getSources());
    Optional.ofNullable(contribution.getComment()).ifPresent(contributionEntity::setUserComment);
}
项目:REST-Web-Services    文件:MoviePersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void updatePoster(
        @NotNull @Valid final ImageRequest poster,
        @Min(1) final Long posterId,
        @NotNull final MovieEntity movie
) {
    log.info("Called with poster {}, posterId {}, movie {}", poster, posterId, movie);

    final MoviePosterEntity moviePoster = this.entityManager.find(MoviePosterEntity.class, posterId);
    moviePoster.setIdInCloud(poster.getIdInCloud());
}
项目:dubbo2    文件:UserRestServiceImpl.java   
@Override
    public User getUser(@Min(value = 1L, message = "User ID must be greater than 1") @PathParam("id") Long id) {
        // test context injection
//        System.out.println("Client address from @Context injection: " + (request != null ? request.getRemoteAddr() : ""));
//        System.out.println("Client address from RpcContext: " + RpcContext.getContext().getRemoteAddressString());
        if (RpcContext.getContext().getRequest(HttpServletRequest.class) != null) {
            System.out.println("Client IP address from RpcContext: " + RpcContext.getContext().getRequest(HttpServletRequest.class).getRemoteAddr());
        }
        if (RpcContext.getContext().getResponse(HttpServletResponse.class) != null) {
            System.out.println("Response object from RpcContext: " + RpcContext.getContext().getResponse(HttpServletResponse.class));
        }
        return userService.getUser(id);
    }
项目:minijax    文件:MinijaxConstraintDescriptor.java   
private static MinijaxConstraintDescriptor<Min> buildMinValidator(final Min min, final Class<?> valueClass) {
    if ((valueClass.isPrimitive() && valueClass != boolean.class) || Number.class.isAssignableFrom(valueClass)) {
        return new MinijaxConstraintDescriptor<>(min, new MinValidator(min));
    }

    throw new ValidationException("Unsupported type for @Min annotation: " + valueClass);
}
项目:ServiceServer    文件:Seat.java   
@Column(name = "row", nullable = false)
@Min(1)
public Integer getRow() {
    return row;
}
项目:yum    文件:GlobalsettingsApi.java   
@ApiOperation(value = "", notes = "get holidays by year", response = Holidays.class, authorizations = {
    @Authorization(value = "Bearer")
}, tags={ "admin", })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "ok", response = Holidays.class),
    @ApiResponse(code = 500, message = "An unexpected error occured.", response = com.jrtechnologies.yum.api.model.Error.class) })

@RequestMapping(value = "/globalsettings/holidays/{year}",
    produces = { "application/json" }, 
    method = RequestMethod.GET)
@CrossOrigin
ResponseEntity<Holidays> globalsettingsHolidaysYearGet( @Min(2000) @Max(2100)@ApiParam(value = "",required=true ) @PathVariable("year") Integer year) throws ApiException;
项目:yum    文件:GlobalsettingsApi.java   
@ApiOperation(value = "", notes = "set holidays by year", response = Void.class, authorizations = {
    @Authorization(value = "Bearer")
}, tags={ "admin", })
@ApiResponses(value = { 
    @ApiResponse(code = 204, message = "holidays saved", response = Void.class),
    @ApiResponse(code = 400, message = "An unexpected error occured.", response = com.jrtechnologies.yum.api.model.Error.class),
    @ApiResponse(code = 409, message = "Concurrent modification error", response = Holidays.class),
    @ApiResponse(code = 500, message = "An unexpected error occured.", response = com.jrtechnologies.yum.api.model.Error.class) })

@RequestMapping(value = "/globalsettings/holidays/{year}",
    produces = { "application/json" }, 
    method = RequestMethod.POST)
@CrossOrigin
ResponseEntity<Object> globalsettingsHolidaysYearPost( @Min(2000) @Max(2100)@ApiParam(value = "",required=true ) @PathVariable("year") Integer year,@ApiParam(value = "The holidays to set" ,required=true )  @Valid @RequestBody Holidays holidays) throws ApiException;
项目:drift    文件:DriftClientConfig.java   
@Min(0L)
public int getMaxRetries()
{
    return maxRetries;
}
项目:minijax    文件:MinValidator.java   
public MinValidator(final Min min) {
    this.min = min;
}
项目:dubbocloud    文件:AnotherUserRestService.java   
@GET
@Path("{id : \\d+}")
User getUser(@PathParam("id") @Min(1L) Long id);
项目:dubbocloud    文件:UserRestService.java   
@GET
@Path("{id : ${symbol_escape}${symbol_escape}d+}")
public User getUser(@Min(value = 1L, message = "User ID must be greater than 1") @PathParam("id") Long id/*, @Context HttpServletRequest request*/);
项目:dubbox-hystrix    文件:UserRestService.java   
@GET
@Path("{id : \\d+}")
public User getUser(@Min(value=1L, message="User ID must be greater than 1") @PathParam("id") Long id/*, @Context HttpServletRequest request*/) ;
项目:REST-Web-Services    文件:MoviePersistenceServiceImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public void saveRating(
        @NotNull @Valid final Rate rate,
        @Min(1) final Long movieId,
        @NotBlank final String userId
) throws ResourceNotFoundException, ResourceConflictException {
    log.info("Called with rate {}, movieId {}, userId {}", rate, movieId, userId);

    final UserEntity user = this.findUser(userId);
    final MovieEntity movie = this.findMovie(movieId, DataStatus.ACCEPTED);

    final List<MovieReleaseDateEntity> releaseDates = movie.getReleaseDates();

    Lists.newArrayList(releaseDates).sort(Comparator.comparing(MovieReleaseDateEntity::getDate));

    if(!releaseDates.isEmpty()
            && new Date().before(releaseDates.iterator().next().getDate())) {
        throw new ResourceConflictException("The movie with id " + movieId + " had no premiere");
    }

    boolean rated = false;

    final List<MovieRateEntity> ratings = movie.getRatings();
    for(final MovieRateEntity mRate : ratings) {
        if(mRate.getUser().getUniqueId().equals(userId)) {
            mRate.setRate(rate.getRate());

            movie.setRating(this.calculationRating(ratings));

            rated = true;

            break;
        }
    }

    if(!rated) {
        final MovieRateEntity movieRate = new MovieRateEntity();
        movieRate.setRate(rate.getRate());
        movieRate.setMovie(movie);
        movieRate.setUser(user);

        movie.getRatings().add(movieRate);

        movie.setRating(this.calculationRating(movie.getRatings()));
    }
}
项目:dubbo2    文件:AnotherUserRestService.java   
@GET
@Path("{id : \\d+}")
User getUser(@PathParam("id") @Min(1L) Long id);
项目:beanvalidation    文件:ValidatorUtilTest.java   
@Test
public void testAssertViolatedWithViolationAnnotation() {
    testBean.setNumber(0);
    ValidationTestHelper.assertViolated(Min.class, testBean);
}
项目:beanvalidation    文件:ValidatorUtilTest.java   
@Test
public void testAssertViolatedWithViolationAnnotationAndProperty2() {
    testBean.setNumber(0);
    ValidationTestHelper.assertNotViolated(Min.class, testBean, "name");
}
项目:onboarding-service    文件:CreateUserCommand.java   
@Min(18)
@JsonIgnore
public int getAge() {
  return PersonalCode.getAge(personalCode);
}
项目:beanvalidation    文件:ValidatorUtilTest.java   
@Test(expected = AssertionError.class)
public void testAssertViolatedWithViolationAnnotationAndPropertyException() {
    testBean.setNumber(0);
    ValidationTestHelper.assertNotViolated(Min.class, testBean, "number");
}
项目:REST-Web-Services    文件:MovieContributionPersistenceService.java   
/**
 * Update the contribution status.
 *
 * @param contributionId The contribution ID
 * @param userId The user ID
 * @param status Status for the contribution
 * @param comment Comment for verification
 * @throws ResourceForbiddenException if no permissions
 * @throws ResourceNotFoundException if no contribution found or no user found
 */
void updateContributionStatus(
        @Min(1) final Long contributionId,
        @NotBlank final String userId,
        @NotNull final VerificationStatus status,
        final String comment
) throws ResourceForbiddenException, ResourceNotFoundException;
项目:REST-Web-Services    文件:MovieContributionSearchService.java   
/**
 * Search for contributions which match the given filter criteria. Null or empty parameters are ignored.
 *
 * @param id  The movie ID
 * @param field  The movie's field
 * @param status  The contribution's status
 * @param fromDate  Min date of the contribution
 * @param toDate  Max date of the contribution
 * @param page  The page to get
 * @return All the contributions matching the criteria
 * @throws ResourceNotFoundException if no movie found
 */
Page<ContributionSearchResult> findContributions(
        @Nullable @Min(1) final Long id,
        @Nullable final MovieField field,
        @Nullable final DataStatus status,
        @Nullable final Date fromDate,
        @Nullable final Date toDate,
        @NotNull final Pageable page
) throws ResourceNotFoundException;