#247 -- Fix jpa mapping, update springdoc

This commit is contained in:
Anton Romanov 2024-05-02 11:53:38 +04:00
parent 23797bae9e
commit a9e8336986
65 changed files with 470 additions and 686 deletions

View File

@ -83,9 +83,10 @@ dependencies {
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-dialect'
implementation group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-springsecurity6'
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-afterburner'
@ -95,7 +96,7 @@ dependencies {
implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
implementation group: 'org.liquibase', name: 'liquibase-core', version: '3.6.3'
implementation group: 'org.liquibase', name: 'liquibase-core', version: '4.27.0'
implementation group: 'com.mattbertolini', name: 'liquibase-slf4j', version: '2.0.0'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
@ -106,8 +107,7 @@ dependencies {
implementation group: 'org.webjars.npm', name: 'jquery.easing', version: '1.4.1'
implementation group: 'org.webjars', name: 'font-awesome', version: '4.7.0'
implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.6.0'
implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.6.0'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.8.0'
implementation group: 'net.sourceforge.htmlunit', name: 'htmlunit', version: '2.35.0'
implementation group: 'xalan', name: 'xalan', version: '2.7.2'

View File

@ -1,6 +1,8 @@
package ru.ulstu.conference.controller;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.Errors;
@ -14,9 +16,7 @@ import ru.ulstu.conference.model.ConferenceFilterDto;
import ru.ulstu.conference.model.ConferenceUser;
import ru.ulstu.conference.service.ConferenceService;
import ru.ulstu.user.model.User;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
@ -29,7 +29,7 @@ import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
@Controller()
@RequestMapping(value = "/conferences")
@ApiIgnore
@Hidden
public class ConferenceController {
private final ConferenceService conferenceService;

View File

@ -1,5 +1,17 @@
package ru.ulstu.conference.model;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OrderBy;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.validation.constraints.NotBlank;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.springframework.format.annotation.DateTimeFormat;
@ -11,18 +23,6 @@ import ru.ulstu.paper.model.Paper;
import ru.ulstu.timeline.model.Event;
import ru.ulstu.user.model.User;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
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;

View File

@ -2,16 +2,16 @@ package ru.ulstu.conference.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import org.springframework.format.annotation.DateTimeFormat;
import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.name.NameContainer;
import ru.ulstu.paper.model.Paper;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

View File

@ -2,18 +2,17 @@ package ru.ulstu.conference.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.user.model.User;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "users_conference")
public class ConferenceUser extends BaseEntity {
@ -70,7 +69,6 @@ public class ConferenceUser extends BaseEntity {
public ConferenceUser(User user) {
this.user = user;
this.deposit = Deposit.REPORT;
this.participation = Participation.INTRAMURAL;
}
@JsonCreator

View File

@ -13,7 +13,7 @@ import java.util.List;
public interface ConferenceRepository extends JpaRepository<Conference, Integer>, BaseRepository {
@Query("SELECT c FROM Conference c LEFT JOIN c.users u WHERE (:user IS NULL OR u.user = :user) " +
"AND (YEAR(c.beginDate) = :year OR :year IS NULL) ORDER BY begin_date DESC")
"AND (YEAR(c.beginDate) = :year OR :year IS NULL) ORDER BY c.beginDate DESC")
List<Conference> findByUserAndYear(@Param("user") User user, @Param("year") Integer year);
@Query("SELECT c FROM Conference c WHERE c.beginDate > :date")

View File

@ -1,6 +1,5 @@
package ru.ulstu.conference.service;
import com.google.common.collect.ImmutableMap;
import org.springframework.stereotype.Service;
import ru.ulstu.conference.model.Conference;
import ru.ulstu.core.util.DateUtils;
@ -57,22 +56,22 @@ public class ConferenceNotificationService {
}
private void sendMessageDeadline(Conference conference) {
Map<String, Object> variables = ImmutableMap.of("conference", conference);
Map<String, Object> variables = Map.of("conference", conference);
sendForAllParticipants(variables, conference, TEMPLATE_DEADLINE, String.format(TITLE_DEADLINE, conference.getTitle()));
}
public void sendCreateNotification(Conference conference) {
Map<String, Object> variables = ImmutableMap.of("conference", conference);
Map<String, Object> variables = Map.of("conference", conference);
sendForAllUsers(variables, String.format(TITLE_CREATE, conference.getTitle()));
}
public void updateDeadlineNotification(Conference conference) {
Map<String, Object> variables = ImmutableMap.of("conference", conference);
Map<String, Object> variables = Map.of("conference", conference);
sendForAllParticipants(variables, conference, TEMPLATE_UPDATE_DEADLINES, String.format(TITLE_UPDATE_DEADLINES, conference.getTitle()));
}
public void updateConferencesDatesNotification(Conference conference, Date oldBeginDate, Date oldEndDate) {
Map<String, Object> variables = ImmutableMap.of("conference", conference, "oldBeginDate", oldBeginDate, "oldEndDate", oldEndDate);
Map<String, Object> variables = Map.of("conference", conference, "oldBeginDate", oldBeginDate, "oldEndDate", oldEndDate);
sendForAllParticipants(variables, conference, TEMPLATE_UPDATE_DATES, String.format(TITLE_UPDATE_DATES, conference.getTitle()));
}
@ -107,7 +106,7 @@ public class ConferenceNotificationService {
}
private void sendMessagePing(Conference conference) {
Map<String, Object> variables = ImmutableMap.of("conference", conference);
Map<String, Object> variables = Map.of("conference", conference);
sendForAllParticipants(variables, conference, TEMPLATE_PING, String.format(TITLE_PING, conference.getTitle()));
}
}

View File

@ -81,7 +81,7 @@ public class ConferenceService extends BaseService {
public List<Conference> findAll() {
return conferenceRepository.findAll(new Sort(Sort.Direction.DESC, "beginDate"));
return conferenceRepository.findAll(Sort.by(Sort.Direction.DESC, "beginDate"));
}
public List<ConferenceDto> findAllDto() {

View File

@ -1,11 +1,10 @@
package ru.ulstu.configuration;
import jakarta.validation.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

View File

@ -1,10 +1,10 @@
package ru.ulstu.configuration;
import nz.net.ultraq.thymeleaf.LayoutDialect;
import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.extras.springsecurity6.dialect.SpringSecurityDialect;
import org.thymeleaf.spring6.SpringTemplateEngine;
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
import org.thymeleaf.templateresolver.ITemplateResolver;

View File

@ -9,22 +9,12 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.oauth2.client.CommonOAuth2Provider;
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.oauth2.client.endpoint.DefaultAuthorizationCodeTokenResponseClient;
import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient;
import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest;
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository;
import org.springframework.security.oauth2.client.web.AuthorizationRequestRepository;
import org.springframework.security.oauth2.client.web.HttpSessionOAuth2AuthorizationRequestRepository;
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
@ -33,18 +23,10 @@ import ru.ulstu.user.controller.UserController;
import ru.ulstu.user.model.UserRoleConstants;
import ru.ulstu.user.service.UserService;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
public class SecurityConfiguration {
private final Logger log = LoggerFactory.getLogger(SecurityConfiguration.class);
private static List<String> clients = Arrays.asList("google");
private static final String CLIENT_PROPERTY_KEY
= "spring.security.oauth2.client.registration.";
@Autowired
private Environment env;
@ -75,104 +57,60 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
this.authenticationFailureHandler = authenticationFailureHandler;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.csrf(AbstractHttpConfigurer::disable);
if (applicationProperties.isDevMode()) {
log.debug("Security disabled");
http.authorizeRequests()
http.authorizeHttpRequests((authz) -> authz
.anyRequest()
.permitAll();
http.anonymous()
.permitAll()
);
http.anonymous((anonymousCustomizer) -> anonymousCustomizer
.principal("admin")
.authorities(UserRoleConstants.ADMIN);
.authorities(UserRoleConstants.ADMIN)
);
} else {
log.debug("Security enabled");
http.authorizeRequests()
.antMatchers(UserController.ACTIVATE_URL).permitAll()
.antMatchers(Constants.PASSWORD_RESET_REQUEST_PAGE).permitAll()
.antMatchers(Constants.PASSWORD_RESET_PAGE).permitAll()
.antMatchers("/users/block").permitAll()
.antMatchers(UserController.URL + UserController.REGISTER_URL).permitAll()
.antMatchers(UserController.URL + UserController.ACTIVATE_URL).permitAll()
.antMatchers(UserController.URL + UserController.PASSWORD_RESET_REQUEST_URL).permitAll()
.antMatchers(UserController.URL + UserController.PASSWORD_RESET_URL).permitAll()
.antMatchers("/swagger-ui.html").hasAuthority(UserRoleConstants.ADMIN)
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.successHandler(authenticationSuccessHandler)
.failureHandler(authenticationFailureHandler)
.permitAll()
.and()
.logout()
.logoutSuccessHandler(logoutSuccessHandler)
.logoutSuccessUrl(Constants.LOGOUT_URL)
.invalidateHttpSession(false)
.clearAuthentication(true)
.deleteCookies(Constants.COOKIES_NAME)
.permitAll();
http.csrf().disable();
}
if (applicationProperties.isUseHttps()) {
http.portMapper()
.http(httpPort)
.mapsTo(httpsPort)
.and()
.requiresChannel()
.anyRequest()
.requiresSecure();
http.authorizeHttpRequests((authz) -> authz
.requestMatchers(UserController.ACTIVATE_URL).permitAll()
.requestMatchers(Constants.PASSWORD_RESET_REQUEST_PAGE).permitAll()
.requestMatchers(Constants.PASSWORD_RESET_PAGE).permitAll()
.requestMatchers("/users/block").permitAll()
.requestMatchers(UserController.URL + UserController.REGISTER_URL).permitAll()
.requestMatchers(UserController.URL + UserController.ACTIVATE_URL).permitAll()
.requestMatchers(UserController.URL + UserController.PASSWORD_RESET_REQUEST_URL).permitAll()
.requestMatchers(UserController.URL + UserController.PASSWORD_RESET_URL).permitAll()
.requestMatchers("/swagger-ui.html").hasAuthority(UserRoleConstants.ADMIN)
.anyRequest().authenticated())
.formLogin((formLoginCustomizer) -> formLoginCustomizer
.loginPage("/login")
.successHandler(authenticationSuccessHandler)
.failureHandler(authenticationFailureHandler)
.permitAll()
)
.logout((logoutCustomizer) -> logoutCustomizer
.logoutSuccessHandler(logoutSuccessHandler)
.logoutSuccessUrl(Constants.LOGOUT_URL)
.invalidateHttpSession(false)
.clearAuthentication(true)
.deleteCookies(Constants.COOKIES_NAME)
.permitAll()
);
http.csrf(AbstractHttpConfigurer::disable);
}
return http.build();
}
@Bean
public AuthorizationRequestRepository<OAuth2AuthorizationRequest> authorizationRequestRepository() {
return new HttpSessionOAuth2AuthorizationRequestRepository();
}
@Bean
public OAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient() {
DefaultAuthorizationCodeTokenResponseClient accessTokenResponseClient = new DefaultAuthorizationCodeTokenResponseClient();
return accessTokenResponseClient;
}
//@Bean
public ClientRegistrationRepository clientRegistrationRepository() {
List<ClientRegistration> registrations = clients.stream()
.map(c -> getRegistration(c))
.filter(registration -> registration != null)
.collect(Collectors.toList());
return new InMemoryClientRegistrationRepository(registrations);
}
private ClientRegistration getRegistration(String client) {
String clientId = env.getProperty(CLIENT_PROPERTY_KEY + client + ".client-id");
if (clientId == null) {
return null;
}
String clientSecret = env.getProperty(CLIENT_PROPERTY_KEY + client + ".client-secret");
if (client.equals("google")) {
return CommonOAuth2Provider.GOOGLE.getBuilder(client)
.clientId(clientId)
.clientSecret(clientSecret)
.build();
}
return null;
}
@Override
public void configure(WebSecurity web) {
web.ignoring()
.antMatchers("/css/**")
.antMatchers("/javax.faces.resource/**")
.antMatchers("/js/**")
.antMatchers("/templates/**")
.antMatchers("/webjars/**")
.antMatchers("/img/**");
public WebSecurityCustomizer webSecurityCustomizer() {
return (web) -> web.ignoring()
.requestMatchers("/css/**",
"/javax.faces.resource/**",
"/js/**",
"/templates/**",
"/webjars/**",
"/img/**");
}
@Autowired

View File

@ -1,23 +0,0 @@
package ru.ulstu.configuration;
import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket swaggerApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(Predicates.not(PathSelectors.regex("/error")))
.build();
}
}

View File

@ -15,7 +15,7 @@ public class OffsetablePageRequest implements Pageable, Serializable {
}
public OffsetablePageRequest(long offset, int count, Sort.Direction direction, String... properties) {
this(offset, count, new Sort(direction, properties));
this(offset, count, Sort.by(direction, properties));
}
public OffsetablePageRequest(long offset, int count, Sort sort) {
@ -30,6 +30,12 @@ public class OffsetablePageRequest implements Pageable, Serializable {
this.sort = sort;
}
@Override
public Pageable withPage(int pageNumber) {
//TODO
return null;
}
@Override
public Sort getSort() {
return sort;

View File

@ -1,12 +1,12 @@
package ru.ulstu.core.model;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Component;
import ru.ulstu.user.error.UserBlockedException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component

View File

@ -1,11 +1,12 @@
package ru.ulstu.core.model;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.Version;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
@MappedSuperclass

View File

@ -1,9 +1,9 @@
package ru.ulstu.core.repository;
import jakarta.persistence.EntityManager;
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import javax.persistence.EntityManager;
import java.io.Serializable;
public class JpaDetachableRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID>

View File

@ -2,15 +2,15 @@ package ru.ulstu.deadline.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;
import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.user.model.User;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;
import java.util.List;
import java.util.Objects;

View File

@ -1,10 +1,10 @@
package ru.ulstu.file.model;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import ru.ulstu.core.model.BaseEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity

View File

@ -1,5 +1,7 @@
package ru.ulstu.grant.controller;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.Errors;
@ -16,9 +18,7 @@ import ru.ulstu.grant.model.GrantDto;
import ru.ulstu.grant.service.GrantService;
import ru.ulstu.paper.model.PaperDto;
import ru.ulstu.user.model.User;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
@ -29,7 +29,7 @@ import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
@Controller()
@RequestMapping(value = "/grants")
@ApiIgnore
@Hidden
public class GrantController {
private final GrantService grantService;

View File

@ -1,5 +1,20 @@
package ru.ulstu.grant.model;
import jakarta.persistence.CascadeType;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OrderBy;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import ru.ulstu.core.model.BaseEntity;
@ -12,21 +27,6 @@ import ru.ulstu.project.model.Project;
import ru.ulstu.timeline.model.Event;
import ru.ulstu.user.model.User;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

View File

@ -2,6 +2,7 @@ package ru.ulstu.grant.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotEmpty;
import org.apache.commons.lang3.StringUtils;
import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.file.model.FileDataDto;
@ -10,7 +11,6 @@ import ru.ulstu.paper.model.PaperDto;
import ru.ulstu.project.model.ProjectDto;
import ru.ulstu.user.model.UserDto;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

View File

@ -1,6 +1,5 @@
package ru.ulstu.grant.service;
import com.google.common.collect.ImmutableMap;
import org.springframework.stereotype.Service;
import ru.ulstu.core.util.DateUtils;
import ru.ulstu.grant.model.Grant;
@ -46,22 +45,22 @@ public class GrantNotificationService {
}
private void sendMessageDeadline(Grant grant) {
Map<String, Object> variables = ImmutableMap.of("grant", grant);
Map<String, Object> variables = Map.of("grant", grant);
sendForAllAuthors(variables, grant, TEMPLATE_DEADLINE, String.format(TITLE_DEADLINE, grant.getTitle()));
}
public void sendCreateNotification(Grant grant) {
Map<String, Object> variables = ImmutableMap.of("grant", grant);
Map<String, Object> variables = Map.of("grant", grant);
sendForAllAuthors(variables, grant, TEMPLATE_CREATE, String.format(TITLE_CREATE, grant.getTitle()));
}
public void sendAuthorsChangeNotification(Grant grant, Set<User> oldAuthors) {
Map<String, Object> variables = ImmutableMap.of("grant", grant, "oldAuthors", oldAuthors);
Map<String, Object> variables = Map.of("grant", grant, "oldAuthors", oldAuthors);
sendForAllAuthors(variables, grant, TEMPLATE_AUTHORS_CHANGED, String.format(TITLE_AUTHORS_CHANGED, grant.getTitle()));
}
public void sendLeaderChangeNotification(Grant grant, User oldLeader) {
Map<String, Object> variables = ImmutableMap.of("grant", grant, "oldLeader", oldLeader);
Map<String, Object> variables = Map.of("grant", grant, "oldLeader", oldLeader);
sendForAllAuthors(variables, grant, TEMPLATE_LEADER_CHANGED, String.format(TITLE_LEADER_CHANGED, grant.getTitle()));
}

View File

@ -1,16 +1,16 @@
package ru.ulstu.index.controller;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import ru.ulstu.core.controller.AdviceController;
import ru.ulstu.user.service.UserService;
import springfox.documentation.annotations.ApiIgnore;
@Controller()
@RequestMapping(value = "/index")
@ApiIgnore
@Hidden
public class IndexController extends AdviceController {
public IndexController(UserService userService) {
super(userService);

View File

@ -1,14 +1,14 @@
package ru.ulstu.odin.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import ru.ulstu.core.error.OdinException;
import ru.ulstu.odin.model.annotation.OdinCaption;
import ru.ulstu.odin.model.annotation.OdinReadOnly;
import ru.ulstu.odin.model.annotation.OdinVisible;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;

View File

@ -1,10 +1,10 @@
package ru.ulstu.odin.model;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Size;
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;
import static ru.ulstu.odin.model.annotation.OdinString.OdinStringType.EMAIL;

View File

@ -1,5 +1,7 @@
package ru.ulstu.paper.controller;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.validation.Valid;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -21,9 +23,7 @@ import ru.ulstu.paper.model.ReferenceDto;
import ru.ulstu.paper.service.LatexService;
import ru.ulstu.paper.service.PaperService;
import ru.ulstu.user.model.User;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
@ -37,7 +37,7 @@ import static org.springframework.util.StringUtils.isEmpty;
@Controller()
@RequestMapping(value = "/papers")
@ApiIgnore
@Hidden
public class PaperController {
private final PaperService paperService;
private final ConferenceService conferenceService;

View File

@ -1,5 +1,6 @@
package ru.ulstu.paper.controller;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -16,7 +17,6 @@ import ru.ulstu.paper.model.PaperListDto;
import ru.ulstu.paper.model.ReferenceDto;
import ru.ulstu.paper.service.PaperService;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;

View File

@ -1,5 +1,20 @@
package ru.ulstu.paper.model;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OrderBy;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.validation.constraints.NotBlank;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import ru.ulstu.conference.model.Conference;
@ -12,21 +27,6 @@ import ru.ulstu.grant.model.Grant;
import ru.ulstu.timeline.model.Event;
import ru.ulstu.user.model.User;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
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;

View File

@ -2,14 +2,14 @@ package ru.ulstu.paper.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.StringUtils;
import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.file.model.FileDataDto;
import ru.ulstu.user.model.UserDto;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

View File

@ -1,12 +1,11 @@
package ru.ulstu.paper.model;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import ru.ulstu.core.model.BaseEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
@Entity
public class Reference extends BaseEntity {

View File

@ -1,6 +1,5 @@
package ru.ulstu.paper.service;
import com.google.common.collect.ImmutableMap;
import org.springframework.stereotype.Service;
import ru.ulstu.core.util.DateUtils;
import ru.ulstu.paper.model.Paper;
@ -46,22 +45,22 @@ public class PaperNotificationService {
}
private void sendMessageDeadline(Paper paper) {
Map<String, Object> variables = ImmutableMap.of("paper", paper);
Map<String, Object> variables = Map.of("paper", paper);
sendForAllAuhtors(variables, paper, TEMPLATE_DEADLINE, TITLE_DEADLINE);
}
public void sendCreateNotification(Paper paper) {
Map<String, Object> variables = ImmutableMap.of("paper", paper);
Map<String, Object> variables = Map.of("paper", paper);
sendForAllAuhtors(variables, paper, TEMPLATE_CREATE, TITLE_CREATE);
}
public void statusChangeNotification(Paper paper, Paper.PaperStatus oldStatus) {
Map<String, Object> variables = ImmutableMap.of("paper", paper, "oldStatus", oldStatus);
Map<String, Object> variables = Map.of("paper", paper, "oldStatus", oldStatus);
sendForAllAuhtors(variables, paper, TEMPLATE_STATUS_CHANGED, TITLE_STATUS_CHANGED);
}
public void sendFailedNotification(Paper paper, Paper.PaperStatus oldStatus) {
Map<String, Object> variables = ImmutableMap.of("paper", paper, "oldStatus", oldStatus);
Map<String, Object> variables = Map.of("paper", paper, "oldStatus", oldStatus);
sendForAllAuhtors(variables, paper, TEMPLATE_FAILED, TITLE_FAILED);
}

View File

@ -1,8 +1,17 @@
package ru.ulstu.ping.model;
import jakarta.persistence.Column;
import jakarta.persistence.DiscriminatorType;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import org.hibernate.annotations.Any;
import org.hibernate.annotations.AnyMetaDef;
import org.hibernate.annotations.MetaValue;
import org.hibernate.annotations.AnyDiscriminator;
import org.hibernate.annotations.AnyDiscriminatorValue;
import org.hibernate.annotations.AnyKeyJavaClass;
import org.springframework.format.annotation.DateTimeFormat;
import ru.ulstu.conference.model.Conference;
import ru.ulstu.core.model.BaseEntity;
@ -12,14 +21,6 @@ import ru.ulstu.paper.model.Paper;
import ru.ulstu.project.model.Project;
import ru.ulstu.user.model.User;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;
@Entity
@ -36,20 +37,15 @@ public class Ping extends BaseEntity {
@Column(name = "activity_type", insertable = false, updatable = false)
private String activityType;
@Any(
metaColumn = @Column(name = "activity_type"),
fetch = FetchType.LAZY
)
@AnyMetaDef(
idType = "integer", metaType = "string",
metaValues = {
@MetaValue(targetEntity = Conference.class, value = "CONFERENCE"),
@MetaValue(targetEntity = Paper.class, value = "PAPER"),
@MetaValue(targetEntity = Project.class, value = "PROJECT"),
@MetaValue(targetEntity = Grant.class, value = "GRANT")
}
)
@Any
@AnyDiscriminator(DiscriminatorType.STRING)
@AnyKeyJavaClass(Integer.class)
@JoinColumn(name = "activity_id")
@Column(name = "activity_type")
@AnyDiscriminatorValue(entity = Conference.class, discriminator = "CONFERENCE")
@AnyDiscriminatorValue(entity = Paper.class, discriminator = "PAPER")
@AnyDiscriminatorValue(entity = Project.class, discriminator = "PROJECT")
@AnyDiscriminatorValue(entity = Grant.class, discriminator = "GRANT")
private UserActivity activity;
public Ping() {

View File

@ -1,6 +1,5 @@
package ru.ulstu.ping.service;
import com.google.common.collect.ImmutableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
@ -15,6 +14,7 @@ import ru.ulstu.user.service.MailService;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Service
@ -51,7 +51,7 @@ public class PingScheduler {
}
for (PingInfo pingInfo : pingInfos) {
mailService.sendEmailFromTemplate(ImmutableMap.of("pings", pingInfo.getPings()),
mailService.sendEmailFromTemplate(Map.of("pings", pingInfo.getPings()),
pingInfo.getUser(), "pingsInfoWeekEmail", PING_MAIL_SUBJECT);
}
}

View File

@ -28,7 +28,7 @@ public class PingService {
@Transactional
public Ping addPing(UserActivity activity) throws IOException {
Ping newPing = new Ping(new Date(), userService.getCurrentUser());
newPing.setActivity(activity);
//newPing.setActivity(activity);
return pingRepository.save(newPing);
}

View File

@ -1,5 +1,7 @@
package ru.ulstu.project.controller;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.Errors;
@ -16,9 +18,7 @@ import ru.ulstu.project.model.Project;
import ru.ulstu.project.model.ProjectDto;
import ru.ulstu.project.service.ProjectService;
import ru.ulstu.user.model.User;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
@ -27,7 +27,7 @@ import static org.springframework.util.StringUtils.isEmpty;
@Controller()
@RequestMapping(value = "/projects")
@ApiIgnore
@Hidden
public class ProjectController {
private final ProjectService projectService;

View File

@ -1,5 +1,18 @@
package ru.ulstu.project.model;
import jakarta.persistence.CascadeType;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import ru.ulstu.core.model.BaseEntity;
@ -11,19 +24,6 @@ import ru.ulstu.grant.model.Grant;
import ru.ulstu.timeline.model.Event;
import ru.ulstu.user.model.User;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;

View File

@ -2,6 +2,7 @@ package ru.ulstu.project.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotEmpty;
import org.thymeleaf.util.StringUtils;
import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.file.model.FileDataDto;
@ -9,7 +10,6 @@ import ru.ulstu.grant.model.GrantDto;
import ru.ulstu.user.model.User;
import ru.ulstu.user.model.UserDto;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

View File

@ -1,5 +1,7 @@
package ru.ulstu.students.controller;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.Errors;
@ -15,9 +17,7 @@ import ru.ulstu.students.model.TaskDto;
import ru.ulstu.students.model.TaskFilterDto;
import ru.ulstu.students.service.TaskService;
import ru.ulstu.tags.model.Tag;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
@ -29,7 +29,7 @@ import static ru.ulstu.students.controller.Navigation.TASK_PAGE;
@Controller()
@RequestMapping(value = "/students")
@ApiIgnore
@Hidden
public class TaskController {
private final TaskService taskService;

View File

@ -1,14 +1,14 @@
package ru.ulstu.students.model;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;
import ru.ulstu.core.model.BaseEntity;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;
@Entity

View File

@ -1,5 +1,19 @@
package ru.ulstu.students.model;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OrderBy;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.validation.constraints.NotBlank;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import ru.ulstu.core.model.BaseEntity;
@ -9,20 +23,6 @@ import ru.ulstu.tags.model.Tag;
import ru.ulstu.timeline.model.Event;
import ru.ulstu.user.model.User;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
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.Collections;
import java.util.Date;

View File

@ -2,11 +2,11 @@ package ru.ulstu.students.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotEmpty;
import org.apache.commons.lang3.StringUtils;
import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.tags.model.Tag;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

View File

@ -11,16 +11,16 @@ import java.util.List;
public interface TaskRepository extends JpaRepository<Task, Integer> {
@Query("SELECT t FROM Task t WHERE (t.status = :status OR :status IS NULL) AND (:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY create_date DESC")
@Query("SELECT t FROM Task t WHERE (t.status = :status OR :status IS NULL) AND (:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY t.createDate DESC")
List<Task> filterNew(@Param("status") Task.TaskStatus status, @Param("tag") Tag tag);
@Query("SELECT t FROM Task t WHERE (t.status = :status OR :status IS NULL) AND (:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY create_date ASC")
@Query("SELECT t FROM Task t WHERE (t.status = :status OR :status IS NULL) AND (:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY t.createDate ASC")
List<Task> filterOld(@Param("status") Task.TaskStatus status, @Param("tag") Tag tag);
@Query("SELECT t FROM Task t WHERE(:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY create_date DESC")
@Query("SELECT t FROM Task t WHERE(:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY t.createDate DESC")
List<Task> findByTag(@Param("tag") Tag tag);
@Query("SELECT t FROM Task t WHERE (t.createDate >= :date) ORDER BY create_date DESC")
@Query("SELECT t FROM Task t WHERE (t.createDate >= :date) ORDER BY t.createDate DESC")
List<Task> findAllYear(@Param("date") Date date);

View File

@ -55,7 +55,7 @@ public class TaskService {
}
public List<Task> findAll() {
return taskRepository.findAll(new Sort(Sort.Direction.DESC, "createDate"));
return taskRepository.findAll(Sort.by(Sort.Direction.DESC, "createDate"));
}
public List<TaskDto> findAllDto() {

View File

@ -2,13 +2,13 @@ package ru.ulstu.tags.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import ru.ulstu.core.model.BaseEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.Objects;
@Entity

View File

@ -1,5 +1,6 @@
package ru.ulstu.timeline.controller;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -13,7 +14,6 @@ import ru.ulstu.core.model.response.Response;
import ru.ulstu.timeline.model.EventDto;
import ru.ulstu.timeline.service.EventService;
import javax.validation.Valid;
import java.util.List;
@RestController

View File

@ -1,5 +1,19 @@
package ru.ulstu.timeline.model;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import ru.ulstu.conference.model.Conference;
import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.grant.model.Grant;
@ -8,20 +22,6 @@ import ru.ulstu.project.model.Project;
import ru.ulstu.students.model.Task;
import ru.ulstu.user.model.User;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
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.ArrayList;
import java.util.Date;
import java.util.List;

View File

@ -2,6 +2,8 @@ package ru.ulstu.timeline.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import ru.ulstu.conference.model.ConferenceDto;
import ru.ulstu.grant.model.GrantDto;
import ru.ulstu.paper.model.PaperDto;
@ -9,8 +11,6 @@ import ru.ulstu.project.model.ProjectDto;
import ru.ulstu.students.model.TaskDto;
import ru.ulstu.user.model.UserDto;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

View File

@ -1,11 +1,11 @@
package ru.ulstu.timeline.model;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import ru.ulstu.core.model.BaseEntity;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,6 +1,5 @@
package ru.ulstu.timeline.service;
import com.google.common.collect.ImmutableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
@ -31,7 +30,7 @@ public class EventScheduler {
public void sendNotifications() {
List<Event> events = eventService.findByCurrentDate();
events.forEach(event -> {
Map<String, Object> variables = ImmutableMap.of("description", event.getDescription());
Map<String, Object> variables = Map.of("description", event.getDescription());
event.getRecipients()
.forEach(recipient -> mailService.sendEmailFromTemplate(variables, recipient, "eventNotification", event.getTitle()));
if (event.getPeriod() == null) {

View File

@ -1,9 +1,8 @@
package ru.ulstu.user.component;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
final class IpAddressResolver {
private static final String CLIENT_IP_HEADER = "Client-IP";
private static final String FORWARDED_FOR_HEADER = "X-Forwarded-For";

View File

@ -1,5 +1,9 @@
package ru.ulstu.user.component;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
@ -9,10 +13,6 @@ import org.springframework.stereotype.Component;
import ru.ulstu.configuration.Constants;
import ru.ulstu.user.service.UserSessionService;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@Component

View File

@ -1,5 +1,9 @@
package ru.ulstu.user.component;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
@ -9,10 +13,6 @@ import org.springframework.stereotype.Component;
import ru.ulstu.configuration.Constants;
import ru.ulstu.user.service.UserSessionService;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@Component

View File

@ -1,5 +1,8 @@
package ru.ulstu.user.controller;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.annotation.Secured;
@ -29,9 +32,6 @@ import ru.ulstu.user.model.UserSessionListDto;
import ru.ulstu.user.service.UserService;
import ru.ulstu.user.service.UserSessionService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import java.util.Map;
import static ru.ulstu.user.controller.UserController.URL;

View File

@ -1,6 +1,7 @@
package ru.ulstu.user.controller;
import com.google.common.collect.ImmutableMap;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
@ -17,8 +18,6 @@ import ru.ulstu.user.model.UserListDto;
import ru.ulstu.user.service.UserService;
import ru.ulstu.user.service.UserSessionService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;
@ -65,7 +64,7 @@ public class UserMvcController extends OdinController<UserListDto, UserDto> {
@ModelAttribute("allActivities")
public Map<String, String> getAllActivites() {
return ImmutableMap.of("PAPER", "Статьи",
return Map.of("PAPER", "Статьи",
"GRANT", "Гранты",
"PROJECT", "Проекты",
"CONFERENCE", "Конференции");

View File

@ -1,14 +1,24 @@
package ru.ulstu.user.model;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import org.hibernate.annotations.BatchSize;
import ru.ulstu.configuration.Constants;
import ru.ulstu.core.model.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;

View File

@ -1,6 +1,10 @@
package ru.ulstu.user.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import org.springframework.util.StringUtils;
import ru.ulstu.configuration.Constants;
import ru.ulstu.odin.model.OdinDto;
@ -10,11 +14,11 @@ import ru.ulstu.odin.model.annotation.OdinString;
import ru.ulstu.odin.model.annotation.OdinVisible;
import ru.ulstu.user.controller.UserController;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.*;
import java.util.Collection;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import static ru.ulstu.odin.model.annotation.OdinString.OdinStringType.PASSWORD;

View File

@ -1,9 +1,9 @@
package ru.ulstu.user.model;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import ru.ulstu.configuration.Constants;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.Objects;
public class UserResetPasswordDto {

View File

@ -1,11 +1,11 @@
package ru.ulstu.user.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
@Entity
@Table(name = "user_roles")

View File

@ -1,15 +1,15 @@
package ru.ulstu.user.model;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.validation.constraints.NotNull;
import ru.ulstu.core.model.BaseEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Entity

View File

@ -1,5 +1,7 @@
package ru.ulstu.user.service;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.MimeMessage;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -10,13 +12,11 @@ import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring6.SpringTemplateEngine;
import ru.ulstu.configuration.ApplicationProperties;
import ru.ulstu.configuration.Constants;
import ru.ulstu.user.model.User;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.nio.charset.StandardCharsets;
import java.util.Map;
@ -113,7 +113,7 @@ public class MailService {
sendEmailFromTemplate(user, "activationEmail", Constants.MAIL_ACTIVATE);
}
public void sendPasswordResetMail(User user) throws MessagingException, MailException {
public void sendPasswordResetMail(User user) throws MailException {
sendEmailFromTemplate(user, "passwordResetEmail", Constants.MAIL_RESET);
}

View File

@ -1,6 +1,6 @@
package ru.ulstu.user.service;
import com.google.common.collect.ImmutableMap;
import jakarta.mail.MessagingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
@ -24,8 +24,25 @@ import ru.ulstu.core.model.UserActivity;
import ru.ulstu.core.model.response.PageableItems;
import ru.ulstu.ping.model.Ping;
import ru.ulstu.ping.service.PingService;
import ru.ulstu.user.error.*;
import ru.ulstu.user.model.*;
import ru.ulstu.user.error.UserActivationError;
import ru.ulstu.user.error.UserBlockedException;
import ru.ulstu.user.error.UserEmailExistsException;
import ru.ulstu.user.error.UserIdExistsException;
import ru.ulstu.user.error.UserIsUndeadException;
import ru.ulstu.user.error.UserLoginExistsException;
import ru.ulstu.user.error.UserNotActivatedException;
import ru.ulstu.user.error.UserNotFoundException;
import ru.ulstu.user.error.UserPasswordsNotValidOrNotMatchException;
import ru.ulstu.user.error.UserResetKeyError;
import ru.ulstu.user.error.UserSendingMailException;
import ru.ulstu.user.model.User;
import ru.ulstu.user.model.UserDto;
import ru.ulstu.user.model.UserInfoNow;
import ru.ulstu.user.model.UserListDto;
import ru.ulstu.user.model.UserResetPasswordDto;
import ru.ulstu.user.model.UserRole;
import ru.ulstu.user.model.UserRoleConstants;
import ru.ulstu.user.model.UserRoleDto;
import ru.ulstu.user.repository.UserRepository;
import ru.ulstu.user.repository.UserRoleRepository;
import ru.ulstu.user.util.UserUtils;
@ -33,9 +50,17 @@ import ru.ulstu.utils.timetable.TimetableService;
import ru.ulstu.utils.timetable.errors.TimetableClientException;
import ru.ulstu.utils.timetable.model.Lesson;
import javax.mail.MessagingException;
import java.text.ParseException;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@ -258,7 +283,7 @@ public class UserService implements UserDetailsService {
user = userRepository.save(user);
try {
mailService.sendPasswordResetMail(user);
} catch (MessagingException | MailException e) {
} catch (MailException e) {
throw new UserSendingMailException(email);
}
log.debug("Created Reset Password Request for User: {}", user.getLogin());
@ -356,7 +381,7 @@ public class UserService implements UserDetailsService {
user.setActivated(true);
userRepository.save(user);
Map<String, Object> variables = ImmutableMap.of("password", password, "email", email);
Map<String, Object> variables = Map.of("password", password, "email", email);
try {
mailService.sendInviteMail(variables, email);
} catch (MessagingException | MailException e) {
@ -386,7 +411,7 @@ public class UserService implements UserDetailsService {
userSessionService.isOnline(user))
);
}
return ImmutableMap.of("users", usersInfoNow, "error", err);
return Map.of("users", usersInfoNow, "error", err);
}
public Map<String, Integer> getActivitiesPings(Integer userId,

View File

@ -33,7 +33,7 @@ public class UserSessionService {
@Transactional(readOnly = true)
public PageableItems<UserSessionListDto> getSessions(int offset, int count) {
final Page<UserSession> page = userSessionRepository.findAll(
new OffsetablePageRequest(offset, count, new Sort(Sort.Direction.DESC, "loginTime")));
new OffsetablePageRequest(offset, count, Sort.by(Sort.Direction.DESC, "loginTime")));
return new PageableItems<>(page.getTotalElements(),
convert(page.getContent(), UserSessionListDto::new));
}

View File

@ -29,6 +29,7 @@ spring.datasource.username=postgres
spring.datasource.password=postgres
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
# Liquibase Settings
spring.liquibase.change-log=classpath:db/changelog-master.xml
spring.liquibase.drop-first=false

View File

@ -78,8 +78,8 @@
</div>
</div>
</nav>
<div th:replace="users/inviteModal"/>
<div th:replace="users/changePassword"/>
<div th:replace="~{users/inviteModal}"/>
<div th:replace="~{users/changePassword}"/>
<div class="container-fluid">
<div class="container">
<ul id="messages" class="feedback-panel">

View File

@ -18,7 +18,7 @@
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading text-uppercase">Редактирование статьи</h2>
<div th:replace="papers/fragments/paperNavigationFragment"/>
<div th:replace="~{papers/fragments/paperNavigationFragment}"/>
</div>
</div>
<hr/>
@ -29,276 +29,114 @@
th:object="${paperDto}">
<div class="row">
<div class="col-md-7 col-sm-12">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-main-tab" data-toggle="tab"
href="#nav-main" role="tab" aria-controls="nav-main" aria-selected="true">Статья</a>
<a class="nav-item nav-link" id="nav-references-tab" data-toggle="tab"
href="#nav-references" role="tab" aria-controls="nav-references"
aria-selected="false">References</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-main" role="tabpanel"
aria-labelledby="nav-main-tab">
<input type="hidden" id="paperId" name="id" th:field="*{id}"/>
<div class="form-group">
<label for="title">Название:</label>
<input class="form-control" id="title" type="text"
placeholder="Название статьи"
th:field="*{title}"/>
<p th:if="${#fields.hasErrors('title')}" th:errors="*{title}"
class="alert alert-danger">Incorrect title</p>
<p class="help-block text-danger"></p>
</div>
<input type="hidden" id="paperId" name="id" th:field="*{id}"/>
<div class="form-group">
<label for="title">Название:</label>
<input class="form-control" id="title" type="text"
placeholder="Название статьи"
th:field="*{title}"/>
<p th:if="${#fields.hasErrors('title')}" th:errors="*{title}"
class="alert alert-danger">Incorrect title</p>
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<label for="type">Тип статьи:</label>
<select class="form-control" th:field="*{type}" id="type">
<option th:each="type : ${allTypes}" th:value="${type}"
th:text="${type.typeName}">Type
</option>
</select>
</div>
<div class="form-group">
<label for="type">Тип статьи:</label>
<select class="form-control" th:field="*{type}" id="type">
<option th:each="type : ${allTypes}" th:value="${type}"
th:text="${type.typeName}">Type
</option>
</select>
</div>
<div class="form-group">
<label for="status">Статус:</label>
<select class="form-control" th:field="*{status}" id="status">
<option th:each="status : ${allStatuses}" th:value="${status}"
th:text="${status.statusName}">Status
</option>
</select>
</div>
<div class="form-group">
<label for="status">Статус:</label>
<select class="form-control" th:field="*{status}" id="status">
<option th:each="status : ${allStatuses}" th:value="${status}"
th:text="${status.statusName}">Status
</option>
</select>
</div>
<div class="form-group">
<label for="comment">Комментарий:</label>
<textarea class="form-control" rows="5" id="comment"
th:field="*{comment}"></textarea>
</div>
<div class="form-group">
<label for="comment">Комментарий:</label>
<textarea class="form-control" rows="5" id="comment"
th:field="*{comment}"></textarea>
</div>
<div class="form-group">
<label for="title">Ссылка на сайт конференции:</label>
<input class="form-control" id="url" type="text"
placeholder="Url"
th:field="*{url}"/>
</div>
<div class="form-group">
<label for="title">Ссылка на сайт конференции:</label>
<input class="form-control" id="url" type="text"
placeholder="Url"
th:field="*{url}"/>
</div>
<div class="form-group">
<label>Дедлайны:</label>
<div class="row deadline" th:each="deadline, rowStat : *{deadlines}">
<input type="hidden" th:field="*{deadlines[__${rowStat.index}__].id}"/>
<div class="col-6">
<input type="date" class="form-control deadline-date"
name="deadline"
th:field="*{deadlines[__${rowStat.index}__].date}"/>
</div>
<div class="col-4">
<input class="form-control deadline-desc" type="text"
placeholder="Описание"
th:field="*{deadlines[__${rowStat.index}__].description}"/>
</div>
<div class="col-2">
<a class="btn btn-danger float-right"
th:onclick="|$('#deadlines${rowStat.index}\\.description').val('');
<div class="form-group">
<label>Дедлайны:</label>
<div class="row deadline" th:each="deadline, rowStat : *{deadlines}">
<input type="hidden" th:field="*{deadlines[__${rowStat.index}__].id}"/>
<div class="col-6">
<input type="date" class="form-control deadline-date"
name="deadline"
th:field="*{deadlines[__${rowStat.index}__].date}"/>
</div>
<div class="col-4">
<input class="form-control deadline-desc" type="text"
placeholder="Описание"
th:field="*{deadlines[__${rowStat.index}__].description}"/>
</div>
<div class="col-2">
<a class="btn btn-danger float-right"
th:onclick="|$('#deadlines${rowStat.index}\\.description').val('');
$('#deadlines${rowStat.index}\\.date').val('');
$('#addDeadline').click();|"><span
aria-hidden="true"><i class="fa fa-times"/></span>
</a>
</div>
</div>
<p th:if="${#fields.hasErrors('deadlines')}" th:errors="*{deadlines}"
class="alert alert-danger">Incorrect title</p>
aria-hidden="true"><i class="fa fa-times"/></span>
</a>
</div>
<div class="form-group">
<input type="submit" id="addDeadline" name="addDeadline"
class="btn btn-primary"
value="Добавить
</div>
<p th:if="${#fields.hasErrors('deadlines')}" th:errors="*{deadlines}"
class="alert alert-danger">Incorrect title</p>
</div>
<div class="form-group">
<input type="submit" id="addDeadline" name="addDeadline"
class="btn btn-primary"
value="Добавить
дедлайн"/>
</div>
<div class="form-group">
<label>Авторы:</label>
<select class="selectpicker form-control" multiple="true"
data-live-search="true"
title="-- Выберите авторов --"
th:field="*{authorIds}">
<option th:each="author: ${allAuthors}" th:value="${author.id}"
th:text="${author.lastName}">Status
</option>
</select>
<p th:if="${#fields.hasErrors('authorIds')}" th:errors="*{authorIds}"
class="alert alert-danger">Incorrect title</p>
</div>
</div>
<div class="form-group">
<label>Авторы:</label>
<select class="selectpicker form-control" multiple="true"
data-live-search="true"
title="-- Выберите авторов --"
th:field="*{authorIds}">
<option th:each="author: ${allAuthors}" th:value="${author.id}"
th:text="${author.lastName}">Status
</option>
</select>
<p th:if="${#fields.hasErrors('authorIds')}" th:errors="*{authorIds}"
class="alert alert-danger">Incorrect title</p>
</div>
<div class="form-group files-list" id="files-list">
<label>Файлы:</label>
<div class="form-group files-list" id="files-list">
<label>Файлы:</label>
<div th:replace="papers/fragments/paperFilesListFragment :: filesList(isLatexAttach = ${false})"/>
<div th:replace="~{papers/fragments/paperFilesListFragment :: filesList(isLatexAttach = ${false})}"/>
</div>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="locked"
th:field="*{locked}"/>
<label class="form-check-label" for="locked">Заблокирована</label>
</div>
<div class="form-group">
<label for="loader">Загрузить статью:</label>
<div id="loader">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="locked"
th:field="*{locked}"/>
<label class="form-check-label" for="locked">Заблокирована</label>
</div>
<div class="form-group">
<label for="loader">Загрузить статью:</label>
<div id="loader">
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-latex" role="tabpanel"
aria-labelledby="nav-profile-tab">
<div class="form-group">
<label for="latex-text">Latex текст:</label>
<textarea class="form-control" id="latex-text" type="text" rows="10"
placeholder="Latex.."
th:field="*{latexText}"/>
</div>
<div class="form-group files-list" id="latex-files-list">
<label>Файлы:</label>
<div th:replace="papers/fragments/paperFilesListFragment :: filesList(isLatexAttach = ${true})"/>
</div>
<div class="form-group">
<label for="latex-loader">Загрузить файлы:</label>
<div id="latex-loader">
</div>
</div>
<div class="form-group">
<button id="pdfBtn" class="btn btn-primary text-uppercase"
onclick="generatePDF()"
type="button">
<i id="pdfLoadingIcon" class='fa fa-circle-o-notch fa-spin'
style="display: none;"></i>
pdf
</button>
</div>
</div>
<div class="tab-pane fade" id="nav-references" role="tabpanel"
aria-labelledby="nav-profile-tab">
<div class="form-group">
<label>References:</label>
<th:block th:each="reference, rowStat : *{references}">
<div class="row" th:id="|reference${rowStat.index}|"
th:style="${reference.deleted} ? 'display: none;' :''">
<div class="form-group col-11">
<a data-toggle="collapse"
th:href="${'#collapseReference'+rowStat.index}"
aria-expanded="false">
<div class="collapse-heading"
th:text="${(reference.referenceType.toString() == 'ARTICLE'?'Статья':'Книга') +'. '
+(reference.publicationTitle==null?'':reference.publicationTitle+'. ')+(reference.authors==null?'':reference.authors+'. ') }">
</div>
</a>
</div>
<div class="col-1">
<a class="btn btn-danger float-right"
th:onclick="|$('#references${rowStat.index}\\.deleted').val('true'); $('#reference${rowStat.index}').hide(); |"><span
aria-hidden="true"><i class="fa fa-times"/></span>
</a>
</div>
<div class="collapse" th:id="${'collapseReference'+rowStat.index}">
<input type="hidden"
th:field="*{references[__${rowStat.index}__].id}"/>
<input type="hidden"
th:field="*{references[__${rowStat.index}__].deleted}"/>
<div class="form-group col-12">
<label class="col-4">Вид публикации:</label>
<select class="form-control col-7"
th:field="*{references[__${rowStat.index}__].referenceType}">
<option th:each="type : ${allReferenceTypes}"
th:value="${type}"
th:text="${type.typeName}">Type
</option>
</select>
</div>
<div class="form-group col-12">
<label class="col-4">Авторы:</label>
<input type="text"
class="form-control col-7 autocomplete author"
name="authors"
th:field="*{references[__${rowStat.index}__].authors}"/>
</div>
<div class="form-group col-12">
<label class="col-4 ">Название публикации:</label>
<input type="text"
class="form-control col-7 autocomplete publicationTitle"
name="publicationTitle"
th:field="*{references[__${rowStat.index}__].publicationTitle}"/>
</div>
<div class="form-group col-12">
<label class="col-4">Год издания:</label>
<input type="number"
class="form-control col-7 publicationYear"
name="publicationYear"
th:field="*{references[__${rowStat.index}__].publicationYear}"/>
</div>
<div class="form-group col-12">
<label class="col-4">Издательство:</label>
<input type="text"
class="form-control col-7 autocomplete publisher"
name="publisher"
th:field="*{references[__${rowStat.index}__].publisher}"/>
</div>
<div class="form-group col-12">
<label class="col-4">Страницы:</label>
<input type="text" class="form-control col-7 pages"
name="pages"
th:field="*{references[__${rowStat.index}__].pages}"/>
</div>
<div class="form-group col-12">
<label class="col-4">Название журнала или сборника статей
конференции:</label>
<input type="text"
class="form-control col-7 autocomplete journalOrCollectionTitle"
name="journalOrCollectionTitle"
th:field="*{references[__${rowStat.index}__].journalOrCollectionTitle}"/>
</div>
</div>
</div>
</th:block>
<div class="form-group">
<input type="submit" id="addReference" name="addReference"
class="btn btn-primary"
value="Добавить источник"/>
</div>
<div class="form-group">
<div class="col-12 form-group">
<label for="formatStandard">Стандарт форматирования:</label>
<select class="form-control" th:field="*{formatStandard}"
id="formatStandard">
<option th:each="standard : ${allFormatStandards}"
th:value="${standard}"
th:text="${standard.standardName}">standard
</option>
</select>
</div>
<div class="col-12 form-group">
<button id="formatBtn" class="btn btn-primary text-uppercase"
onclick="getFormattedReferences()"
type="button">
Форматировать
</button>
</div>
<div class="col-12">
<textarea class="form-control"
id="formattedReferencesArea"></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4 offset-md-1 col-sm-12 offset-sm-0">
<div class="form-group">
<div class="row">
@ -333,21 +171,19 @@
</button>
</div>
</div>
<div class="clearfix"></div>
<div class="col-lg-12">
<div class="form-group">
<button id="sendMessageButton" name="save"
class="btn btn-success text-uppercase"
type="submit">
Сохранить
</button>
<a id="cancelButton" class="btn btn-default text-uppercase"
href="/papers/papers">
Отмена
</a>
</div>
</div>
<div class="clearfix"></div>
<div class="col-lg-12">
<div class="form-group">
<button id="sendMessageButton" name="save"
class="btn btn-success text-uppercase"
type="submit">
Сохранить
</button>
<a id="cancelButton" class="btn btn-default text-uppercase"
href="/papers/papers">
Отмена
</a>
</div>
</div>
</form>