From 1487affb8e29bc5e65fc1326e58f5517f41c45f7 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Wed, 20 Mar 2019 19:20:28 +0400 Subject: [PATCH] #73 fix deprecated annotations and classes --- .../java/ru/ulstu/configuration/ApplicationProperties.java | 3 ++- src/main/java/ru/ulstu/configuration/MvcConfiguration.java | 4 ++-- src/main/java/ru/ulstu/grant/model/Grant.java | 2 +- src/main/java/ru/ulstu/grant/model/GrantDto.java | 2 +- src/main/java/ru/ulstu/odin/model/OdinStringField.java | 2 +- src/main/java/ru/ulstu/paper/model/Paper.java | 2 +- src/main/java/ru/ulstu/paper/model/PaperDto.java | 2 +- src/main/java/ru/ulstu/project/model/Project.java | 2 +- src/main/java/ru/ulstu/project/model/ProjectDto.java | 2 +- src/main/java/ru/ulstu/timeline/model/Event.java | 2 +- src/main/java/ru/ulstu/timeline/model/EventDto.java | 2 +- src/main/java/ru/ulstu/user/model/UserResetPasswordDto.java | 2 +- src/main/java/ru/ulstu/user/service/UserService.java | 2 +- 13 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/ru/ulstu/configuration/ApplicationProperties.java b/src/main/java/ru/ulstu/configuration/ApplicationProperties.java index 8615cb2..339bcb7 100644 --- a/src/main/java/ru/ulstu/configuration/ApplicationProperties.java +++ b/src/main/java/ru/ulstu/configuration/ApplicationProperties.java @@ -1,10 +1,11 @@ package ru.ulstu.configuration; -import org.hibernate.validator.constraints.NotBlank; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.NotBlank; + @Component @ConfigurationProperties(prefix = "ng-tracker") @Validated diff --git a/src/main/java/ru/ulstu/configuration/MvcConfiguration.java b/src/main/java/ru/ulstu/configuration/MvcConfiguration.java index 3e8d66f..f9e887f 100644 --- a/src/main/java/ru/ulstu/configuration/MvcConfiguration.java +++ b/src/main/java/ru/ulstu/configuration/MvcConfiguration.java @@ -3,10 +3,10 @@ package ru.ulstu.configuration; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration -public class MvcConfiguration extends WebMvcConfigurerAdapter { +public class MvcConfiguration implements WebMvcConfigurer { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/{articlename:\\w+}"); diff --git a/src/main/java/ru/ulstu/grant/model/Grant.java b/src/main/java/ru/ulstu/grant/model/Grant.java index 685a1d5..09c2cdf 100644 --- a/src/main/java/ru/ulstu/grant/model/Grant.java +++ b/src/main/java/ru/ulstu/grant/model/Grant.java @@ -1,6 +1,5 @@ package ru.ulstu.grant.model; -import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.file.model.FileData; @@ -14,6 +13,7 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.Comparator; diff --git a/src/main/java/ru/ulstu/grant/model/GrantDto.java b/src/main/java/ru/ulstu/grant/model/GrantDto.java index fb29164..1d0a43c 100644 --- a/src/main/java/ru/ulstu/grant/model/GrantDto.java +++ b/src/main/java/ru/ulstu/grant/model/GrantDto.java @@ -2,10 +2,10 @@ package ru.ulstu.grant.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import org.hibernate.validator.constraints.NotEmpty; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.project.model.ProjectDto; +import javax.validation.constraints.NotEmpty; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/ru/ulstu/odin/model/OdinStringField.java b/src/main/java/ru/ulstu/odin/model/OdinStringField.java index 5157d7e..498b375 100644 --- a/src/main/java/ru/ulstu/odin/model/OdinStringField.java +++ b/src/main/java/ru/ulstu/odin/model/OdinStringField.java @@ -1,9 +1,9 @@ package ru.ulstu.odin.model; -import org.hibernate.validator.constraints.Email; import ru.ulstu.odin.model.annotation.OdinString; import ru.ulstu.odin.model.annotation.OdinString.OdinStringType; +import javax.validation.constraints.Email; import javax.validation.constraints.Size; import java.lang.reflect.Field; diff --git a/src/main/java/ru/ulstu/paper/model/Paper.java b/src/main/java/ru/ulstu/paper/model/Paper.java index c09fd28..685a901 100644 --- a/src/main/java/ru/ulstu/paper/model/Paper.java +++ b/src/main/java/ru/ulstu/paper/model/Paper.java @@ -2,7 +2,6 @@ package ru.ulstu.paper.model; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.core.model.UserContainer; import ru.ulstu.deadline.model.Deadline; @@ -22,6 +21,7 @@ import javax.persistence.OneToMany; import javax.persistence.OrderBy; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.validation.constraints.NotBlank; import java.util.ArrayList; import java.util.Comparator; import java.util.Date; diff --git a/src/main/java/ru/ulstu/paper/model/PaperDto.java b/src/main/java/ru/ulstu/paper/model/PaperDto.java index 3405768..c828381 100644 --- a/src/main/java/ru/ulstu/paper/model/PaperDto.java +++ b/src/main/java/ru/ulstu/paper/model/PaperDto.java @@ -3,10 +3,10 @@ package ru.ulstu.paper.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.StringUtils; -import org.hibernate.validator.constraints.NotEmpty; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.user.model.UserDto; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Size; import java.util.ArrayList; import java.util.Date; diff --git a/src/main/java/ru/ulstu/project/model/Project.java b/src/main/java/ru/ulstu/project/model/Project.java index 06722a1..896c53d 100644 --- a/src/main/java/ru/ulstu/project/model/Project.java +++ b/src/main/java/ru/ulstu/project/model/Project.java @@ -1,6 +1,5 @@ package ru.ulstu.project.model; -import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.deadline.model.Deadline; @@ -8,6 +7,7 @@ import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; +import javax.validation.constraints.NotBlank; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/ru/ulstu/project/model/ProjectDto.java b/src/main/java/ru/ulstu/project/model/ProjectDto.java index db7fc75..65f4365 100644 --- a/src/main/java/ru/ulstu/project/model/ProjectDto.java +++ b/src/main/java/ru/ulstu/project/model/ProjectDto.java @@ -2,9 +2,9 @@ package ru.ulstu.project.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import org.hibernate.validator.constraints.NotEmpty; import ru.ulstu.deadline.model.Deadline; +import javax.validation.constraints.NotEmpty; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/ru/ulstu/timeline/model/Event.java b/src/main/java/ru/ulstu/timeline/model/Event.java index 290f136..f64963d 100644 --- a/src/main/java/ru/ulstu/timeline/model/Event.java +++ b/src/main/java/ru/ulstu/timeline/model/Event.java @@ -1,6 +1,5 @@ package ru.ulstu.timeline.model; -import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.user.model.User; @@ -16,6 +15,7 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.util.Date; import java.util.List; diff --git a/src/main/java/ru/ulstu/timeline/model/EventDto.java b/src/main/java/ru/ulstu/timeline/model/EventDto.java index 9e70a9d..b053d36 100644 --- a/src/main/java/ru/ulstu/timeline/model/EventDto.java +++ b/src/main/java/ru/ulstu/timeline/model/EventDto.java @@ -2,9 +2,9 @@ package ru.ulstu.timeline.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.user.model.UserDto; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.util.Date; import java.util.List; diff --git a/src/main/java/ru/ulstu/user/model/UserResetPasswordDto.java b/src/main/java/ru/ulstu/user/model/UserResetPasswordDto.java index 33d84bc..6da2813 100644 --- a/src/main/java/ru/ulstu/user/model/UserResetPasswordDto.java +++ b/src/main/java/ru/ulstu/user/model/UserResetPasswordDto.java @@ -1,8 +1,8 @@ package ru.ulstu.user.model; -import org.hibernate.validator.constraints.NotEmpty; import ru.ulstu.configuration.Constants; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Size; import java.util.Objects; diff --git a/src/main/java/ru/ulstu/user/service/UserService.java b/src/main/java/ru/ulstu/user/service/UserService.java index e318401..198ffcd 100644 --- a/src/main/java/ru/ulstu/user/service/UserService.java +++ b/src/main/java/ru/ulstu/user/service/UserService.java @@ -94,7 +94,7 @@ public class UserService implements UserDetailsService { @Transactional(readOnly = true) public PageableItems getAllUsers(int offset, int count) { - final Page page = userRepository.findAll(new OffsetablePageRequest(offset, count, new Sort("id"))); + final Page page = userRepository.findAll(new OffsetablePageRequest(offset, count, Sort.by("id"))); return new PageableItems<>(page.getTotalElements(), userMapper.userEntitiesToUserListDtos(page.getContent())); }