diff --git a/core/pom.xml b/core/pom.xml deleted file mode 100644 index 4a34740..0000000 --- a/core/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - consultant - org.sadtech - 1.0-SNAPSHOT - - 4.0.0 - - consultant-core - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - - - 1.0.2 - 1.18.4 - 1.2.17 - - 2.1.3.RELEASE - - - - - javax.persistence - persistence-api - ${persistence.ver} - - - - org.projectlombok - lombok - ${lombok.ver} - - - - log4j - log4j - ${log4j} - - - - org.springframework.data - spring-data-jpa - ${spring.data} - - - javax.persistence - javax.persistence-api - 2.2 - - - - \ No newline at end of file diff --git a/fit-elit-consultant/pom.xml b/fit-elit-consultant/pom.xml deleted file mode 100644 index 63bbdc8..0000000 --- a/fit-elit-consultant/pom.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - consultant - org.sadtech - 0.1-SNAPSHOT - - 4.0.0 - - ru.fit-elit - consultant - 0.1-SNAPSHOT - - - - org.apache.maven.plugins - maven-compiler-plugin - - 7 - 7 - - - - - - - 0.5.13-SNAPSHOT - - 5.1.3.RELEASE - 5.1.3.RELEASE - 5.1.3.RELEASE - 5.1.3.RELEASE - 5.1.3.RELEASE - 5.1.3.RELEASE - 2.1.3.RELEASE - - 3.1.0 - 2.2 - - 5.4.0.Final - 5.2.10.Final - - 8.0.13 - - 1.18.4 - - 1.2.17 - - 20180813 - - 6.1.25 - - - - - - com.vk.api - sdk - ${vk.api.ver} - - - - org.sadtech - vk-bot - 0.2-SNAPSHOT - - - - org.projectlombok - lombok - ${lombok} - - - - log4j - log4j - ${log4j} - - - - - org.springframework - spring-core - ${spring.core} - - - org.springframework - spring-context - ${spring.context} - - - org.springframework - spring-context-support - ${spring.context} - - - org.springframework - spring-web - ${spring.web} - - - org.springframework - spring-webmvc - ${spring.webmvc} - - - org.springframework.data - spring-data-jpa - ${spring.data} - - - org.springframework - spring-orm - 5.1.3.RELEASE - - - - com.google.code.gson - gson - 2.8.5 - - - - org.mortbay.jetty - jetty-util - ${jetty.util} - - - - org.json - json - ${json} - - - - javax.persistence - javax.persistence-api - ${javax.persistance} - - - mysql - mysql-connector-java - ${mysql.connector} - - - - org.hibernate - hibernate-entitymanager - ${hibernate.entitymanager} - - - org.hibernate - hibernate-core - ${hibernate.core} - - - - org.slf4j - slf4j-nop - 1.7.13 - - - - org.sadtech - consultant-core - 1.0-SNAPSHOT - compile - - - org.jetbrains - annotations-java5 - 16.0.2 - compile - - - - - - \ No newline at end of file diff --git a/fit-elit-consultant/src/main/java/ru/fitelit/consultant/Main.java b/fit-elit-consultant/src/main/java/ru/fitelit/consultant/Main.java deleted file mode 100644 index 0ce3138..0000000 --- a/fit-elit-consultant/src/main/java/ru/fitelit/consultant/Main.java +++ /dev/null @@ -1,27 +0,0 @@ -package ru.fitelit.consultant; - -import lombok.extern.log4j.Log4j; -import org.sadtech.consultant.processing.MessageHandler; -import org.sadtech.vkbot.core.handlers.Handled; -import org.sadtech.vkbot.core.listener.EventListenable; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import ru.fitelit.consultant.config.SpringConfigVk; - -@Log4j -public class Main { - - public static void main(String[] args) throws Exception { - Main main = new Main(); - main.run(); - } - - public void run() throws Exception { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfigVk.class); - EventListenable eventListener = context.getBean(EventListenable.class); - eventListener.listen(); - Handled dispatcherHandler = context.getBean(Handled.class); - dispatcherHandler.sortAndSend(); - MessageHandler messageHandler = context.getBean(MessageHandler.class); - messageHandler.processing(); - } -} diff --git a/fit-elit-consultant/src/main/java/ru/fitelit/consultant/config/DataConfig.java b/fit-elit-consultant/src/main/java/ru/fitelit/consultant/config/DataConfig.java deleted file mode 100644 index ccef4cb..0000000 --- a/fit-elit-consultant/src/main/java/ru/fitelit/consultant/config/DataConfig.java +++ /dev/null @@ -1,76 +0,0 @@ -package ru.fitelit.consultant.config; - -import org.hibernate.jpa.HibernatePersistenceProvider; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import javax.sql.DataSource; -import java.util.Properties; - -@Configuration -@EnableTransactionManagement -@ComponentScan("org.sadtech.consultant.database.service") -@EnableJpaRepositories("org.sadtech.consultant.database.repository") -public class DataConfig { - - @Value("${db.driver}") - private String PROPERTY_NAME_DATABASE_DRIVER; - @Value("${db.url}") - private String PROPERTY_NAME_DATABASE_URL; - @Value("${db.username}") - private String PROPERTY_NAME_DATABASE_USERNAME; - @Value("${db.password}") - private String PROPERTY_NAME_DATABASE_PASSWORD; - - @Value("${db.hibernate.dialect}") - private String PROPERTY_NAME_HIBERNATE_DIALECT; - @Value("${db.hibernate.show_sql}") - private String PROPERTY_NAME_HIBERNATE_SHOW_SQL; - @Value("${db.entitymanager.packages.to.scan}") - private String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN; - @Value("${db.hibernate.hbm2ddl.auto}") - private String PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO; - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); - entityManagerFactoryBean.setDataSource(dataSource()); - entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class); - entityManagerFactoryBean.setPackagesToScan(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN); - entityManagerFactoryBean.setJpaProperties(hibernateProp()); - return entityManagerFactoryBean; - } - - @Bean - public JpaTransactionManager transactionManager() { - JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); - return transactionManager; - } - - @Bean - public DataSource dataSource() { - DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(PROPERTY_NAME_DATABASE_DRIVER); - dataSource.setUrl(PROPERTY_NAME_DATABASE_URL); - dataSource.setUsername(PROPERTY_NAME_DATABASE_USERNAME); - dataSource.setPassword(PROPERTY_NAME_DATABASE_PASSWORD); - return dataSource; - } - - private Properties hibernateProp() { - Properties properties = new Properties(); - properties.put("hibernate.dialect", PROPERTY_NAME_HIBERNATE_DIALECT); - properties.put("hibernate.show_sql", PROPERTY_NAME_HIBERNATE_SHOW_SQL); - properties.put("hibernate.hbm2ddl.auto", PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO); - return properties; - } - -} \ No newline at end of file diff --git a/fit-elit-consultant/src/main/java/ru/fitelit/consultant/config/SpringConfigVk.java b/fit-elit-consultant/src/main/java/ru/fitelit/consultant/config/SpringConfigVk.java deleted file mode 100644 index a700ffe..0000000 --- a/fit-elit-consultant/src/main/java/ru/fitelit/consultant/config/SpringConfigVk.java +++ /dev/null @@ -1,90 +0,0 @@ -package ru.fitelit.consultant.config; - -import com.vk.api.sdk.client.TransportClient; -import com.vk.api.sdk.client.VkApiClient; -import com.vk.api.sdk.client.actors.GroupActor; -import com.vk.api.sdk.client.actors.ServiceActor; -import com.vk.api.sdk.exceptions.ApiException; -import com.vk.api.sdk.exceptions.ClientException; -import com.vk.api.sdk.httpclient.HttpTransportClient; -import com.vk.api.sdk.objects.groups.responses.GetLongPollServerResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.*; -import org.springframework.core.task.TaskExecutor; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor; - -import java.util.concurrent.Executors; - - -@Configuration -@EnableAsync -@PropertySource("classpath:config.properties") -@Import({DataConfig.class}) -@ComponentScan({"ru.fitelit.consultant", "org.sadtech.consultant.processing", "org.sadtech.vkbot.core"}) - -public class SpringConfigVk { - - @Value("${vk.groupID}") - private String groupId; - - @Value("${vk.appID}") - private String appID; - - @Value("${vk.secretKey}") - private String secretKey; - - @Value("${vk.redirectURL}") - private String redirectURL; - - @Value("${vk.code}") - private String code; - - @Value("${vk.token}") - private String token; - - @Value("${vk.service.token}") - private String serviceToken; - - @Bean - public TransportClient transportClient() { - return HttpTransportClient.getInstance(); - } - - @Bean - public VkApiClient vkApiClient() { - VkApiClient vk = new VkApiClient(transportClient()); - return vk; - } - - @Bean - public GroupActor groupActor() { - GroupActor actor = new GroupActor(new Integer(groupId), token); - return actor; - } - - @Bean - public ServiceActor serviceActor() { - ServiceActor actor = new ServiceActor(new Integer(appID), serviceToken); - return actor; - } - - @Bean - public GetLongPollServerResponse GroupsGetLongPollServerQuery() { - GetLongPollServerResponse getLongPollServerResponse = null; - try { - getLongPollServerResponse = vkApiClient().groups().getLongPollServer(groupActor()).execute(); - } catch (ApiException | ClientException e) { - e.printStackTrace(); - } - return getLongPollServerResponse; - } - - - @Bean - public TaskExecutor taskExecutor() { - return new ConcurrentTaskExecutor(Executors.newFixedThreadPool(5)); - } - - -} diff --git a/fit-elit-consultant/src/main/java/ru/fitelit/consultant/config/WebConfig.java b/fit-elit-consultant/src/main/java/ru/fitelit/consultant/config/WebConfig.java deleted file mode 100644 index df46ba0..0000000 --- a/fit-elit-consultant/src/main/java/ru/fitelit/consultant/config/WebConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -//package org.sadtech.vkbot.config; -// -//import com.vk.api.sdk.exceptions.ApiException; -//import com.vk.api.sdk.exceptions.ClientException; -//import EventListenable; -//import Observable; -//import EventListenerVk; -//import org.springframework.context.annotation.ComponentScan; -//import org.springframework.context.annotation.Configuration; -//import org.springframework.web.WebApplicationInitializer; -//import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -//import org.springframework.web.servlet.DispatcherServlet; -// -//import javax.servlet.ServletContext; -//import javax.servlet.ServletException; -// -//@Configuration -//public class WebConfig implements WebApplicationInitializer { -// -// @Override -// public void onStartup(ServletContext servletContext) throws ServletException { -// AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); -// context.register(SpringConfigVk.class, DataConfig.class, WebConfig.class); -// -//// context.setServletContext(servletContext); -//// -//// -//// ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(context)); -//// dispatcher.setLoadOnStartup(1); -//// dispatcher.addMapping("/"); -// } -//} diff --git a/pom.xml b/pom.xml index 8d58c86..26b594b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,15 +4,57 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.sadtech - consultant - pom - 0.1-SNAPSHOT - - vk-bot - core - fit-elit-consultant - + consultant-core + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + + 1.0.2 + 1.18.4 + 1.2.17 + + 2.1.3.RELEASE + + + + + javax.persistence + persistence-api + ${persistence.ver} + + + + org.projectlombok + lombok + ${lombok.ver} + + + + log4j + log4j + ${log4j} + + + + org.springframework.data + spring-data-jpa + ${spring.data} + + + javax.persistence + javax.persistence-api + 2.2 + + \ No newline at end of file diff --git a/core/src/main/java/org/sadtech/consultant/MessageSender.java b/src/main/java/org/sadtech/consultant/MessageSender.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/MessageSender.java rename to src/main/java/org/sadtech/consultant/MessageSender.java diff --git a/core/src/main/java/org/sadtech/consultant/database/entity/Mail.java b/src/main/java/org/sadtech/consultant/database/entity/Mail.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/entity/Mail.java rename to src/main/java/org/sadtech/consultant/database/entity/Mail.java diff --git a/core/src/main/java/org/sadtech/consultant/database/entity/NextUnit.java b/src/main/java/org/sadtech/consultant/database/entity/NextUnit.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/entity/NextUnit.java rename to src/main/java/org/sadtech/consultant/database/entity/NextUnit.java diff --git a/core/src/main/java/org/sadtech/consultant/database/entity/Person.java b/src/main/java/org/sadtech/consultant/database/entity/Person.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/entity/Person.java rename to src/main/java/org/sadtech/consultant/database/entity/Person.java diff --git a/core/src/main/java/org/sadtech/consultant/database/entity/SaveUnit.java b/src/main/java/org/sadtech/consultant/database/entity/SaveUnit.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/entity/SaveUnit.java rename to src/main/java/org/sadtech/consultant/database/entity/SaveUnit.java diff --git a/core/src/main/java/org/sadtech/consultant/database/entity/Unit.java b/src/main/java/org/sadtech/consultant/database/entity/Unit.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/entity/Unit.java rename to src/main/java/org/sadtech/consultant/database/entity/Unit.java diff --git a/core/src/main/java/org/sadtech/consultant/database/repository/MailRepository.java b/src/main/java/org/sadtech/consultant/database/repository/MailRepository.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/repository/MailRepository.java rename to src/main/java/org/sadtech/consultant/database/repository/MailRepository.java diff --git a/core/src/main/java/org/sadtech/consultant/database/repository/NextUnitRepository.java b/src/main/java/org/sadtech/consultant/database/repository/NextUnitRepository.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/repository/NextUnitRepository.java rename to src/main/java/org/sadtech/consultant/database/repository/NextUnitRepository.java diff --git a/core/src/main/java/org/sadtech/consultant/database/repository/PersonRepository.java b/src/main/java/org/sadtech/consultant/database/repository/PersonRepository.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/repository/PersonRepository.java rename to src/main/java/org/sadtech/consultant/database/repository/PersonRepository.java diff --git a/core/src/main/java/org/sadtech/consultant/database/repository/SaveUnitRepositoriy.java b/src/main/java/org/sadtech/consultant/database/repository/SaveUnitRepositoriy.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/repository/SaveUnitRepositoriy.java rename to src/main/java/org/sadtech/consultant/database/repository/SaveUnitRepositoriy.java diff --git a/core/src/main/java/org/sadtech/consultant/database/repository/UnitRepositoriy.java b/src/main/java/org/sadtech/consultant/database/repository/UnitRepositoriy.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/repository/UnitRepositoriy.java rename to src/main/java/org/sadtech/consultant/database/repository/UnitRepositoriy.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/MailService.java b/src/main/java/org/sadtech/consultant/database/service/MailService.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/MailService.java rename to src/main/java/org/sadtech/consultant/database/service/MailService.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/NextUnitService.java b/src/main/java/org/sadtech/consultant/database/service/NextUnitService.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/NextUnitService.java rename to src/main/java/org/sadtech/consultant/database/service/NextUnitService.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/PersonService.java b/src/main/java/org/sadtech/consultant/database/service/PersonService.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/PersonService.java rename to src/main/java/org/sadtech/consultant/database/service/PersonService.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/SaveUnitService.java b/src/main/java/org/sadtech/consultant/database/service/SaveUnitService.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/SaveUnitService.java rename to src/main/java/org/sadtech/consultant/database/service/SaveUnitService.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/UnitService.java b/src/main/java/org/sadtech/consultant/database/service/UnitService.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/UnitService.java rename to src/main/java/org/sadtech/consultant/database/service/UnitService.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/impl/MailServiceImpl.java b/src/main/java/org/sadtech/consultant/database/service/impl/MailServiceImpl.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/impl/MailServiceImpl.java rename to src/main/java/org/sadtech/consultant/database/service/impl/MailServiceImpl.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/impl/NextUnitServiceImpl.java b/src/main/java/org/sadtech/consultant/database/service/impl/NextUnitServiceImpl.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/impl/NextUnitServiceImpl.java rename to src/main/java/org/sadtech/consultant/database/service/impl/NextUnitServiceImpl.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/impl/PersonServiceImpl.java b/src/main/java/org/sadtech/consultant/database/service/impl/PersonServiceImpl.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/impl/PersonServiceImpl.java rename to src/main/java/org/sadtech/consultant/database/service/impl/PersonServiceImpl.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/impl/SaveUnitServiceImpl.java b/src/main/java/org/sadtech/consultant/database/service/impl/SaveUnitServiceImpl.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/impl/SaveUnitServiceImpl.java rename to src/main/java/org/sadtech/consultant/database/service/impl/SaveUnitServiceImpl.java diff --git a/core/src/main/java/org/sadtech/consultant/database/service/impl/UnitServiceImpl.java b/src/main/java/org/sadtech/consultant/database/service/impl/UnitServiceImpl.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/database/service/impl/UnitServiceImpl.java rename to src/main/java/org/sadtech/consultant/database/service/impl/UnitServiceImpl.java diff --git a/core/src/main/java/org/sadtech/consultant/processing/MessageHandler.java b/src/main/java/org/sadtech/consultant/processing/MessageHandler.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/processing/MessageHandler.java rename to src/main/java/org/sadtech/consultant/processing/MessageHandler.java diff --git a/core/src/main/java/org/sadtech/consultant/processing/MessageLogicService.java b/src/main/java/org/sadtech/consultant/processing/MessageLogicService.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/processing/MessageLogicService.java rename to src/main/java/org/sadtech/consultant/processing/MessageLogicService.java diff --git a/core/src/main/java/org/sadtech/consultant/processing/PersonLogicService.java b/src/main/java/org/sadtech/consultant/processing/PersonLogicService.java similarity index 100% rename from core/src/main/java/org/sadtech/consultant/processing/PersonLogicService.java rename to src/main/java/org/sadtech/consultant/processing/PersonLogicService.java