/**
* {@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());
}
java类javax.validation.constraints.Min的实例源码
MoviePersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 40
收藏 0
点赞 0
评论 0
MoviePersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 34
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MoviePersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 33
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MoviePersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 91
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MoviePersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 31
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MoviePersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 30
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MoviePersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 26
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MovieSearchServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 35
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MovieSearchServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 27
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MinMaxAnnotationPostProcessor.java 文件源码
项目:randomito-all
阅读 26
收藏 0
点赞 0
评论 0
@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;
}
UserRestServiceImpl.java 文件源码
项目:dubbox-hystrix
阅读 21
收藏 0
点赞 0
评论 0
@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);
}
MovieSearchServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 33
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MovieSearchServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 32
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MovieSearchServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 30
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MovieSearchServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 30
收藏 0
点赞 0
评论 0
/**
* {@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());
}
MovieContributionPersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 26
收藏 0
点赞 0
评论 0
/**
* {@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);
}
}
UserRestServiceImpl.java 文件源码
项目:dubbocloud
阅读 24
收藏 0
点赞 0
评论 0
@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);
}
MovieContributionPersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 26
收藏 0
点赞 0
评论 0
/**
* {@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);
}
UserRestServiceImpl.java 文件源码
项目:dubbox-hystrix
阅读 20
收藏 0
点赞 0
评论 0
@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);
}
MovieContributionPersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 27
收藏 0
点赞 0
评论 0
/**
* {@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);
}
MovieContributionPersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 27
收藏 0
点赞 0
评论 0
/**
* {@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);
}
MoviePersistenceServiceImpl.java 文件源码
项目:REST-Web-Services
阅读 29
收藏 0
点赞 0
评论 0
/**
* {@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());
}
UserRestServiceImpl.java 文件源码
项目:dubbo2
阅读 19
收藏 0
点赞 0
评论 0
@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);
}
MinijaxConstraintDescriptor.java 文件源码
项目:minijax
阅读 26
收藏 0
点赞 0
评论 0
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);
}
Seat.java 文件源码
项目:ServiceServer
阅读 20
收藏 0
点赞 0
评论 0
@Column(name = "row", nullable = false)
@Min(1)
public Integer getRow() {
return row;
}
GlobalsettingsApi.java 文件源码
项目:yum
阅读 25
收藏 0
点赞 0
评论 0
@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;
GlobalsettingsApi.java 文件源码
项目:yum
阅读 26
收藏 0
点赞 0
评论 0
@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;
DriftClientConfig.java 文件源码
项目:drift
阅读 21
收藏 0
点赞 0
评论 0
@Min(0L)
public int getMaxRetries()
{
return maxRetries;
}
MinValidator.java 文件源码
项目:minijax
阅读 16
收藏 0
点赞 0
评论 0
public MinValidator(final Min min) {
this.min = min;
}
AnotherUserRestService.java 文件源码
项目:dubbocloud
阅读 24
收藏 0
点赞 0
评论 0
@GET
@Path("{id : \\d+}")
User getUser(@PathParam("id") @Min(1L) Long id);