Compare commits
No commits in common. "db4620694ce915010b52b7d034d967fa31a9fbb7" and "4ab3637d9cd0802d5613e4800150c243d9ba9941" have entirely different histories.
db4620694c
...
4ab3637d9c
15
Jenkinsfile
vendored
15
Jenkinsfile
vendored
@ -1,15 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
stages {
|
|
||||||
stage('Build') {
|
|
||||||
steps {
|
|
||||||
./gradlew build
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Test') {
|
|
||||||
steps {
|
|
||||||
./gradlew test
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
100
build.gradle
100
build.gradle
@ -1,19 +1,34 @@
|
|||||||
plugins {
|
buildscript {
|
||||||
id 'java'
|
ext {
|
||||||
id 'org.springframework.boot' version '3.2.4'
|
versionSpringBoot = '2.1.6.RELEASE'
|
||||||
id 'io.spring.dependency-management' version '1.1.4'
|
}
|
||||||
id 'checkstyle'
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: versionSpringBoot
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'ru.ulstu'
|
group 'ru.ulstu'
|
||||||
version '0.1.0-SNAPSHOT'
|
version '0.1.0-SNAPSHOT'
|
||||||
|
|
||||||
|
apply plugin: 'application'
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'org.springframework.boot'
|
||||||
|
apply plugin: 'io.spring.dependency-management'
|
||||||
|
apply plugin: 'checkstyle'
|
||||||
|
|
||||||
|
mainClassName = 'ru.ulstu.NgTrackerApplication'
|
||||||
|
|
||||||
build.dependsOn checkstyleMain
|
build.dependsOn checkstyleMain
|
||||||
bootRun.dependsOn checkstyleMain
|
bootRun.dependsOn checkstyleMain
|
||||||
|
|
||||||
java {
|
sourceCompatibility = 11
|
||||||
sourceCompatibility = '17'
|
targetCompatibility = 11
|
||||||
}
|
|
||||||
|
|
||||||
bootRun {
|
bootRun {
|
||||||
systemProperties = System.properties
|
systemProperties = System.properties
|
||||||
@ -49,7 +64,7 @@ checkstyle {
|
|||||||
checkstyle
|
checkstyle
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies{
|
||||||
assert project.hasProperty("checkstyleVersion")
|
assert project.hasProperty("checkstyleVersion")
|
||||||
|
|
||||||
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
|
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
|
||||||
@ -61,12 +76,9 @@ task health(dependsOn: [
|
|||||||
'checkstyleMain'
|
'checkstyleMain'
|
||||||
])
|
])
|
||||||
|
|
||||||
jar {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
bootJar {
|
jar {
|
||||||
archiveFileName = String.format('%s-%s.jar', rootProject.name, version)
|
baseName = 'ng-tracker'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
@ -76,44 +88,48 @@ compileJava {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
url "https://repository.primefaces.org/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web'
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security'
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-mail'
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat'
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
|
||||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
|
compile group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-dialect'
|
||||||
implementation group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-dialect'
|
compile group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-springsecurity5'
|
||||||
implementation group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-springsecurity6'
|
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-afterburner'
|
||||||
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-afterburner'
|
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hibernate5'
|
||||||
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hibernate5'
|
compile group: 'org.springframework.security', name: 'spring-security-oauth2-client'
|
||||||
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-client'
|
compile group: 'org.springframework.security', name: 'spring-security-oauth2-jose'
|
||||||
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose'
|
|
||||||
|
|
||||||
implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
|
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
|
||||||
|
|
||||||
implementation group: 'org.liquibase', name: 'liquibase-core', version: '4.27.0'
|
compile group: 'org.liquibase', name: 'liquibase-core', version: '3.6.3'
|
||||||
implementation group: 'com.mattbertolini', name: 'liquibase-slf4j', version: '2.0.0'
|
compile group: 'com.mattbertolini', name: 'liquibase-slf4j', version: '2.0.0'
|
||||||
|
|
||||||
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
|
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
|
||||||
|
|
||||||
implementation group: 'org.webjars', name: 'bootstrap', version: '4.1.0'
|
//primefaces
|
||||||
implementation group: 'org.webjars', name: 'bootstrap-select', version: '1.13.3'
|
compile group: 'org.primefaces', name: 'primefaces', version: '7.0'
|
||||||
implementation group: 'org.webjars', name: 'jquery', version: '3.3.1-1'
|
compile group: 'net.bootsfaces', name: 'bootsfaces', version: '1.4.2'
|
||||||
implementation group: 'org.webjars.npm', name: 'jquery.easing', version: '1.4.1'
|
compile group: 'org.joinfaces', name: 'jsf-spring-boot-starter', version: '4.1.2'
|
||||||
implementation group: 'org.webjars', name: 'font-awesome', version: '4.7.0'
|
compile group: 'org.javassist', name: 'javassist', version: '3.25.0-GA'
|
||||||
|
compile group: 'org.primefaces.themes', name: 'all-themes', version: '1.0.10'
|
||||||
|
|
||||||
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.8.0'
|
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.6.0'
|
||||||
implementation group: 'net.sourceforge.htmlunit', name: 'htmlunit', version: '2.35.0'
|
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.6.0'
|
||||||
implementation group: 'xalan', name: 'xalan', version: '2.7.2'
|
compile group: 'net.sourceforge.htmlunit', name: 'htmlunit', version: '2.35.0'
|
||||||
|
compile group: 'xalan', name: 'xalan', version: '2.7.2'
|
||||||
|
|
||||||
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
|
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
|
||||||
//compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.3.1'
|
//compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.3.1'
|
||||||
//testCompile group: 'org.seleniumhq.selenium', name: 'selenium-support', version: '3.3.1'
|
//testCompile group: 'org.seleniumhq.selenium', name: 'selenium-support', version: '3.3.1'
|
||||||
//testCompile group: 'com.google.guava', name: 'guava', version: '21.0'
|
//testCompile group: 'com.google.guava', name: 'guava', version: '21.0'
|
||||||
testImplementation group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
|
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
|
||||||
}
|
}
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -2,6 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
|
||||||
networkTimeout=10000
|
|
||||||
validateDistributionUrl=true
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package ru.ulstu.conference.controller;
|
package ru.ulstu.conference.controller;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
@ -16,7 +14,9 @@ import ru.ulstu.conference.model.ConferenceFilterDto;
|
|||||||
import ru.ulstu.conference.model.ConferenceUser;
|
import ru.ulstu.conference.model.ConferenceUser;
|
||||||
import ru.ulstu.conference.service.ConferenceService;
|
import ru.ulstu.conference.service.ConferenceService;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -29,7 +29,7 @@ import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
|
|||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@RequestMapping(value = "/conferences")
|
@RequestMapping(value = "/conferences")
|
||||||
@Hidden
|
@ApiIgnore
|
||||||
public class ConferenceController {
|
public class ConferenceController {
|
||||||
|
|
||||||
private final ConferenceService conferenceService;
|
private final ConferenceService conferenceService;
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
package ru.ulstu.conference.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import ru.ulstu.conference.model.Conference;
|
||||||
|
import ru.ulstu.conference.service.ConferenceService;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.convert.Converter;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ConferenceConverter implements Converter {
|
||||||
|
@Inject
|
||||||
|
private ConferenceService conferenceService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getAsObject(FacesContext context, UIComponent component, String value) {
|
||||||
|
return value == null || value.equals("") ? null : conferenceService.findOne(Integer.valueOf(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAsString(FacesContext context, UIComponent component, Object value) {
|
||||||
|
return value == null
|
||||||
|
? ""
|
||||||
|
: (value.getClass().equals(Conference.class) ? ((Conference) value).getId().toString() : null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package ru.ulstu.conference.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.conference.model.Conference;
|
||||||
|
import ru.ulstu.conference.service.ConferenceService;
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class ConferenceDashboardView {
|
||||||
|
@Inject
|
||||||
|
private ConferenceService conferenceService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
private List<Conference> conferences;
|
||||||
|
|
||||||
|
private List<Conference> selectedConferences = new ArrayList<>();
|
||||||
|
|
||||||
|
private String newConferenceTitle;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
conferences = conferenceService.findAllActiveByCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Conference> getConferences() {
|
||||||
|
return conferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
conferenceService.createByTitle(newConferenceTitle);
|
||||||
|
FacesUtil.showInfoMessage("Статья создана", newConferenceTitle);
|
||||||
|
newConferenceTitle = "";
|
||||||
|
conferences = conferenceService.findAllActiveByCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteSelected() {
|
||||||
|
conferenceService.delete(selectedConferences);
|
||||||
|
conferences = conferenceService.findAllActiveByCurrentUser();
|
||||||
|
FacesUtil.showInfoMessage("Было удалено статей: " + selectedConferences.size(), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewConferenceTitle() {
|
||||||
|
return newConferenceTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewConferenceTitle(String newConferenceTitle) {
|
||||||
|
this.newConferenceTitle = newConferenceTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Conference> getSelectedConferences() {
|
||||||
|
return selectedConferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedConferences(List<Conference> selectedConferences) {
|
||||||
|
this.selectedConferences = selectedConferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentUser() {
|
||||||
|
return userService.getCurrentUser().getUserAbbreviate();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package ru.ulstu.conference.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.conference.model.Conference;
|
||||||
|
import ru.ulstu.conference.service.ConferenceService;
|
||||||
|
import ru.ulstu.core.navigation.Page;
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
|
import ru.ulstu.deadline.service.DeadlineService;
|
||||||
|
import ru.ulstu.user.model.User;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class ConferenceView implements Serializable {
|
||||||
|
@Inject
|
||||||
|
private ConferenceService conferenceService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DeadlineService deadlineService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
private Conference conference;
|
||||||
|
|
||||||
|
private Date newDeadlineDate;
|
||||||
|
|
||||||
|
private String newDeadlineDescription;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
conference = conferenceService.findOne(Integer.valueOf(FacesUtil.getRequestParams().get("id")));
|
||||||
|
newDeadlineDescription = "";
|
||||||
|
newDeadlineDate = new Date();
|
||||||
|
FacesUtil.showInfoMessage("Статья открыта", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Conference getConference() {
|
||||||
|
return conference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConference(Conference conference) {
|
||||||
|
this.conference = conference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> getAuthors() {
|
||||||
|
return userService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String save() {
|
||||||
|
conferenceService.save(conference);
|
||||||
|
FacesUtil.showInfoMessage("Статья сохранена", "");
|
||||||
|
return Page.CONFERENCE_LIST + "?faces-redirect=true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getNewDeadlineDate() {
|
||||||
|
return newDeadlineDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewDeadlineDate(Date newDeadlineDate) {
|
||||||
|
this.newDeadlineDate = newDeadlineDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewDeadlineDescription() {
|
||||||
|
return newDeadlineDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewDeadlineDescription(String newDeadlineDescription) {
|
||||||
|
this.newDeadlineDescription = newDeadlineDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteDeadline(Deadline deadline) {
|
||||||
|
conference.getDeadlines().remove(deadline);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDeadline() {
|
||||||
|
conference.getDeadlines().add(deadlineService.create(newDeadlineDescription, newDeadlineDate));
|
||||||
|
newDeadlineDescription = "";
|
||||||
|
newDeadlineDate = new Date();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package ru.ulstu.conference.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.conference.model.Conference;
|
||||||
|
import ru.ulstu.conference.service.ConferenceService;
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class ConferencesView {
|
||||||
|
@Inject
|
||||||
|
private ConferenceService conferenceService;
|
||||||
|
|
||||||
|
private List<Conference> conferences;
|
||||||
|
|
||||||
|
private List<Conference> selectedConferences = new ArrayList<>();
|
||||||
|
|
||||||
|
private String newConferenceTitle;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
conferences = conferenceService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
conferenceService.createByTitle(newConferenceTitle);
|
||||||
|
FacesUtil.showInfoMessage("Конференция создана", newConferenceTitle);
|
||||||
|
newConferenceTitle = "";
|
||||||
|
conferences = conferenceService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteSelected() {
|
||||||
|
conferenceService.delete(selectedConferences);
|
||||||
|
conferences = conferenceService.findAll();
|
||||||
|
FacesUtil.showInfoMessage("Было удалено конференций: " + selectedConferences.size(), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Conference> getConferences() {
|
||||||
|
return conferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewConferenceTitle() {
|
||||||
|
return newConferenceTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewConferenceTitle(String newConferenceTitle) {
|
||||||
|
this.newConferenceTitle = newConferenceTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Conference> getSelectedConferences() {
|
||||||
|
return selectedConferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedConferences(List<Conference> selectedConferences) {
|
||||||
|
this.selectedConferences = selectedConferences;
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,5 @@
|
|||||||
package ru.ulstu.conference.model;
|
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.Fetch;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
@ -23,6 +11,18 @@ import ru.ulstu.paper.model.Paper;
|
|||||||
import ru.ulstu.timeline.model.Event;
|
import ru.ulstu.timeline.model.Event;
|
||||||
import ru.ulstu.user.model.User;
|
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.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -2,16 +2,16 @@ package ru.ulstu.conference.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
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 org.springframework.format.annotation.DateTimeFormat;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
import ru.ulstu.name.NameContainer;
|
import ru.ulstu.name.NameContainer;
|
||||||
import ru.ulstu.paper.model.Paper;
|
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.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -2,17 +2,18 @@ package ru.ulstu.conference.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
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.core.model.BaseEntity;
|
||||||
import ru.ulstu.user.model.User;
|
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
|
@Entity
|
||||||
@Table(name = "users_conference")
|
@Table(name = "users_conference")
|
||||||
public class ConferenceUser extends BaseEntity {
|
public class ConferenceUser extends BaseEntity {
|
||||||
@ -69,6 +70,7 @@ public class ConferenceUser extends BaseEntity {
|
|||||||
public ConferenceUser(User user) {
|
public ConferenceUser(User user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.deposit = Deposit.REPORT;
|
this.deposit = Deposit.REPORT;
|
||||||
|
this.participation = Participation.INTRAMURAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface ConferenceRepository extends JpaRepository<Conference, Integer>, BaseRepository {
|
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) " +
|
@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 c.beginDate DESC")
|
"AND (YEAR(c.beginDate) = :year OR :year IS NULL) ORDER BY begin_date DESC")
|
||||||
List<Conference> findByUserAndYear(@Param("user") User user, @Param("year") Integer year);
|
List<Conference> findByUserAndYear(@Param("user") User user, @Param("year") Integer year);
|
||||||
|
|
||||||
@Query("SELECT c FROM Conference c WHERE c.beginDate > :date")
|
@Query("SELECT c FROM Conference c WHERE c.beginDate > :date")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.ulstu.conference.service;
|
package ru.ulstu.conference.service;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.conference.model.Conference;
|
import ru.ulstu.conference.model.Conference;
|
||||||
import ru.ulstu.core.util.DateUtils;
|
import ru.ulstu.core.util.DateUtils;
|
||||||
@ -56,22 +57,22 @@ public class ConferenceNotificationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessageDeadline(Conference conference) {
|
private void sendMessageDeadline(Conference conference) {
|
||||||
Map<String, Object> variables = Map.of("conference", conference);
|
Map<String, Object> variables = ImmutableMap.of("conference", conference);
|
||||||
sendForAllParticipants(variables, conference, TEMPLATE_DEADLINE, String.format(TITLE_DEADLINE, conference.getTitle()));
|
sendForAllParticipants(variables, conference, TEMPLATE_DEADLINE, String.format(TITLE_DEADLINE, conference.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendCreateNotification(Conference conference) {
|
public void sendCreateNotification(Conference conference) {
|
||||||
Map<String, Object> variables = Map.of("conference", conference);
|
Map<String, Object> variables = ImmutableMap.of("conference", conference);
|
||||||
sendForAllUsers(variables, String.format(TITLE_CREATE, conference.getTitle()));
|
sendForAllUsers(variables, String.format(TITLE_CREATE, conference.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDeadlineNotification(Conference conference) {
|
public void updateDeadlineNotification(Conference conference) {
|
||||||
Map<String, Object> variables = Map.of("conference", conference);
|
Map<String, Object> variables = ImmutableMap.of("conference", conference);
|
||||||
sendForAllParticipants(variables, conference, TEMPLATE_UPDATE_DEADLINES, String.format(TITLE_UPDATE_DEADLINES, conference.getTitle()));
|
sendForAllParticipants(variables, conference, TEMPLATE_UPDATE_DEADLINES, String.format(TITLE_UPDATE_DEADLINES, conference.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateConferencesDatesNotification(Conference conference, Date oldBeginDate, Date oldEndDate) {
|
public void updateConferencesDatesNotification(Conference conference, Date oldBeginDate, Date oldEndDate) {
|
||||||
Map<String, Object> variables = Map.of("conference", conference, "oldBeginDate", oldBeginDate, "oldEndDate", oldEndDate);
|
Map<String, Object> variables = ImmutableMap.of("conference", conference, "oldBeginDate", oldBeginDate, "oldEndDate", oldEndDate);
|
||||||
sendForAllParticipants(variables, conference, TEMPLATE_UPDATE_DATES, String.format(TITLE_UPDATE_DATES, conference.getTitle()));
|
sendForAllParticipants(variables, conference, TEMPLATE_UPDATE_DATES, String.format(TITLE_UPDATE_DATES, conference.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ public class ConferenceNotificationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessagePing(Conference conference) {
|
private void sendMessagePing(Conference conference) {
|
||||||
Map<String, Object> variables = Map.of("conference", conference);
|
Map<String, Object> variables = ImmutableMap.of("conference", conference);
|
||||||
sendForAllParticipants(variables, conference, TEMPLATE_PING, String.format(TITLE_PING, conference.getTitle()));
|
sendForAllParticipants(variables, conference, TEMPLATE_PING, String.format(TITLE_PING, conference.getTitle()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ public class ConferenceService extends BaseService {
|
|||||||
|
|
||||||
|
|
||||||
public List<Conference> findAll() {
|
public List<Conference> findAll() {
|
||||||
return conferenceRepository.findAll(Sort.by(Sort.Direction.DESC, "beginDate"));
|
return conferenceRepository.findAll(new Sort(Sort.Direction.DESC, "beginDate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ConferenceDto> findAllDto() {
|
public List<ConferenceDto> findAllDto() {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package ru.ulstu.configuration;
|
package ru.ulstu.configuration;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "ng-tracker")
|
@ConfigurationProperties(prefix = "ng-tracker")
|
||||||
@Validated
|
@Validated
|
||||||
|
@ -14,7 +14,7 @@ public class Constants {
|
|||||||
public static final String LOGIN_REGEX = "^[_'.@A-Za-z0-9-]*$";
|
public static final String LOGIN_REGEX = "^[_'.@A-Za-z0-9-]*$";
|
||||||
|
|
||||||
public static final String COOKIES_NAME = "JSESSIONID";
|
public static final String COOKIES_NAME = "JSESSIONID";
|
||||||
public static final String LOGOUT_URL = "/login?logout";
|
public static final String LOGOUT_URL = "/login.xhtml";
|
||||||
public static final String SESSION_ID_ATTR = "sessionId";
|
public static final String SESSION_ID_ATTR = "sessionId";
|
||||||
public static final int SESSION_TIMEOUT_SECONDS = 30 * 60;
|
public static final int SESSION_TIMEOUT_SECONDS = 30 * 60;
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package ru.ulstu.configuration;
|
package ru.ulstu.configuration;
|
||||||
|
|
||||||
import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect;
|
import nz.net.ultraq.thymeleaf.LayoutDialect;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.thymeleaf.extras.springsecurity6.dialect.SpringSecurityDialect;
|
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;
|
||||||
import org.thymeleaf.spring6.SpringTemplateEngine;
|
import org.thymeleaf.spring5.SpringTemplateEngine;
|
||||||
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
||||||
import org.thymeleaf.templateresolver.ITemplateResolver;
|
import org.thymeleaf.templateresolver.ITemplateResolver;
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package ru.ulstu.configuration;
|
package ru.ulstu.configuration;
|
||||||
|
|
||||||
|
import org.springframework.boot.web.server.ErrorPage;
|
||||||
|
import org.springframework.boot.web.server.ErrorPageRegistrar;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
@ -9,20 +12,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||||||
public class MvcConfiguration implements WebMvcConfigurer {
|
public class MvcConfiguration implements WebMvcConfigurer {
|
||||||
@Override
|
@Override
|
||||||
public void addViewControllers(ViewControllerRegistry registry) {
|
public void addViewControllers(ViewControllerRegistry registry) {
|
||||||
registry.addViewController("/{articlename:\\w+}");
|
registry.addRedirectViewController("/", "/index.xhtml");
|
||||||
registry.addViewController("/admin/{articlename:\\w+}");
|
|
||||||
registry.addViewController("/papers/{articlename:\\w+}");
|
|
||||||
registry.addViewController("/grants/{articlename:\\w+}");
|
|
||||||
registry.addViewController("/conferences/{articlename:\\w+}");
|
|
||||||
registry.addViewController("/students/{articlename:\\w+}");
|
|
||||||
registry.addRedirectViewController("/", "/index");
|
|
||||||
registry.addRedirectViewController("/default", "/index");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Bean
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public ErrorPageRegistrar errorPageRegistrar() {
|
||||||
registry
|
return registry -> {
|
||||||
.addResourceHandler("/webjars/**")
|
registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error/404.xhtml"));
|
||||||
.addResourceLocations("/webjars/");
|
registry.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500.xhtml"));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,24 +9,42 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
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.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.EnableWebSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
import org.springframework.security.config.oauth2.client.CommonOAuth2Provider;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
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.authentication.AuthenticationFailureHandler;
|
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
||||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||||
import ru.ulstu.core.model.AuthFailureHandler;
|
import ru.ulstu.core.model.AuthFailureHandler;
|
||||||
import ru.ulstu.user.controller.UserController;
|
import ru.ulstu.core.navigation.Page;
|
||||||
import ru.ulstu.user.model.UserRoleConstants;
|
import ru.ulstu.user.model.UserRoleConstants;
|
||||||
import ru.ulstu.user.service.UserService;
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
public class SecurityConfiguration {
|
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||||
|
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||||
private final Logger log = LoggerFactory.getLogger(SecurityConfiguration.class);
|
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
|
@Autowired
|
||||||
private Environment env;
|
private Environment env;
|
||||||
@ -57,60 +75,110 @@ public class SecurityConfiguration {
|
|||||||
this.authenticationFailureHandler = authenticationFailureHandler;
|
this.authenticationFailureHandler = authenticationFailureHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Override
|
||||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.csrf(AbstractHttpConfigurer::disable);
|
http.csrf().disable();
|
||||||
if (applicationProperties.isDevMode()) {
|
if (applicationProperties.isDevMode()) {
|
||||||
log.debug("Security disabled");
|
log.debug("Security disabled");
|
||||||
http.authorizeHttpRequests((authz) -> authz
|
http.authorizeRequests()
|
||||||
.anyRequest()
|
.anyRequest()
|
||||||
.permitAll()
|
.permitAll();
|
||||||
);
|
http.anonymous()
|
||||||
http.anonymous((anonymousCustomizer) -> anonymousCustomizer
|
|
||||||
.principal("admin")
|
.principal("admin")
|
||||||
.authorities(UserRoleConstants.ADMIN)
|
.authorities(UserRoleConstants.ADMIN);
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
log.debug("Security enabled");
|
http.authorizeRequests()
|
||||||
http.authorizeHttpRequests((authz) -> authz
|
.antMatchers("/login.xhtml", "/logout")
|
||||||
.requestMatchers(UserController.ACTIVATE_URL).permitAll()
|
.permitAll()
|
||||||
.requestMatchers(Constants.PASSWORD_RESET_REQUEST_PAGE).permitAll()
|
.anyRequest()
|
||||||
.requestMatchers(Constants.PASSWORD_RESET_PAGE).permitAll()
|
.authenticated()
|
||||||
.requestMatchers("/users/block").permitAll()
|
.antMatchers("/swagger-ui.html").hasAuthority(UserRoleConstants.ADMIN)
|
||||||
.requestMatchers(UserController.URL + UserController.REGISTER_URL).permitAll()
|
.and()
|
||||||
.requestMatchers(UserController.URL + UserController.ACTIVATE_URL).permitAll()
|
.formLogin()
|
||||||
.requestMatchers(UserController.URL + UserController.PASSWORD_RESET_REQUEST_URL).permitAll()
|
.loginPage("/login.xhtml")
|
||||||
.requestMatchers(UserController.URL + UserController.PASSWORD_RESET_URL).permitAll()
|
|
||||||
.requestMatchers("/swagger-ui.html").hasAuthority(UserRoleConstants.ADMIN)
|
|
||||||
.anyRequest().authenticated())
|
|
||||||
.formLogin((formLoginCustomizer) -> formLoginCustomizer
|
|
||||||
.loginPage("/login")
|
|
||||||
.successHandler(authenticationSuccessHandler)
|
.successHandler(authenticationSuccessHandler)
|
||||||
.failureHandler(authenticationFailureHandler)
|
.failureHandler(authenticationFailureHandler)
|
||||||
.permitAll()
|
.permitAll()
|
||||||
)
|
.and()
|
||||||
.logout((logoutCustomizer) -> logoutCustomizer
|
.oauth2Login()
|
||||||
|
.loginPage("/login.xhtml")
|
||||||
|
.authorizationEndpoint()
|
||||||
|
.baseUri("/oauth2/authorize-client")
|
||||||
|
.authorizationRequestRepository(authorizationRequestRepository())
|
||||||
|
.and()
|
||||||
|
.tokenEndpoint()
|
||||||
|
.accessTokenResponseClient(accessTokenResponseClient())
|
||||||
|
.and()
|
||||||
|
.defaultSuccessUrl(Page.INDEX)
|
||||||
|
.failureUrl("/loginFailure")
|
||||||
|
.and()
|
||||||
|
.logout()
|
||||||
.logoutSuccessHandler(logoutSuccessHandler)
|
.logoutSuccessHandler(logoutSuccessHandler)
|
||||||
.logoutSuccessUrl(Constants.LOGOUT_URL)
|
.logoutSuccessUrl(Page.LOGOUT)
|
||||||
.invalidateHttpSession(false)
|
.invalidateHttpSession(true)
|
||||||
.clearAuthentication(true)
|
.clearAuthentication(true)
|
||||||
.deleteCookies(Constants.COOKIES_NAME)
|
.deleteCookies(Constants.COOKIES_NAME)
|
||||||
.permitAll()
|
.permitAll();
|
||||||
);
|
http.csrf().disable();
|
||||||
http.csrf(AbstractHttpConfigurer::disable);
|
}
|
||||||
|
if (applicationProperties.isUseHttps()) {
|
||||||
|
http.portMapper()
|
||||||
|
.http(httpPort)
|
||||||
|
.mapsTo(httpsPort)
|
||||||
|
.and()
|
||||||
|
.requiresChannel()
|
||||||
|
.anyRequest()
|
||||||
|
.requiresSecure();
|
||||||
}
|
}
|
||||||
return http.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public WebSecurityCustomizer webSecurityCustomizer() {
|
public AuthorizationRequestRepository<OAuth2AuthorizationRequest> authorizationRequestRepository() {
|
||||||
return (web) -> web.ignoring()
|
return new HttpSessionOAuth2AuthorizationRequestRepository();
|
||||||
.requestMatchers("/css/**",
|
}
|
||||||
"/javax.faces.resource/**",
|
|
||||||
"/js/**",
|
@Bean
|
||||||
"/templates/**",
|
public OAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient() {
|
||||||
"/webjars/**",
|
DefaultAuthorizationCodeTokenResponseClient accessTokenResponseClient = new DefaultAuthorizationCodeTokenResponseClient();
|
||||||
"/img/**");
|
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/**");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
@ -1,115 +0,0 @@
|
|||||||
package ru.ulstu.core.controller;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.validation.FieldError;
|
|
||||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import ru.ulstu.core.error.EntityIdIsNullException;
|
|
||||||
import ru.ulstu.core.model.ErrorConstants;
|
|
||||||
import ru.ulstu.core.model.response.Response;
|
|
||||||
import ru.ulstu.core.model.response.ResponseExtended;
|
|
||||||
import ru.ulstu.user.error.UserActivationError;
|
|
||||||
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.service.UserService;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
//@ControllerAdvice
|
|
||||||
public class AdviceController {
|
|
||||||
private final Logger log = LoggerFactory.getLogger(AdviceController.class);
|
|
||||||
private final UserService userService;
|
|
||||||
|
|
||||||
public AdviceController(UserService userService) {
|
|
||||||
this.userService = userService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModelAttribute("flashMessage")
|
|
||||||
public String getFlashMessage() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Response<Void> handleException(ErrorConstants error) {
|
|
||||||
log.warn(error.toString());
|
|
||||||
return new Response<>(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
private <E> ResponseExtended<E> handleException(ErrorConstants error, E errorData) {
|
|
||||||
log.warn(error.toString());
|
|
||||||
return new ResponseExtended<>(error, errorData);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(EntityIdIsNullException.class)
|
|
||||||
public Response<Void> handleEntityIdIsNullException(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.ID_IS_NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
|
||||||
public ResponseExtended<Set<String>> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
|
||||||
final Set<String> errors = e.getBindingResult().getAllErrors().stream()
|
|
||||||
.filter(error -> error instanceof FieldError)
|
|
||||||
.map(error -> ((FieldError) error).getField())
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
return handleException(ErrorConstants.VALIDATION_ERROR, errors);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserIdExistsException.class)
|
|
||||||
public Response<Void> handleUserIdExistsException(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_ID_EXISTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserActivationError.class)
|
|
||||||
public ResponseExtended<String> handleUserActivationError(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_ACTIVATION_ERROR, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserLoginExistsException.class)
|
|
||||||
public ResponseExtended<String> handleUserLoginExistsException(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_LOGIN_EXISTS, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserEmailExistsException.class)
|
|
||||||
public ResponseExtended<String> handleUserEmailExistsException(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_EMAIL_EXISTS, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserPasswordsNotValidOrNotMatchException.class)
|
|
||||||
public Response<Void> handleUserPasswordsNotValidOrNotMatchException(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_PASSWORDS_NOT_VALID_OR_NOT_MATCH);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserNotFoundException.class)
|
|
||||||
public ResponseExtended<String> handleUserNotFoundException(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_NOT_FOUND, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserNotActivatedException.class)
|
|
||||||
public Response<Void> handleUserNotActivatedException(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_NOT_ACTIVATED);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserResetKeyError.class)
|
|
||||||
public ResponseExtended<String> handleUserResetKeyError(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_RESET_ERROR, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserIsUndeadException.class)
|
|
||||||
public ResponseExtended<String> handleUserIsUndeadException(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_UNDEAD_ERROR, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(UserSendingMailException.class)
|
|
||||||
public ResponseExtended<String> handleUserSendingMailException(Throwable e) {
|
|
||||||
return handleException(ErrorConstants.USER_SENDING_MAIL_EXCEPTION, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,7 +15,7 @@ public class OffsetablePageRequest implements Pageable, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public OffsetablePageRequest(long offset, int count, Sort.Direction direction, String... properties) {
|
public OffsetablePageRequest(long offset, int count, Sort.Direction direction, String... properties) {
|
||||||
this(offset, count, Sort.by(direction, properties));
|
this(offset, count, new Sort(direction, properties));
|
||||||
}
|
}
|
||||||
|
|
||||||
public OffsetablePageRequest(long offset, int count, Sort sort) {
|
public OffsetablePageRequest(long offset, int count, Sort sort) {
|
||||||
@ -30,12 +30,6 @@ public class OffsetablePageRequest implements Pageable, Serializable {
|
|||||||
this.sort = sort;
|
this.sort = sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Pageable withPage(int pageNumber) {
|
|
||||||
//TODO
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Sort getSort() {
|
public Sort getSort() {
|
||||||
return sort;
|
return sort;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package ru.ulstu.core.model;
|
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.core.AuthenticationException;
|
||||||
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.ulstu.user.error.UserBlockedException;
|
import ru.ulstu.user.error.UserBlockedException;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package ru.ulstu.core.model;
|
package ru.ulstu.core.model;
|
||||||
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import jakarta.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import jakarta.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import javax.persistence.MappedSuperclass;
|
||||||
import jakarta.persistence.Version;
|
import javax.persistence.Version;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
package ru.ulstu.core.navigation;
|
package ru.ulstu.core.navigation;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
@Named
|
||||||
public class Page {
|
public class Page {
|
||||||
public static final String INDEX = "/index.html";
|
public static final String INDEX = "/index.xhtml";
|
||||||
public static final String PAPER = "/paper/paper.html";
|
public static final String PAPER = "/paper/paper.xhtml";
|
||||||
public static final String PAPER_LIST = "/paper/papers.html";
|
public static final String PAPER_LIST = "/paper/papers.xhtml";
|
||||||
public static final String PAPER_DASHBOARD = "/paper/dashboard.html";
|
public static final String PAPER_DASHBOARD = "/paper/dashboard.xhtml";
|
||||||
public static final String GRANT = "/grant/grant.html";
|
public static final String GRANT = "/grant/grant.xhtml";
|
||||||
public static final String GRANT_LIST = "/grant/grants.html";
|
public static final String GRANT_LIST = "/grant/grants.xhtml";
|
||||||
public static final String GRANT_DASHBOARD = "/grant/dashboard.html";
|
public static final String GRANT_DASHBOARD = "/grant/dashboard.xhtml";
|
||||||
public static final String USER_LIST = "/admin/users.html";
|
public static final String USER_LIST = "/admin/users.xhtml";
|
||||||
public static final String LOGOUT = "/logout";
|
public static final String LOGOUT = "/logout";
|
||||||
public static final String CONFERENCE = "/conference/conference.html";
|
public static final String CONFERENCE = "/conference/conference.xhtml";
|
||||||
public static final String CONFERENCE_DASHBOARD = "/conference/dashboard.html";
|
public static final String CONFERENCE_DASHBOARD = "/conference/dashboard.xhtml";
|
||||||
public static final String CONFERENCE_LIST = "/conference/conferences.html";
|
public static final String CONFERENCE_LIST = "/conference/conferences.xhtml";
|
||||||
public static final String PROJECT_DASHBOARD = "/conference/dashboard.html";
|
public static final String PROJECT_DASHBOARD = "/conference/dashboard.xhtml";
|
||||||
|
|
||||||
public String getIndex() {
|
public String getIndex() {
|
||||||
return INDEX;
|
return INDEX;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package ru.ulstu.core.repository;
|
package ru.ulstu.core.repository;
|
||||||
|
|
||||||
import jakarta.persistence.EntityManager;
|
|
||||||
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
|
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
|
||||||
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
|
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class JpaDetachableRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID>
|
public class JpaDetachableRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID>
|
||||||
|
47
src/main/java/ru/ulstu/core/util/FacesUtil.java
Normal file
47
src/main/java/ru/ulstu/core/util/FacesUtil.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package ru.ulstu.core.util;
|
||||||
|
|
||||||
|
import javax.faces.FacesException;
|
||||||
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.faces.context.ExternalContext;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class FacesUtil {
|
||||||
|
public static void redirectToPage(FacesContext context, String page, String params) {
|
||||||
|
ExternalContext extContext = context.getExternalContext();
|
||||||
|
String url = extContext.encodeActionURL(context.getApplication().getViewHandler().getActionURL(context, page)
|
||||||
|
+ params);
|
||||||
|
try {
|
||||||
|
extContext.redirect(url);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new FacesException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void redirectToPage(String page) {
|
||||||
|
redirectToPage(FacesContext.getCurrentInstance(), page, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void redirectToPage(String page, String params) {
|
||||||
|
redirectToPage(FacesContext.getCurrentInstance(), page, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, String> getRequestParams() {
|
||||||
|
return FacesContext.getCurrentInstance().
|
||||||
|
getExternalContext().getRequestParameterMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showInfoMessage(String summary, String detail) {
|
||||||
|
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, detail);
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.getExternalContext().getFlash().setKeepMessages(true);
|
||||||
|
fc.addMessage("messages", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showDangerMessage(String summary, String detail) {
|
||||||
|
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, summary, detail);
|
||||||
|
FacesContext.getCurrentInstance().addMessage(null, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,15 +2,15 @@ package ru.ulstu.deadline.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
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 org.springframework.format.annotation.DateTimeFormat;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
import ru.ulstu.user.model.User;
|
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.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -108,7 +108,9 @@ public class Deadline extends BaseEntity {
|
|||||||
}
|
}
|
||||||
return getId().equals(deadline.getId()) &&
|
return getId().equals(deadline.getId()) &&
|
||||||
description.equals(deadline.description) &&
|
description.equals(deadline.description) &&
|
||||||
date.equals(deadline.date);
|
date.equals(deadline.date) &&
|
||||||
|
executors.equals(deadline.executors) &&
|
||||||
|
done.equals(deadline.done);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package ru.ulstu.file.model;
|
package ru.ulstu.file.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Table;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package ru.ulstu.grant.controller;
|
package ru.ulstu.grant.controller;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
@ -18,7 +16,9 @@ import ru.ulstu.grant.model.GrantDto;
|
|||||||
import ru.ulstu.grant.service.GrantService;
|
import ru.ulstu.grant.service.GrantService;
|
||||||
import ru.ulstu.paper.model.PaperDto;
|
import ru.ulstu.paper.model.PaperDto;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
|
|||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@RequestMapping(value = "/grants")
|
@RequestMapping(value = "/grants")
|
||||||
@Hidden
|
@ApiIgnore
|
||||||
public class GrantController {
|
public class GrantController {
|
||||||
private final GrantService grantService;
|
private final GrantService grantService;
|
||||||
|
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package ru.ulstu.grant.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
import ru.ulstu.grant.model.Grant;
|
||||||
|
import ru.ulstu.grant.service.GrantService;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class GrantDashboardView {
|
||||||
|
@Inject
|
||||||
|
private GrantService grantService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
private List<Grant> grants;
|
||||||
|
|
||||||
|
private List<Grant> selectedGrants = new ArrayList<>();
|
||||||
|
|
||||||
|
private String newGrantTitle;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
grants = grantService.findAllActiveByCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Grant> getGrants() {
|
||||||
|
return grants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
grantService.createByTitle(newGrantTitle);
|
||||||
|
FacesUtil.showInfoMessage("Статья создана", newGrantTitle);
|
||||||
|
newGrantTitle = "";
|
||||||
|
grants = grantService.findAllActiveByCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteSelected() {
|
||||||
|
grantService.delete(selectedGrants);
|
||||||
|
grants = grantService.findAllActiveByCurrentUser();
|
||||||
|
FacesUtil.showInfoMessage("Было удалено грантов: " + selectedGrants.size(), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Grant.GrantStatus> getGrantStatuses() {
|
||||||
|
return Arrays.asList(Grant.GrantStatus.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewGrantTitle() {
|
||||||
|
return newGrantTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewGrantTitle(String newGrantTitle) {
|
||||||
|
this.newGrantTitle = newGrantTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Grant> getSelectedGrants() {
|
||||||
|
return selectedGrants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedGrants(List<Grant> selectedGrants) {
|
||||||
|
this.selectedGrants = selectedGrants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentUser() {
|
||||||
|
return userService.getCurrentUser().getUserAbbreviate();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package ru.ulstu.grant.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.grant.model.Grant;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.convert.Converter;
|
||||||
|
import javax.faces.convert.FacesConverter;
|
||||||
|
|
||||||
|
@FacesConverter(value = "grantStatusConverter")
|
||||||
|
public class GrantStatusConverter implements Converter {
|
||||||
|
@Override
|
||||||
|
public Object getAsObject(FacesContext context, UIComponent component, String value) {
|
||||||
|
return Grant.GrantStatus.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAsString(FacesContext context, UIComponent component, Object value) {
|
||||||
|
return value == null ? "" : ((Grant.GrantStatus) value).name();
|
||||||
|
}
|
||||||
|
}
|
94
src/main/java/ru/ulstu/grant/controller/GrantView.java
Normal file
94
src/main/java/ru/ulstu/grant/controller/GrantView.java
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
package ru.ulstu.grant.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.core.navigation.Page;
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
|
import ru.ulstu.deadline.service.DeadlineService;
|
||||||
|
import ru.ulstu.grant.model.Grant;
|
||||||
|
import ru.ulstu.grant.service.GrantService;
|
||||||
|
import ru.ulstu.user.model.User;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class GrantView implements Serializable {
|
||||||
|
@Inject
|
||||||
|
private GrantService grantService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DeadlineService deadlineService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
private Grant grant;
|
||||||
|
|
||||||
|
private Date newDeadlineDate;
|
||||||
|
|
||||||
|
private String newDeadlineDescription;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
grant = grantService.findById(Integer.valueOf(FacesUtil.getRequestParams().get("id")));
|
||||||
|
newDeadlineDescription = "";
|
||||||
|
newDeadlineDate = new Date();
|
||||||
|
FacesUtil.showInfoMessage("Статья открыта", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Grant getGrant() {
|
||||||
|
return grant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrant(Grant grant) {
|
||||||
|
this.grant = grant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Grant.GrantStatus> getGrantStatuses() {
|
||||||
|
return Arrays.asList(Grant.GrantStatus.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> getAuthors() {
|
||||||
|
return userService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String save() {
|
||||||
|
grantService.save(grant);
|
||||||
|
FacesUtil.showInfoMessage("Грант сохранен", "");
|
||||||
|
return Page.GRANT_LIST + "?faces-redirect=true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getNewDeadlineDate() {
|
||||||
|
return newDeadlineDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewDeadlineDate(Date newDeadlineDate) {
|
||||||
|
this.newDeadlineDate = newDeadlineDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewDeadlineDescription() {
|
||||||
|
return newDeadlineDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewDeadlineDescription(String newDeadlineDescription) {
|
||||||
|
this.newDeadlineDescription = newDeadlineDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteDeadline(Deadline deadline) {
|
||||||
|
grant.getDeadlines().remove(deadline);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDeadline() {
|
||||||
|
grant.getDeadlines().add(deadlineService.create(newDeadlineDescription, newDeadlineDate));
|
||||||
|
newDeadlineDescription = "";
|
||||||
|
newDeadlineDate = new Date();
|
||||||
|
}
|
||||||
|
}
|
68
src/main/java/ru/ulstu/grant/controller/GrantsView.java
Normal file
68
src/main/java/ru/ulstu/grant/controller/GrantsView.java
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package ru.ulstu.grant.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
import ru.ulstu.grant.model.Grant;
|
||||||
|
import ru.ulstu.grant.service.GrantService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class GrantsView {
|
||||||
|
@Inject
|
||||||
|
private GrantService grantService;
|
||||||
|
|
||||||
|
private List<Grant> grants;
|
||||||
|
|
||||||
|
private List<Grant> selectedGrants = new ArrayList<>();
|
||||||
|
|
||||||
|
private String newGrantTitle;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
grants = grantService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
grantService.createByTitle(newGrantTitle);
|
||||||
|
FacesUtil.showInfoMessage("Статья создана", newGrantTitle);
|
||||||
|
newGrantTitle = "";
|
||||||
|
grants = grantService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteSelected() {
|
||||||
|
grantService.delete(selectedGrants);
|
||||||
|
grants = grantService.findAll();
|
||||||
|
FacesUtil.showInfoMessage("Было удалено грантов: " + selectedGrants.size(), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Grant.GrantStatus> getGrantStatuses() {
|
||||||
|
return Arrays.asList(Grant.GrantStatus.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Grant> getGrants() {
|
||||||
|
return grants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewGrantTitle() {
|
||||||
|
return newGrantTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewGrantTitle(String newGrantTitle) {
|
||||||
|
this.newGrantTitle = newGrantTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Grant> getSelectedGrants() {
|
||||||
|
return selectedGrants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedGrants(List<Grant> selectedGrants) {
|
||||||
|
this.selectedGrants = selectedGrants;
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,5 @@
|
|||||||
package ru.ulstu.grant.model;
|
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.Fetch;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
@ -27,6 +12,21 @@ import ru.ulstu.project.model.Project;
|
|||||||
import ru.ulstu.timeline.model.Event;
|
import ru.ulstu.timeline.model.Event;
|
||||||
import ru.ulstu.user.model.User;
|
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.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -2,7 +2,6 @@ package ru.ulstu.grant.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
import ru.ulstu.file.model.FileDataDto;
|
import ru.ulstu.file.model.FileDataDto;
|
||||||
@ -11,6 +10,7 @@ import ru.ulstu.paper.model.PaperDto;
|
|||||||
import ru.ulstu.project.model.ProjectDto;
|
import ru.ulstu.project.model.ProjectDto;
|
||||||
import ru.ulstu.user.model.UserDto;
|
import ru.ulstu.user.model.UserDto;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.ulstu.grant.service;
|
package ru.ulstu.grant.service;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.core.util.DateUtils;
|
import ru.ulstu.core.util.DateUtils;
|
||||||
import ru.ulstu.grant.model.Grant;
|
import ru.ulstu.grant.model.Grant;
|
||||||
@ -45,22 +46,22 @@ public class GrantNotificationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessageDeadline(Grant grant) {
|
private void sendMessageDeadline(Grant grant) {
|
||||||
Map<String, Object> variables = Map.of("grant", grant);
|
Map<String, Object> variables = ImmutableMap.of("grant", grant);
|
||||||
sendForAllAuthors(variables, grant, TEMPLATE_DEADLINE, String.format(TITLE_DEADLINE, grant.getTitle()));
|
sendForAllAuthors(variables, grant, TEMPLATE_DEADLINE, String.format(TITLE_DEADLINE, grant.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendCreateNotification(Grant grant) {
|
public void sendCreateNotification(Grant grant) {
|
||||||
Map<String, Object> variables = Map.of("grant", grant);
|
Map<String, Object> variables = ImmutableMap.of("grant", grant);
|
||||||
sendForAllAuthors(variables, grant, TEMPLATE_CREATE, String.format(TITLE_CREATE, grant.getTitle()));
|
sendForAllAuthors(variables, grant, TEMPLATE_CREATE, String.format(TITLE_CREATE, grant.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendAuthorsChangeNotification(Grant grant, Set<User> oldAuthors) {
|
public void sendAuthorsChangeNotification(Grant grant, Set<User> oldAuthors) {
|
||||||
Map<String, Object> variables = Map.of("grant", grant, "oldAuthors", oldAuthors);
|
Map<String, Object> variables = ImmutableMap.of("grant", grant, "oldAuthors", oldAuthors);
|
||||||
sendForAllAuthors(variables, grant, TEMPLATE_AUTHORS_CHANGED, String.format(TITLE_AUTHORS_CHANGED, grant.getTitle()));
|
sendForAllAuthors(variables, grant, TEMPLATE_AUTHORS_CHANGED, String.format(TITLE_AUTHORS_CHANGED, grant.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendLeaderChangeNotification(Grant grant, User oldLeader) {
|
public void sendLeaderChangeNotification(Grant grant, User oldLeader) {
|
||||||
Map<String, Object> variables = Map.of("grant", grant, "oldLeader", oldLeader);
|
Map<String, Object> variables = ImmutableMap.of("grant", grant, "oldLeader", oldLeader);
|
||||||
sendForAllAuthors(variables, grant, TEMPLATE_LEADER_CHANGED, String.format(TITLE_LEADER_CHANGED, grant.getTitle()));
|
sendForAllAuthors(variables, grant, TEMPLATE_LEADER_CHANGED, String.format(TITLE_LEADER_CHANGED, grant.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
@Controller()
|
|
||||||
@RequestMapping(value = "/index")
|
|
||||||
@Hidden
|
|
||||||
public class IndexController extends AdviceController {
|
|
||||||
public IndexController(UserService userService) {
|
|
||||||
super(userService);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
public void currentUser(ModelMap modelMap) {
|
|
||||||
//нужен здесь для добавления параметров на стартовой странице
|
|
||||||
}
|
|
||||||
}
|
|
28
src/main/java/ru/ulstu/index/controller/IndexView.java
Normal file
28
src/main/java/ru/ulstu/index/controller/IndexView.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package ru.ulstu.index.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.core.navigation.Page;
|
||||||
|
import ru.ulstu.index.model.Section;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class IndexView {
|
||||||
|
private List<Section> sections = new ArrayList<>();
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
sections.add(new Section("Статьи", Page.PAPER_DASHBOARD, "papers.jpg"));
|
||||||
|
sections.add(new Section("Конференции", Page.CONFERENCE_DASHBOARD, "conf.jpg"));
|
||||||
|
sections.add(new Section("Гранты", Page.GRANT_DASHBOARD, "grants.jpg"));
|
||||||
|
sections.add(new Section("Проекты", Page.PROJECT_DASHBOARD, "projects.jpg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Section> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,14 @@
|
|||||||
package ru.ulstu.odin.model;
|
package ru.ulstu.odin.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
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.core.error.OdinException;
|
||||||
import ru.ulstu.odin.model.annotation.OdinCaption;
|
import ru.ulstu.odin.model.annotation.OdinCaption;
|
||||||
import ru.ulstu.odin.model.annotation.OdinReadOnly;
|
import ru.ulstu.odin.model.annotation.OdinReadOnly;
|
||||||
import ru.ulstu.odin.model.annotation.OdinVisible;
|
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.annotation.Annotation;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package ru.ulstu.odin.model;
|
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;
|
||||||
import ru.ulstu.odin.model.annotation.OdinString.OdinStringType;
|
import ru.ulstu.odin.model.annotation.OdinString.OdinStringType;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Email;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import static ru.ulstu.odin.model.annotation.OdinString.OdinStringType.EMAIL;
|
import static ru.ulstu.odin.model.annotation.OdinString.OdinStringType.EMAIL;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package ru.ulstu.paper.controller;
|
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.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@ -23,7 +21,9 @@ import ru.ulstu.paper.model.ReferenceDto;
|
|||||||
import ru.ulstu.paper.service.LatexService;
|
import ru.ulstu.paper.service.LatexService;
|
||||||
import ru.ulstu.paper.service.PaperService;
|
import ru.ulstu.paper.service.PaperService;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -37,7 +37,7 @@ import static org.springframework.util.StringUtils.isEmpty;
|
|||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@RequestMapping(value = "/papers")
|
@RequestMapping(value = "/papers")
|
||||||
@Hidden
|
@ApiIgnore
|
||||||
public class PaperController {
|
public class PaperController {
|
||||||
private final PaperService paperService;
|
private final PaperService paperService;
|
||||||
private final ConferenceService conferenceService;
|
private final ConferenceService conferenceService;
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package ru.ulstu.paper.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
import ru.ulstu.paper.model.Paper;
|
||||||
|
import ru.ulstu.paper.service.PaperService;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class PaperDashboardView {
|
||||||
|
@Inject
|
||||||
|
private PaperService paperService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
private List<Paper> papers;
|
||||||
|
|
||||||
|
private List<Paper> selectedPapers = new ArrayList<>();
|
||||||
|
|
||||||
|
private String newPaperTitle;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
papers = paperService.findAllActiveByCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Paper> getPapers() {
|
||||||
|
return papers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
paperService.createByTitle(newPaperTitle);
|
||||||
|
FacesUtil.showInfoMessage("Статья создана", newPaperTitle);
|
||||||
|
newPaperTitle = "";
|
||||||
|
papers = paperService.findAllActiveByCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteSelected() {
|
||||||
|
paperService.delete(selectedPapers);
|
||||||
|
papers = paperService.findAllActiveByCurrentUser();
|
||||||
|
FacesUtil.showInfoMessage("Было удалено статей: " + selectedPapers.size(), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Paper.PaperStatus> getPaperStatuses() {
|
||||||
|
return Arrays.asList(Paper.PaperStatus.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewPaperTitle() {
|
||||||
|
return newPaperTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewPaperTitle(String newPaperTitle) {
|
||||||
|
this.newPaperTitle = newPaperTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Paper> getSelectedPapers() {
|
||||||
|
return selectedPapers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedPapers(List<Paper> selectedPapers) {
|
||||||
|
this.selectedPapers = selectedPapers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentUser() {
|
||||||
|
return userService.getCurrentUser().getUserAbbreviate();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package ru.ulstu.paper.controller;
|
package ru.ulstu.paper.controller;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@ -17,6 +16,7 @@ import ru.ulstu.paper.model.PaperListDto;
|
|||||||
import ru.ulstu.paper.model.ReferenceDto;
|
import ru.ulstu.paper.model.ReferenceDto;
|
||||||
import ru.ulstu.paper.service.PaperService;
|
import ru.ulstu.paper.service.PaperService;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package ru.ulstu.paper.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.paper.model.Paper;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.convert.Converter;
|
||||||
|
import javax.faces.convert.FacesConverter;
|
||||||
|
|
||||||
|
@FacesConverter(value = "paperStatusConverter")
|
||||||
|
public class PaperStatusConverter implements Converter {
|
||||||
|
@Override
|
||||||
|
public Object getAsObject(FacesContext context, UIComponent component, String value) {
|
||||||
|
return Paper.PaperStatus.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAsString(FacesContext context, UIComponent component, Object value) {
|
||||||
|
return value == null ? "" : ((Paper.PaperStatus) value).name();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package ru.ulstu.paper.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.paper.model.Paper;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.convert.Converter;
|
||||||
|
import javax.faces.convert.FacesConverter;
|
||||||
|
|
||||||
|
@FacesConverter(value = "paperTypeConverter")
|
||||||
|
public class PaperTypeConverter implements Converter {
|
||||||
|
@Override
|
||||||
|
public Object getAsObject(FacesContext context, UIComponent component, String value) {
|
||||||
|
return Paper.PaperType.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAsString(FacesContext context, UIComponent component, Object value) {
|
||||||
|
return ((Paper.PaperType) value).name();
|
||||||
|
}
|
||||||
|
}
|
120
src/main/java/ru/ulstu/paper/controller/PaperView.java
Normal file
120
src/main/java/ru/ulstu/paper/controller/PaperView.java
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
package ru.ulstu.paper.controller;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import ru.ulstu.conference.model.Conference;
|
||||||
|
import ru.ulstu.conference.service.ConferenceService;
|
||||||
|
import ru.ulstu.core.navigation.Page;
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
|
import ru.ulstu.deadline.service.DeadlineService;
|
||||||
|
import ru.ulstu.paper.model.Paper;
|
||||||
|
import ru.ulstu.paper.service.PaperService;
|
||||||
|
import ru.ulstu.user.model.User;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class PaperView implements Serializable {
|
||||||
|
private static final int MAX_CONFERENCE_TITLE_LENGTH = 20;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private PaperService paperService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DeadlineService deadlineService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ConferenceService conferenceService;
|
||||||
|
|
||||||
|
private Paper paper;
|
||||||
|
|
||||||
|
private Date newDeadlineDate;
|
||||||
|
|
||||||
|
private String newDeadlineDescription;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
paper = paperService.findPaperById(Integer.valueOf(FacesUtil.getRequestParams().get("id")));
|
||||||
|
newDeadlineDescription = "";
|
||||||
|
newDeadlineDate = new Date();
|
||||||
|
FacesUtil.showInfoMessage("Статья открыта", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paper getPaper() {
|
||||||
|
return paper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaper(Paper paper) {
|
||||||
|
this.paper = paper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Paper.PaperStatus> getPaperStatuses() {
|
||||||
|
return Arrays.asList(Paper.PaperStatus.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Paper.PaperType> getPaperTypes() {
|
||||||
|
return Arrays.asList(Paper.PaperType.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> getAuthors() {
|
||||||
|
return userService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String save() {
|
||||||
|
paperService.save(paper);
|
||||||
|
FacesUtil.showInfoMessage("Статья сохранена", "");
|
||||||
|
return Page.PAPER_LIST + "?faces-redirect=true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getNewDeadlineDate() {
|
||||||
|
return newDeadlineDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewDeadlineDate(Date newDeadlineDate) {
|
||||||
|
this.newDeadlineDate = newDeadlineDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewDeadlineDescription() {
|
||||||
|
return newDeadlineDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewDeadlineDescription(String newDeadlineDescription) {
|
||||||
|
this.newDeadlineDescription = newDeadlineDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteDeadline(Deadline deadline) {
|
||||||
|
paper.getDeadlines().remove(deadline);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDeadline() {
|
||||||
|
paper.getDeadlines().add(deadlineService.create(newDeadlineDescription, newDeadlineDate));
|
||||||
|
newDeadlineDescription = "";
|
||||||
|
newDeadlineDate = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Conference> getConferences() {
|
||||||
|
return conferenceService.findAllActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConferenceTitle(Conference conference) {
|
||||||
|
if (conference == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (conference.getTitle().length() > MAX_CONFERENCE_TITLE_LENGTH) {
|
||||||
|
return StringUtils.truncate(conference.getTitle(), MAX_CONFERENCE_TITLE_LENGTH) + "...";
|
||||||
|
}
|
||||||
|
return conference.getTitle();
|
||||||
|
}
|
||||||
|
}
|
68
src/main/java/ru/ulstu/paper/controller/PapersView.java
Normal file
68
src/main/java/ru/ulstu/paper/controller/PapersView.java
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package ru.ulstu.paper.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
import ru.ulstu.paper.model.Paper;
|
||||||
|
import ru.ulstu.paper.service.PaperService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class PapersView {
|
||||||
|
@Inject
|
||||||
|
private PaperService paperService;
|
||||||
|
|
||||||
|
private List<Paper> papers;
|
||||||
|
|
||||||
|
private List<Paper> selectedPapers = new ArrayList<>();
|
||||||
|
|
||||||
|
private String newPaperTitle;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
papers = paperService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
paperService.createByTitle(newPaperTitle);
|
||||||
|
FacesUtil.showInfoMessage("Статья создана", newPaperTitle);
|
||||||
|
newPaperTitle = "";
|
||||||
|
papers = paperService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteSelected() {
|
||||||
|
paperService.delete(selectedPapers);
|
||||||
|
papers = paperService.findAll();
|
||||||
|
FacesUtil.showInfoMessage("Было удалено статей: " + selectedPapers.size(), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Paper.PaperStatus> getPaperStatuses() {
|
||||||
|
return Arrays.asList(Paper.PaperStatus.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Paper> getPapers() {
|
||||||
|
return papers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewPaperTitle() {
|
||||||
|
return newPaperTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewPaperTitle(String newPaperTitle) {
|
||||||
|
this.newPaperTitle = newPaperTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Paper> getSelectedPapers() {
|
||||||
|
return selectedPapers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedPapers(List<Paper> selectedPapers) {
|
||||||
|
this.selectedPapers = selectedPapers;
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,5 @@
|
|||||||
package ru.ulstu.paper.model;
|
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.Fetch;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
import ru.ulstu.conference.model.Conference;
|
import ru.ulstu.conference.model.Conference;
|
||||||
@ -27,6 +12,21 @@ import ru.ulstu.grant.model.Grant;
|
|||||||
import ru.ulstu.timeline.model.Event;
|
import ru.ulstu.timeline.model.Event;
|
||||||
import ru.ulstu.user.model.User;
|
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.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -100,7 +100,7 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
|
|||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date updateDate = new Date();
|
private Date updateDate = new Date();
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||||
@JoinColumn(name = "paper_id", unique = true)
|
@JoinColumn(name = "paper_id", unique = true)
|
||||||
@Fetch(FetchMode.SUBSELECT)
|
@Fetch(FetchMode.SUBSELECT)
|
||||||
@OrderBy("date")
|
@OrderBy("date")
|
||||||
@ -123,6 +123,10 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
|
|||||||
|
|
||||||
@ManyToMany(fetch = FetchType.EAGER)
|
@ManyToMany(fetch = FetchType.EAGER)
|
||||||
private Set<User> authors = new HashSet<>();
|
private Set<User> authors = new HashSet<>();
|
||||||
|
|
||||||
|
@Column(name = "latex_text")
|
||||||
|
private String latexText;
|
||||||
|
|
||||||
@ManyToOne()
|
@ManyToOne()
|
||||||
@JoinColumn(name = "conference_id")
|
@JoinColumn(name = "conference_id")
|
||||||
private Conference conference;
|
private Conference conference;
|
||||||
@ -241,6 +245,14 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
|
|||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLatexText() {
|
||||||
|
return latexText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatexText(String latexText) {
|
||||||
|
this.latexText = latexText;
|
||||||
|
}
|
||||||
|
|
||||||
public Conference getConference() {
|
public Conference getConference() {
|
||||||
return conference;
|
return conference;
|
||||||
}
|
}
|
||||||
@ -310,12 +322,13 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
|
|||||||
Objects.equals(events, paper.events) &&
|
Objects.equals(events, paper.events) &&
|
||||||
Objects.equals(files, paper.files) &&
|
Objects.equals(files, paper.files) &&
|
||||||
Objects.equals(authors, paper.authors) &&
|
Objects.equals(authors, paper.authors) &&
|
||||||
|
Objects.equals(latexText, paper.latexText) &&
|
||||||
Objects.equals(conference, paper.conference) &&
|
Objects.equals(conference, paper.conference) &&
|
||||||
Objects.equals(grants, paper.grants);
|
Objects.equals(grants, paper.grants);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(super.hashCode(), title, status, type, createDate, updateDate, deadlines, comment, url, locked, events, files, authors, conference, grants);
|
return Objects.hash(super.hashCode(), title, status, type, createDate, updateDate, deadlines, comment, url, locked, events, files, authors, latexText, conference, grants);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,13 @@ package ru.ulstu.paper.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.Size;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
|
||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
import ru.ulstu.file.model.FileDataDto;
|
import ru.ulstu.file.model.FileDataDto;
|
||||||
import ru.ulstu.user.model.UserDto;
|
import ru.ulstu.user.model.UserDto;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -90,9 +89,10 @@ public class PaperDto {
|
|||||||
this.deadlines = paper.getDeadlines();
|
this.deadlines = paper.getDeadlines();
|
||||||
this.comment = paper.getComment();
|
this.comment = paper.getComment();
|
||||||
this.url = paper.getUrl();
|
this.url = paper.getUrl();
|
||||||
|
this.latexText = paper.getLatexText();
|
||||||
this.locked = paper.getLocked();
|
this.locked = paper.getLocked();
|
||||||
this.files = convert(paper.getFiles(), FileDataDto::new);
|
this.files = convert(paper.getFiles(), FileDataDto::new);
|
||||||
this.authorIds = convert(paper.getAuthors(), BaseEntity::getId);
|
this.authorIds = convert(paper.getAuthors(), user -> user.getId());
|
||||||
this.authors = convert(paper.getAuthors(), UserDto::new);
|
this.authors = convert(paper.getAuthors(), UserDto::new);
|
||||||
this.references = convert(paper.getReferences(), ReferenceDto::new);
|
this.references = convert(paper.getReferences(), ReferenceDto::new);
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ public class PaperDto {
|
|||||||
public String getAuthorsString() {
|
public String getAuthorsString() {
|
||||||
return StringUtils.abbreviate(authors
|
return StringUtils.abbreviate(authors
|
||||||
.stream()
|
.stream()
|
||||||
.map(UserDto::getLastName)
|
.map(author -> author.getLastName())
|
||||||
.collect(Collectors.joining(", ")), MAX_AUTHORS_LENGTH);
|
.collect(Collectors.joining(", ")), MAX_AUTHORS_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package ru.ulstu.paper.model;
|
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 ru.ulstu.core.model.BaseEntity;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Reference extends BaseEntity {
|
public class Reference extends BaseEntity {
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.ulstu.paper.service;
|
package ru.ulstu.paper.service;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.core.util.DateUtils;
|
import ru.ulstu.core.util.DateUtils;
|
||||||
import ru.ulstu.paper.model.Paper;
|
import ru.ulstu.paper.model.Paper;
|
||||||
@ -45,22 +46,22 @@ public class PaperNotificationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessageDeadline(Paper paper) {
|
private void sendMessageDeadline(Paper paper) {
|
||||||
Map<String, Object> variables = Map.of("paper", paper);
|
Map<String, Object> variables = ImmutableMap.of("paper", paper);
|
||||||
sendForAllAuhtors(variables, paper, TEMPLATE_DEADLINE, TITLE_DEADLINE);
|
sendForAllAuhtors(variables, paper, TEMPLATE_DEADLINE, TITLE_DEADLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendCreateNotification(Paper paper) {
|
public void sendCreateNotification(Paper paper) {
|
||||||
Map<String, Object> variables = Map.of("paper", paper);
|
Map<String, Object> variables = ImmutableMap.of("paper", paper);
|
||||||
sendForAllAuhtors(variables, paper, TEMPLATE_CREATE, TITLE_CREATE);
|
sendForAllAuhtors(variables, paper, TEMPLATE_CREATE, TITLE_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void statusChangeNotification(Paper paper, Paper.PaperStatus oldStatus) {
|
public void statusChangeNotification(Paper paper, Paper.PaperStatus oldStatus) {
|
||||||
Map<String, Object> variables = Map.of("paper", paper, "oldStatus", oldStatus);
|
Map<String, Object> variables = ImmutableMap.of("paper", paper, "oldStatus", oldStatus);
|
||||||
sendForAllAuhtors(variables, paper, TEMPLATE_STATUS_CHANGED, TITLE_STATUS_CHANGED);
|
sendForAllAuhtors(variables, paper, TEMPLATE_STATUS_CHANGED, TITLE_STATUS_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendFailedNotification(Paper paper, Paper.PaperStatus oldStatus) {
|
public void sendFailedNotification(Paper paper, Paper.PaperStatus oldStatus) {
|
||||||
Map<String, Object> variables = Map.of("paper", paper, "oldStatus", oldStatus);
|
Map<String, Object> variables = ImmutableMap.of("paper", paper, "oldStatus", oldStatus);
|
||||||
sendForAllAuhtors(variables, paper, TEMPLATE_FAILED, TITLE_FAILED);
|
sendForAllAuhtors(variables, paper, TEMPLATE_FAILED, TITLE_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,9 @@ public class PaperService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<PaperDto> findAllDto() {
|
public List<PaperDto> findAllDto() {
|
||||||
return convert(findAll(), PaperDto::new);
|
List<PaperDto> papers = convert(findAll(), PaperDto::new);
|
||||||
|
papers.forEach(paperDto -> paperDto.setTitle(StringUtils.abbreviate(paperDto.getTitle(), MAX_DISPLAY_SIZE)));
|
||||||
|
return papers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Paper> findAllActive() {
|
public List<Paper> findAllActive() {
|
||||||
@ -123,6 +125,7 @@ public class PaperService {
|
|||||||
private Paper copyFromDto(Paper paper, PaperDto paperDto) throws IOException {
|
private Paper copyFromDto(Paper paper, PaperDto paperDto) throws IOException {
|
||||||
paper.setComment(paperDto.getComment());
|
paper.setComment(paperDto.getComment());
|
||||||
paper.setUrl(paperDto.getUrl());
|
paper.setUrl(paperDto.getUrl());
|
||||||
|
paper.setLatexText(paperDto.getLatexText());
|
||||||
paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate());
|
paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate());
|
||||||
paper.setLocked(paperDto.getLocked());
|
paper.setLocked(paperDto.getLocked());
|
||||||
paper.setStatus(paperDto.getStatus() == null ? DRAFT : paperDto.getStatus());
|
paper.setStatus(paperDto.getStatus() == null ? DRAFT : paperDto.getStatus());
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
package ru.ulstu.ping.model;
|
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.Any;
|
||||||
import org.hibernate.annotations.AnyDiscriminator;
|
import org.hibernate.annotations.AnyMetaDef;
|
||||||
import org.hibernate.annotations.AnyDiscriminatorValue;
|
import org.hibernate.annotations.MetaValue;
|
||||||
import org.hibernate.annotations.AnyKeyJavaClass;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import ru.ulstu.conference.model.Conference;
|
import ru.ulstu.conference.model.Conference;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
@ -21,6 +12,14 @@ import ru.ulstu.paper.model.Paper;
|
|||||||
import ru.ulstu.project.model.Project;
|
import ru.ulstu.project.model.Project;
|
||||||
import ru.ulstu.user.model.User;
|
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;
|
import java.util.Date;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@ -37,15 +36,20 @@ public class Ping extends BaseEntity {
|
|||||||
@Column(name = "activity_type", insertable = false, updatable = false)
|
@Column(name = "activity_type", insertable = false, updatable = false)
|
||||||
private String activityType;
|
private String activityType;
|
||||||
|
|
||||||
@Any
|
@Any(
|
||||||
@AnyDiscriminator(DiscriminatorType.STRING)
|
metaColumn = @Column(name = "activity_type"),
|
||||||
@AnyKeyJavaClass(Integer.class)
|
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")
|
||||||
|
}
|
||||||
|
)
|
||||||
@JoinColumn(name = "activity_id")
|
@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;
|
private UserActivity activity;
|
||||||
|
|
||||||
public Ping() {
|
public Ping() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.ulstu.ping.service;
|
package ru.ulstu.ping.service;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
@ -14,7 +15,6 @@ import ru.ulstu.user.service.MailService;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -51,7 +51,7 @@ public class PingScheduler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (PingInfo pingInfo : pingInfos) {
|
for (PingInfo pingInfo : pingInfos) {
|
||||||
mailService.sendEmailFromTemplate(Map.of("pings", pingInfo.getPings()),
|
mailService.sendEmailFromTemplate(ImmutableMap.of("pings", pingInfo.getPings()),
|
||||||
pingInfo.getUser(), "pingsInfoWeekEmail", PING_MAIL_SUBJECT);
|
pingInfo.getUser(), "pingsInfoWeekEmail", PING_MAIL_SUBJECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class PingService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public Ping addPing(UserActivity activity) throws IOException {
|
public Ping addPing(UserActivity activity) throws IOException {
|
||||||
Ping newPing = new Ping(new Date(), userService.getCurrentUser());
|
Ping newPing = new Ping(new Date(), userService.getCurrentUser());
|
||||||
//newPing.setActivity(activity);
|
newPing.setActivity(activity);
|
||||||
return pingRepository.save(newPing);
|
return pingRepository.save(newPing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package ru.ulstu.project.controller;
|
package ru.ulstu.project.controller;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
@ -18,7 +16,9 @@ import ru.ulstu.project.model.Project;
|
|||||||
import ru.ulstu.project.model.ProjectDto;
|
import ru.ulstu.project.model.ProjectDto;
|
||||||
import ru.ulstu.project.service.ProjectService;
|
import ru.ulstu.project.service.ProjectService;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -27,7 +27,7 @@ import static org.springframework.util.StringUtils.isEmpty;
|
|||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@RequestMapping(value = "/projects")
|
@RequestMapping(value = "/projects")
|
||||||
@Hidden
|
@ApiIgnore
|
||||||
public class ProjectController {
|
public class ProjectController {
|
||||||
private final ProjectService projectService;
|
private final ProjectService projectService;
|
||||||
|
|
||||||
|
@ -1,18 +1,5 @@
|
|||||||
package ru.ulstu.project.model;
|
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.Fetch;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
@ -24,6 +11,19 @@ import ru.ulstu.grant.model.Grant;
|
|||||||
import ru.ulstu.timeline.model.Event;
|
import ru.ulstu.timeline.model.Event;
|
||||||
import ru.ulstu.user.model.User;
|
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.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -2,7 +2,6 @@ package ru.ulstu.project.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import org.thymeleaf.util.StringUtils;
|
import org.thymeleaf.util.StringUtils;
|
||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
import ru.ulstu.file.model.FileDataDto;
|
import ru.ulstu.file.model.FileDataDto;
|
||||||
@ -10,6 +9,7 @@ import ru.ulstu.grant.model.GrantDto;
|
|||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
import ru.ulstu.user.model.UserDto;
|
import ru.ulstu.user.model.UserDto;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package ru.ulstu.students.controller;
|
package ru.ulstu.students.controller;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
@ -17,7 +15,9 @@ import ru.ulstu.students.model.TaskDto;
|
|||||||
import ru.ulstu.students.model.TaskFilterDto;
|
import ru.ulstu.students.model.TaskFilterDto;
|
||||||
import ru.ulstu.students.service.TaskService;
|
import ru.ulstu.students.service.TaskService;
|
||||||
import ru.ulstu.tags.model.Tag;
|
import ru.ulstu.tags.model.Tag;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -29,7 +29,7 @@ import static ru.ulstu.students.controller.Navigation.TASK_PAGE;
|
|||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@RequestMapping(value = "/students")
|
@RequestMapping(value = "/students")
|
||||||
@Hidden
|
@ApiIgnore
|
||||||
public class TaskController {
|
public class TaskController {
|
||||||
|
|
||||||
private final TaskService taskService;
|
private final TaskService taskService;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package ru.ulstu.students.model;
|
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 org.springframework.format.annotation.DateTimeFormat;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
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;
|
import java.util.Date;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -1,19 +1,5 @@
|
|||||||
package ru.ulstu.students.model;
|
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.Fetch;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
@ -23,6 +9,20 @@ import ru.ulstu.tags.model.Tag;
|
|||||||
import ru.ulstu.timeline.model.Event;
|
import ru.ulstu.timeline.model.Event;
|
||||||
import ru.ulstu.user.model.User;
|
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.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -2,11 +2,11 @@ package ru.ulstu.students.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
import ru.ulstu.tags.model.Tag;
|
import ru.ulstu.tags.model.Tag;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -11,16 +11,16 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface TaskRepository extends JpaRepository<Task, Integer> {
|
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 t.createDate 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 create_date DESC")
|
||||||
List<Task> filterNew(@Param("status") Task.TaskStatus status, @Param("tag") Tag tag);
|
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 t.createDate 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 create_date ASC")
|
||||||
List<Task> filterOld(@Param("status") Task.TaskStatus status, @Param("tag") Tag tag);
|
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 t.createDate DESC")
|
@Query("SELECT t FROM Task t WHERE(:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY create_date DESC")
|
||||||
List<Task> findByTag(@Param("tag") Tag tag);
|
List<Task> findByTag(@Param("tag") Tag tag);
|
||||||
|
|
||||||
@Query("SELECT t FROM Task t WHERE (t.createDate >= :date) ORDER BY t.createDate DESC")
|
@Query("SELECT t FROM Task t WHERE (t.createDate >= :date) ORDER BY create_date DESC")
|
||||||
List<Task> findAllYear(@Param("date") Date date);
|
List<Task> findAllYear(@Param("date") Date date);
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class TaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Task> findAll() {
|
public List<Task> findAll() {
|
||||||
return taskRepository.findAll(Sort.by(Sort.Direction.DESC, "createDate"));
|
return taskRepository.findAll(new Sort(Sort.Direction.DESC, "createDate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TaskDto> findAllDto() {
|
public List<TaskDto> findAllDto() {
|
||||||
|
@ -2,13 +2,13 @@ package ru.ulstu.tags.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
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 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;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package ru.ulstu.timeline.controller;
|
package ru.ulstu.timeline.controller;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@ -14,6 +13,7 @@ import ru.ulstu.core.model.response.Response;
|
|||||||
import ru.ulstu.timeline.model.EventDto;
|
import ru.ulstu.timeline.model.EventDto;
|
||||||
import ru.ulstu.timeline.service.EventService;
|
import ru.ulstu.timeline.service.EventService;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -1,19 +1,5 @@
|
|||||||
package ru.ulstu.timeline.model;
|
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.conference.model.Conference;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
import ru.ulstu.grant.model.Grant;
|
import ru.ulstu.grant.model.Grant;
|
||||||
@ -22,6 +8,20 @@ import ru.ulstu.project.model.Project;
|
|||||||
import ru.ulstu.students.model.Task;
|
import ru.ulstu.students.model.Task;
|
||||||
import ru.ulstu.user.model.User;
|
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.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -2,8 +2,6 @@ package ru.ulstu.timeline.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
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.conference.model.ConferenceDto;
|
||||||
import ru.ulstu.grant.model.GrantDto;
|
import ru.ulstu.grant.model.GrantDto;
|
||||||
import ru.ulstu.paper.model.PaperDto;
|
import ru.ulstu.paper.model.PaperDto;
|
||||||
@ -11,6 +9,8 @@ import ru.ulstu.project.model.ProjectDto;
|
|||||||
import ru.ulstu.students.model.TaskDto;
|
import ru.ulstu.students.model.TaskDto;
|
||||||
import ru.ulstu.user.model.UserDto;
|
import ru.ulstu.user.model.UserDto;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package ru.ulstu.timeline.model;
|
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 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.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.ulstu.timeline.service;
|
package ru.ulstu.timeline.service;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
@ -30,7 +31,7 @@ public class EventScheduler {
|
|||||||
public void sendNotifications() {
|
public void sendNotifications() {
|
||||||
List<Event> events = eventService.findByCurrentDate();
|
List<Event> events = eventService.findByCurrentDate();
|
||||||
events.forEach(event -> {
|
events.forEach(event -> {
|
||||||
Map<String, Object> variables = Map.of("description", event.getDescription());
|
Map<String, Object> variables = ImmutableMap.of("description", event.getDescription());
|
||||||
event.getRecipients()
|
event.getRecipients()
|
||||||
.forEach(recipient -> mailService.sendEmailFromTemplate(variables, recipient, "eventNotification", event.getTitle()));
|
.forEach(recipient -> mailService.sendEmailFromTemplate(variables, recipient, "eventNotification", event.getTitle()));
|
||||||
if (event.getPeriod() == null) {
|
if (event.getPeriod() == null) {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package ru.ulstu.user.component;
|
package ru.ulstu.user.component;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
final class IpAddressResolver {
|
final class IpAddressResolver {
|
||||||
private static final String CLIENT_IP_HEADER = "Client-IP";
|
private static final String CLIENT_IP_HEADER = "Client-IP";
|
||||||
private static final String FORWARDED_FOR_HEADER = "X-Forwarded-For";
|
private static final String FORWARDED_FOR_HEADER = "X-Forwarded-For";
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package ru.ulstu.user.component;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@ -13,6 +9,10 @@ import org.springframework.stereotype.Component;
|
|||||||
import ru.ulstu.configuration.Constants;
|
import ru.ulstu.configuration.Constants;
|
||||||
import ru.ulstu.user.service.UserSessionService;
|
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;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package ru.ulstu.user.component;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@ -13,6 +9,10 @@ import org.springframework.stereotype.Component;
|
|||||||
import ru.ulstu.configuration.Constants;
|
import ru.ulstu.configuration.Constants;
|
||||||
import ru.ulstu.user.service.UserSessionService;
|
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;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package ru.ulstu.user.controller;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.access.annotation.Secured;
|
import org.springframework.security.access.annotation.Secured;
|
||||||
@ -32,6 +29,9 @@ import ru.ulstu.user.model.UserSessionListDto;
|
|||||||
import ru.ulstu.user.service.UserService;
|
import ru.ulstu.user.service.UserService;
|
||||||
import ru.ulstu.user.service.UserSessionService;
|
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 java.util.Map;
|
||||||
|
|
||||||
import static ru.ulstu.user.controller.UserController.URL;
|
import static ru.ulstu.user.controller.UserController.URL;
|
||||||
|
26
src/main/java/ru/ulstu/user/controller/UserConverter.java
Normal file
26
src/main/java/ru/ulstu/user/controller/UserConverter.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package ru.ulstu.user.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import ru.ulstu.user.model.User;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.convert.Converter;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserConverter implements Converter {
|
||||||
|
@Inject
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getAsObject(FacesContext context, UIComponent component, String value) {
|
||||||
|
return value == null ? null : userService.findById(Integer.valueOf(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAsString(FacesContext context, UIComponent component, Object value) {
|
||||||
|
return ((User) value).getId().toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package ru.ulstu.user.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.user.model.User;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.convert.Converter;
|
||||||
|
import javax.faces.convert.FacesConverter;
|
||||||
|
|
||||||
|
@FacesConverter(value = "userDegreeConverter")
|
||||||
|
public class UserDegreeConverter implements Converter {
|
||||||
|
@Override
|
||||||
|
public Object getAsObject(FacesContext context, UIComponent component, String value) {
|
||||||
|
return User.UserDegree.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAsString(FacesContext context, UIComponent component, Object value) {
|
||||||
|
return ((User.UserDegree) value).name();
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package ru.ulstu.user.controller;
|
package ru.ulstu.user.controller;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import jakarta.servlet.http.HttpSession;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -18,6 +17,8 @@ import ru.ulstu.user.model.UserListDto;
|
|||||||
import ru.ulstu.user.service.UserService;
|
import ru.ulstu.user.service.UserService;
|
||||||
import ru.ulstu.user.service.UserSessionService;
|
import ru.ulstu.user.service.UserSessionService;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ public class UserMvcController extends OdinController<UserListDto, UserDto> {
|
|||||||
|
|
||||||
@ModelAttribute("allActivities")
|
@ModelAttribute("allActivities")
|
||||||
public Map<String, String> getAllActivites() {
|
public Map<String, String> getAllActivites() {
|
||||||
return Map.of("PAPER", "Статьи",
|
return ImmutableMap.of("PAPER", "Статьи",
|
||||||
"GRANT", "Гранты",
|
"GRANT", "Гранты",
|
||||||
"PROJECT", "Проекты",
|
"PROJECT", "Проекты",
|
||||||
"CONFERENCE", "Конференции");
|
"CONFERENCE", "Конференции");
|
||||||
|
46
src/main/java/ru/ulstu/user/controller/UserView.java
Normal file
46
src/main/java/ru/ulstu/user/controller/UserView.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package ru.ulstu.user.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.core.navigation.Page;
|
||||||
|
import ru.ulstu.core.util.FacesUtil;
|
||||||
|
import ru.ulstu.user.model.User;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class UserView implements Serializable {
|
||||||
|
@Inject
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
user = userService.findById(Integer.valueOf(FacesUtil.getRequestParams().get("id")));
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User.UserDegree> getDegrees() {
|
||||||
|
return Arrays.asList(User.UserDegree.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String save() {
|
||||||
|
userService.updateUserInformation(user);
|
||||||
|
FacesUtil.showInfoMessage("Данные пользователя сохранены", user.getUserAbbreviate());
|
||||||
|
return Page.USER_LIST + "?faces-redirect=true";
|
||||||
|
}
|
||||||
|
}
|
29
src/main/java/ru/ulstu/user/controller/UsersView.java
Normal file
29
src/main/java/ru/ulstu/user/controller/UsersView.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package ru.ulstu.user.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.user.model.User;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class UsersView implements Serializable {
|
||||||
|
@Inject
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
private List<User> users;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
users = userService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> getUsers() {
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
}
|
@ -1,24 +1,24 @@
|
|||||||
package ru.ulstu.user.model;
|
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 org.hibernate.annotations.BatchSize;
|
||||||
import ru.ulstu.configuration.Constants;
|
import ru.ulstu.configuration.Constants;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.ManyToMany;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
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.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -28,6 +28,7 @@ import java.util.Set;
|
|||||||
@Table(name = "users")
|
@Table(name = "users")
|
||||||
public class User extends BaseEntity {
|
public class User extends BaseEntity {
|
||||||
private final static String USER_ABBREVIATE_TEMPLATE = "%s %s %s";
|
private final static String USER_ABBREVIATE_TEMPLATE = "%s %s %s";
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Pattern(regexp = Constants.LOGIN_REGEX)
|
@Pattern(regexp = Constants.LOGIN_REGEX)
|
||||||
@Size(min = 1, max = 50)
|
@Size(min = 1, max = 50)
|
||||||
@ -38,22 +39,27 @@ public class User extends BaseEntity {
|
|||||||
@Size(min = 60, max = 60)
|
@Size(min = 60, max = 60)
|
||||||
@Column(name = "password_hash", length = 60, nullable = false)
|
@Column(name = "password_hash", length = 60, nullable = false)
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Size(max = 50)
|
@Size(max = 50)
|
||||||
@Column(name = "first_name", length = 50, nullable = false)
|
@Column(name = "first_name", length = 50, nullable = false)
|
||||||
private String firstName;
|
private String firstName;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Size(max = 50)
|
@Size(max = 50)
|
||||||
@Column(name = "last_name", length = 50, nullable = false)
|
@Column(name = "last_name", length = 50, nullable = false)
|
||||||
private String lastName;
|
private String lastName;
|
||||||
|
|
||||||
@Size(max = 50)
|
@Size(max = 50)
|
||||||
@Column(name = "patronymic", length = 50)
|
@Column(name = "patronymic", length = 50)
|
||||||
private String patronymic;
|
private String patronymic;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Email
|
@Email
|
||||||
@Size(min = 5, max = 100)
|
@Size(min = 5, max = 100)
|
||||||
@Column(length = 100, nullable = false, unique = true)
|
@Column(length = 100, nullable = false, unique = true)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private boolean activated;
|
private boolean activated;
|
||||||
@ -90,12 +96,6 @@ public class User extends BaseEntity {
|
|||||||
@JoinColumn(name = "blocker_id")
|
@JoinColumn(name = "blocker_id")
|
||||||
private User blocker;
|
private User blocker;
|
||||||
|
|
||||||
private String orcId;
|
|
||||||
|
|
||||||
private String scopusId;
|
|
||||||
|
|
||||||
private String elibraryId;
|
|
||||||
|
|
||||||
public enum UserDegree {
|
public enum UserDegree {
|
||||||
CANDIDATE("Кандидат технических наук"),
|
CANDIDATE("Кандидат технических наук"),
|
||||||
DOCTOR("Доктор технических наук");
|
DOCTOR("Доктор технических наук");
|
||||||
@ -242,30 +242,6 @@ public class User extends BaseEntity {
|
|||||||
this.blocker = blocker;
|
this.blocker = blocker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrcId() {
|
|
||||||
return orcId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrcId(String orcId) {
|
|
||||||
this.orcId = orcId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getScopusId() {
|
|
||||||
return scopusId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScopusId(String scopusId) {
|
|
||||||
this.scopusId = scopusId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getElibraryId() {
|
|
||||||
return elibraryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setElibraryId(String elibraryId) {
|
|
||||||
this.elibraryId = elibraryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserAbbreviate() {
|
public String getUserAbbreviate() {
|
||||||
return String.format(USER_ABBREVIATE_TEMPLATE,
|
return String.format(USER_ABBREVIATE_TEMPLATE,
|
||||||
lastName == null ? "" : lastName,
|
lastName == null ? "" : lastName,
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
package ru.ulstu.user.model;
|
package ru.ulstu.user.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
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 org.springframework.util.StringUtils;
|
||||||
import ru.ulstu.configuration.Constants;
|
import ru.ulstu.configuration.Constants;
|
||||||
import ru.ulstu.odin.model.OdinDto;
|
import ru.ulstu.odin.model.OdinDto;
|
||||||
@ -14,6 +10,10 @@ import ru.ulstu.odin.model.annotation.OdinString;
|
|||||||
import ru.ulstu.odin.model.annotation.OdinVisible;
|
import ru.ulstu.odin.model.annotation.OdinVisible;
|
||||||
import ru.ulstu.user.controller.UserController;
|
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.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
@ -75,12 +75,6 @@ public class UserDto implements OdinDto {
|
|||||||
|
|
||||||
private User.UserDegree degree;
|
private User.UserDegree degree;
|
||||||
|
|
||||||
private String orcId;
|
|
||||||
|
|
||||||
private String scopusId;
|
|
||||||
|
|
||||||
private String elibraryId;
|
|
||||||
|
|
||||||
public UserDto() {
|
public UserDto() {
|
||||||
activated = false;
|
activated = false;
|
||||||
roles = new LinkedHashSet<>();
|
roles = new LinkedHashSet<>();
|
||||||
@ -99,9 +93,6 @@ public class UserDto implements OdinDto {
|
|||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
this.birthDate = user.getBirthDate();
|
this.birthDate = user.getBirthDate();
|
||||||
this.degree = user.getDegree();
|
this.degree = user.getDegree();
|
||||||
this.orcId = user.getOrcId();
|
|
||||||
this.scopusId = user.getScopusId();
|
|
||||||
this.elibraryId = user.getElibraryId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@ -195,30 +186,6 @@ public class UserDto implements OdinDto {
|
|||||||
this.degree = degree;
|
this.degree = degree;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrcId() {
|
|
||||||
return orcId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrcId(String orcId) {
|
|
||||||
this.orcId = orcId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getScopusId() {
|
|
||||||
return scopusId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScopusId(String scopusId) {
|
|
||||||
this.scopusId = scopusId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getElibraryId() {
|
|
||||||
return elibraryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setElibraryId(String elibraryId) {
|
|
||||||
this.elibraryId = elibraryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public boolean isPasswordsValid() {
|
public boolean isPasswordsValid() {
|
||||||
if (StringUtils.isEmpty(password) || StringUtils.isEmpty(passwordConfirm)) {
|
if (StringUtils.isEmpty(password) || StringUtils.isEmpty(passwordConfirm)) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package ru.ulstu.user.model;
|
package ru.ulstu.user.model;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.Size;
|
|
||||||
import ru.ulstu.configuration.Constants;
|
import ru.ulstu.configuration.Constants;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class UserResetPasswordDto {
|
public class UserResetPasswordDto {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package ru.ulstu.user.model;
|
package ru.ulstu.user.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import jakarta.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "user_roles")
|
@Table(name = "user_roles")
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package ru.ulstu.user.model;
|
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 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;
|
import java.util.Date;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package ru.ulstu.user.service;
|
package ru.ulstu.user.service;
|
||||||
|
|
||||||
import jakarta.mail.MessagingException;
|
|
||||||
import jakarta.mail.internet.MimeMessage;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -12,11 +10,13 @@ import org.springframework.mail.javamail.MimeMessageHelper;
|
|||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.thymeleaf.context.Context;
|
import org.thymeleaf.context.Context;
|
||||||
import org.thymeleaf.spring6.SpringTemplateEngine;
|
import org.thymeleaf.spring5.SpringTemplateEngine;
|
||||||
import ru.ulstu.configuration.ApplicationProperties;
|
import ru.ulstu.configuration.ApplicationProperties;
|
||||||
import ru.ulstu.configuration.Constants;
|
import ru.ulstu.configuration.Constants;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
|
|
||||||
|
import javax.mail.MessagingException;
|
||||||
|
import javax.mail.internet.MimeMessage;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ public class MailService {
|
|||||||
sendEmailFromTemplate(user, "activationEmail", Constants.MAIL_ACTIVATE);
|
sendEmailFromTemplate(user, "activationEmail", Constants.MAIL_ACTIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPasswordResetMail(User user) throws MailException {
|
public void sendPasswordResetMail(User user) throws MessagingException, MailException {
|
||||||
sendEmailFromTemplate(user, "passwordResetEmail", Constants.MAIL_RESET);
|
sendEmailFromTemplate(user, "passwordResetEmail", Constants.MAIL_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package ru.ulstu.user.service;
|
package ru.ulstu.user.service;
|
||||||
|
|
||||||
import jakarta.mail.MessagingException;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
@ -50,6 +50,7 @@ import ru.ulstu.utils.timetable.TimetableService;
|
|||||||
import ru.ulstu.utils.timetable.errors.TimetableClientException;
|
import ru.ulstu.utils.timetable.errors.TimetableClientException;
|
||||||
import ru.ulstu.utils.timetable.model.Lesson;
|
import ru.ulstu.utils.timetable.model.Lesson;
|
||||||
|
|
||||||
|
import javax.mail.MessagingException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -206,9 +207,6 @@ public class UserService implements UserDetailsService {
|
|||||||
user.setLogin(userDto.getLogin());
|
user.setLogin(userDto.getLogin());
|
||||||
user.setFirstName(userDto.getFirstName());
|
user.setFirstName(userDto.getFirstName());
|
||||||
user.setLastName(userDto.getLastName());
|
user.setLastName(userDto.getLastName());
|
||||||
user.setOrcId(userDto.getOrcId());
|
|
||||||
user.setScopusId(userDto.getScopusId());
|
|
||||||
user.setElibraryId(userDto.getElibraryId());
|
|
||||||
user.setEmail(userDto.getEmail());
|
user.setEmail(userDto.getEmail());
|
||||||
if (userDto.isActivated() != user.getActivated()) {
|
if (userDto.isActivated() != user.getActivated()) {
|
||||||
if (userDto.isActivated()) {
|
if (userDto.isActivated()) {
|
||||||
@ -248,9 +246,6 @@ public class UserService implements UserDetailsService {
|
|||||||
user.setLastName(updateUser.getLastName());
|
user.setLastName(updateUser.getLastName());
|
||||||
user.setEmail(updateUser.getEmail());
|
user.setEmail(updateUser.getEmail());
|
||||||
user.setLogin(updateUser.getLogin());
|
user.setLogin(updateUser.getLogin());
|
||||||
user.setOrcId(updateUser.getOrcId());
|
|
||||||
user.setScopusId(updateUser.getScopusId());
|
|
||||||
user.setElibraryId(updateUser.getElibraryId());
|
|
||||||
user = updateUserInformation(user);
|
user = updateUserInformation(user);
|
||||||
log.debug("Updated Information for User: {}", user.getLogin());
|
log.debug("Updated Information for User: {}", user.getLogin());
|
||||||
return userMapper.userEntityToUserDto(user);
|
return userMapper.userEntityToUserDto(user);
|
||||||
@ -283,7 +278,7 @@ public class UserService implements UserDetailsService {
|
|||||||
user = userRepository.save(user);
|
user = userRepository.save(user);
|
||||||
try {
|
try {
|
||||||
mailService.sendPasswordResetMail(user);
|
mailService.sendPasswordResetMail(user);
|
||||||
} catch (MailException e) {
|
} catch (MessagingException | MailException e) {
|
||||||
throw new UserSendingMailException(email);
|
throw new UserSendingMailException(email);
|
||||||
}
|
}
|
||||||
log.debug("Created Reset Password Request for User: {}", user.getLogin());
|
log.debug("Created Reset Password Request for User: {}", user.getLogin());
|
||||||
@ -381,7 +376,7 @@ public class UserService implements UserDetailsService {
|
|||||||
user.setActivated(true);
|
user.setActivated(true);
|
||||||
userRepository.save(user);
|
userRepository.save(user);
|
||||||
|
|
||||||
Map<String, Object> variables = Map.of("password", password, "email", email);
|
Map<String, Object> variables = ImmutableMap.of("password", password, "email", email);
|
||||||
try {
|
try {
|
||||||
mailService.sendInviteMail(variables, email);
|
mailService.sendInviteMail(variables, email);
|
||||||
} catch (MessagingException | MailException e) {
|
} catch (MessagingException | MailException e) {
|
||||||
@ -411,7 +406,7 @@ public class UserService implements UserDetailsService {
|
|||||||
userSessionService.isOnline(user))
|
userSessionService.isOnline(user))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Map.of("users", usersInfoNow, "error", err);
|
return ImmutableMap.of("users", usersInfoNow, "error", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getActivitiesPings(Integer userId,
|
public Map<String, Integer> getActivitiesPings(Integer userId,
|
||||||
|
@ -33,7 +33,7 @@ public class UserSessionService {
|
|||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public PageableItems<UserSessionListDto> getSessions(int offset, int count) {
|
public PageableItems<UserSessionListDto> getSessions(int offset, int count) {
|
||||||
final Page<UserSession> page = userSessionRepository.findAll(
|
final Page<UserSession> page = userSessionRepository.findAll(
|
||||||
new OffsetablePageRequest(offset, count, Sort.by(Sort.Direction.DESC, "loginTime")));
|
new OffsetablePageRequest(offset, count, new Sort(Sort.Direction.DESC, "loginTime")));
|
||||||
return new PageableItems<>(page.getTotalElements(),
|
return new PageableItems<>(page.getTotalElements(),
|
||||||
convert(page.getContent(), UserSessionListDto::new));
|
convert(page.getContent(), UserSessionListDto::new));
|
||||||
}
|
}
|
||||||
|
115
src/main/resources/META-INF/resources/admin/user.xhtml
Normal file
115
src/main/resources/META-INF/resources/admin/user.xhtml
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
|
||||||
|
<ui:composition template="/basicTemplate.xhtml">
|
||||||
|
<ui:define name="header">
|
||||||
|
Редактирование пользователя
|
||||||
|
</ui:define>
|
||||||
|
<ui:define name="content">
|
||||||
|
<style>
|
||||||
|
#mainForm\:paperStatus > tbody > tr {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#mainForm\:paperStatus > tbody > tr > td {
|
||||||
|
border: none;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#mainForm\:paperPanel > tbody > tr {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#mainForm\:paperPanel > tbody > tr > td {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-editor.ui-widget-content {
|
||||||
|
background: white !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<p:panel id="panel" header="Редактирование пользователя" style="margin-bottom:10px;">
|
||||||
|
<p:panelGrid cellpadding="5" id="userPanel">
|
||||||
|
<p:row>
|
||||||
|
<p:column>
|
||||||
|
<h:outputLabel value="Имя"/>
|
||||||
|
</p:column>
|
||||||
|
<p:column>
|
||||||
|
<p:inputText id="firstName" required="true" value="#{userView.user.firstName}"/>
|
||||||
|
<p:message for="firstName"/>
|
||||||
|
</p:column>
|
||||||
|
</p:row>
|
||||||
|
<p:row>
|
||||||
|
<p:column>
|
||||||
|
<h:outputLabel value="Отчество"/>
|
||||||
|
</p:column>
|
||||||
|
<p:column>
|
||||||
|
<p:inputText id="patr" value="#{userView.user.patronymic}"/>
|
||||||
|
<p:message for="patr"/>
|
||||||
|
</p:column>
|
||||||
|
</p:row>
|
||||||
|
<p:row>
|
||||||
|
<p:column>
|
||||||
|
<h:outputLabel value="Фамилия"/>
|
||||||
|
</p:column>
|
||||||
|
<p:column>
|
||||||
|
<p:inputText id="lastName" required="true" value="#{userView.user.lastName}"/>
|
||||||
|
<p:message for="lastName"/>
|
||||||
|
</p:column>
|
||||||
|
</p:row>
|
||||||
|
<p:row>
|
||||||
|
<p:column>
|
||||||
|
<h:outputLabel value="Email"/>
|
||||||
|
</p:column>
|
||||||
|
<p:column>
|
||||||
|
<p:outputLabel value="#{userView.user.email}"/>
|
||||||
|
</p:column>
|
||||||
|
</p:row>
|
||||||
|
<p:row>
|
||||||
|
<p:column>
|
||||||
|
<h:outputLabel value="Логин"/>
|
||||||
|
</p:column>
|
||||||
|
<p:column>
|
||||||
|
<p:outputLabel value="#{userView.user.login}"/>
|
||||||
|
</p:column>
|
||||||
|
</p:row>
|
||||||
|
<p:row>
|
||||||
|
<p:column>
|
||||||
|
<h:outputLabel value="Дата рождения"/>
|
||||||
|
</p:column>
|
||||||
|
<p:column>
|
||||||
|
<p:datePicker id="bDate" required="true" value="#{userView.user.birthDate}"
|
||||||
|
placeholder="Введите дату"
|
||||||
|
pattern="dd.MM.yyyy"/>
|
||||||
|
<p:message for="bDate"/>
|
||||||
|
</p:column>
|
||||||
|
</p:row>
|
||||||
|
<p:row>
|
||||||
|
<p:column>
|
||||||
|
<h:outputLabel value="Ученая степень"/>
|
||||||
|
</p:column>
|
||||||
|
<p:column>
|
||||||
|
<p:selectOneMenu id="degree" value="#{userView.user.degree}"
|
||||||
|
converter="#{userDegreeConverter}">
|
||||||
|
<f:attribute name="collectionType" value="java.util.HashSet"/>
|
||||||
|
<f:selectItem itemLabel="Нет" itemValue="#{null}" noSelectionOption="true"/>
|
||||||
|
<f:selectItems value="#{userView.degrees}"
|
||||||
|
var="degree"
|
||||||
|
itemLabel="#{degree.degreeName}"
|
||||||
|
itemValue="#{degree}"/>
|
||||||
|
</p:selectOneMenu>
|
||||||
|
</p:column>
|
||||||
|
</p:row>
|
||||||
|
<p:row>
|
||||||
|
<p:column>
|
||||||
|
<p:commandButton action="#{userView.save}" value="Сохранить" ajax="true" process="@form"
|
||||||
|
update="messages @form"/>
|
||||||
|
</p:column>
|
||||||
|
</p:row>
|
||||||
|
</p:panelGrid>
|
||||||
|
</p:panel>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
34
src/main/resources/META-INF/resources/admin/users.xhtml
Normal file
34
src/main/resources/META-INF/resources/admin/users.xhtml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||||
|
<ui:composition template="/basicTemplate.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<style>
|
||||||
|
.ui-datatable .ui-datatable-header {
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<p:dataTable value="#{usersView.users}" var="user" paginator="true" rows="10" id="usersTable"
|
||||||
|
widgetVar="usersTable" emptyMessage="Не найдено пользователей">
|
||||||
|
<f:facet name="header">
|
||||||
|
<p:outputPanel>
|
||||||
|
<h:outputText value="Поиск:"/>
|
||||||
|
<p:inputText id="globalFilter" onkeyup="PF('usersTable').filter()" style="width:150px"
|
||||||
|
placeholder="Строка поиска..."/>
|
||||||
|
</p:outputPanel>
|
||||||
|
</f:facet>
|
||||||
|
<p:column headerText="Имя" filterBy="#{user.userAbbreviate}" filterMatchMode="contains">
|
||||||
|
<h:outputLink value="/admin/user.xhtml">
|
||||||
|
#{user.userAbbreviate}
|
||||||
|
<f:param name="id" value="#{user.id}"/>
|
||||||
|
</h:outputLink>
|
||||||
|
</p:column>
|
||||||
|
<p:column headerText="Email" filterBy="#{user.email}" filterMatchMode="contains">
|
||||||
|
<p:outputLabel value="#{user.email}"/>
|
||||||
|
</p:column>
|
||||||
|
</p:dataTable>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
55
src/main/resources/META-INF/resources/basicTemplate.xhtml
Normal file
55
src/main/resources/META-INF/resources/basicTemplate.xhtml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||||
|
|
||||||
|
<h:head>
|
||||||
|
<title><ui:insert name="header">NG-Tracker</ui:insert></title>
|
||||||
|
<h:outputStylesheet name="css/style.css"/>
|
||||||
|
<h:outputStylesheet name="css/google/kaushan.css"/>
|
||||||
|
<h:outputStylesheet name="primeicons/primeicons.css" library="primefaces"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||||
|
</h:head>
|
||||||
|
|
||||||
|
<h:body class="black">
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<h:form id="mainForm">
|
||||||
|
<div class="ui-g">
|
||||||
|
<div class="ui-g-12 ui-md-2"></div>
|
||||||
|
<div class="ui-g-12 ui-md-8">
|
||||||
|
<p:menubar>
|
||||||
|
<p:menuitem class="navbar-brand" value="NG-Tracker" url="#{page.index}"/>
|
||||||
|
<p:submenu label="Статьи" icon="fa fa-file-text-o">
|
||||||
|
<p:menuitem value="Мои статьи" icon="fa fa-calendar" url="#{page.paperDashboard}"/>
|
||||||
|
<p:menuitem value="Все статьи" icon="fa fa-file-o" url="#{page.paperList}"/>
|
||||||
|
</p:submenu>
|
||||||
|
<p:submenu label="Гранты" icon="fa fa-file-text-o">
|
||||||
|
<p:menuitem value="Мои гранты" icon="fa fa-calendar" url="#{page.grantDashboard}"/>
|
||||||
|
<p:menuitem value="Все гранты" icon="fa fa-file-o" url="#{page.grantList}"/>
|
||||||
|
</p:submenu>
|
||||||
|
<p:submenu label="Конференции" icon="fa fa-file-text-o">
|
||||||
|
<p:menuitem value="Мои конференции" icon="fa fa-calendar" url="#{page.conferenceDashboard}"/>
|
||||||
|
<p:menuitem value="Все конференции" icon="fa fa-file-o" url="#{page.conferenceList}"/>
|
||||||
|
</p:submenu>
|
||||||
|
<p:menuitem value="Пользователи" icon="fa fa-calendar" url="#{page.userList}"/>
|
||||||
|
|
||||||
|
<f:facet name="options">
|
||||||
|
<p:link href="#{page.logout}" value="Выход"/>
|
||||||
|
</f:facet>
|
||||||
|
</p:menubar>
|
||||||
|
<div class="ui-fluid">
|
||||||
|
<p:growl id="messages" for="messages" showDetail="true"/>
|
||||||
|
<ui:insert name="content">Content</ui:insert>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,139 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
>
|
||||||
|
<ui:composition template="/basicTemplate.xhtml">
|
||||||
|
<ui:define name="header">
|
||||||
|
Редактирование конференции
|
||||||
|
</ui:define>
|
||||||
|
<ui:define name="content">
|
||||||
|
<style>
|
||||||
|
#mainForm\:conferencePanel > tbody > tr {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#mainForm\:conferencePanel > tbody > tr > td {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-editor.ui-widget-content {
|
||||||
|
background: white !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<p:panel id="panel" header="Редактирование конференции: #{conferenceView.conference.title}"
|
||||||
|
style="margin-bottom:10px;">
|
||||||
|
<div class="ui-fluid">
|
||||||
|
<div class="ui-g">
|
||||||
|
<div class="ui-md-3 ui-g-12">
|
||||||
|
<h:outputLabel value="Название:"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-7 ui-g-12">
|
||||||
|
<p:inputText id="name" required="true" value="#{conferenceView.conference.title}"/>
|
||||||
|
<p:message for="name"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-md-3 ui-g-12">
|
||||||
|
<h:outputLabel value="Ссылка:"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-7 ui-g-12">
|
||||||
|
<p:inputText id="url" required="true" value="#{conferenceView.conference.url}"/>
|
||||||
|
<p:message for="url"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-md-3 ui-g-12">
|
||||||
|
<h:outputLabel value="Дата начала:"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-md-7 ui-g-12">
|
||||||
|
<p:datePicker value="#{conferenceView.conference.beginDate}" placeholder="Введите дату"
|
||||||
|
pattern="dd.MM.yyyy"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-md-3 ui-g-12">
|
||||||
|
<h:outputLabel value="Дата окончания:"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-md-7 ui-g-12">
|
||||||
|
<p:datePicker value="#{conferenceView.conference.endDate}" placeholder="Введите дату"
|
||||||
|
pattern="dd.MM.yyyy"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-md-3 ui-g-12">
|
||||||
|
<!-- <p:outputLabel for="authors" value="Авторы:"/>-->
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-7 ui-g-12">
|
||||||
|
<!-- <p:selectCheckboxMenu id="authors" value="#{conferenceView.conference.users}" multiple="true"-->
|
||||||
|
<!-- converter="#{conferenceUserConverter}">-->
|
||||||
|
<!-- <f:attribute name="collectionType" value="java.util.HashSet"/>-->
|
||||||
|
<!-- <f:selectItems value="#{conferenceView.authors}"-->
|
||||||
|
<!-- var="author"-->
|
||||||
|
<!-- itemLabel="#{author.userAbbreviate}"-->
|
||||||
|
<!-- itemValue="#{author}"/>-->
|
||||||
|
<!-- </p:selectCheckboxMenu>-->
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-3 ui-g-12">
|
||||||
|
<!-- <p:outputLabel for="authors" value="Ключевые даты:"/>-->
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-7 ui-g-12">
|
||||||
|
<div class="ui-fluid">
|
||||||
|
<div class="ui-g">
|
||||||
|
<ui:repeat value="#{conferenceView.conference.deadlines}" var="deadline">
|
||||||
|
<div class="ui-md-5 ui-g-12">
|
||||||
|
<p:datePicker value="#{deadline.date}" pattern="dd.MM.yyyy"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-5 ui-g-12">
|
||||||
|
<p:inputText value="#{deadline.description}"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-1 ui-g-12">
|
||||||
|
<p:commandButton icon="pi pi-times">
|
||||||
|
<p:ajax update="mainForm" process="@this"
|
||||||
|
listener="#{conferenceView.deleteDeadline(deadline)}"/>
|
||||||
|
</p:commandButton>
|
||||||
|
</div>
|
||||||
|
</ui:repeat>
|
||||||
|
<div class="ui-md-5 ui-g-12">
|
||||||
|
<p:datePicker value="#{conferenceView.newDeadlineDate}" placeholder="Введите дату"
|
||||||
|
pattern="dd.MM.yyyy"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-5 ui-g-12">
|
||||||
|
<p:inputText value="#{conferenceView.newDeadlineDescription}"
|
||||||
|
placeholder="Описание ключевой даты"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-1 ui-g-12">
|
||||||
|
<p:commandButton icon="pi pi-check">
|
||||||
|
<p:ajax update="mainForm" process="@this"
|
||||||
|
listener="#{conferenceView.addDeadline()}"/>
|
||||||
|
</p:commandButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-md-3 ui-g-12">
|
||||||
|
<p:outputLabel for="comment" value="Комментарий:"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-7 ui-g-12">
|
||||||
|
<p:editor id="comment" widgetVar="editor2" value="#{conferenceView.conference.description}"
|
||||||
|
height="300"
|
||||||
|
style="margin-bottom:10px" placeholder="Комментарий"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-2 ui-g-12">
|
||||||
|
<p>
|
||||||
|
Конференция создана
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Конференция обновлена
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-5 ui-g-12">
|
||||||
|
<p:commandButton action="#{conferenceView.save}" value="Сохранить" ajax="true" process="@form"
|
||||||
|
update="messages @form"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
@ -0,0 +1,10 @@
|
|||||||
|
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://java.sun.com/jsf/html">
|
||||||
|
<span class="fa-stack fa-1x big-icon" title="#{conference.status.statusName}">
|
||||||
|
<i class="fa fa-circle #{conference.status.elementClass} fa-stack-2x"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
<ui:fragment rendered="#{shortMode != true}">
|
||||||
|
<p:outputText value="#{conference.status.statusName}"/>
|
||||||
|
</ui:fragment>
|
||||||
|
</ui:composition>
|
@ -0,0 +1,79 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||||
|
<ui:composition template="/basicTemplate.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<style>
|
||||||
|
.ui-datatable .ui-datatable-header {
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<p:panel id="panel" header="Все конференции" style="margin-bottom:10px;">
|
||||||
|
|
||||||
|
<div class="ui-fluid">
|
||||||
|
<div class="ui-g">
|
||||||
|
<div class="ui-md-5 ui-g-12">
|
||||||
|
<p:inputText placeholder="Создать новую коференцию" id="newConferenceName"
|
||||||
|
value="#{conferencesView.newConferenceTitle}" required="true"
|
||||||
|
requiredMessage="Введите название новой конференции"/>
|
||||||
|
<p:message for="newConferenceName"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-2 ui-g-12">
|
||||||
|
<p:commandButton action="#{conferencesView.create}" value="Создать" ajax="true" process="@form"
|
||||||
|
update="messages @form mainForm:conferencesTable"/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-3 ui-g-12">
|
||||||
|
<p:commandButton value="Удалить выделенные" id="conferencesRemoveButton"
|
||||||
|
disabled="#{conferencesView.selectedConferences.isEmpty()}"
|
||||||
|
action="#{conferencesView.deleteSelected}" ajax="true"
|
||||||
|
process="mainForm:conferencesRemoveButton"
|
||||||
|
update="messages mainForm:conferencesTable">
|
||||||
|
<p:confirm header="Подтверждение" message="Удалить выделенные конференции?"
|
||||||
|
icon="pi pi-exclamation-triangle"/>
|
||||||
|
</p:commandButton>
|
||||||
|
</div>
|
||||||
|
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
|
||||||
|
<p:commandButton value="Да" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check"/>
|
||||||
|
<p:commandButton value="Нет" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times"/>
|
||||||
|
</p:confirmDialog>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p:dataTable value="#{conferencesView.conferences}" var="conference" paginator="true"
|
||||||
|
paginatorPosition="bottom"
|
||||||
|
rows="10" id="conferencesTable"
|
||||||
|
widgetVar="conferencesTable" emptyMessage="Не найдено подходящих конференций"
|
||||||
|
selection="#{conferencesView.selectedConferences}" rowKey="#{conference.id}">
|
||||||
|
<f:facet name="header">
|
||||||
|
<p:outputPanel>
|
||||||
|
<h:outputText value="Поиск:"/>
|
||||||
|
<p:inputText id="globalFilter" onkeyup="PF('conferencesTable').filter()" style="width:150px"
|
||||||
|
placeholder="Строка поиска..."/>
|
||||||
|
</p:outputPanel>
|
||||||
|
</f:facet>
|
||||||
|
<p:ajax event="rowSelect" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"/>
|
||||||
|
<p:ajax event="rowSelectCheckbox" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"/>
|
||||||
|
<p:ajax event="rowUnselectCheckbox" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"/>
|
||||||
|
<p:ajax event="rowUnselect" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"/>
|
||||||
|
<p:ajax event="toggleSelect" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"
|
||||||
|
partialSubmit="true"/>
|
||||||
|
<p:column selectionMode="multiple" style="width:16px;text-align:center"/>
|
||||||
|
<p:column headerText="Название" filterBy="#{conference.title}" filterMatchMode="contains">
|
||||||
|
<h:outputLink value="#{page.conference}">
|
||||||
|
#{conference.title}
|
||||||
|
<f:param name="id" value="#{conference.id}"/>
|
||||||
|
</h:outputLink>
|
||||||
|
</p:column>
|
||||||
|
</p:dataTable>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
@ -0,0 +1,81 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||||
|
<ui:composition template="/basicTemplate.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<style>
|
||||||
|
.ui-datatable .ui-datatable-header {
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<p:panel id="panel" header="Активные конференции пользователя #{conferenceDashboardView.currentUser}"
|
||||||
|
style="margin-bottom:10px;">
|
||||||
|
|
||||||
|
<div class="ui-fluid">
|
||||||
|
<div class="ui-g">
|
||||||
|
<div class="ui-md-5 ui-g-12">
|
||||||
|
<p:inputText placeholder="Создать новую конференцию" id="newConferenceName"
|
||||||
|
value="#{conferenceDashboardView.newConferenceTitle}" required="true"
|
||||||
|
requiredMessage="Введите название новой конференции"/>
|
||||||
|
<p:message for="newConferenceName"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-2 ui-g-12">
|
||||||
|
<p:commandButton action="#{conferenceDashboardView.create}" value="Создать" ajax="true"
|
||||||
|
process="@form"
|
||||||
|
update="messages @form mainForm:conferencesTable"/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="ui-md-3 ui-g-12">
|
||||||
|
<p:commandButton value="Удалить выделенные" id="conferencesRemoveButton"
|
||||||
|
disabled="#{conferenceDashboardView.selectedConferences.isEmpty()}"
|
||||||
|
action="#{conferenceDashboardView.deleteSelected}" ajax="true"
|
||||||
|
process="mainForm:conferencesRemoveButton"
|
||||||
|
update="messages mainForm:conferencesTable">
|
||||||
|
<p:confirm header="Подтверждение" message="Удалить выделенные конференции?"
|
||||||
|
icon="pi pi-exclamation-triangle"/>
|
||||||
|
</p:commandButton>
|
||||||
|
</div>
|
||||||
|
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
|
||||||
|
<p:commandButton value="Да" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check"/>
|
||||||
|
<p:commandButton value="Нет" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times"/>
|
||||||
|
</p:confirmDialog>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p:dataTable value="#{conferenceDashboardView.conferences}" var="conference" paginator="true"
|
||||||
|
paginatorPosition="bottom"
|
||||||
|
rows="10" id="conferencesTable"
|
||||||
|
widgetVar="conferencesTable" emptyMessage="Не найдено подходящих конференций"
|
||||||
|
selection="#{conferenceDashboardView.selectedConferences}" rowKey="#{conference.id}">
|
||||||
|
<f:facet name="header">
|
||||||
|
<p:outputPanel>
|
||||||
|
<h:outputText value="Поиск:"/>
|
||||||
|
<p:inputText id="globalFilter" onkeyup="PF('conferencesTable').filter()" style="width:150px"
|
||||||
|
placeholder="Строка поиска..."/>
|
||||||
|
</p:outputPanel>
|
||||||
|
</f:facet>
|
||||||
|
<p:ajax event="rowSelect" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"/>
|
||||||
|
<p:ajax event="rowSelectCheckbox" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"/>
|
||||||
|
<p:ajax event="rowUnselectCheckbox" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"/>
|
||||||
|
<p:ajax event="rowUnselect" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"/>
|
||||||
|
<p:ajax event="toggleSelect" update="mainForm:conferencesRemoveButton"
|
||||||
|
process="mainForm:conferencesTable"
|
||||||
|
partialSubmit="true"/>
|
||||||
|
<p:column selectionMode="multiple" style="width:16px;text-align:center"/>
|
||||||
|
<p:column headerText="Название" filterBy="#{conference.title}" filterMatchMode="contains">
|
||||||
|
<h:outputLink value="#{page.conference}">
|
||||||
|
#{conference.title}
|
||||||
|
<f:param name="id" value="#{conference.id}"/>
|
||||||
|
</h:outputLink>
|
||||||
|
</p:column>
|
||||||
|
</p:dataTable>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
35
src/main/resources/META-INF/resources/css/google/droid.css
Normal file
35
src/main/resources/META-INF/resources/css/google/droid.css
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Droid Serif';
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Droid Serif Italic'), local('DroidSerif-Italic'), url(https://fonts.gstatic.com/s/droidserif/v8/tDbK2oqRg1oM3QBjjcaDkOr4nAfcHg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Droid Serif';
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Droid Serif Bold Italic'), local('DroidSerif-BoldItalic'), url(https://fonts.gstatic.com/s/droidserif/v8/tDbX2oqRg1oM3QBjjcaDkOr4lLz5CwOnSA.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Droid Serif';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Droid Serif Regular'), local('DroidSerif-Regular'), url(https://fonts.gstatic.com/s/droidserif/v8/tDbI2oqRg1oM3QBjjcaDkOr9rAU.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Droid Serif';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Droid Serif Bold'), local('DroidSerif-Bold'), url(https://fonts.gstatic.com/s/droidserif/v8/tDbV2oqRg1oM3QBjjcaDkOJGiRD7OwE.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
17
src/main/resources/META-INF/resources/css/google/kaushan.css
Normal file
17
src/main/resources/META-INF/resources/css/google/kaushan.css
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/* latin-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Kaushan Script';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Kaushan Script'), local('KaushanScript-Regular'), url(https://fonts.gstatic.com/s/kaushanscript/v6/vm8vdRfvXFLG3OLnsO15WYS5DG72wNJHMw.woff2) format('woff2');
|
||||||
|
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Kaushan Script';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Kaushan Script'), local('KaushanScript-Regular'), url(https://fonts.gstatic.com/s/kaushanscript/v6/vm8vdRfvXFLG3OLnsO15WYS5DG74wNI.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
/* cyrillic-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v12/JTUSjIg1_i6t8kCHKm459WRhyzbi.woff2) format('woff2');
|
||||||
|
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v12/JTUSjIg1_i6t8kCHKm459W1hyzbi.woff2) format('woff2');
|
||||||
|
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vietnamese */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v12/JTUSjIg1_i6t8kCHKm459WZhyzbi.woff2) format('woff2');
|
||||||
|
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v12/JTUSjIg1_i6t8kCHKm459Wdhyzbi.woff2) format('woff2');
|
||||||
|
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v12/JTUSjIg1_i6t8kCHKm459Wlhyw.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v12/JTURjIg1_i6t8kCHKm45_dJE3gTD_u50.woff2) format('woff2');
|
||||||
|
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v12/JTURjIg1_i6t8kCHKm45_dJE3g3D_u50.woff2) format('woff2');
|
||||||
|
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vietnamese */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v12/JTURjIg1_i6t8kCHKm45_dJE3gbD_u50.woff2) format('woff2');
|
||||||
|
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v12/JTURjIg1_i6t8kCHKm45_dJE3gfD_u50.woff2) format('woff2');
|
||||||
|
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v12/JTURjIg1_i6t8kCHKm45_dJE3gnD_g.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
251
src/main/resources/META-INF/resources/css/google/roboto.css
Normal file
251
src/main/resources/META-INF/resources/css/google/roboto.css
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
/* cyrillic-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100;
|
||||||
|
src: local('Roboto Slab Thin'), local('RobotoSlab-Thin'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngOUXZYTXPIvIBgJJSb6u-u1qqh5CCD.woff2) format('woff2');
|
||||||
|
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100;
|
||||||
|
src: local('Roboto Slab Thin'), local('RobotoSlab-Thin'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngOUXZYTXPIvIBgJJSb6u-u1qOh5CCD.woff2) format('woff2');
|
||||||
|
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* greek-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100;
|
||||||
|
src: local('Roboto Slab Thin'), local('RobotoSlab-Thin'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngOUXZYTXPIvIBgJJSb6u-u1quh5CCD.woff2) format('woff2');
|
||||||
|
unicode-range: U+1F00-1FFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* greek */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100;
|
||||||
|
src: local('Roboto Slab Thin'), local('RobotoSlab-Thin'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngOUXZYTXPIvIBgJJSb6u-u1qSh5CCD.woff2) format('woff2');
|
||||||
|
unicode-range: U+0370-03FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vietnamese */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100;
|
||||||
|
src: local('Roboto Slab Thin'), local('RobotoSlab-Thin'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngOUXZYTXPIvIBgJJSb6u-u1qih5CCD.woff2) format('woff2');
|
||||||
|
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100;
|
||||||
|
src: local('Roboto Slab Thin'), local('RobotoSlab-Thin'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngOUXZYTXPIvIBgJJSb6u-u1qmh5CCD.woff2) format('woff2');
|
||||||
|
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100;
|
||||||
|
src: local('Roboto Slab Thin'), local('RobotoSlab-Thin'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngOUXZYTXPIvIBgJJSb6u-u1qeh5A.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 300;
|
||||||
|
src: local('Roboto Slab Light'), local('RobotoSlab-Light'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u9mxLCLwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 300;
|
||||||
|
src: local('Roboto Slab Light'), local('RobotoSlab-Light'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u9mxLCCwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* greek-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 300;
|
||||||
|
src: local('Roboto Slab Light'), local('RobotoSlab-Light'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u9mxLCKwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+1F00-1FFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* greek */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 300;
|
||||||
|
src: local('Roboto Slab Light'), local('RobotoSlab-Light'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u9mxLCFwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0370-03FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vietnamese */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 300;
|
||||||
|
src: local('Roboto Slab Light'), local('RobotoSlab-Light'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u9mxLCJwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 300;
|
||||||
|
src: local('Roboto Slab Light'), local('RobotoSlab-Light'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u9mxLCIwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 300;
|
||||||
|
src: local('Roboto Slab Light'), local('RobotoSlab-Light'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u9mxLCGwR0.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Roboto Slab Regular'), local('RobotoSlab-Regular'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngMUXZYTXPIvIBgJJSb6ufA5qW54A.woff2) format('woff2');
|
||||||
|
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Roboto Slab Regular'), local('RobotoSlab-Regular'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngMUXZYTXPIvIBgJJSb6ufJ5qW54A.woff2) format('woff2');
|
||||||
|
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* greek-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Roboto Slab Regular'), local('RobotoSlab-Regular'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngMUXZYTXPIvIBgJJSb6ufB5qW54A.woff2) format('woff2');
|
||||||
|
unicode-range: U+1F00-1FFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* greek */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Roboto Slab Regular'), local('RobotoSlab-Regular'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngMUXZYTXPIvIBgJJSb6ufO5qW54A.woff2) format('woff2');
|
||||||
|
unicode-range: U+0370-03FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vietnamese */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Roboto Slab Regular'), local('RobotoSlab-Regular'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngMUXZYTXPIvIBgJJSb6ufC5qW54A.woff2) format('woff2');
|
||||||
|
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Roboto Slab Regular'), local('RobotoSlab-Regular'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngMUXZYTXPIvIBgJJSb6ufD5qW54A.woff2) format('woff2');
|
||||||
|
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Roboto Slab Regular'), local('RobotoSlab-Regular'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngMUXZYTXPIvIBgJJSb6ufN5qU.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Roboto Slab Bold'), local('RobotoSlab-Bold'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u92w7CLwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cyrillic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Roboto Slab Bold'), local('RobotoSlab-Bold'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u92w7CCwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* greek-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Roboto Slab Bold'), local('RobotoSlab-Bold'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u92w7CKwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+1F00-1FFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* greek */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Roboto Slab Bold'), local('RobotoSlab-Bold'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u92w7CFwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0370-03FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vietnamese */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Roboto Slab Bold'), local('RobotoSlab-Bold'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u92w7CJwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin-ext */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Roboto Slab Bold'), local('RobotoSlab-Bold'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u92w7CIwR26eg.woff2) format('woff2');
|
||||||
|
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto Slab';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
src: local('Roboto Slab Bold'), local('RobotoSlab-Bold'), url(https://fonts.gstatic.com/s/robotoslab/v7/BngRUXZYTXPIvIBgJJSb6u92w7CGwR0.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
49
src/main/resources/META-INF/resources/css/style.css
Normal file
49
src/main/resources/META-INF/resources/css/style.css
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
.black {
|
||||||
|
background-color: #383838 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-picklist-list-wrapper {
|
||||||
|
width: 50% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-picklist-list {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.text-draft {
|
||||||
|
color: rgba(0, 0, 0, 0.48) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-primary {
|
||||||
|
color: #228bba !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-warning {
|
||||||
|
color: #940000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-review {
|
||||||
|
color: #94028d !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-success {
|
||||||
|
color: #007741 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-accepted {
|
||||||
|
color: #fec503 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-not-accepted {
|
||||||
|
color: #A38831 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-failed {
|
||||||
|
color: #A38831 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
color: #fed136 !important;
|
||||||
|
font-family: 'Kaushan Script', 'Helvetica Neue', Helvetica, Arial, cursive;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user