Project first commit

This commit is contained in:
ilyin 2024-07-18 18:01:54 +03:00
commit b3e4f6cffe
205 changed files with 39437 additions and 0 deletions

394
backend/pom.xml Normal file
View file

@ -0,0 +1,394 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ervu_secret</groupId>
<artifactId>ervu_secret</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>ervu_secret.ervu_secret</groupId>
<artifactId>backend</artifactId>
<packaging>war</packaging>
<dependencies>
<!--JWT-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ervu_secret.ervu_secret</groupId>
<artifactId>resources</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.reporting.reporting-jasper</groupId>
<artifactId>reporting-jasper-fonts</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime</artifactId>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
</dependency>
<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<!-- security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<!-- -->
<dependency>
<groupId>ru.cg.webbpm.modules</groupId>
<artifactId>inject</artifactId>
</dependency>
<!-- bpmn -->
<dependency>
<groupId>ru.cg.webbpm.modules.bpmn</groupId>
<artifactId>bpmn-workflow-api</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.bpmn</groupId>
<artifactId>bpmn-workflow-jbpm-api</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.bpmn</groupId>
<artifactId>bpmn-workflow-jbpm</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.bpmn</groupId>
<artifactId>bpmn-beans</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.bpmn</groupId>
<artifactId>bpmn-variable-condition-adapter</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.bpmn</groupId>
<artifactId>bpmn-deploy</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules</groupId>
<artifactId>webkit-rpc</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules</groupId>
<artifactId>webkit-beans</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.core</groupId>
<artifactId>core-runtime-api</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.resources</groupId>
<artifactId>resources-api</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.core</groupId>
<artifactId>error-handling-api</artifactId>
</dependency>
<!-- database asset-->
<dependency>
<groupId>ru.cg.webbpm.modules.database</groupId>
<artifactId>database-api</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.database</groupId>
<artifactId>database-impl</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.jndi</groupId>
<artifactId>jndi-beans</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.jndi</groupId>
<artifactId>jndi-inject</artifactId>
</dependency>
<!-- packaged -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.database</groupId>
<artifactId>database-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules</groupId>
<artifactId>standard-annotations</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.core</groupId>
<artifactId>metrics</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.webkit</groupId>
<artifactId>active-users-tracker</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.security</groupId>
<artifactId>security-beans</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.security</groupId>
<artifactId>security-api</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.security</groupId>
<artifactId>security-esia</artifactId>
</dependency>
<!-- reporting -->
<dependency>
<groupId>ru.cg.webbpm.modules.reporting</groupId>
<artifactId>reporting-api</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.reporting</groupId>
<artifactId>reporting-runtime-api</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.reporting</groupId>
<artifactId>reporting-runtime-impl</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.reporting.reporting-jasper</groupId>
<artifactId>reporting-jasper-impl</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.reporting.reporting-jasper</groupId>
<artifactId>reporting-jasper-runtime-impl</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.reporting.reporting-xdoc</groupId>
<artifactId>reporting-xdoc-impl</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.reporting.reporting-xdoc</groupId>
<artifactId>reporting-xdoc-runtime-impl</artifactId>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules</groupId>
<artifactId>webkit-base</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.security</groupId>
<artifactId>security-db-synchronization-api</artifactId>
</dependency>
<dependency>
<groupId>ru.cg.webbpm.modules.security</groupId>
<artifactId>security-db-synchronization-ldap-impl</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>ru.micord.fias</groupId>
<artifactId>client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.kerberos</groupId>
<artifactId>spring-security-kerberos-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.kerberos</groupId>
<artifactId>spring-security-kerberos-web</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
</dependency>
<dependency>
<groupId>org.mnode.ical4j</groupId>
<artifactId>ical4j</artifactId>
</dependency>
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-spring</artifactId>
</dependency>
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-provider-jdbc-template</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- false means true due https://issues.apache.org/jira/browse/MCOMPILER-209 -->
<useIncrementalCompilation>false</useIncrementalCompilation>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/target/generated-sources/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>studio</id>
<dependencies>
<dependency>
<groupId>ru.cg.webbpm.modules.resources</groupId>
<artifactId>resources-impl-development</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dev</id>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,65 @@
import java.time.Duration;
import javax.sql.DataSource;
import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider;
import net.javacrumbs.shedlock.spring.ScheduledLockConfiguration;
import net.javacrumbs.shedlock.spring.ScheduledLockConfigurationBuilder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
/**
* Root application context
* This context imports XML configs from all the other jars, and is created by {@link WebAppInitializer}
* NB: modules are excluded from component scan since spring-context.xml sometimes holds important parameters and / or annotations
* @author krylov
*/
@Configuration
@ComponentScan(basePackages = {
"service",
"dao",
"bpmn",
"i18n",
"errorhandling",
"database",
"security",
"component.addresses",
"gen",
"ru.cg",
"ru.micord"
})
@EnableAspectJAutoProxy(proxyTargetClass = true)
@EnableWebMvc
@EnableScheduling
public class AppConfig {
@Bean
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer(){
return new PropertySourcesPlaceholderConfigurer();
}
@Bean
public ScheduledLockConfiguration taskScheduler(LockProvider lockProvider) {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(12);
scheduler.initialize();
return ScheduledLockConfigurationBuilder
.withLockProvider(lockProvider)
.withTaskScheduler(scheduler)
.withDefaultLockAtMostFor(Duration.ofHours(4))
.build();
}
@Bean
public LockProvider lockProvider(@Qualifier("datasource") DataSource dataSource) {
return new JdbcTemplateLockProvider(dataSource);
}
}

View file

@ -0,0 +1,31 @@
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import org.springframework.web.util.IntrospectorCleanupListener;
/**
* This initializer creates root context and registers dispatcher servlet
* Spring scans for initializers automatically
*/
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
servletContext.addListener(new IntrospectorCleanupListener());
}
protected String[] getServletMappings() {
return new String[]{"/"};
}
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[]{AppConfig.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[0];
}
}

View file

@ -0,0 +1,34 @@
package controller;
import dto.jivoprofile.JivoProfileDto;
import org.hsqldb.lib.StringUtil;
import org.springframework.web.bind.annotation.*;
import ru.cg.webbpm.modules.security.api.model.User;
import ru.cg.webbpm.modules.security.api.service.UserService;
@RestController
public class ProfileController {
private UserService userService;
public ProfileController(UserService userService) {
this.userService = userService;
}
@RequestMapping(value = "/profile/jivo/{userId}", method = RequestMethod.GET)
public JivoProfileDto profile(@PathVariable("userId") String userId) {
if (StringUtil.isEmpty(userId)) {
return new JivoProfileDto();
}
User user = userService.get(userId);
JivoProfileDto profileDto = new JivoProfileDto();
profileDto.setUsername(user.firstName());
profileDto.setEmail(user.email());
profileDto.setPhone(user.phone());
return profileDto;
}
}

View file

@ -0,0 +1,35 @@
package dto.jivoprofile;
import ru.cg.webbpm.modules.webkit.annotations.Model;
@Model
public class JivoProfileDto {
public String username;
public String email;
public String phone;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}

View file