Compare commits
2 Commits
20241010_0
...
feature/SD
| Author | SHA1 | Date | |
|---|---|---|---|
| 21347036cc | |||
| 67170a87ca |
117
.gitignore
vendored
117
.gitignore
vendored
@@ -1,60 +1,39 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/intellij
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij
|
||||
# Created by https://www.gitignore.io/api/intellij
|
||||
|
||||
### Intellij ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
# User-specific stuff:
|
||||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
.idea/dictionaries
|
||||
.idea/vcs.xml
|
||||
.idea/jsLibraryMappings.xml
|
||||
.shelf/*
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
# Sensitive or high-churn files:
|
||||
.idea/dataSources.ids
|
||||
.idea/dataSources.xml
|
||||
.idea/dataSources.local.xml
|
||||
.idea/sqlDataSources.xml
|
||||
.idea/dynamic.xml
|
||||
.idea/uiDesigner.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
# Gradle:
|
||||
.idea/gradle.xml
|
||||
.idea/libraries
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
# Mongo Explorer plugin:
|
||||
.idea/mongoSettings.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
.idea/artifacts
|
||||
.idea/compiler.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/modules.xml
|
||||
.idea/*.iml
|
||||
.idea/modules
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
## File-based project format:
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
@@ -62,62 +41,20 @@ out/
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### Intellij Patch ###
|
||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||
|
||||
# *.iml
|
||||
# modules.xml
|
||||
# .idea/misc.xml
|
||||
# *.ipr
|
||||
*.iml
|
||||
modules.xml
|
||||
|
||||
# Sonarlint plugin
|
||||
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
||||
.idea/**/sonarlint/
|
||||
|
||||
# SonarQube Plugin
|
||||
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
||||
.idea/**/sonarIssues.xml
|
||||
|
||||
# Markdown Navigator plugin
|
||||
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
||||
.idea/**/markdown-navigator.xml
|
||||
.idea/**/markdown-navigator-enh.xml
|
||||
.idea/**/markdown-navigator/
|
||||
|
||||
# Cache file creation bug
|
||||
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
||||
.idea/$CACHE_FILE$
|
||||
|
||||
# CodeStream plugin
|
||||
# https://plugins.jetbrains.com/plugin/12206-codestream
|
||||
.idea/codestream.xml
|
||||
|
||||
# Azure Toolkit for IntelliJ plugin
|
||||
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
|
||||
.idea/**/azureSettings.xml
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/intellij
|
||||
|
||||
# Integry
|
||||
*/target/*
|
||||
*.ckie
|
||||
/ts
|
||||
/temp
|
||||
|
||||
17
.idea/compiler.xml
generated
17
.idea/compiler.xml
generated
@@ -6,9 +6,24 @@
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="ems-engine" />
|
||||
<module name="ems-core" />
|
||||
<module name="ems-engine" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="ems-activity" target="1.8" />
|
||||
<module name="ems-contabil" target="1.8" />
|
||||
<module name="ems-document" target="1.8" />
|
||||
<module name="ems-engine-customizations" target="1.8" />
|
||||
<module name="ems-logistic" target="1.8" />
|
||||
<module name="ems-offer" target="1.8" />
|
||||
<module name="ems-order" target="1.8" />
|
||||
<module name="ems-ordikids" target="1.8" />
|
||||
<module name="ems-product" target="1.8" />
|
||||
<module name="ems-production" target="1.8" />
|
||||
<module name="ems-retail" target="1.8" />
|
||||
<module name="ems-system" target="1.8" />
|
||||
<module name="ems-utility" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
||||
26
.idea/encodings.xml
generated
26
.idea/encodings.xml
generated
@@ -1,10 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/ems-activity/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-activity/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-contabil/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-contabil/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-core/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-core/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-document/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-document/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-engine-customizations/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-engine-customizations/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-engine/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-engine/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-logistic/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-logistic/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-offer/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-offer/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-order/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-order/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-ordikids/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-ordikids/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-product/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-product/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-production/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-production/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-retail/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-retail/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-system/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-system/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-utility/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ems-utility/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
|
||||
8
.idea/file.template.settings.xml
generated
8
.idea/file.template.settings.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExportableFileTemplateSettings">
|
||||
<default_templates>
|
||||
<template name="IntegryMigrationClass.java" file-name="Migration_${YEAR}${MONTH}${DAY}${HOUR}${MINUTE}${SECOND}" reformat="true" live-template-enabled="false" />
|
||||
</default_templates>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/git_toolbox_blame.xml
generated
6
.idea/git_toolbox_blame.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxBlameSettings">
|
||||
<option name="version" value="2" />
|
||||
</component>
|
||||
</project>
|
||||
15
.idea/git_toolbox_prj.xml
generated
15
.idea/git_toolbox_prj.xml
generated
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxProjectSettings">
|
||||
<option name="commitMessageIssueKeyValidationOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationEnabledOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
2
.idea/inspectionProfiles/Project_Default.xml
generated
2
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -2,7 +2,7 @@
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,com.annimon.stream.Stream,of" />
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,org.apache.http.impl.client.HttpClientBuilder,build,org.apache.http.impl.client.HttpClients,createDefault,com.annimon.stream.Stream,of" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
15
.idea/jarRepositories.xml
generated
15
.idea/jarRepositories.xml
generated
@@ -1,16 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="repo-sqlserver" />
|
||||
<option name="name" value="repo-sqlserver" />
|
||||
<option name="url" value="http://maven.lib.umd.edu/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central-http" />
|
||||
<option name="name" value="central-http" />
|
||||
<option name="url" value="http://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="AsposeJavaAPI" />
|
||||
<option name="name" value="Aspose Java API" />
|
||||
<option name="url" value="https://releases.aspose.com/java/repo/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
|
||||
6
.idea/jenkinsSettings.xml
generated
6
.idea/jenkinsSettings.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Jenkins.Application.Settings">
|
||||
<option name="serverUrl" value="https://ci.studioml.it" />
|
||||
</component>
|
||||
</project>
|
||||
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@@ -7,9 +7,7 @@
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="PWA">
|
||||
<option name="wasEnabledAtLeastOnce" value="true" />
|
||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
15
.idea/runConfigurations/MenuStaticCreator.xml
generated
15
.idea/runConfigurations/MenuStaticCreator.xml
generated
@@ -1,15 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="MenuStaticCreator" type="Application" factoryName="Application" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="it.integry.ems.menu.MenuStaticCreator" />
|
||||
<module name="ems-core" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="it.integry.ems.menu.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
107
.idea/runConfigurations/Tomcat.xml
generated
107
.idea/runConfigurations/Tomcat.xml
generated
@@ -1,107 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat" ALTERNATIVE_JRE_ENABLED="false" ALTERNATIVE_JRE_PATH="1.8" nameIsGenerated="true">
|
||||
<option name="COMMON_VM_ARGUMENTS" value="-Xms512m -Xmx2048m" />
|
||||
<deployment>
|
||||
<artifact name="ems-engine:war exploded">
|
||||
<settings>
|
||||
<option name="CONTEXT_PATH" value="/ems-api" />
|
||||
</settings>
|
||||
</artifact>
|
||||
</deployment>
|
||||
<server-settings>
|
||||
<option name="BASE_DIRECTORY_NAME" value="a89fc2ca-88f5-402a-95b3-33bd03a9c1ac" />
|
||||
</server-settings>
|
||||
<log_file alias="Tomcat Manager Log" path="%IDEA_RUN:CATALINA_BASE%/logs/manager.*" />
|
||||
<log_file alias="Tomcat Host Manager Log" path="%IDEA_RUN:CATALINA_BASE%/logs/host-manager.*" />
|
||||
<log_file alias="Tomcat Localhost Access Log" path="%IDEA_RUN:CATALINA_BASE%/logs/localhost_access_log.*" />
|
||||
<predefined_log_file enabled="true" id="Tomcat" />
|
||||
<predefined_log_file enabled="true" id="Tomcat Catalina" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="javadebug" />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="JProfiler">
|
||||
<option name="jreHome" value="$USER_HOME$/.jdks/openjdk-21.0.2" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="JProfiler">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Profile">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
<option name="BuildArtifacts" enabled="true">
|
||||
<artifact name="ems-engine:war exploded" />
|
||||
</option>
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
16
.idea/runConfigurations/Tomcat_9__1__ServerDev_.xml
generated
16
.idea/runConfigurations/Tomcat_9__1__ServerDev_.xml
generated
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat 9 #1 (ServerDev)" type="Remote">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="serverdev" />
|
||||
<option name="PORT" value="8001" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8001" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
12
.idea/runConfigurations/Tomcat_9__2__ServerDev_.xml
generated
12
.idea/runConfigurations/Tomcat_9__2__ServerDev_.xml
generated
@@ -1,12 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat 9 #2 (ServerDev)" type="Remote">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="serverdev" />
|
||||
<option name="PORT" value="8002" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
16
.idea/runConfigurations/Tomcat_9__RistoCash_.xml
generated
16
.idea/runConfigurations/Tomcat_9__RistoCash_.xml
generated
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat 9 (RistoCash)" type="Remote">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="127.0.0.1" />
|
||||
<option name="PORT" value="8001" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8001" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
16
.idea/runConfigurations/Tomcat__1__GestSRV_.xml
generated
16
.idea/runConfigurations/Tomcat__1__GestSRV_.xml
generated
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat #1 (GestSRV)" type="Remote" folderName="Carelli">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="172.16.30.238" />
|
||||
<option name="PORT" value="8001" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8001" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat #1 (Rosso Gargano)" type="Remote" folderName="Rosso Gargano">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="192.168.1.13" />
|
||||
<option name="PORT" value="8001" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8001" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
16
.idea/runConfigurations/Tomcat__1__ServerTomcat_.xml
generated
16
.idea/runConfigurations/Tomcat__1__ServerTomcat_.xml
generated
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat #1 (ServerTomcat)" type="Remote">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="8000" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8000" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
16
.idea/runConfigurations/Tomcat__2__GestSRV_.xml
generated
16
.idea/runConfigurations/Tomcat__2__GestSRV_.xml
generated
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat #2 (GestSRV)" type="Remote" folderName="Carelli">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="172.16.30.238" />
|
||||
<option name="PORT" value="8002" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8002" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
16
.idea/runConfigurations/Tomcat__AnydeskTunnel_.xml
generated
16
.idea/runConfigurations/Tomcat__AnydeskTunnel_.xml
generated
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat (AnydeskTunnel)" type="Remote">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="servertomcat" />
|
||||
<option name="PORT" value="8000" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8000" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
107
.idea/runConfigurations/Tomcat__FAST_.xml
generated
107
.idea/runConfigurations/Tomcat__FAST_.xml
generated
@@ -1,107 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat (FAST)" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat" ALTERNATIVE_JRE_ENABLED="false">
|
||||
<option name="COMMON_VM_ARGUMENTS" value="-DDISABLE_DROOLS_COMPILE=TRUE -Xms6G -Xmx6G -XX:MaxPermSize=1G -XX:PermSize=512M" />
|
||||
<deployment>
|
||||
<artifact name="ems-engine:war exploded">
|
||||
<settings>
|
||||
<option name="CONTEXT_PATH" value="/ems-api" />
|
||||
</settings>
|
||||
</artifact>
|
||||
</deployment>
|
||||
<server-settings>
|
||||
<option name="BASE_DIRECTORY_NAME" value="00c7852d-22fb-44e1-9140-8ae73b4192fd" />
|
||||
</server-settings>
|
||||
<log_file alias="Tomcat Manager Log" path="%IDEA_RUN:CATALINA_BASE%/logs/manager.*" />
|
||||
<log_file alias="Tomcat Host Manager Log" path="%IDEA_RUN:CATALINA_BASE%/logs/host-manager.*" />
|
||||
<log_file alias="Tomcat Localhost Access Log" path="%IDEA_RUN:CATALINA_BASE%/logs/localhost_access_log.*" />
|
||||
<predefined_log_file enabled="true" id="Tomcat" />
|
||||
<predefined_log_file enabled="true" id="Tomcat Catalina" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="javadebug" />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="JProfiler">
|
||||
<option name="jreHome" value="$PROJECT_DIR$/../../../Program Files/Java/jdk1.8.0_202" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="JProfiler">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Profile">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
<option name="BuildArtifacts" enabled="true">
|
||||
<artifact name="ems-engine:war exploded" />
|
||||
</option>
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
16
.idea/runConfigurations/Tosca_Cloud.xml
generated
16
.idea/runConfigurations/Tosca_Cloud.xml
generated
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tosca Cloud" type="Remote" folderName="Tosca">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="4.232.161.31" />
|
||||
<option name="PORT" value="8001" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8001" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
16
.idea/runConfigurations/Tosca_Verona.xml
generated
16
.idea/runConfigurations/Tosca_Verona.xml
generated
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tosca Verona" type="Remote" folderName="Tosca">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="10.19.178.6" />
|
||||
<option name="PORT" value="8001" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8001" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
4152
IntegryManagementSystem.ipr
Normal file
4152
IntegryManagementSystem.ipr
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,122 +0,0 @@
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage ('PreBuild Steps (Master)') {
|
||||
when {
|
||||
expression {
|
||||
return env.GIT_BRANCH == "master"
|
||||
}
|
||||
}
|
||||
steps {
|
||||
echo "Creo version tag su Git"
|
||||
bat 'build\\create_build_tag.bat'
|
||||
}
|
||||
}
|
||||
stage('Maven Build') {
|
||||
steps {
|
||||
echo "${WORKSPACE}"
|
||||
withMaven(jdk: 'JDK 17.0.6 x64', traceability: true, maven: 'Maven 3.9.5') {
|
||||
bat(script: 'mvn clean install -t toolchains-jenkins.xml', returnStdout: true)
|
||||
archiveArtifacts(artifacts: 'ems-engine/target/*.war*', onlyIfSuccessful: true)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish Develop') {
|
||||
when {
|
||||
expression {
|
||||
return env.GIT_BRANCH == "develop"
|
||||
}
|
||||
}
|
||||
parallel {
|
||||
stage('Tomcat update') {
|
||||
stages {
|
||||
stage('Update Tomcat 1') {
|
||||
steps {
|
||||
echo "Updating Tomcat9 from ${WORKSPACE}"
|
||||
powershell returnStdout: true, script: "build\\update_tomcat.ps1 -serviceName \"Tomcat9\" -httpPort \"8081\" -updatedArtifactPath \"${WORKSPACE}\\ems-engine\\target\\ems-api.war\""
|
||||
}
|
||||
}
|
||||
stage('Update Tomcat 2') {
|
||||
steps {
|
||||
echo "Updating Tomcat9 from ${WORKSPACE}"
|
||||
powershell returnStdout: true, script: "build\\update_tomcat.ps1 -serviceName \"Tomcat9Backup\" -httpPort \"8082\" -updatedArtifactPath \"${WORKSPACE}\\ems-engine\\target\\ems-api.war\""
|
||||
bat 'curl -k https://devservices.studioml.it/ems-api/updateWMSApp'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish over FTP') {
|
||||
steps {
|
||||
echo "Publish over FTP"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish Master') {
|
||||
when {
|
||||
expression {
|
||||
return env.GIT_BRANCH == "master"
|
||||
}
|
||||
}
|
||||
parallel {
|
||||
stage('Tomcat update') {
|
||||
stages {
|
||||
stage('Update Tomcat 1') {
|
||||
steps {
|
||||
echo "Updating Tomcat9 from ${WORKSPACE}"
|
||||
sshPublisher(publishers: [sshPublisherDesc(configName: 'Production Linux Tomcat Server (192.168.3.16)', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''sudo /usr/bin/systemctl stop tomcat9
|
||||
rm -R tomcat9/webapps/ems-api
|
||||
sudo /usr/bin/systemctl start tomcat9
|
||||
|
||||
/home/studioml/./wait_tomcat_startup.sh 8081''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/tomcat9/webapps', remoteDirectorySDF: false, removePrefix: 'ems-engine/target/', sourceFiles: 'ems-engine/target/*.war*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
||||
}
|
||||
}
|
||||
stage('Update Tomcat 2') {
|
||||
steps {
|
||||
echo "Updating Tomcat9 from ${WORKSPACE}"
|
||||
sshPublisher(publishers: [sshPublisherDesc(configName: 'Production Linux Tomcat Server (192.168.3.16)', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''sudo /usr/bin/systemctl stop tomcat9backup
|
||||
rm -R tomcat9backup/webapps/ems-api
|
||||
sudo /usr/bin/systemctl start tomcat9backup
|
||||
|
||||
/home/studioml/./wait_tomcat_startup.sh 8082
|
||||
|
||||
sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/tomcat9backup/webapps', remoteDirectorySDF: false, removePrefix: 'ems-engine/target/', sourceFiles: 'ems-engine/target/*.war*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
||||
bat 'curl -k https://services.studioml.it/ems-api/updateWMSApp'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish over FTP') {
|
||||
steps {
|
||||
ftpPublisher alwaysPublishFromMaster: false,
|
||||
continueOnError: false,
|
||||
failOnError: false,
|
||||
masterNodeName: '',
|
||||
paramPublish: null,
|
||||
publishers: [[configName: 'OVH Linux Web Server (51.38.112.23)',
|
||||
transfers: [[asciiMode: false,
|
||||
cleanRemote: false,
|
||||
excludes: '',
|
||||
flatten: false,
|
||||
makeEmptyDirs: false,
|
||||
noDefaultExcludes: false,
|
||||
patternSeparator: '[, ]+',
|
||||
remoteDirectory: '/download/Aggiornamenti',
|
||||
remoteDirectorySDF: false,
|
||||
removePrefix: 'ems-engine/target/',
|
||||
sourceFiles: 'ems-engine/target/*.war*']],
|
||||
usePromotionTimestamp: false,
|
||||
useWorkspaceInPromotion: false,
|
||||
verbose: true]]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
REM SET YEAR
|
||||
set YEAR=%date:~6,4%
|
||||
|
||||
REM SET MONTH
|
||||
set MONTH=%date:~3,2%
|
||||
if %MONTH% LSS 10 set MONTH=%MONTH:~1,2%
|
||||
if %MONTH% LSS 10 set MONTH=0%MONTH%
|
||||
|
||||
REM SET DAY
|
||||
set DAY=%date:~0,2%
|
||||
if %DAY% LSS 10 set DAY=%DAY:~1,2%
|
||||
if %DAY% LSS 10 set DAY=0%DAY%
|
||||
|
||||
REM SET HOUR
|
||||
set HOUR=%time:~0,2%
|
||||
if %HOUR% LSS 10 set HOUR=%HOUR:~1,2%
|
||||
if %HOUR% LSS 10 set HOUR=0%HOUR%
|
||||
|
||||
REM SET MINUTE
|
||||
set MINUTE=%time:~3,2%
|
||||
if %MINUTE% LSS 10 set MINUTE=%MINUTE:~1,2%
|
||||
if %MINUTE% LSS 10 set MINUTE=0%MINUTE%
|
||||
|
||||
REM SET SECOND
|
||||
set SECOND=%time:~6,2%
|
||||
if %SECOND% LSS 10 set SECOND=%SECOND:~1,2%
|
||||
if %SECOND% LSS 10 set SECOND=0%SECOND%
|
||||
|
||||
set mydate=%YEAR%%MONTH%%DAY%_%HOUR%%MINUTE%%SECOND%
|
||||
|
||||
|
||||
|
||||
echo #spring.profiles.active=@activatedProperties@ > ems-core\src\main\resources\configs\env.properties
|
||||
echo project.version=%mydate% >> ems-core\src\main\resources\configs\env.properties
|
||||
|
||||
|
||||
git add . -A
|
||||
git commit -m "%mydate%"
|
||||
git tag "%mydate%"
|
||||
|
||||
|
||||
git push https://git.studioml.it/Integry/IntegryManagementSystem.git --tags
|
||||
git push https://git.studioml.it/Integry/IntegryManagementSystem.git --all
|
||||
@@ -1,153 +0,0 @@
|
||||
Param(
|
||||
[string]$serviceName, #Argomento passato dal chiamante
|
||||
[Int32]$httpPort, #Argomento passato dal chiamante
|
||||
[string]$updatedArtifactPath #Argomento passato dal chiamante
|
||||
)
|
||||
|
||||
$max_attempts = 48
|
||||
$attempt = 0
|
||||
$webappsPath = "C:\Program Files\$serviceName\webapps"
|
||||
|
||||
# Funzione per eseguire la chiamata GET e controllare lo status code
|
||||
function Check-Status {
|
||||
try {
|
||||
$request = Invoke-WebRequest -Uri "http://localhost:$httpPort/ems-api/system/ok" -Method Get -ErrorAction Stop
|
||||
$statusCode = $request.StatusCode
|
||||
if ($statusCode -eq 200) {
|
||||
Write-Host "Status code 200 ricevuto, processo completato."
|
||||
exit 0
|
||||
} else {
|
||||
Write-Host "Status code $statusCode ricevuto, continuo a provare..."
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Errore: $_"
|
||||
}
|
||||
}
|
||||
|
||||
# Funzione per cancellare una cartella e un file
|
||||
function Delete-FilesAndFolder
|
||||
{
|
||||
param (
|
||||
[string]$folderPath,
|
||||
[string]$filePath
|
||||
)
|
||||
|
||||
try {
|
||||
# Cancellare la cartella specificata
|
||||
if (Test-Path -Path $folderPath) {
|
||||
Remove-Item -Path $folderPath -Recurse -Force
|
||||
Write-Host "Cartella $folderPath eliminata con successo."
|
||||
} else {
|
||||
Write-Host "La cartella $folderPath non esiste."
|
||||
}
|
||||
|
||||
# Cancellare il file specificato
|
||||
if (Test-Path -Path $filePath) {
|
||||
Remove-Item -Path $filePath -Force
|
||||
Write-Host "File $filePath eliminato con successo."
|
||||
} else {
|
||||
Write-Host "Il file $filePath non esiste."
|
||||
}
|
||||
|
||||
} catch {
|
||||
Write-Host "Errore nella cancellazione di file o cartella: $_"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Funzione per copiare un file
|
||||
function Copy-File {
|
||||
param (
|
||||
[string]$sourceFilePath,
|
||||
[string]$destinationFilePath
|
||||
)
|
||||
|
||||
try {
|
||||
if (Test-Path -Path $sourceFilePath) {
|
||||
Copy-Item -Path $sourceFilePath -Destination $destinationFilePath -Force
|
||||
Write-Host "File copiato da $sourceFilePath a $destinationFilePath con successo."
|
||||
} else {
|
||||
Write-Host "Il file sorgente $sourceFilePath non esiste."
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Errore nella copia del file: $_"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Funzione per stoppare un servizio e attendere che sia completamente fermato
|
||||
function Stop-ServiceAndWait {
|
||||
param (
|
||||
[string]$serviceName
|
||||
)
|
||||
|
||||
# Tentativo di stoppare il servizio
|
||||
try {
|
||||
Write-Host "Sto stoppando il servizio $serviceName..."
|
||||
Stop-Service -Name $serviceName -Force
|
||||
|
||||
# Attesa finché il servizio non viene stoppato
|
||||
$service = Get-Service -Name $serviceName
|
||||
while ($service.Status -ne 'Stopped') {
|
||||
Write-Host "Attendo che il servizio $serviceName si fermi..."
|
||||
Start-Sleep -Seconds 5
|
||||
$service = Get-Service -Name $serviceName
|
||||
}
|
||||
|
||||
Write-Host "Il servizio $serviceName è stato fermato con successo."
|
||||
} catch {
|
||||
Write-Host "Errore nello stoppare il servizio ${serviceName}: $_"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Funzione per avviare nuovamente un servizio e attendere che sia in esecuzione
|
||||
function Start-ServiceAndWait {
|
||||
param (
|
||||
[string]$serviceName
|
||||
)
|
||||
|
||||
try {
|
||||
Write-Host "Sto avviando il servizio $serviceName..."
|
||||
Start-Service -Name $serviceName
|
||||
|
||||
# Attesa finché il servizio non viene avviato
|
||||
$service = Get-Service -Name $serviceName
|
||||
while ($service.Status -ne 'Running') {
|
||||
Write-Host "Attendo che il servizio $serviceName si avvii..."
|
||||
Start-Sleep -Seconds 5
|
||||
$service = Get-Service -Name $serviceName
|
||||
}
|
||||
|
||||
Write-Host "Il servizio $serviceName è stato avviato con successo."
|
||||
|
||||
} catch {
|
||||
Write-Host "Errore nell'avvio del servizio ${serviceName}: $_"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Chiamare la funzione per stoppare il servizio
|
||||
Stop-ServiceAndWait -serviceName $serviceName
|
||||
|
||||
# Subito dopo lo stop, cancellare la cartella e il file
|
||||
$emsApiPath = "$webappsPath\ems-api"
|
||||
$emsWarFilePath = "$webappsPath\ems-api.war"
|
||||
Delete-FilesAndFolder -folderPath $emsApiPath -filePath $emsWarFilePath
|
||||
|
||||
# Chiamare la funzione per copiare il file
|
||||
Write-Host "Copio $updatedArtifactPath in $emsWarFilePath"
|
||||
Copy-File -sourceFilePath $updatedArtifactPath -destinationFilePath $emsWarFilePath
|
||||
|
||||
# Avvia nuovamente il servizio
|
||||
Start-ServiceAndWait -serviceName $serviceName
|
||||
|
||||
# Ciclo fino a quando lo status code non è 200 o superiamo il numero massimo di tentativi
|
||||
while ($attempt -lt $max_attempts) {
|
||||
$attempt++
|
||||
Check-Status
|
||||
Start-Sleep -Seconds 5 # Attendere per 5 secondi prima di fare un altro tentativo
|
||||
}
|
||||
|
||||
Write-Host "Numero massimo di tentativi superato. Nessuna risposta 200 ricevuta."
|
||||
exit 1
|
||||
127
ems-core/pom.xml
127
ems-core/pom.xml
@@ -19,6 +19,11 @@
|
||||
<id>maven-public</id>
|
||||
<url>https://maven.studioml.it/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>AsposeJavaAPI</id>
|
||||
<name>Aspose Java API</name>
|
||||
<url>https://releases.aspose.com/java/repo/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
@@ -42,38 +47,19 @@
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<version>3.0.0</version>
|
||||
<configuration>
|
||||
<longClasspath>true</longClasspath>
|
||||
<longModulepath>true</longModulepath>
|
||||
<toolchain>jdk</toolchain>
|
||||
<executable>java</executable>
|
||||
<cleanupDaemonThreads>false</cleanupDaemonThreads>
|
||||
<skip>false</skip>
|
||||
<arguments>
|
||||
<argument>-classpath</argument>
|
||||
<!-- automatically creates the classpath using all project dependencies,
|
||||
also adding the project build directory -->
|
||||
<classpath/>
|
||||
<argument>it.integry.ems_model.rulescompleting.KieStaticCompiler</argument>
|
||||
<argument>src/main/resources/rules/</argument>
|
||||
<argument>../ems-engine/src/main/webapp/drools/</argument>
|
||||
</arguments>
|
||||
<systemProperties>
|
||||
<projectProperties/>
|
||||
<exec.longClasspath>true</exec.longClasspath>
|
||||
</systemProperties>
|
||||
|
||||
<skip>true</skip>
|
||||
<mainClass>it.integry.ems_model.rulescompleting.KieStaticCompiler</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-classes</phase>
|
||||
<phase>post-clean</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -139,7 +125,7 @@
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -173,24 +159,19 @@
|
||||
<version>1.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>8.4.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- SWAGGER -->
|
||||
<!-- SWAGGER
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-oas</artifactId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
|
||||
<!-- REST CLIENT -->
|
||||
<dependency>
|
||||
@@ -205,7 +186,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jackson2-provider</artifactId>
|
||||
<artifactId>resteasy-jackson-provider</artifactId>
|
||||
<version>${resteasy.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -240,7 +221,7 @@
|
||||
<dependency>
|
||||
<groupId>org.reflections</groupId>
|
||||
<artifactId>reflections</artifactId>
|
||||
<version>0.10.2</version>
|
||||
<version>0.9.10</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mail -->
|
||||
@@ -250,17 +231,29 @@
|
||||
<version>1.4.7</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
<artifactId>xmlbeans</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JASPER REPORT -->
|
||||
<dependency>
|
||||
<groupId>net.sf.jasperreports</groupId>
|
||||
<artifactId>jasperreports</artifactId>
|
||||
<version>${jaspersoft.version}</version>
|
||||
<version>6.16.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.lowagie</groupId>
|
||||
<artifactId>itext</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.lowagie</groupId>
|
||||
<artifactId>itext</artifactId>
|
||||
<version>2.1.7.js8</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.lowagie</groupId>-->
|
||||
<!-- <artifactId>itext</artifactId>-->
|
||||
<!-- <version>2.1.7.js8</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>net.sf.jasperreports</groupId>
|
||||
<artifactId>jasperreports-htmlcomponent</artifactId>
|
||||
@@ -269,12 +262,12 @@
|
||||
<dependency>
|
||||
<groupId>net.sf.jasperreports</groupId>
|
||||
<artifactId>jasperreports-fonts</artifactId>
|
||||
<version>${jaspersoft.version}</version>
|
||||
<version>6.16.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.jasperreports</groupId>
|
||||
<artifactId>jasperreports-functions</artifactId>
|
||||
<version>${jaspersoft.version}</version>
|
||||
<version>6.16.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>it.integry.font</groupId>
|
||||
@@ -370,14 +363,14 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>5.2.3</version>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.2.3</version>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -401,13 +394,18 @@
|
||||
<artifactId>utility-barcode</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>it.integry</groupId>
|
||||
<artifactId>utilityImage</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- IntegryUtility (Barcodes, ecc) -->
|
||||
<dependency>
|
||||
<groupId>it.integry</groupId>
|
||||
<artifactId>Utility</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -433,21 +431,11 @@
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-csv</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
@@ -467,6 +455,11 @@
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-instrument-tomcat</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-oxm</artifactId>
|
||||
@@ -516,7 +509,6 @@
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- log4j -->
|
||||
<dependency>
|
||||
<groupId>com.lmax</groupId>
|
||||
@@ -555,7 +547,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -573,6 +565,11 @@
|
||||
</dependency>
|
||||
|
||||
<!-- UTILS -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
@@ -699,7 +696,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.firebase</groupId>
|
||||
<artifactId>firebase-admin</artifactId>
|
||||
<version>9.2.0</version>
|
||||
<version>7.0.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -714,6 +711,12 @@
|
||||
<artifactId>jcodec-javase</artifactId>
|
||||
<version>0.2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.annimon</groupId>
|
||||
<artifactId>stream</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.docx4j</groupId>
|
||||
@@ -727,11 +730,5 @@
|
||||
<version>0.27.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.javaparser</groupId>
|
||||
<artifactId>javaparser-symbol-solver-core</artifactId>
|
||||
<version>3.26.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package it.integry.FoodProcess.api;
|
||||
|
||||
import javax.ws.rs.client.ClientRequestContext;
|
||||
import javax.ws.rs.client.ClientRequestFilter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class AddApiKeyHeaderRequestFilter implements ClientRequestFilter {
|
||||
private final String apiKey;
|
||||
|
||||
public AddApiKeyHeaderRequestFilter(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filter(ClientRequestContext clientRequestContext) throws IOException {
|
||||
clientRequestContext.getHeaders().add("X-Api-Key", apiKey);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package it.integry.FoodProcess.api;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import it.integry.FoodProcess.dto.response.ErrorResponse;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.client.ClientRequestContext;
|
||||
import javax.ws.rs.client.ClientResponseContext;
|
||||
import javax.ws.rs.client.ClientResponseFilter;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ErrorMessageResponseFilter implements ClientResponseFilter {
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Override
|
||||
public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
|
||||
if (responseContext.getStatus() != Response.Status.OK.getStatusCode()) {
|
||||
if (responseContext.hasEntity()) {
|
||||
ErrorResponse error = objectMapper.readValue(responseContext.getEntityStream(), ErrorResponse.class);
|
||||
String message = error.getErrorMessage();
|
||||
|
||||
Response.Status status = Response.Status.fromStatusCode(responseContext.getStatus());
|
||||
WebApplicationException webAppException;
|
||||
switch (status) {
|
||||
case BAD_REQUEST:
|
||||
webAppException = new BadRequestException(message);
|
||||
break;
|
||||
case UNAUTHORIZED:
|
||||
webAppException = new NotAuthorizedException(message, Response.status(Response.Status.UNAUTHORIZED).build());
|
||||
break;
|
||||
case FORBIDDEN:
|
||||
webAppException = new ForbiddenException(message);
|
||||
break;
|
||||
case NOT_FOUND:
|
||||
webAppException = new NotFoundException(message);
|
||||
break;
|
||||
case METHOD_NOT_ALLOWED:
|
||||
webAppException = new NotAllowedException(message);
|
||||
break;
|
||||
case NOT_ACCEPTABLE:
|
||||
webAppException = new NotAcceptableException(message);
|
||||
break;
|
||||
case UNSUPPORTED_MEDIA_TYPE:
|
||||
webAppException = new NotSupportedException(message);
|
||||
break;
|
||||
case INTERNAL_SERVER_ERROR:
|
||||
webAppException = new InternalServerErrorException(message);
|
||||
break;
|
||||
case SERVICE_UNAVAILABLE:
|
||||
webAppException = new ServiceUnavailableException(message);
|
||||
break;
|
||||
default:
|
||||
webAppException = new WebApplicationException(message);
|
||||
}
|
||||
|
||||
throw webAppException;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package it.integry.FoodProcess.api;
|
||||
|
||||
import it.integry.FoodProcess.dto.*;
|
||||
import it.integry.FoodProcess.dto.response.*;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.List;
|
||||
|
||||
public interface FoodProcessClient {
|
||||
// Orders
|
||||
|
||||
@GET
|
||||
@Path("/getorderstatuses")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
List<OrderStatusResponse> getOrderStatuses(@QueryParam("order_ids") List<String> orderIds);
|
||||
|
||||
@POST
|
||||
@Path("/importorders")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
ImportOrdersResponse importOrders(ImportOrdersRequest importOrdersRequest);
|
||||
|
||||
// Master data
|
||||
|
||||
@GET
|
||||
@Path("/getarticles")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
List<Article> getArticles();
|
||||
|
||||
@POST
|
||||
@Path("/importarticles")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
ImportArticlesResponse importArticles(ImportArticlesRequest importArticlesRequest);
|
||||
|
||||
@GET
|
||||
@Path("/getbusinesspartners")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
List<BusinessPartner> getBusinessPartners();
|
||||
|
||||
@POST
|
||||
@Path("/importbusinesspartners")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
ImportBusinessPartnersResponse importBusinessPartners(ImportBusinessPartnersRequest importBusinessPartnersRequest);
|
||||
|
||||
@GET
|
||||
@Path("/getpackagingmaterials")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
List<PackagingMaterial> getPackagingMaterials();
|
||||
|
||||
@POST
|
||||
@Path("/importpackagingmaterials")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
ImportPackagingMaterialsResponse importPackagingMaterials(ImportPackagingMaterialsRequest importPackagingMaterialsRequest);
|
||||
|
||||
@GET
|
||||
@Path("/getrawmaterials")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
List<RawMaterial> getRawMaterials();
|
||||
|
||||
@POST
|
||||
@Path("/importrawmaterials")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
ImportRawMaterialsResponse importRawMaterials(ImportRawMaterialsRequest importRawMaterialsRequest);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package it.integry.FoodProcess.api;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.MultivaluedMap;
|
||||
import javax.ws.rs.ext.Provider;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
@Provider
|
||||
public class JacksonProvider extends ResteasyJackson2Provider {
|
||||
@Override
|
||||
public void writeTo(Object value, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException {
|
||||
ObjectMapper mapper = locateMapper(type, MediaType.APPLICATION_JSON_TYPE);
|
||||
|
||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
|
||||
super.writeTo(value, type, genericType, annotations, mediaType, httpHeaders, entityStream);
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Article {
|
||||
@SqlField
|
||||
private String id;
|
||||
|
||||
@SqlField
|
||||
private String code;
|
||||
|
||||
@SqlField
|
||||
private String name;
|
||||
|
||||
@JsonProperty("raw_materials")
|
||||
private List<ArticleRawMaterial> rawMaterials;
|
||||
|
||||
@JsonProperty("packaging_material_id")
|
||||
private String packagingMaterialId;
|
||||
|
||||
@JsonProperty("packaging_material_code")
|
||||
private String packagingMaterialCode;
|
||||
|
||||
@JsonProperty("packaging_material_name")
|
||||
private String packagingMaterialName;
|
||||
|
||||
@SqlField
|
||||
private String note;
|
||||
|
||||
@JsonProperty("is_archived")
|
||||
private boolean isArchived;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Article setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public Article setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Article setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<ArticleRawMaterial> getRawMaterials() {
|
||||
return rawMaterials;
|
||||
}
|
||||
|
||||
public Article setRawMaterials(List<ArticleRawMaterial> rawMaterials) {
|
||||
this.rawMaterials = rawMaterials;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPackagingMaterialId() {
|
||||
return packagingMaterialId;
|
||||
}
|
||||
|
||||
public Article setPackagingMaterialId(String packagingMaterialId) {
|
||||
this.packagingMaterialId = packagingMaterialId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPackagingMaterialCode() {
|
||||
return packagingMaterialCode;
|
||||
}
|
||||
|
||||
public Article setPackagingMaterialCode(String packagingMaterialCode) {
|
||||
this.packagingMaterialCode = packagingMaterialCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPackagingMaterialName() {
|
||||
return packagingMaterialName;
|
||||
}
|
||||
|
||||
public Article setPackagingMaterialName(String packagingMaterialName) {
|
||||
this.packagingMaterialName = packagingMaterialName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public Article setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getIsArchived() {
|
||||
return isArchived;
|
||||
}
|
||||
|
||||
public Article setIsArchived(boolean isArchived) {
|
||||
this.isArchived = isArchived;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ArticleRawMaterial {
|
||||
private String id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String name;
|
||||
|
||||
@JsonProperty("weight_kg")
|
||||
private Double weightKg;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public ArticleRawMaterial setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public ArticleRawMaterial setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ArticleRawMaterial setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Double getWeightKg() {
|
||||
return weightKg;
|
||||
}
|
||||
|
||||
public ArticleRawMaterial setWeightKg(Double weightKg) {
|
||||
this.weightKg = weightKg;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
public class BusinessPartner {
|
||||
@SqlField
|
||||
private String id;
|
||||
|
||||
@SqlField
|
||||
private String code;
|
||||
|
||||
@SqlField
|
||||
private String name;
|
||||
|
||||
@SqlField
|
||||
@JsonProperty("is_customer")
|
||||
private boolean isCustomer;
|
||||
|
||||
@SqlField
|
||||
@JsonProperty("is_supplier")
|
||||
private boolean isSupplier;
|
||||
|
||||
@SqlField
|
||||
private String note;
|
||||
|
||||
@SqlField
|
||||
@JsonProperty("is_archived")
|
||||
private boolean isArchived;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public BusinessPartner setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public BusinessPartner setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public BusinessPartner setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getIsCustomer() {
|
||||
return isCustomer;
|
||||
}
|
||||
|
||||
public BusinessPartner setIsCustomer(boolean isCustomer) {
|
||||
this.isCustomer = isCustomer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getIsSupplier() {
|
||||
return isSupplier;
|
||||
}
|
||||
|
||||
public BusinessPartner setIsSupplier(boolean isSupplier) {
|
||||
this.isSupplier = isSupplier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public BusinessPartner setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getIsArchived() {
|
||||
return isArchived;
|
||||
}
|
||||
|
||||
public BusinessPartner setIsArchived(boolean isArchived) {
|
||||
this.isArchived = isArchived;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportArticlesRequest {
|
||||
private List<Article> articles;
|
||||
|
||||
public List<Article> getArticles() {
|
||||
return articles;
|
||||
}
|
||||
|
||||
public ImportArticlesRequest setArticles(List<Article> articles) {
|
||||
this.articles = articles;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportBusinessPartnersRequest {
|
||||
@JsonProperty("business_partners")
|
||||
private List<BusinessPartner> businessPartners;
|
||||
|
||||
public List<BusinessPartner> getBusinessPartners() {
|
||||
return businessPartners;
|
||||
}
|
||||
|
||||
public ImportBusinessPartnersRequest setBusinessPartners(List<BusinessPartner> businessPartners) {
|
||||
this.businessPartners = businessPartners;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportOrdersRequest {
|
||||
private List<RequestOrder> orders;
|
||||
|
||||
public List<RequestOrder> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
public ImportOrdersRequest setOrders(List<RequestOrder> orders) {
|
||||
this.orders = orders;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportPackagingMaterialsRequest {
|
||||
@JsonProperty("packaging_materials")
|
||||
private List<PackagingMaterial> packagingMaterials;
|
||||
|
||||
public List<PackagingMaterial> getPackagingMaterials() {
|
||||
return packagingMaterials;
|
||||
}
|
||||
|
||||
public ImportPackagingMaterialsRequest setPackagingMaterials(List<PackagingMaterial> packagingMaterials) {
|
||||
this.packagingMaterials = packagingMaterials;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportRawMaterialsRequest {
|
||||
@JsonProperty("raw_materials")
|
||||
private List<RawMaterial> rawMaterials;
|
||||
|
||||
public List<RawMaterial> getRawMaterials() {
|
||||
return rawMaterials;
|
||||
}
|
||||
|
||||
public ImportRawMaterialsRequest setRawMaterials(List<RawMaterial> rawMaterials) {
|
||||
this.rawMaterials = rawMaterials;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class PackagingMaterial {
|
||||
private String id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String name;
|
||||
|
||||
private PackagingMaterialType type;
|
||||
|
||||
@JsonProperty("weight_kg")
|
||||
private Double weightKg;
|
||||
|
||||
@JsonProperty("length_mm")
|
||||
private Double lengthMm;
|
||||
|
||||
@JsonProperty("width_mm")
|
||||
private Double widthMm;
|
||||
|
||||
@JsonProperty("height_mm")
|
||||
private Double heightMm;
|
||||
|
||||
private String note;
|
||||
|
||||
@JsonProperty("is_archived")
|
||||
private boolean isArchived;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public PackagingMaterial setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public PackagingMaterial setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public PackagingMaterial setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PackagingMaterialType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public PackagingMaterial setType(PackagingMaterialType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Double getWeightKg() {
|
||||
return weightKg;
|
||||
}
|
||||
|
||||
public PackagingMaterial setWeightKg(Double weightKg) {
|
||||
this.weightKg = weightKg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Double getLengthMm() {
|
||||
return lengthMm;
|
||||
}
|
||||
|
||||
public PackagingMaterial setLengthMm(Double lengthMm) {
|
||||
this.lengthMm = lengthMm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Double getWidthMm() {
|
||||
return widthMm;
|
||||
}
|
||||
|
||||
public PackagingMaterial setWidthMm(Double widthMm) {
|
||||
this.widthMm = widthMm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Double getHeightMm() {
|
||||
return heightMm;
|
||||
}
|
||||
|
||||
public PackagingMaterial setHeightMm(Double heightMm) {
|
||||
this.heightMm = heightMm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public PackagingMaterial setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getIsArchived() {
|
||||
return isArchived;
|
||||
}
|
||||
|
||||
public PackagingMaterial setIsArchived(boolean isArchived) {
|
||||
this.isArchived = isArchived;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
public enum PackagingMaterialType {
|
||||
PUNNET,
|
||||
TRAY,
|
||||
BAG,
|
||||
CARTON,
|
||||
CRATE,
|
||||
PALLET
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class RawMaterial {
|
||||
private String id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String name;
|
||||
|
||||
private String note;
|
||||
|
||||
@JsonProperty("is_archived")
|
||||
private boolean isArchived;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public RawMaterial setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public RawMaterial setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public RawMaterial setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public RawMaterial setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getIsArchived() {
|
||||
return isArchived;
|
||||
}
|
||||
|
||||
public RawMaterial setIsArchived(boolean isArchived) {
|
||||
this.isArchived = isArchived;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,234 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class RequestOrder {
|
||||
private String id;
|
||||
|
||||
private String type;
|
||||
|
||||
@JsonProperty("article_id")
|
||||
private String articleId;
|
||||
|
||||
@JsonProperty("article_code")
|
||||
private String articleCode;
|
||||
|
||||
@JsonProperty("customer_id")
|
||||
private String customerId;
|
||||
|
||||
@JsonProperty("customer_code")
|
||||
private String customerCode;
|
||||
|
||||
@JsonProperty("secondary_packaging_material_id")
|
||||
private String secondaryPackagingMaterialId;
|
||||
|
||||
@JsonProperty("secondary_packaging_material_code")
|
||||
private String secondaryPackagingMaterialCode;
|
||||
|
||||
@JsonProperty("tertiary_packaging_material_id")
|
||||
private String tertiaryPackagingMaterialId;
|
||||
|
||||
@JsonProperty("tertiary_packaging_material_code")
|
||||
private String tertiaryPackagingMaterialCode;
|
||||
|
||||
@JsonProperty("units_per_secondary_packaging")
|
||||
private int unitsPerSecondaryPackaging;
|
||||
|
||||
@JsonProperty("units_per_pallet_layer")
|
||||
private int unitsPerPalletLayer;
|
||||
|
||||
@JsonProperty("pallet_layer_quantity")
|
||||
private int palletLayerQuantity;
|
||||
|
||||
@JsonProperty("target_quantity")
|
||||
private double targetQuantity;
|
||||
|
||||
@JsonProperty("target_quantity_unit")
|
||||
private TargetQuantityUnit targetQuantityUnit;
|
||||
|
||||
@JsonProperty("scheduled_for")
|
||||
private LocalDateTime scheduledFor;
|
||||
|
||||
@JsonProperty("to_be_completed_until")
|
||||
private LocalDateTime toBeCompletedUntil;
|
||||
|
||||
@JsonProperty("best_before_date")
|
||||
private LocalDate bestBeforeDate;
|
||||
|
||||
@JsonProperty("production_lot")
|
||||
private String productionLot;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public RequestOrder setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public RequestOrder setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getArticleId() {
|
||||
return articleId;
|
||||
}
|
||||
|
||||
public RequestOrder setArticleId(String articleId) {
|
||||
this.articleId = articleId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getArticleCode() {
|
||||
return articleCode;
|
||||
}
|
||||
|
||||
public RequestOrder setArticleCode(String articleCode) {
|
||||
this.articleCode = articleCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public RequestOrder setCustomerId(String customerId) {
|
||||
this.customerId = customerId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCustomerCode() {
|
||||
return customerCode;
|
||||
}
|
||||
|
||||
public RequestOrder setCustomerCode(String customerCode) {
|
||||
this.customerCode = customerCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSecondaryPackagingMaterialId() {
|
||||
return secondaryPackagingMaterialId;
|
||||
}
|
||||
|
||||
public RequestOrder setSecondaryPackagingMaterialId(String secondaryPackagingMaterialId) {
|
||||
this.secondaryPackagingMaterialId = secondaryPackagingMaterialId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSecondaryPackagingMaterialCode() {
|
||||
return secondaryPackagingMaterialCode;
|
||||
}
|
||||
|
||||
public RequestOrder setSecondaryPackagingMaterialCode(String secondaryPackagingMaterialCode) {
|
||||
this.secondaryPackagingMaterialCode = secondaryPackagingMaterialCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTertiaryPackagingMaterialId() {
|
||||
return tertiaryPackagingMaterialId;
|
||||
}
|
||||
|
||||
public RequestOrder setTertiaryPackagingMaterialId(String tertiaryPackagingMaterialId) {
|
||||
this.tertiaryPackagingMaterialId = tertiaryPackagingMaterialId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTertiaryPackagingMaterialCode() {
|
||||
return tertiaryPackagingMaterialCode;
|
||||
}
|
||||
|
||||
public RequestOrder setTertiaryPackagingMaterialCode(String tertiaryPackagingMaterialCode) {
|
||||
this.tertiaryPackagingMaterialCode = tertiaryPackagingMaterialCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getUnitsPerSecondaryPackaging() {
|
||||
return unitsPerSecondaryPackaging;
|
||||
}
|
||||
|
||||
public RequestOrder setUnitsPerSecondaryPackaging(int unitsPerSecondaryPackaging) {
|
||||
this.unitsPerSecondaryPackaging = unitsPerSecondaryPackaging;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getUnitsPerPalletLayer() {
|
||||
return unitsPerPalletLayer;
|
||||
}
|
||||
|
||||
public RequestOrder setUnitsPerPalletLayer(int unitsPerPalletLayer) {
|
||||
this.unitsPerPalletLayer = unitsPerPalletLayer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getPalletLayerQuantity() {
|
||||
return palletLayerQuantity;
|
||||
}
|
||||
|
||||
public RequestOrder setPalletLayerQuantity(int palletLayerQuantity) {
|
||||
this.palletLayerQuantity = palletLayerQuantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public double getTargetQuantity() {
|
||||
return targetQuantity;
|
||||
}
|
||||
|
||||
public RequestOrder setTargetQuantity(double targetQuantity) {
|
||||
this.targetQuantity = targetQuantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TargetQuantityUnit getTargetQuantityUnit() {
|
||||
return targetQuantityUnit;
|
||||
}
|
||||
|
||||
public RequestOrder setTargetQuantityUnit(TargetQuantityUnit targetQuantityUnit) {
|
||||
this.targetQuantityUnit = targetQuantityUnit;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getScheduledFor() {
|
||||
return scheduledFor;
|
||||
}
|
||||
|
||||
public RequestOrder setScheduledFor(LocalDateTime scheduledFor) {
|
||||
this.scheduledFor = scheduledFor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getToBeCompletedUntil() {
|
||||
return toBeCompletedUntil;
|
||||
}
|
||||
|
||||
public RequestOrder setToBeCompletedUntil(LocalDateTime toBeCompletedUntil) {
|
||||
this.toBeCompletedUntil = toBeCompletedUntil;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getBestBeforeDate() {
|
||||
return bestBeforeDate;
|
||||
}
|
||||
|
||||
public RequestOrder setBestBeforeDate(LocalDate bestBeforeDate) {
|
||||
this.bestBeforeDate = bestBeforeDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getProductionLot() {
|
||||
return productionLot;
|
||||
}
|
||||
|
||||
public RequestOrder setProductionLot(String productionLot) {
|
||||
this.productionLot = productionLot;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package it.integry.FoodProcess.dto;
|
||||
|
||||
public enum TargetQuantityUnit {
|
||||
PIECE,
|
||||
SECONDARY_PACKAGING,
|
||||
TERTIARY_PACKAGING,
|
||||
KILOGRAM
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ErrorResponse {
|
||||
@JsonProperty("error_message")
|
||||
private String errorMessage;
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public ErrorResponse setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ImportArticleStatus extends ResponseStatus {
|
||||
@JsonProperty("article_id")
|
||||
private String articleId;
|
||||
|
||||
public String getArticleId() {
|
||||
return articleId;
|
||||
}
|
||||
|
||||
public ImportArticleStatus setArticleId(String articleId) {
|
||||
this.articleId = articleId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportArticlesResponse {
|
||||
private List<ImportArticleStatus> statuses;
|
||||
|
||||
public List<ImportArticleStatus> getStatuses() {
|
||||
return statuses;
|
||||
}
|
||||
|
||||
public ImportArticlesResponse setStatuses(List<ImportArticleStatus> statuses) {
|
||||
this.statuses = statuses;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ImportBusinessPartnerStatus extends ResponseStatus {
|
||||
@JsonProperty("business_partner_id")
|
||||
private String businessPartnerId;
|
||||
|
||||
public String getBusinessPartnerId() {
|
||||
return businessPartnerId;
|
||||
}
|
||||
|
||||
public ImportBusinessPartnerStatus setBusinessPartnerId(String businessPartnerId) {
|
||||
this.businessPartnerId = businessPartnerId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportBusinessPartnersResponse {
|
||||
private List<ImportBusinessPartnerStatus> statuses;
|
||||
|
||||
public List<ImportBusinessPartnerStatus> getStatuses() {
|
||||
return statuses;
|
||||
}
|
||||
|
||||
public ImportBusinessPartnersResponse setStatuses(List<ImportBusinessPartnerStatus> statuses) {
|
||||
this.statuses = statuses;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ImportOrderStatus extends ResponseStatus {
|
||||
@JsonProperty("order_id")
|
||||
private String orderId;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public ImportOrderStatus setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportOrdersResponse {
|
||||
private List<ImportOrderStatus> statuses;
|
||||
|
||||
public List<ImportOrderStatus> getStatuses() {
|
||||
return statuses;
|
||||
}
|
||||
|
||||
public ImportOrdersResponse setStatuses(List<ImportOrderStatus> statuses) {
|
||||
this.statuses = statuses;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ImportPackagingMaterialStatus extends ResponseStatus {
|
||||
@JsonProperty("packaging_material_id")
|
||||
private String packagingMaterialId;
|
||||
|
||||
public String getPackagingMaterialId() {
|
||||
return packagingMaterialId;
|
||||
}
|
||||
|
||||
public ImportPackagingMaterialStatus setPackagingMaterialId(String packagingMaterialId) {
|
||||
this.packagingMaterialId = packagingMaterialId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportPackagingMaterialsResponse {
|
||||
private List<ImportPackagingMaterialStatus> statuses;
|
||||
|
||||
public List<ImportPackagingMaterialStatus> getStatuses() {
|
||||
return statuses;
|
||||
}
|
||||
|
||||
public ImportPackagingMaterialsResponse setStatuses(List<ImportPackagingMaterialStatus> statuses) {
|
||||
this.statuses = statuses;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ImportRawMaterialStatus extends ResponseStatus {
|
||||
@JsonProperty("raw_material_id")
|
||||
private String rawMaterialId;
|
||||
|
||||
public String getRawMaterialId() {
|
||||
return rawMaterialId;
|
||||
}
|
||||
|
||||
public ImportRawMaterialStatus setRawMaterialId(String rawMaterialId) {
|
||||
this.rawMaterialId = rawMaterialId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImportRawMaterialsResponse {
|
||||
private List<ImportRawMaterialStatus> statuses;
|
||||
|
||||
public List<ImportRawMaterialStatus> getStatuses() {
|
||||
return statuses;
|
||||
}
|
||||
|
||||
public ImportRawMaterialsResponse setStatuses(List<ImportRawMaterialStatus> statuses) {
|
||||
this.statuses = statuses;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
public enum OrderStatus {
|
||||
NEW,
|
||||
ASSIGNED,
|
||||
ACTIVE,
|
||||
CLOSED,
|
||||
CANCELED
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class OrderStatusResponse {
|
||||
@JsonProperty("order_id")
|
||||
private String orderId;
|
||||
|
||||
@JsonProperty("order_status")
|
||||
private OrderStatus orderStatus;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public OrderStatusResponse setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrderStatus getOrderStatus() {
|
||||
return orderStatus;
|
||||
}
|
||||
|
||||
public OrderStatusResponse setOrderStatus(OrderStatus orderStatus) {
|
||||
this.orderStatus = orderStatus;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package it.integry.FoodProcess.dto.response;
|
||||
|
||||
public class ResponseStatus {
|
||||
private boolean success;
|
||||
private String message;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public ResponseStatus setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public ResponseStatus setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
package it.integry.FoodProcess.service;
|
||||
|
||||
import it.integry.FoodProcess.api.AddApiKeyHeaderRequestFilter;
|
||||
import it.integry.FoodProcess.api.ErrorMessageResponseFilter;
|
||||
import it.integry.FoodProcess.api.FoodProcessClient;
|
||||
import it.integry.FoodProcess.api.JacksonProvider;
|
||||
import it.integry.FoodProcess.dto.Article;
|
||||
import it.integry.FoodProcess.dto.ImportArticlesRequest;
|
||||
import it.integry.FoodProcess.dto.response.ImportArticlesResponse;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.MtbAartAnag;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
|
||||
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
|
||||
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class FoodProcessRestService {
|
||||
private final Pattern ID_REGEX = Pattern.compile("^[0-9A-Fa-f]{1,}$");
|
||||
|
||||
private final SetupGest setupGest;
|
||||
private final MultiDBTransactionManager multiDBTransactionManager;
|
||||
private final EntityProcessor entityProcessor;
|
||||
|
||||
public FoodProcessRestService(SetupGest setupGest, MultiDBTransactionManager multiDBTransactionManager, EntityProcessor entityProcessor) {
|
||||
this.setupGest = setupGest;
|
||||
this.multiDBTransactionManager = multiDBTransactionManager;
|
||||
this.entityProcessor = entityProcessor;
|
||||
}
|
||||
|
||||
public FoodProcessClient makeInstance() throws Exception {
|
||||
String endpoint = setupGest.getSetup("FOODPROCESS", "SETUP", "ENDPOINT");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(endpoint)) {
|
||||
throw new Exception("Endpoint per il servizio di FoodProcess non configurato.\nImpostarlo in FOODPROCESS->SETUP->ENDPOINT.");
|
||||
}
|
||||
|
||||
String apiKey = setupGest.getSetup("FOODPROCESS", "SETUP", "API_KEY");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(apiKey)) {
|
||||
throw new Exception("Api key per il servizio di FoodProcess non configurato.\nImpostarlo in FOODPROCESS->SETUP->API_KEY.");
|
||||
}
|
||||
|
||||
ResteasyClient client = new ResteasyClientBuilder().build();
|
||||
|
||||
client.register(new JacksonProvider());
|
||||
client.register(new ErrorMessageResponseFilter());
|
||||
client.register(new AddApiKeyHeaderRequestFilter(apiKey));
|
||||
|
||||
ResteasyWebTarget target = client.target(endpoint);
|
||||
|
||||
return target.proxy(FoodProcessClient.class);
|
||||
}
|
||||
|
||||
public ImportArticlesResponse importArticles(ImportArticlesRequest importArticlesRequest) throws Exception {
|
||||
if (UtilityList.isNullOrEmpty(importArticlesRequest.getArticles())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String codAnagTopControl = setupGest.getSetup("FOODPROCESS", "SETUP", "TOPCONTROL_CODANAG");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(codAnagTopControl)) {
|
||||
throw new Exception("Cod. anag. di Top Control non configurato.\nImpostarlo in FOODPROCESS->SETUP->TOPCONTROL_CODANAG.");
|
||||
}
|
||||
|
||||
FoodProcessClient client = makeInstance();
|
||||
|
||||
List<Article> foodProcessArticles = client.getArticles();
|
||||
|
||||
List<MtbAart> entityList = new ArrayList<>();
|
||||
|
||||
for (Article article : importArticlesRequest.getArticles()) {
|
||||
if (UtilityString.isNullOrEmpty(article.getId()) || !ID_REGEX.matcher(article.getId()).matches()) {
|
||||
String sql;
|
||||
MtbAartAnag mtbAartAnag = null;
|
||||
|
||||
// Cerco negli articoli loro
|
||||
Optional<Article> optionalFoodProcessArticle = foodProcessArticles.stream()
|
||||
.filter(x -> !x.getIsArchived())
|
||||
.filter(x -> x.getCode().equalsIgnoreCase(article.getCode()))
|
||||
.findFirst();
|
||||
|
||||
if (optionalFoodProcessArticle.isPresent()) {
|
||||
Article foodProcessArticle = optionalFoodProcessArticle.get();
|
||||
|
||||
mtbAartAnag = new MtbAartAnag()
|
||||
.setCodAnag(codAnagTopControl)
|
||||
.setCodMartAnag(foodProcessArticle.getId())
|
||||
.setCodMart(article.getId());
|
||||
|
||||
mtbAartAnag.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
}
|
||||
|
||||
// Cerco id in nostra anagrafica
|
||||
if (mtbAartAnag == null && !UtilityString.isNullOrEmpty(article.getId())) {
|
||||
sql = Query.format(
|
||||
"SELECT id, cod_mart_anag\n" +
|
||||
"FROM mtb_aart_anag\n" +
|
||||
"WHERE cod_anag = %s\n" +
|
||||
" AND cod_mart = %s",
|
||||
codAnagTopControl,
|
||||
article.getId()
|
||||
);
|
||||
|
||||
mtbAartAnag = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbAartAnag.class);
|
||||
}
|
||||
|
||||
// Articolo nuovo, creo un nuovo id
|
||||
if (mtbAartAnag == null) {
|
||||
sql = Query.format(
|
||||
"SELECT CAST(ISNULL(MAX(CAST(cod_mart_anag AS INT)), 0) + 1 AS VARCHAR) AS cod_mart_anag\n" +
|
||||
"FROM mtb_aart_anag\n" +
|
||||
"WHERE cod_anag = %s",
|
||||
codAnagTopControl
|
||||
);
|
||||
|
||||
String codMartAnag = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
mtbAartAnag = new MtbAartAnag()
|
||||
.setCodAnag(codAnagTopControl)
|
||||
.setCodMartAnag(codMartAnag);
|
||||
|
||||
mtbAartAnag.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(mtbAartAnag)) {
|
||||
if (!mtbAartAnag.getOperation().equals(OperationType.SELECT_OBJECT)) {
|
||||
MtbAart mtbAart = entityList.stream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(article.getId()))
|
||||
.findFirst()
|
||||
.orElseGet(() -> {
|
||||
MtbAart newMtbAart = new MtbAart()
|
||||
.setCodMart(article.getId())
|
||||
.setMtbAartAnag(new ArrayList<>());
|
||||
|
||||
newMtbAart.setOperation(OperationType.NO_OP);
|
||||
|
||||
entityList.add(newMtbAart);
|
||||
|
||||
return newMtbAart;
|
||||
});
|
||||
|
||||
mtbAart.getMtbAartAnag().add(mtbAartAnag);
|
||||
}
|
||||
|
||||
article.setId(mtbAartAnag.getCodMartAnag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!UtilityList.isNullOrEmpty(entityList)) {
|
||||
entityProcessor.processEntityList(entityList, false);
|
||||
|
||||
UtilityEntity.throwEntitiesException(entityList);
|
||||
}
|
||||
|
||||
return client.importArticles(importArticlesRequest);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import it.integry.WooCommerce.dto.order.WooCommerceOrderDTO;
|
||||
import it.integry.WooCommerce.service.WooCommerceService;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.json.JSONObjectMapper;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -26,7 +26,7 @@ public class WooCommerceController {
|
||||
@Autowired
|
||||
private WooCommerceService wooService;
|
||||
@Autowired
|
||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||
private JSONObjectMapper jsonObjectMapper;
|
||||
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_WOO_NEW_ORDER, method = RequestMethod.POST)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.integry.WooCommerce.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
public class AttributeDTO {
|
||||
@SqlField("attributo")
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package it.integry.WooCommerce.dto.order;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import it.integry.WooCommerce.enums.OrderStatus;
|
||||
import org.codehaus.jackson.JsonNode;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -768,8 +768,7 @@ public class WooCommerceService {
|
||||
|
||||
private void sendErrorMail(String errorMsg, String service, byte[] content, String filename, List<AnomalieDTO> anomalie) {
|
||||
try {
|
||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, service, "WOOCOMMERCE", "Errore WooCommerce",
|
||||
null, content, filename, anomalie);
|
||||
mailService.sendErrorMail(multiDBTransactionManager, service, "WOOCOMMERCE", null, content, filename, anomalie);
|
||||
} catch (Exception exception) {
|
||||
logger.error(service, exception);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package it.integry.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD, ElementType.ANNOTATION_TYPE})
|
||||
@Target(FIELD)
|
||||
public @interface PostContextAutowired {
|
||||
}
|
||||
|
||||
@@ -38,10 +38,7 @@ public class CommonConstants {
|
||||
public static final DateTimeFormatter TIMESTAMP_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss")
|
||||
.withZone(ZoneId.systemDefault());
|
||||
|
||||
public static final DateTimeFormatter DATESTAMP_YMD_FORMATTER = DateTimeFormatter.ofPattern("yyMMdd")
|
||||
.withZone(ZoneId.systemDefault());
|
||||
|
||||
public static final DateTimeFormatter DATESTAMP_DMY_FORMATTER = DateTimeFormatter.ofPattern("ddMMyy")
|
||||
public static final DateTimeFormatter DATESTAMP_FORMATTER = DateTimeFormatter.ofPattern("yyMMdd")
|
||||
.withZone(ZoneId.systemDefault());
|
||||
|
||||
|
||||
|
||||
@@ -9,21 +9,21 @@ import java.util.HashMap;
|
||||
public class EmsDBConst {
|
||||
|
||||
|
||||
private HashMap<String, Const> datiAziendaBindingTable = new HashMap<String, Const>() {{
|
||||
private HashMap<String, Const> typesBindingTable = new HashMap<String, Const>() {{
|
||||
}};
|
||||
|
||||
public Const getConsts(String profileDb) {
|
||||
String aziendaUp = profileDb.toUpperCase();
|
||||
public Const getConsts(String azienda) {
|
||||
String aziendaUp = azienda.toUpperCase();
|
||||
|
||||
if (!datiAziendaBindingTable.containsKey(aziendaUp)) {
|
||||
datiAziendaBindingTable.put(aziendaUp, new Const());
|
||||
if (!typesBindingTable.containsKey(aziendaUp)) {
|
||||
typesBindingTable.put(aziendaUp, new Const());
|
||||
}
|
||||
|
||||
return datiAziendaBindingTable.get(aziendaUp);
|
||||
return typesBindingTable.get(aziendaUp);
|
||||
}
|
||||
|
||||
public void destroyAll() {
|
||||
datiAziendaBindingTable = new HashMap<String, Const>();
|
||||
typesBindingTable = new HashMap<String, Const>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ public enum EntityImportType {
|
||||
ORDINI("ORDINI"),
|
||||
ORDINI_WEB("ORDINI WEB"),
|
||||
ORDINI_ACQUISTO("ORDINI ACQUISTO"),
|
||||
ORDINI_VENDITA("ORDINI VENDITA"),
|
||||
DOCUMENTI("DOCUMENTI"),
|
||||
DOCUMENTI_ACQUISTO("DOCUMENTI ACQUISTO"),
|
||||
DOCUMENTI_LAVORAZIONE("DOCUMENTI LAVORAZIONE"),
|
||||
@@ -23,9 +22,7 @@ public enum EntityImportType {
|
||||
RAPPORTINI_FG("RAPPORTINI FG"),
|
||||
SCONTRINI("SCONTRINI"),
|
||||
MOVIMENTI_CONTABILI("MOVIMENTI CONTABILI"),
|
||||
GRIGLIA_VENDITA("GRIGLIA VENDITA"),
|
||||
GRIGLIA_ACQUISTO("GRIGLIA ACQUISTO"),
|
||||
SCADENZE("SCADENZE");
|
||||
GRIGLIA_ACQUISTO("GRIGLIA ACQUISTO");
|
||||
|
||||
private String text;
|
||||
|
||||
|
||||
@@ -5,9 +5,17 @@ import com.microsoft.sqlserver.jdbc.SQLServerDriver;
|
||||
import it.integry.annotations.PostContextAutowired;
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.annotations.PostWebServerConstruct;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
import it.integry.ems.schedule.new_cron_job.dto.AutomatedOperationTypeEnum;
|
||||
import it.integry.ems.schedule.new_cron_job.dto.operations.ServiceCallAutomatedOperationDTO;
|
||||
import it.integry.ems.schedule.new_cron_job.dto.operations.base_classes.BaseAutomatedOperationDTO;
|
||||
import it.integry.ems.schedule.new_cron_job.service.AutomatedOperationHandlerComponent;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.settings.SettingsController;
|
||||
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.postgresql.Driver;
|
||||
@@ -25,12 +33,10 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.DriverManager;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.reflections.scanners.Scanners.TypesAnnotated;
|
||||
|
||||
@Component
|
||||
public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent> {
|
||||
@@ -47,6 +53,9 @@ public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
@Autowired
|
||||
private EmsProperties emsProperties;
|
||||
|
||||
private boolean contextInitialized = false;
|
||||
|
||||
private boolean firstStart = true;
|
||||
@@ -99,7 +108,6 @@ public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent
|
||||
dispatchPostWebServerConstruct(multiDBTransactionManager);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("EmsCoreContext.onPostDBLoaded", e);
|
||||
}
|
||||
}
|
||||
@@ -107,11 +115,13 @@ public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent
|
||||
|
||||
private void dispatchPostContextConstruct(MultiDBTransactionManager multiDBTransactionManager) throws InvocationTargetException, IllegalAccessException {
|
||||
Reflections reflections = new Reflections("it.integry");
|
||||
final Set<Class<?>> typesAnnotatedWith = reflections.get(TypesAnnotated.with(Component.class, Service.class).asClass());
|
||||
final Set<Class<?>> typesAnnotatedWith = reflections.getTypesAnnotatedWith(Component.class);
|
||||
|
||||
typesAnnotatedWith.addAll(reflections.getTypesAnnotatedWith(Service.class));
|
||||
|
||||
List<Class<?>> classesWithPostContextConstruct = Stream.of(typesAnnotatedWith)
|
||||
.filter(x -> Arrays.stream(x.getDeclaredMethods()).anyMatch(y -> y.isAnnotationPresent(PostContextConstruct.class)))
|
||||
.sortBy(x -> Arrays.stream(x.getDeclaredMethods())
|
||||
.filter(x -> Stream.of(x.getDeclaredMethods()).anyMatch(y -> y.isAnnotationPresent(PostContextConstruct.class)))
|
||||
.sortBy(x -> Stream.of(x.getDeclaredMethods())
|
||||
.filter(y -> y.isAnnotationPresent(PostContextConstruct.class))
|
||||
.findFirst()
|
||||
.get()
|
||||
@@ -123,9 +133,9 @@ public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent
|
||||
logger.debug("PostContextConstruct - " + classType.getSimpleName() + " - START");
|
||||
Object beanInstance = ContextLoader.getCurrentWebApplicationContext().getBean(classType);
|
||||
|
||||
List<Field> fieldsToInject = Arrays.stream(classType.getDeclaredFields())
|
||||
List<Field> fieldsToInject = Stream.of(classType.getDeclaredFields())
|
||||
.filter(y -> y.isAnnotationPresent(PostContextAutowired.class))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
for (Field fieldToInject : fieldsToInject) {
|
||||
fieldToInject.setAccessible(true);
|
||||
@@ -135,7 +145,7 @@ public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent
|
||||
}
|
||||
}
|
||||
|
||||
Method constructor = Arrays.stream(classType.getDeclaredMethods())
|
||||
Method constructor = Stream.of(classType.getDeclaredMethods())
|
||||
.filter(y -> y.isAnnotationPresent(PostContextConstruct.class))
|
||||
.findFirst()
|
||||
.get();
|
||||
@@ -148,11 +158,13 @@ public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent
|
||||
|
||||
private void dispatchPostWebServerConstruct(MultiDBTransactionManager multiDBTransactionManager) throws InvocationTargetException, IllegalAccessException {
|
||||
Reflections reflections = new Reflections("it.integry");
|
||||
final Set<Class<?>> typesAnnotatedWith = reflections.get(TypesAnnotated.with(Component.class, Service.class).asClass());
|
||||
final Set<Class<?>> typesAnnotatedWith = reflections.getTypesAnnotatedWith(Component.class);
|
||||
|
||||
typesAnnotatedWith.addAll(reflections.getTypesAnnotatedWith(Service.class));
|
||||
|
||||
List<Class<?>> classesWithPostWebServerConstruct = Stream.of(typesAnnotatedWith)
|
||||
.filter(x -> Arrays.stream(x.getDeclaredMethods()).anyMatch(y -> y.isAnnotationPresent(PostWebServerConstruct.class)))
|
||||
.sortBy(x -> Arrays.stream(x.getDeclaredMethods())
|
||||
.filter(x -> Stream.of(x.getDeclaredMethods()).anyMatch(y -> y.isAnnotationPresent(PostWebServerConstruct.class)))
|
||||
.sortBy(x -> Stream.of(x.getDeclaredMethods())
|
||||
.filter(y -> y.isAnnotationPresent(PostWebServerConstruct.class))
|
||||
.findFirst()
|
||||
.get()
|
||||
@@ -164,9 +176,9 @@ public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent
|
||||
logger.debug("PostWebServerConstruct - " + classType.getSimpleName() + " - START");
|
||||
Object beanInstance = ContextLoader.getCurrentWebApplicationContext().getBean(classType);
|
||||
|
||||
List<Field> fieldsToInject = Arrays.stream(classType.getDeclaredFields())
|
||||
List<Field> fieldsToInject = Stream.of(classType.getDeclaredFields())
|
||||
.filter(y -> y.isAnnotationPresent(PostContextAutowired.class))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
for (Field fieldToInject : fieldsToInject) {
|
||||
fieldToInject.setAccessible(true);
|
||||
@@ -176,7 +188,7 @@ public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent
|
||||
}
|
||||
}
|
||||
|
||||
Method constructor = Arrays.stream(classType.getDeclaredMethods())
|
||||
Method constructor = Stream.of(classType.getDeclaredMethods())
|
||||
.filter(y -> y.isAnnotationPresent(PostWebServerConstruct.class))
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
@@ -3,16 +3,18 @@ package it.integry.ems._context;
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.common.var.EmsDBConst;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.dynamic_cache.DynamicCacheService;
|
||||
import it.integry.ems.expansion.RunnableArgs;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.settings.SettingsController;
|
||||
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.service.UserCacheService;
|
||||
import it.integry.ems.user.UserCacheService;
|
||||
import it.integry.ems_model.entity.Azienda;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -20,7 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class EmsCoreDBLoader {
|
||||
|
||||
@@ -1,27 +1,20 @@
|
||||
package it.integry.ems.adapter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
public class JsonDateAdapterDeserializer extends StdDeserializer<Date> {
|
||||
|
||||
public JsonDateAdapterDeserializer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
protected JsonDateAdapterDeserializer(Class<?> vc) {
|
||||
super(vc);
|
||||
}
|
||||
public class JsonDateAdapterDeserializer extends JsonDeserializer<Date> {
|
||||
|
||||
@Override
|
||||
public Date deserialize(JsonParser jp, DeserializationContext arg1)
|
||||
throws IOException {
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
if (UtilityString.isNullOrEmpty(jp.getText()))
|
||||
return null;
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package it.integry.ems.configuration;
|
||||
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
public class JsonConfig implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
public ResponseJSONObjectMapper jacksonResponseObjectMapper() {
|
||||
final ResponseJSONObjectMapper objectMapper = new ResponseJSONObjectMapper();
|
||||
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||
configurer.defaultContentType(MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
final MappingJackson2HttpMessageConverter httpMessageConverter = converters.stream()
|
||||
.filter(x -> x instanceof MappingJackson2HttpMessageConverter)
|
||||
.map(x -> (MappingJackson2HttpMessageConverter) x)
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
httpMessageConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||
httpMessageConverter.setObjectMapper(jacksonResponseObjectMapper());
|
||||
|
||||
int oldIndex = converters.indexOf(httpMessageConverter);
|
||||
converters.remove(oldIndex);
|
||||
|
||||
converters.add(0, httpMessageConverter);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package it.integry.ems.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.oas.annotations.EnableOpenApi;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
@Configuration
|
||||
//@EnableSwagger2
|
||||
@EnableWebMvc
|
||||
@EnableOpenApi
|
||||
public class SwaggerConfig implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
public Docket api() {
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.any())
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/swagger-ui/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
|
||||
.resourceChain(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
registry.addViewController("/swagger-ui/")
|
||||
.setViewName("forward:" + "swagger-ui/index.html");
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,13 @@ import it.integry.ems.Import.base.EntityImportResponse;
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems.download.DownloadFileHandlerService;
|
||||
import it.integry.ems.download.dto.DownloadFileDto;
|
||||
import it.integry.ems.dto.CreateZipDTO;
|
||||
import it.integry.ems.dto.EntityHierarchy;
|
||||
import it.integry.ems.dto.EntityHierarchyDTO;
|
||||
import it.integry.ems.export.base.EntityExportResponse;
|
||||
import it.integry.ems.export.base.EntityExportedFile;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.media.MediaImageService;
|
||||
import it.integry.ems.media.MimeTypesHandler;
|
||||
import it.integry.ems.metrics.service.MetricService;
|
||||
import it.integry.ems.model.EntityModel;
|
||||
import it.integry.ems.model.FieldModel;
|
||||
import it.integry.ems.model.PKFieldModel;
|
||||
@@ -49,8 +49,6 @@ import org.quartz.*;
|
||||
import org.quartz.impl.matchers.GroupMatcher;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -98,6 +96,9 @@ public class EmsController {
|
||||
@Autowired
|
||||
private ServiceChecker serviceChecker;
|
||||
|
||||
@Autowired
|
||||
private MetricService metricService;
|
||||
|
||||
@Autowired
|
||||
private SchedulerFactoryBean quartzScheduler;
|
||||
|
||||
@@ -182,6 +183,17 @@ public class EmsController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/metric/count", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse metricCount(HttpServletRequest request) {
|
||||
try {
|
||||
return ServiceRestResponse.createPositiveResponse(metricService.getJsonCountMetric());
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/decodeUcs", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
String decodeUcs(@RequestBody String encodedUcs) {
|
||||
@@ -545,7 +557,8 @@ public class EmsController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_EXPORT, method = RequestMethod.POST)
|
||||
public @ResponseBody ServiceRestResponse export(
|
||||
public @ResponseBody
|
||||
ServiceRestResponse export(
|
||||
HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam(value = EmsRestConstants.TYPE) String typeExport,
|
||||
@@ -553,39 +566,44 @@ public class EmsController {
|
||||
@RequestParam(required = false, defaultValue = "false") Boolean binaryDownload,
|
||||
@RequestParam(required = false, defaultValue = "true") boolean headless,
|
||||
@RequestBody(required = false) JsonNode body) throws Exception {
|
||||
ServiceRestResponse sr = null;
|
||||
|
||||
EntityExportResponse<?> entityExportResponse = emsServices.export(typeExport, formatExport, body, headless);
|
||||
try {
|
||||
EntityExportResponse<?> entityExportResponse = emsServices.export(typeExport, formatExport, body, headless);
|
||||
|
||||
ServiceRestResponse sr = ServiceRestResponse.createPositiveResponse();
|
||||
if (entityExportResponse != null) {
|
||||
sr = new ServiceRestResponse(EsitoType.OK);
|
||||
if (entityExportResponse != null) {
|
||||
|
||||
if (binaryDownload) {
|
||||
List<DownloadFileDto> downloadableFileList = new ArrayList<>();
|
||||
for (EntityExportedFile exportedFile : (List<EntityExportedFile>) entityExportResponse.getResponse()) {
|
||||
downloadableFileList.add(downloadFileHandlerService.generateDownloadItem(exportedFile.getFile()));
|
||||
if (binaryDownload) {
|
||||
List<DownloadFileDto> downloadableFileList = new ArrayList<>();
|
||||
for (EntityExportedFile exportedFile : (List<EntityExportedFile>) entityExportResponse.getResponse()) {
|
||||
downloadableFileList.add(downloadFileHandlerService.generateDownloadItem(exportedFile.getFile()));
|
||||
}
|
||||
sr.setJsonObject(downloadableFileList);
|
||||
|
||||
|
||||
} else if (entityExportResponse.isResponseToB64()) {
|
||||
List<File> listaFile = new ArrayList<>();
|
||||
|
||||
for (EntityExportedFile exportedFile : (List<EntityExportedFile>) entityExportResponse.getResponse()) {
|
||||
listaFile.add(exportedFile.getFile());
|
||||
}
|
||||
|
||||
sr.setJsonObject(EncodedB64File.fromFileList(listaFile));
|
||||
|
||||
} else {
|
||||
sr.setJsonObject(entityExportResponse.getResponse());
|
||||
}
|
||||
sr.setJsonObject(downloadableFileList);
|
||||
|
||||
|
||||
} else if (entityExportResponse.isResponseToB64()) {
|
||||
List<File> listaFile = new ArrayList<>();
|
||||
|
||||
for (EntityExportedFile exportedFile : (List<EntityExportedFile>) entityExportResponse.getResponse()) {
|
||||
listaFile.add(exportedFile.getFile());
|
||||
if (!UtilityString.isNullOrEmpty(entityExportResponse.getMessageContent())) {
|
||||
sr.initMessageList();
|
||||
sr.getMessages().add(new MessageDTO()
|
||||
.setLevel(MessageDTO.Level.INFO)
|
||||
.setText(entityExportResponse.getMessageContent()));
|
||||
}
|
||||
|
||||
sr.setJsonObject(EncodedB64File.fromFileList(listaFile));
|
||||
|
||||
} else {
|
||||
sr.setJsonObject(entityExportResponse.getResponse());
|
||||
}
|
||||
if (!UtilityString.isNullOrEmpty(entityExportResponse.getMessageContent())) {
|
||||
sr.initMessageList();
|
||||
sr.getMessages()
|
||||
.add(new MessageDTO()
|
||||
.setLevel(MessageDTO.Level.INFO)
|
||||
.setText(entityExportResponse.getMessageContent()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
sr = new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryDatasource().getProfile(), e);
|
||||
}
|
||||
|
||||
return sr;
|
||||
@@ -598,64 +616,70 @@ public class EmsController {
|
||||
@RequestParam(value = EmsRestConstants.TYPE) String importType,
|
||||
@RequestParam(value = EmsRestConstants.FORMAT) String importFormat,
|
||||
@RequestParam(required = false, defaultValue = "true") boolean headless,
|
||||
@RequestBody(required = false) ImportRequestDTO requestBody) throws Exception {
|
||||
|
||||
EntityImportResponse<List<EntityBase>> importResponse = emsServices.importEntity(importType, importFormat, requestBody, headless);
|
||||
List<EntityBase> entities = importResponse.getResponse();
|
||||
|
||||
@RequestBody(required = false) ImportRequestDTO requestBody) {
|
||||
|
||||
ServiceRestResponse response;
|
||||
if (entities != null && entities.size() > 0 && Stream.of(entities).anyMatch(x -> x instanceof EntityBase)) {
|
||||
List<MessageDTO> errorMessages = Stream.of(entities)
|
||||
.filter(x -> x.getException() != null)
|
||||
.map(x -> MessageDTO.error(x.getException().getMessage()))
|
||||
.toList();
|
||||
|
||||
List<MessageDTO> messages = Stream.of(importResponse.getAnomalie())
|
||||
.filter(x -> x.getTipo() != null)
|
||||
.map(x -> {
|
||||
switch (x.getTipo()) {
|
||||
case ERROR:
|
||||
return MessageDTO.error(x.getMessage());
|
||||
case WARNING:
|
||||
default:
|
||||
return MessageDTO.warning(x.getMessage());
|
||||
}
|
||||
})
|
||||
.toList();
|
||||
try {
|
||||
EntityImportResponse<List<EntityBase>> importResponse = emsServices.importEntity(importType, importFormat, requestBody, headless);
|
||||
List<EntityBase> entities = importResponse.getResponse();
|
||||
|
||||
errorMessages.addAll(messages);
|
||||
|
||||
if (errorMessages.size() > 0) {
|
||||
response = ServiceRestResponse.createNegativeResponse();
|
||||
} else {
|
||||
response = ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
response.setMessages(errorMessages);
|
||||
response.setEntityList(Stream.of(entities).filter(x -> x.getException() == null).toList());
|
||||
if (entities != null && entities.size() > 0 && Stream.of(entities).anyMatch(x -> x instanceof EntityBase)) {
|
||||
List<MessageDTO> errorMessages = Stream.of(entities)
|
||||
.filter(x -> x.getException() != null)
|
||||
.map(x -> MessageDTO.error(x.getException().getMessage()))
|
||||
.toList();
|
||||
|
||||
} else {
|
||||
if (importResponse.getAnomalie() != null) {
|
||||
List<MessageDTO> messages = Stream.of(importResponse.getAnomalie())
|
||||
.filter(x -> x.getTipo() != null)
|
||||
.map(x -> {
|
||||
switch (x.getTipo()) {
|
||||
case ERROR:
|
||||
return MessageDTO.error(x.getMessage());
|
||||
case WARNING:
|
||||
default:
|
||||
return MessageDTO.warning(x.getMessage());
|
||||
}
|
||||
})
|
||||
.toList();
|
||||
|
||||
if (!importResponse.getAnomalie().isEmpty()) {
|
||||
|
||||
List<MessageDTO> messages = Stream.of(importResponse.getAnomalie())
|
||||
.map(x -> {
|
||||
switch (x.getTipo()) {
|
||||
case ERROR:
|
||||
return MessageDTO.error(x.getMessage());
|
||||
case WARNING:
|
||||
default:
|
||||
return MessageDTO.warning(x.getMessage());
|
||||
}
|
||||
})
|
||||
.toList();
|
||||
errorMessages.addAll(messages);
|
||||
|
||||
if (errorMessages.size() > 0) {
|
||||
response = ServiceRestResponse.createNegativeResponse();
|
||||
response.setMessages(messages);
|
||||
} else response = ServiceRestResponse.createPositiveResponse();
|
||||
} else {
|
||||
response = ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
response.setMessages(errorMessages);
|
||||
response.setEntityList(Stream.of(entities).filter(x -> x.getException() == null).toList());
|
||||
|
||||
} else throw new Exception("Non ci sono dati da importare");
|
||||
} else {
|
||||
if (importResponse.getAnomalie() != null) {
|
||||
|
||||
if (!importResponse.getAnomalie().isEmpty()) {
|
||||
|
||||
List<MessageDTO> messages = Stream.of(importResponse.getAnomalie())
|
||||
.map(x -> {
|
||||
switch (x.getTipo()) {
|
||||
case ERROR:
|
||||
return MessageDTO.error(x.getMessage());
|
||||
case WARNING:
|
||||
default:
|
||||
return MessageDTO.warning(x.getMessage());
|
||||
}
|
||||
})
|
||||
.toList();
|
||||
|
||||
response = ServiceRestResponse.createNegativeResponse();
|
||||
response.setMessages(messages);
|
||||
} else response = ServiceRestResponse.createPositiveResponse();
|
||||
|
||||
} else throw new Exception("Non ci sono dati da importare");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
response = ServiceRestResponse.createNegativeResponse(e);
|
||||
logger.error("Import " + httpRequest.getRequestURI(), e.getMessage());
|
||||
}
|
||||
|
||||
return response;
|
||||
@@ -754,42 +778,47 @@ public class EmsController {
|
||||
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_FILE_ATTACHMENT + "/{idAttach}/{filename}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<byte[]> downloadStbFileAttachment(
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@PathVariable String idAttach,
|
||||
@PathVariable String filename,
|
||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
||||
public byte[] downloadStbFileAttachment(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@PathVariable String idAttach,
|
||||
@PathVariable String filename,
|
||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
||||
|
||||
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(idAttach, requestThumbnail);
|
||||
|
||||
if (attachmentDTO != null) {
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType(attachmentDTO.getMimeType()))
|
||||
.contentLength(attachmentDTO.getFileSize())
|
||||
.header("Content-Disposition", "attachment; filename=\"" + attachmentDTO.getFileName() + "\"")
|
||||
.body(attachmentDTO.getFileContent());
|
||||
response.setContentType(attachmentDTO.getMimeType());
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + attachmentDTO.getFileName() + "\"");
|
||||
|
||||
response.setContentLength((int) attachmentDTO.getFileSize());
|
||||
return attachmentDTO.getFileContent();
|
||||
}
|
||||
|
||||
return ResponseEntity.notFound().build();
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.GET)
|
||||
public ResponseEntity<byte[]> downloadStbFileAttachmentPath(
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String idAttach,
|
||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
||||
public byte[] downloadStbFileAttachmentPath(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String idAttach,
|
||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
||||
|
||||
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(idAttach, requestThumbnail);
|
||||
|
||||
if (attachmentDTO != null) {
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType(attachmentDTO.getMimeType()))
|
||||
.contentLength(attachmentDTO.getFileSize())
|
||||
.header("Content-Disposition", "attachment; filename=\"" + attachmentDTO.getFileName() + "\"")
|
||||
.body(attachmentDTO.getFileContent());
|
||||
response.setContentType(attachmentDTO.getMimeType());
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + attachmentDTO.getFileName() + "\"");
|
||||
|
||||
response.setContentLength((int) attachmentDTO.getFileSize());
|
||||
return attachmentDTO.getFileContent();
|
||||
}
|
||||
|
||||
return ResponseEntity.notFound().build();
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -830,7 +859,7 @@ public class EmsController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_PDF, method = RequestMethod.GET)
|
||||
public byte[] downloadDtbDocPdf(HttpServletResponse response,
|
||||
public byte[] downloadDtbDocPdf(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String dataDoc,
|
||||
@RequestParam String serDoc,
|
||||
@@ -914,7 +943,6 @@ public class EmsController {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam(required = false) String idAttach,
|
||||
@RequestParam(required = false) String descrizione,
|
||||
@RequestParam(required = false) String typeAttach,
|
||||
@RequestPart() MultipartFile[] files
|
||||
) {
|
||||
try {
|
||||
@@ -929,7 +957,6 @@ public class EmsController {
|
||||
files[0].getBytes(),
|
||||
descrizione,
|
||||
files[0].getContentType(),
|
||||
typeAttach,
|
||||
null, null);
|
||||
|
||||
stbFilesAttached.setOnlyPkMaster(false);
|
||||
@@ -1074,11 +1101,6 @@ public class EmsController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "createZipFromFiles", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse createZipFromFiles(@RequestBody CreateZipDTO createZipDTO) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(emsServices.createZipFromFiles(createZipDTO));
|
||||
}
|
||||
|
||||
// @RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_EMAIL_CONTENT, method = RequestMethod.POST)
|
||||
// public ServiceRestResponse uploadStbFileAttachment(HttpServletRequest request, HttpServletResponse response,
|
||||
@@ -1125,7 +1147,8 @@ public class EmsController {
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_CLEAN_DIRECTORIES, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse cleanDirectories(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
ServiceRestResponse cleanDirectories(HttpServletRequest httpRequest, HttpServletResponse httpResponse,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
try {
|
||||
emsServices.cleanDirectories();
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
@@ -1144,9 +1167,11 @@ public class EmsController {
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_GET_ENTITY_MAPPING, method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse getEntityMapping(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
ServiceRestResponse getEntityMapping(HttpServletRequest httpRequest,
|
||||
HttpServletResponse httpResponse,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
try {
|
||||
List<EntityHierarchy> mapping = emsServices.getEntityMapping();
|
||||
List<EntityHierarchyDTO> mapping = emsServices.getEntityMapping();
|
||||
return ServiceRestResponse.createPositiveResponse(mapping);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
@@ -1156,7 +1181,9 @@ public class EmsController {
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_GET_HISTORY_PROFILE_DB, method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse getHistoryProfileDb(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
ServiceRestResponse getHistoryProfileDb(HttpServletRequest httpRequest,
|
||||
HttpServletResponse httpResponse,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
try {
|
||||
String historyProfileDb = settingsController.getHistoryProfileDb();
|
||||
return ServiceRestResponse.createPositiveResponse(historyProfileDb);
|
||||
@@ -1168,7 +1195,9 @@ public class EmsController {
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_GET_ENTITY_DETAILS, method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse getEntityDetails(@RequestParam("entityName") String entityName,
|
||||
ServiceRestResponse getEntityDetails(HttpServletRequest httpRequest,
|
||||
HttpServletResponse httpResponse,
|
||||
@RequestParam("entityName") String entityName,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config
|
||||
) throws Exception {
|
||||
try {
|
||||
|
||||
@@ -30,6 +30,6 @@ public class EmsResponseEntityExceptionHandler extends ResponseEntityExceptionHa
|
||||
logger.error("Eccezione non gestita", ex);
|
||||
|
||||
ServiceRestResponse serviceRestResponse = ServiceRestResponse.createNegativeResponse(ex);
|
||||
return new ResponseEntity<>(serviceRestResponse, headers, status);
|
||||
return new ResponseEntity(serviceRestResponse, headers, status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,26 @@ package it.integry.ems.devices;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems_model.entity.StbDevices;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.StbDevice;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityDate;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.naming.Context;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.Connection;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -48,14 +57,14 @@ public class DevicesService {
|
||||
UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), selectSql);
|
||||
|
||||
if(!exists) {
|
||||
StbDevices stbDevices = new StbDevices()
|
||||
StbDevice stbDevice = new StbDevice()
|
||||
.setName(appName)
|
||||
.setIdentificationId(deviceId)
|
||||
.setCreatedAt(new Date())
|
||||
.setLastUse(new Date());
|
||||
|
||||
stbDevices.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
entityProcessor.processEntity(stbDevices, multiDBTransactionManager);
|
||||
stbDevice.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
entityProcessor.processEntity(stbDevice, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.ems.directory;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.json.JSONObjectMapper;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.FileItem;
|
||||
@@ -39,10 +39,10 @@ public class EmailWatcherListener extends TimerTask {
|
||||
private EmailListenerInfo emailListenerInfo;
|
||||
private EmsProperties prop;
|
||||
private SetupGest setupGest;
|
||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||
private JSONObjectMapper jsonObjectMapper;
|
||||
|
||||
public EmailWatcherListener(EmailListenerInfo emailListenerInfo, EmsProperties prop,
|
||||
SetupGest setupGest, ResponseJSONObjectMapper jsonObjectMapper) {
|
||||
SetupGest setupGest, JSONObjectMapper jsonObjectMapper) {
|
||||
super();
|
||||
this.emailListenerInfo = emailListenerInfo;
|
||||
this.prop = prop;
|
||||
|
||||
@@ -12,10 +12,6 @@ public class ApplicationInfoDTO {
|
||||
private String loadMenuPvm;
|
||||
private List<String> salvataggiSoap;
|
||||
|
||||
private boolean delimitedIdentifier;
|
||||
private boolean ansiPadding;
|
||||
private boolean concatNullYieldsNull;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -78,31 +74,4 @@ public class ApplicationInfoDTO {
|
||||
this.salvataggiSoap = salvataggiSoap;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isConcatNullYieldsNull() {
|
||||
return concatNullYieldsNull;
|
||||
}
|
||||
|
||||
public ApplicationInfoDTO setConcatNullYieldsNull(boolean concatNullYieldNulls) {
|
||||
this.concatNullYieldsNull = concatNullYieldNulls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isAnsiPadding() {
|
||||
return ansiPadding;
|
||||
}
|
||||
|
||||
public ApplicationInfoDTO setAnsiPadding(boolean ansiPadding) {
|
||||
this.ansiPadding = ansiPadding;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDelimitedIdentifier() {
|
||||
return delimitedIdentifier;
|
||||
}
|
||||
|
||||
public ApplicationInfoDTO setDelimitedIdentifier(boolean delimitedIdentifier) {
|
||||
this.delimitedIdentifier = delimitedIdentifier;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
package it.integry.ems.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import it.integry.ems.report.dto.JasperDTO;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.DtbDocPdf;
|
||||
import it.integry.ems_model.entity.MtbAartLink;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
import it.integry.ems_model.entity.StbActivityFile;
|
||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class CreateZipDTO {
|
||||
private List<String> listIdAttach;
|
||||
|
||||
private List<StbActivityFile> listStbActivityFile;
|
||||
|
||||
private List<MtbAartLink> listMtbAartLink;
|
||||
|
||||
private List<DtbDocPdf> listDtbDocPdf;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private SaveMode saveMode = SaveMode.STB_FILES_ATTACHED;
|
||||
|
||||
private EntityBase entityToSaveTo;
|
||||
|
||||
public List<String> getListIdAttach() {
|
||||
return listIdAttach;
|
||||
}
|
||||
|
||||
public CreateZipDTO setListIdAttach(List<String> listIdAttach) {
|
||||
this.listIdAttach = listIdAttach;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<StbActivityFile> getListStbActivityFile() {
|
||||
return listStbActivityFile;
|
||||
}
|
||||
|
||||
public CreateZipDTO setListStbActivityFile(List<StbActivityFile> listStbActivityFile) {
|
||||
this.listStbActivityFile = listStbActivityFile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbAartLink> getListMtbAartLink() {
|
||||
return listMtbAartLink;
|
||||
}
|
||||
|
||||
public CreateZipDTO setListMtbAartLink(List<MtbAartLink> listMtbAartLink) {
|
||||
this.listMtbAartLink = listMtbAartLink;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<DtbDocPdf> getListDtbDocPdf() {
|
||||
return listDtbDocPdf;
|
||||
}
|
||||
|
||||
public CreateZipDTO setListDtbDocPdf(List<DtbDocPdf> listDtbDocPdf) {
|
||||
this.listDtbDocPdf = listDtbDocPdf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public CreateZipDTO setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SaveMode getSaveMode() {
|
||||
return saveMode;
|
||||
}
|
||||
|
||||
public CreateZipDTO setSaveMode(SaveMode saveMode) {
|
||||
this.saveMode = saveMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityBase getEntityToSaveTo() {
|
||||
return entityToSaveTo;
|
||||
}
|
||||
|
||||
public CreateZipDTO setEntityToSaveTo(EntityBase entityToSaveTo) {
|
||||
this.entityToSaveTo = entityToSaveTo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public enum SaveMode implements IBaseEnum<SaveMode> {
|
||||
STB_FILES_ATTACHED((short) 0),
|
||||
STB_ACTIVITY_FILE((short) 1);
|
||||
|
||||
private final short value;
|
||||
|
||||
SaveMode(final short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static SaveMode from(Object value) {
|
||||
short castValue = (short) value;
|
||||
for (SaveMode b : SaveMode.values()) {
|
||||
if (b.value == castValue)
|
||||
return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public short getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaveMode fromInternal(Object val) {
|
||||
return from(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
package it.integry.ems.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EntityInterface;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityHierarchy {
|
||||
|
||||
private Class<? extends EntityBase> clazz;
|
||||
private String entityName;
|
||||
private String tableName;
|
||||
private java.lang.reflect.Field parentField; //Used for entityChild
|
||||
private boolean master;
|
||||
private boolean equatable;
|
||||
private List<EntityHierarchy> children;
|
||||
private List<Field> fields;
|
||||
|
||||
public Class<? extends EntityInterface> getClazz() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public EntityHierarchy setClazz(Class<? extends EntityBase> clazz) {
|
||||
this.clazz = clazz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEntityName() {
|
||||
return entityName;
|
||||
}
|
||||
|
||||
public void setEntityName(String entityName) {
|
||||
this.entityName = entityName;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public java.lang.reflect.Field getParentField() {
|
||||
return parentField;
|
||||
}
|
||||
|
||||
public EntityHierarchy setParentField(java.lang.reflect.Field parentField) {
|
||||
this.parentField = parentField;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMaster() {
|
||||
return master;
|
||||
}
|
||||
|
||||
public EntityHierarchy setMaster(boolean master) {
|
||||
this.master = master;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<EntityHierarchy> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<EntityHierarchy> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public void addChild(EntityHierarchy child) {
|
||||
this.children.add(child);
|
||||
}
|
||||
|
||||
public void removeChild(EntityHierarchy child) {
|
||||
this.children.remove(child);
|
||||
}
|
||||
|
||||
public List<Field> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public EntityHierarchy setFields(List<Field> fields) {
|
||||
this.fields = fields;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isEquatable() {
|
||||
return equatable;
|
||||
}
|
||||
|
||||
public EntityHierarchy setEquatable(boolean equatable) {
|
||||
this.equatable = equatable;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public static class Field {
|
||||
private java.lang.reflect.Field field;
|
||||
private Identity identity;
|
||||
private SqlField sqlField;
|
||||
private ObjectStorage objectStorage;
|
||||
private Blob blob;
|
||||
private Clob clob;
|
||||
|
||||
public java.lang.reflect.Field getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public Field setField(java.lang.reflect.Field field) {
|
||||
this.field = field;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSqlField() {
|
||||
return sqlField != null;
|
||||
}
|
||||
|
||||
public boolean isObjectStorage() {
|
||||
return objectStorage != null;
|
||||
}
|
||||
|
||||
public boolean isBlob() {
|
||||
return blob != null;
|
||||
}
|
||||
|
||||
public boolean isClob() {
|
||||
return clob != null;
|
||||
}
|
||||
|
||||
public boolean isIdentity() {
|
||||
return identity != null;
|
||||
}
|
||||
|
||||
public Identity getIdentity() {
|
||||
return identity;
|
||||
}
|
||||
|
||||
public Field setIdentity(Identity identity) {
|
||||
this.identity = identity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SqlField getSqlField() {
|
||||
return sqlField;
|
||||
}
|
||||
|
||||
public Field setSqlField(SqlField sqlField) {
|
||||
this.sqlField = sqlField;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ObjectStorage getObjectStorage() {
|
||||
return objectStorage;
|
||||
}
|
||||
|
||||
public Field setObjectStorage(ObjectStorage objectStorage) {
|
||||
this.objectStorage = objectStorage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Blob getBlob() {
|
||||
return blob;
|
||||
}
|
||||
|
||||
public Field setBlob(Blob blob) {
|
||||
this.blob = blob;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Clob getClob() {
|
||||
return clob;
|
||||
}
|
||||
|
||||
public Field setClob(Clob clob) {
|
||||
this.clob = clob;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package it.integry.ems.dto;
|
||||
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
public class EntityHierarchyDTO {
|
||||
|
||||
private Class<? extends EntityBase> clazz;
|
||||
private String entityName;
|
||||
private String tableName;
|
||||
private Field field;
|
||||
private boolean master;
|
||||
private List<EntityHierarchyDTO> children;
|
||||
|
||||
public Class<? extends EntityBase> getClazz() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public EntityHierarchyDTO setClazz(Class<? extends EntityBase> clazz) {
|
||||
this.clazz = clazz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEntityName() {
|
||||
return entityName;
|
||||
}
|
||||
|
||||
public void setEntityName(String entityName) {
|
||||
this.entityName = entityName;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public Field getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public EntityHierarchyDTO setField(Field field) {
|
||||
this.field = field;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMaster() {
|
||||
return master;
|
||||
}
|
||||
|
||||
public EntityHierarchyDTO setMaster(boolean master) {
|
||||
this.master = master;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<EntityHierarchyDTO> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<EntityHierarchyDTO> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public void addChild(EntityHierarchyDTO child) {
|
||||
this.children.add(child);
|
||||
}
|
||||
|
||||
public void removeChild(EntityHierarchyDTO child) {
|
||||
this.children.remove(child);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package it.integry.ems.dto;
|
||||
|
||||
public abstract class Result<T> {
|
||||
private Result() {}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this instanceof Result.Success) {
|
||||
Result.Success<?> success = (Result.Success<?>) this;
|
||||
return "Success[data=" + success.getData().toString() + "]";
|
||||
} else if (this instanceof Result.Error) {
|
||||
Result.Error error = (Result.Error) this;
|
||||
return "Error[exception=" + error.getError().toString() + "]";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static final class Success<T> extends Result<T> {
|
||||
private final T data;
|
||||
|
||||
public Success() {
|
||||
data = null;
|
||||
}
|
||||
|
||||
public Success(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Error<T> extends Result<T> {
|
||||
private final Exception exception;
|
||||
|
||||
public Error(Exception exception) {
|
||||
exception.printStackTrace();
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
public Exception getError() {
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package it.integry.ems.dynamic_cache;
|
||||
|
||||
import it.integry.ems.expansion.RunnableArgsWithReturn;
|
||||
import it.integry.ems.expansion.RunnableWithReturn;
|
||||
import it.integry.ems.looper.service.LooperService;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
@@ -13,7 +12,6 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -36,46 +34,17 @@ public class DynamicCacheService {
|
||||
public enum Keys {
|
||||
DATI_AZIENDA_KEY,
|
||||
ENTITY_LOGGER_SETUP,
|
||||
GRIGLIA_ACQUISTO_KEY,
|
||||
ENTITY_SYNC_KEY
|
||||
GRIGLIA_ACQUISTO_KEY
|
||||
}
|
||||
|
||||
public void addItem(Keys key, int invalidateTimeInMins, RunnableWithReturn<Object> refreshAction) {
|
||||
//cacheData.put(key, refreshAction.run());
|
||||
|
||||
this.looperService.add(() -> {
|
||||
cacheData.put(key, refreshAction.run());
|
||||
}, invalidateTimeInMins * 60 * 1000, "dynamic-cache-" + key);
|
||||
}
|
||||
|
||||
public <T>void addDbItem(Keys key, int invalidateTimeInMins, RunnableArgsWithReturn<Connection, T> refreshAction, List<String> dbNames) {
|
||||
List<String> finalDbNames = dbNames.stream().map(String::toLowerCase).collect(Collectors.toList());
|
||||
RunnableWithReturn<Object> internalRefreshAction = () -> {
|
||||
|
||||
Map<String, List<AvailableConnectionsModel>> databases = settingsModel.getAvailableConnections()
|
||||
.stream()
|
||||
.filter(AvailableConnectionsModel::getInternalDb)
|
||||
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
||||
.collect(Collectors.groupingBy(AvailableConnectionsModel::getDbName));
|
||||
|
||||
final HashMap<String, T> cachedDataByDB = new HashMap<>();
|
||||
|
||||
for (String dbName : databases.keySet()) {
|
||||
String profileName = databases.get(dbName).get(0).getProfileName();
|
||||
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(profileName, false)) {
|
||||
T data = refreshAction.run(multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
cachedDataByDB.putIfAbsent(dbName.toLowerCase(), data);
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
return cachedDataByDB;
|
||||
};
|
||||
|
||||
addItem(key, invalidateTimeInMins, internalRefreshAction);
|
||||
}
|
||||
|
||||
public void addEntity(Keys key, int invalidateTimeInMins, Class<? extends EntityBase> clazz, List<String> dbNames) {
|
||||
|
||||
List<String> finalDbNames = dbNames.stream().map(String::toLowerCase).collect(Collectors.toList());
|
||||
@@ -123,12 +92,16 @@ public class DynamicCacheService {
|
||||
}
|
||||
|
||||
private void cacheEntityByDB(String dbName, String profileName, Class<? extends EntityBase> clazz, HashMap<String, List<? extends EntityBase>> cachedEntitiesByDB) throws Exception {
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(profileName, false)) {
|
||||
MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(profileName, false);
|
||||
|
||||
try {
|
||||
String tableName = clazz.newInstance().getTableName();
|
||||
String sql = "SELECT * FROM " + tableName;
|
||||
List<? extends EntityBase> entities = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, clazz);
|
||||
|
||||
cachedEntitiesByDB.putIfAbsent(dbName.toLowerCase(), entities);
|
||||
} finally {
|
||||
multiDBTransactionManager.closeAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,13 +155,4 @@ public class DynamicCacheService {
|
||||
|
||||
return cachedEntityList;
|
||||
}
|
||||
|
||||
public <T>T getDbItem(Keys key, String dbName) {
|
||||
dbName = dbName.toLowerCase();
|
||||
final HashMap<String, T> cacheObjectByDB = (HashMap<String, T>) cacheData.getOrDefault(key, null);
|
||||
if (cacheObjectByDB == null) return null;
|
||||
|
||||
final T cachedEntityValue = cacheObjectByDB.getOrDefault(dbName, null);
|
||||
return cachedEntityValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package it.integry.ems.ecedi.dto;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -509,7 +508,7 @@ public class EuritmoTestata {
|
||||
|
||||
// Chiave collo
|
||||
mtbColt.setGestione("A");
|
||||
mtbColt.setDataCollo(UtilityLocalDate.localDateFromDate(this.dataDoc));
|
||||
mtbColt.setDataCollo(this.dataDoc);
|
||||
|
||||
mtbColt.setRifOrd(String.format("%s_%s", dataDocString, this.numDoc));
|
||||
mtbColt.setAnnotazioni(annotazioni);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package it.integry.ems.ecedi.enums;
|
||||
|
||||
public enum EuritmoCCIAppIdentifier {
|
||||
CCI37("37"),
|
||||
CCI00("00"),
|
||||
CCI10("10"),
|
||||
CCI17("17"),
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package it.integry.ems.entity_development;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.devices.DevicesService;
|
||||
import it.integry.ems.devices.dto.RegisterDeviceRequestDTO;
|
||||
import it.integry.ems.entity_development.dto.CreateEntityItemRequestDTO;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Scope("request")
|
||||
@RequestMapping("entity-development")
|
||||
public class EntityDevelopmentController {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Autowired
|
||||
private EntityDevelopmentService entityDevelopmentService;
|
||||
|
||||
@RequestMapping(value = "create", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse create(@RequestBody CreateEntityItemRequestDTO[] createEntityItemRequestList) throws Exception {
|
||||
if (!UtilityDebug.isDebugExecution())
|
||||
throw new Exception("Puoi eseguire questa procedura solo in ambiente DEBUG!");
|
||||
|
||||
if (UtilityDebug.isIntegryServerDev())
|
||||
throw new Exception("Non puoi eseguire questa azione su SERVERDEV!");
|
||||
|
||||
entityDevelopmentService.create(createEntityItemRequestList);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,250 +0,0 @@
|
||||
package it.integry.ems.entity_development;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.github.javaparser.ast.CompilationUnit;
|
||||
import com.github.javaparser.ast.NodeList;
|
||||
import com.github.javaparser.ast.body.*;
|
||||
import com.github.javaparser.ast.expr.*;
|
||||
import com.github.javaparser.ast.stmt.BlockStmt;
|
||||
import com.github.javaparser.ast.stmt.ExpressionStmt;
|
||||
import com.github.javaparser.ast.stmt.ReturnStmt;
|
||||
import com.github.javaparser.ast.type.ClassOrInterfaceType;
|
||||
import it.integry.ems.entity_development.dto.CreateEntityItemRequestDTO;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.component.SQLServerDBSchemaManager;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseForeignKey;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableColumn;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableView;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDirs;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.github.javaparser.ast.Modifier.Keyword.*;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class EntityDevelopmentService {
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
public void create(CreateEntityItemRequestDTO[] createEntityItemRequestList) throws Exception {
|
||||
SQLServerDBSchemaManager sourceDBSchema = new SQLServerDBSchemaManager(multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
List<AbstractMap.SimpleEntry<Boolean, CompilationUnit>> masterDetailClassesDeclaration = new ArrayList<>();
|
||||
|
||||
final List<CreateEntityItemRequestDTO> entityChilds = Arrays.stream(createEntityItemRequestList)
|
||||
.filter(x -> !x.isMaster())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (CreateEntityItemRequestDTO createEntityItemRequestDTO : createEntityItemRequestList) {
|
||||
final DatabaseTableView tableData = sourceDBSchema.getTable(createEntityItemRequestDTO.getTableName());
|
||||
final CompilationUnit javaClassDeclaration =
|
||||
createJavaClassDeclaration(createEntityItemRequestDTO, tableData, createEntityItemRequestDTO.isMaster() ? entityChilds : null);
|
||||
|
||||
masterDetailClassesDeclaration.add(new AbstractMap.SimpleEntry<>(createEntityItemRequestDTO.isMaster(), javaClassDeclaration));
|
||||
}
|
||||
|
||||
final String entitiesJavaPath = UtilityDirs.getDevelopmentJavaBaseFolder() + "it\\integry\\ems_model\\entity\\";
|
||||
|
||||
for (AbstractMap.SimpleEntry<Boolean, CompilationUnit> booleanClassOrInterfaceDeclarationSimpleEntry : masterDetailClassesDeclaration) {
|
||||
final TypeDeclaration<?> classDeclaration = booleanClassOrInterfaceDeclarationSimpleEntry.getValue().getType(0);
|
||||
|
||||
writeJavaClassToFile(booleanClassOrInterfaceDeclarationSimpleEntry.getValue(), entitiesJavaPath, classDeclaration.getNameAsString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private CompilationUnit createJavaClassDeclaration(CreateEntityItemRequestDTO createEntityItemRequestDTO, final DatabaseTableView databaseTable, final List<CreateEntityItemRequestDTO> childEntities) throws Exception {
|
||||
CompilationUnit javaClassCompilation = new CompilationUnit();
|
||||
|
||||
javaClassCompilation.setPackageDeclaration("it.integry.ems_model.entity");
|
||||
javaClassCompilation.addImport(LogManager.class);
|
||||
javaClassCompilation.addImport(List.class);
|
||||
javaClassCompilation.addImport(ArrayList.class);
|
||||
|
||||
String javaClassName = UtilityString.sqlToCamelCase(databaseTable.getTableName());
|
||||
javaClassName = javaClassName.substring(0, 1).toUpperCase() + javaClassName.substring(1);
|
||||
|
||||
|
||||
ClassOrInterfaceDeclaration javaClass = javaClassCompilation
|
||||
.addClass(javaClassName)
|
||||
.addExtendedType(EntityBase.class)
|
||||
.setPublic(true);
|
||||
|
||||
if (createEntityItemRequestDTO.isMaster())
|
||||
javaClass.addAnnotation(Master.class);
|
||||
|
||||
javaClass
|
||||
.addAnnotation(PropertyReactive.class);
|
||||
|
||||
|
||||
javaClass.addAndGetAnnotation(Table.class)
|
||||
.addPair("value", new FieldAccessExpr(new NameExpr(javaClassName), "ENTITY"));
|
||||
|
||||
javaClass.addAndGetAnnotation(JsonTypeName.class)
|
||||
.addPair("value", new FieldAccessExpr(new NameExpr(javaClassName), "ENTITY"));
|
||||
|
||||
final FieldDeclaration entityField = javaClass.addFieldWithInitializer(String.class, "ENTITY", new StringLiteralExpr(databaseTable.getTableName()), PUBLIC, FINAL, STATIC);
|
||||
final FieldDeclaration serialVersionUIDField = javaClass.addFieldWithInitializer(Long.class, "serialVersionUID", new LongLiteralExpr("1L"), PRIVATE, FINAL, STATIC);
|
||||
final FieldDeclaration loggerField = javaClass.addFieldWithInitializer(Logger.class, "logger", new MethodCallExpr("LogManager.getLogger"), PRIVATE, FINAL, STATIC);
|
||||
|
||||
|
||||
createEntityConstructor(javaClass);
|
||||
|
||||
List<FieldDeclaration> entityFields = new ArrayList<>();
|
||||
|
||||
for (DatabaseTableColumn databaseColumn : databaseTable.getColumns()) {
|
||||
entityFields.add(createEntityField(javaClass, databaseColumn));
|
||||
}
|
||||
|
||||
if (childEntities != null) {
|
||||
for (CreateEntityItemRequestDTO child : childEntities) {
|
||||
String entityChildClassName = UtilityString.sqlToCamelCase(child.getTableName());
|
||||
entityChildClassName = entityChildClassName.substring(0, 1).toUpperCase() + entityChildClassName.substring(1);
|
||||
|
||||
String variableName = entityChildClassName.substring(0, 1).toLowerCase() + entityChildClassName.substring(1);
|
||||
|
||||
final FieldDeclaration fieldDeclaration = javaClass.addField(
|
||||
"List<" + entityChildClassName + ">",
|
||||
variableName,
|
||||
PRIVATE);
|
||||
|
||||
//final InitializerDeclaration initializerDeclaration = new InitializerDeclaration(false, new BlockStmt().addStatement("new ArrayList<>()"));
|
||||
|
||||
fieldDeclaration.setVariable(0, new VariableDeclarator(fieldDeclaration.getElementType(), variableName, new MethodCallExpr("new ArrayList<>")));
|
||||
entityFields.add(fieldDeclaration);
|
||||
|
||||
fieldDeclaration.addAnnotation(EntityChild.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (FieldDeclaration field : entityFields) {
|
||||
field.createGetter();
|
||||
field.createSetter()
|
||||
.setType(javaClassName)
|
||||
.getBody().ifPresent(x -> x.addStatement(new ReturnStmt("this")));
|
||||
}
|
||||
|
||||
if (childEntities != null && !childEntities.isEmpty()) {
|
||||
createDeleteChildsMethod(javaClass, childEntities);
|
||||
}
|
||||
|
||||
return javaClassCompilation;
|
||||
}
|
||||
|
||||
private void createEntityConstructor(ClassOrInterfaceDeclaration javaClass) {
|
||||
final ConstructorDeclaration constructorDeclaration = javaClass.addConstructor(PUBLIC);
|
||||
|
||||
final BlockStmt constructorBlockStmt = constructorDeclaration.getBody();
|
||||
|
||||
constructorBlockStmt.addStatement(new MethodCallExpr("super",
|
||||
new NameExpr("logger")));
|
||||
|
||||
}
|
||||
|
||||
private FieldDeclaration createEntityField(ClassOrInterfaceDeclaration javaClass, DatabaseTableColumn databaseColumn) throws Exception {
|
||||
final Class<?> aClass = UtilityDB.sqlTypeToJavaClass(databaseColumn.getDataType().toSqlDataType());
|
||||
|
||||
FieldDeclaration fieldDeclaration = javaClass.addField(aClass, UtilityString.sqlToField(databaseColumn.getColumnName()), PRIVATE);
|
||||
|
||||
//Create @PK annotation
|
||||
if (databaseColumn.isPrimaryKey())
|
||||
fieldDeclaration.addAnnotation(PK.class);
|
||||
|
||||
if (databaseColumn.isIdentity())
|
||||
fieldDeclaration.addAnnotation(Identity.class);
|
||||
|
||||
//Create @SqlField annotation
|
||||
final NormalAnnotationExpr sqlFieldAnnotation = fieldDeclaration.addAndGetAnnotation(SqlField.class)
|
||||
.addPair("value", new StringLiteralExpr(databaseColumn.getColumnName()));
|
||||
|
||||
if (databaseColumn.getCharacterMaximumLength() != null)
|
||||
sqlFieldAnnotation.addPair("maxLength", new IntegerLiteralExpr(databaseColumn.getCharacterMaximumLength().toString()));
|
||||
|
||||
sqlFieldAnnotation
|
||||
.addPair("nullable", new BooleanLiteralExpr(databaseColumn.isNullable()));
|
||||
|
||||
//Create @FK annotations
|
||||
if (databaseColumn.getForeignKeys() != null) {
|
||||
for (DatabaseForeignKey fkInfo : databaseColumn.getForeignKeys()) {
|
||||
String javaClassName = UtilityString.sqlToCamelCase(fkInfo.getTableName());
|
||||
javaClassName = javaClassName.substring(0, 1).toUpperCase() + javaClassName.substring(1);
|
||||
|
||||
fieldDeclaration.addAndGetAnnotation(FK.class)
|
||||
.addPair("tableName", new FieldAccessExpr(new NameExpr(javaClassName), "ENTITY"))
|
||||
.addPair("columnName", new StringLiteralExpr(fkInfo.getColumnName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return fieldDeclaration;
|
||||
}
|
||||
|
||||
private MethodDeclaration createDeleteChildsMethod(ClassOrInterfaceDeclaration classDefinition, final List<CreateEntityItemRequestDTO> childEntities) {
|
||||
|
||||
final MethodDeclaration deleteChilds = classDefinition.addMethod("deleteChilds", PROTECTED);
|
||||
deleteChilds.addThrownException(Exception.class);
|
||||
|
||||
final BlockStmt blockStmt = deleteChilds.getBody().get();
|
||||
|
||||
for (CreateEntityItemRequestDTO childEntity : childEntities) {
|
||||
String entityChildClassName = UtilityString.sqlToCamelCase(childEntity.getTableName());
|
||||
entityChildClassName = entityChildClassName.substring(0, 1).toUpperCase() + entityChildClassName.substring(1);
|
||||
|
||||
String variableName = entityChildClassName.substring(0, 1).toLowerCase() + entityChildClassName.substring(1);
|
||||
|
||||
ClassOrInterfaceType classOrInterfaceType = new ClassOrInterfaceType()
|
||||
.setName(entityChildClassName);
|
||||
final VariableDeclarationExpr variableDeclarationExpr = new VariableDeclarationExpr(classOrInterfaceType, variableName);
|
||||
|
||||
variableDeclarationExpr.getVariable(0).setInitializer("new " + entityChildClassName + "()");
|
||||
|
||||
blockStmt.addStatement(
|
||||
new ExpressionStmt(variableDeclarationExpr));
|
||||
|
||||
final NodeList<Expression> nodes = new NodeList<>();
|
||||
nodes.add(new NameExpr("connection"));
|
||||
nodes.add(new NameExpr("this"));
|
||||
|
||||
MethodCallExpr methodCallExpr = new MethodCallExpr(variableDeclarationExpr.getVariable(0).getNameAsExpression(), "deleteAllEntities", nodes);
|
||||
blockStmt.addStatement(methodCallExpr);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void writeJavaClassToFile(CompilationUnit classDefinition, String directoryPath, String nameAsString) throws Exception {
|
||||
String filePath = directoryPath + nameAsString + ".java";
|
||||
File f = new File(filePath);
|
||||
if (f.exists()) throw new Exception("Esiste già un file per " + nameAsString);
|
||||
|
||||
FileOutputStream outputStream = new FileOutputStream(filePath);
|
||||
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8);
|
||||
outputStreamWriter.write(classDefinition.toString());
|
||||
|
||||
outputStreamWriter.close();
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package it.integry.ems.entity_development.dto;
|
||||
|
||||
public class CreateEntityItemRequestDTO {
|
||||
|
||||
private String tableName;
|
||||
private boolean master;
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public CreateEntityItemRequestDTO setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMaster() {
|
||||
return master;
|
||||
}
|
||||
|
||||
public CreateEntityItemRequestDTO setMaster(boolean master) {
|
||||
this.master = master;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import com.microsoft.sqlserver.jdbc.SQLServerException;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.*;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -33,10 +32,6 @@ public class SQLServerDBSchemaManager {
|
||||
this.mPassword = password;
|
||||
}
|
||||
|
||||
public SQLServerDBSchemaManager(Connection connection) {
|
||||
this.mConnection = connection;
|
||||
}
|
||||
|
||||
public void connect() throws SQLException {
|
||||
mConnection = DriverManager.getConnection(getConnectionString(mHost), mUsername, mPassword);
|
||||
mConnection.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
|
||||
@@ -82,168 +77,44 @@ public class SQLServerDBSchemaManager {
|
||||
return UtilityDB.executeSimpleQueryDTO(this.mConnection, sql, DatabaseFile.class);
|
||||
}
|
||||
|
||||
public DatabaseTable getTable(String tableName) throws Exception {
|
||||
return getTableOrView(tableName, DatabaseObjectTypeEnum.TABLE, DatabaseTable.class);
|
||||
}
|
||||
|
||||
public DatabaseView getView(String viewName) throws Exception {
|
||||
return getTableOrView(viewName, DatabaseObjectTypeEnum.VIEW, DatabaseView.class);
|
||||
}
|
||||
|
||||
public <T extends DatabaseTableView> T getTableOrView(String objectName, DatabaseObjectTypeEnum type, Class<T> classType) throws Exception {
|
||||
String sql = "SELECT TABLE_CATALOG,\n" +
|
||||
" COLUMNS.TABLE_SCHEMA,\n" +
|
||||
" COLUMNS.TABLE_NAME,\n" +
|
||||
" COLUMNS.COLUMN_NAME,\n" +
|
||||
" ISNULL(IS_PRIMARY_KEY, 0) AS IS_PRIMARY_KEY,\n" +
|
||||
" CAST(OBJECTPROPERTY(OBJECT_ID(COLUMNS.TABLE_NAME), 'TableHasIdentity') AS BIT) AS TABLE_HAS_IDENTITY,\n" +
|
||||
" ORDINAL_POSITION,\n" +
|
||||
" COLUMN_DEFAULT,\n" +
|
||||
" CAST(CASE WHEN IS_NULLABLE = 'YES' THEN 1 ELSE 0 END AS BIT) AS IS_NULLABLE,\n" +
|
||||
" DATA_TYPE,\n" +
|
||||
" CHARACTER_MAXIMUM_LENGTH,\n" +
|
||||
" CHARACTER_OCTET_LENGTH,\n" +
|
||||
" NUMERIC_PRECISION,\n" +
|
||||
" NUMERIC_PRECISION_RADIX,\n" +
|
||||
" NUMERIC_SCALE,\n" +
|
||||
" DATETIME_PRECISION,\n" +
|
||||
" CHARACTER_SET_CATALOG,\n" +
|
||||
" CHARACTER_SET_SCHEMA,\n" +
|
||||
" CHARACTER_SET_NAME,\n" +
|
||||
" COLLATION_CATALOG,\n" +
|
||||
" COLLATION_SCHEMA,\n" +
|
||||
" COLLATION_NAME,\n" +
|
||||
" DOMAIN_CATALOG,\n" +
|
||||
" DOMAIN_SCHEMA,\n" +
|
||||
" DOMAIN_NAME\n" +
|
||||
"FROM INFORMATION_SCHEMA.COLUMNS\n" +
|
||||
" INNER JOIN sys.objects ON TABLE_NAME = name\n" +
|
||||
" LEFT OUTER JOIN (SELECT TABLE_NAME,\n" +
|
||||
" TABLE_SCHEMA,\n" +
|
||||
" COLUMN_NAME,\n" +
|
||||
" CAST(1 AS BIT) AS IS_PRIMARY_KEY\n" +
|
||||
" FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE\n" +
|
||||
" WHERE OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA + '.' + QUOTENAME(CONSTRAINT_NAME)),\n" +
|
||||
" 'IsPrimaryKey') = 1) pk\n" +
|
||||
" ON pk.TABLE_NAME = COLUMNS.TABLE_NAME AND\n" +
|
||||
" pk.COLUMN_NAME = COLUMNS.COLUMN_NAME AND\n" +
|
||||
" pk.TABLE_SCHEMA = COLUMNS.TABLE_SCHEMA\n" +
|
||||
" WHERE type = " + UtilityDB.valueToString(type.getText()) +
|
||||
" AND COLUMNS.TABLE_NAME = " + UtilityDB.valueToString(objectName);
|
||||
|
||||
List<HashMap<String, Object>> result = UtilityDB.executeSimpleQuery(this.mConnection, sql);
|
||||
|
||||
if (result.isEmpty())
|
||||
return null;
|
||||
|
||||
HashMap<String, ArrayList<DatabaseForeignKey>> foreignKeysResults = getForeignKeys(objectName);
|
||||
|
||||
T databaseTable = (T) classType.newInstance()
|
||||
.setTableName(objectName);
|
||||
|
||||
List<DatabaseTableColumn> databaseTableColumns = new ArrayList<>();
|
||||
for (HashMap<String, Object> column : result) {
|
||||
|
||||
DatabaseTableColumn databaseTableColumn = new DatabaseTableColumn()
|
||||
.setColumnName(UtilityHashMap.getValueIfExists(column, "COLUMN_NAME"))
|
||||
.setOrdinalPosition(UtilityHashMap.getValueIfExists(column, "ORDINAL_POSITION"))
|
||||
.setColumnDefault(UtilityHashMap.getValueIfExists(column, "COLUMN_DEFAULT"))
|
||||
.setNullable(UtilityHashMap.getValueIfExists(column, "IS_NULLABLE"))
|
||||
.setPrimaryKey(UtilityHashMap.getValueIfExists(column, "IS_PRIMARY_KEY"))
|
||||
.setDataType(DatabaseTableColumnDataType.fromString(UtilityHashMap.getValueIfExists(column, "DATA_TYPE")))
|
||||
.setCharacterMaximumLength(UtilityHashMap.getValueIfExists(column, "CHARACTER_MAXIMUM_LENGTH"))
|
||||
.setCharacterOctetLength(UtilityHashMap.getValueIfExists(column, "CHARACTER_OCTET_LENGTH"))
|
||||
.setNumericPrecision(UtilityHashMap.getValueIfExists(column, "NUMERIC_PRECISION"))
|
||||
.setNumericPrecisionRadix(UtilityHashMap.getValueIfExists(column, "NUMERIC_PRECISION_RADIX"))
|
||||
.setNumericScale(UtilityHashMap.getValueIfExists(column, "NUMERIC_SCALE"))
|
||||
.setDatetimePrecision(UtilityHashMap.getValueIfExists(column, "DATETIME_PRECISION"))
|
||||
.setCharacterSetCatalog(UtilityHashMap.getValueIfExists(column, "CHARACTER_SET_CATALOG"))
|
||||
.setCharacterSetSchema(UtilityHashMap.getValueIfExists(column, "CHARACTER_SET_SCHEMA"))
|
||||
.setCharacterSetName(UtilityHashMap.getValueIfExists(column, "CHARACTER_SET_NAME"));
|
||||
|
||||
databaseTableColumn.setIdentity(databaseTableColumn.isPrimaryKey() && UtilityHashMap.<Boolean>getValueIfExists(column, "TABLE_HAS_IDENTITY"));
|
||||
|
||||
if (foreignKeysResults.containsKey(databaseTableColumn.getColumnName()))
|
||||
databaseTableColumn.setForeignKeys(foreignKeysResults.get(databaseTableColumn.getColumnName()));
|
||||
|
||||
databaseTableColumns.add(databaseTableColumn);
|
||||
}
|
||||
|
||||
databaseTable.setColumns(databaseTableColumns);
|
||||
return databaseTable;
|
||||
}
|
||||
|
||||
public List<DatabaseTable> getTables() throws Exception {
|
||||
return getTablesOrViews(DatabaseObjectTypeEnum.TABLE, DatabaseTable.class);
|
||||
}
|
||||
List<DatabaseTable> tableList = new ArrayList<>();
|
||||
|
||||
public List<DatabaseView> getViews() throws Exception {
|
||||
return getTablesOrViews(DatabaseObjectTypeEnum.VIEW, DatabaseView.class);
|
||||
}
|
||||
|
||||
private <T extends DatabaseTableView> List<T> getTablesOrViews(DatabaseObjectTypeEnum type, Class<T> classType) throws Exception {
|
||||
List<T> tableList = new ArrayList<>();
|
||||
|
||||
String sql = "SELECT TABLE_CATALOG,\n" +
|
||||
" COLUMNS.TABLE_SCHEMA,\n" +
|
||||
" COLUMNS.TABLE_NAME,\n" +
|
||||
" COLUMNS.COLUMN_NAME,\n" +
|
||||
" ISNULL(IS_PRIMARY_KEY, 0) AS IS_PRIMARY_KEY,\n" +
|
||||
" CAST(OBJECTPROPERTY(OBJECT_ID(COLUMNS.TABLE_NAME), 'TableHasIdentity') AS BIT) AS TABLE_HAS_IDENTITY,\n" +
|
||||
" ORDINAL_POSITION,\n" +
|
||||
" COLUMN_DEFAULT,\n" +
|
||||
" CAST(CASE WHEN IS_NULLABLE = 'YES' THEN 1 ELSE 0 END AS BIT) AS IS_NULLABLE,\n" +
|
||||
" DATA_TYPE,\n" +
|
||||
" CHARACTER_MAXIMUM_LENGTH,\n" +
|
||||
" CHARACTER_OCTET_LENGTH,\n" +
|
||||
" NUMERIC_PRECISION,\n" +
|
||||
" NUMERIC_PRECISION_RADIX,\n" +
|
||||
" NUMERIC_SCALE,\n" +
|
||||
" DATETIME_PRECISION,\n" +
|
||||
" CHARACTER_SET_CATALOG,\n" +
|
||||
" CHARACTER_SET_SCHEMA,\n" +
|
||||
" CHARACTER_SET_NAME,\n" +
|
||||
" COLLATION_CATALOG,\n" +
|
||||
" COLLATION_SCHEMA,\n" +
|
||||
" COLLATION_NAME,\n" +
|
||||
" DOMAIN_CATALOG,\n" +
|
||||
" DOMAIN_SCHEMA,\n" +
|
||||
" DOMAIN_NAME,\n" +
|
||||
" CAST(create_date AS DATE) AS CREATE_DATE\n" +
|
||||
"FROM INFORMATION_SCHEMA.COLUMNS\n" +
|
||||
" INNER JOIN sys.objects ON TABLE_NAME = name\n" +
|
||||
" LEFT OUTER JOIN (SELECT TABLE_NAME,\n" +
|
||||
" TABLE_SCHEMA,\n" +
|
||||
" COLUMN_NAME,\n" +
|
||||
" CAST(1 AS BIT) AS IS_PRIMARY_KEY\n" +
|
||||
" FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE\n" +
|
||||
" WHERE OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA + '.' + QUOTENAME(CONSTRAINT_NAME)),\n" +
|
||||
" 'IsPrimaryKey') = 1) pk\n" +
|
||||
" ON pk.TABLE_NAME = COLUMNS.TABLE_NAME AND\n" +
|
||||
" pk.COLUMN_NAME = COLUMNS.COLUMN_NAME AND\n" +
|
||||
" pk.TABLE_SCHEMA = COLUMNS.TABLE_SCHEMA\n" +
|
||||
" WHERE type = " + UtilityDB.valueToString(type.getText());
|
||||
String sql = "SELECT TABLE_CATALOG," +
|
||||
" TABLE_SCHEMA," +
|
||||
" TABLE_NAME," +
|
||||
" COLUMN_NAME," +
|
||||
" ORDINAL_POSITION," +
|
||||
" COLUMN_DEFAULT," +
|
||||
" CAST(CASE WHEN IS_NULLABLE = 'YES' THEN 1 ELSE 0 END AS BIT) AS IS_NULLABLE," +
|
||||
" DATA_TYPE," +
|
||||
" CHARACTER_MAXIMUM_LENGTH," +
|
||||
" CHARACTER_OCTET_LENGTH," +
|
||||
" NUMERIC_PRECISION," +
|
||||
" NUMERIC_PRECISION_RADIX," +
|
||||
" NUMERIC_SCALE," +
|
||||
" DATETIME_PRECISION," +
|
||||
" CHARACTER_SET_CATALOG," +
|
||||
" CHARACTER_SET_SCHEMA," +
|
||||
" CHARACTER_SET_NAME," +
|
||||
" COLLATION_CATALOG," +
|
||||
" COLLATION_SCHEMA," +
|
||||
" COLLATION_NAME," +
|
||||
" DOMAIN_CATALOG," +
|
||||
" DOMAIN_SCHEMA," +
|
||||
" DOMAIN_NAME" +
|
||||
" FROM INFORMATION_SCHEMA.COLUMNS" +
|
||||
" INNER JOIN sys.objects ON TABLE_NAME = name " +
|
||||
" WHERE type = " + UtilityDB.valueToString(DatabaseObjectTypeEnum.TABLE.getText());
|
||||
|
||||
List<HashMap<String, Object>> result = UtilityDB.executeSimpleQuery(this.mConnection, sql);
|
||||
final HashMap<String, HashMap<String, ArrayList<DatabaseForeignKey>>> foreignKeys = getForeignKeys();
|
||||
|
||||
|
||||
Stream.of(result)
|
||||
.groupBy(x -> UtilityHashMap.<String>getValueIfExists(x, "TABLE_NAME"))
|
||||
.forEach(x -> {
|
||||
T databaseTable = null;
|
||||
try {
|
||||
databaseTable = (T) classType.newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
databaseTable
|
||||
.setTableName(x.getKey())
|
||||
.setCreationDate(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(x.getValue().get(0), "CREATE_DATE")));
|
||||
|
||||
HashMap<String, ArrayList<DatabaseForeignKey>> foreignKeysResults = foreignKeys.getOrDefault(x.getKey(), new HashMap<>());
|
||||
DatabaseTable databaseTable = new DatabaseTable()
|
||||
.setTableName(x.getKey());
|
||||
|
||||
List<DatabaseTableColumn> databaseTableColumns = new ArrayList<>();
|
||||
for (HashMap<String, Object> column : x.getValue()) {
|
||||
@@ -253,7 +124,6 @@ public class SQLServerDBSchemaManager {
|
||||
.setOrdinalPosition(UtilityHashMap.getValueIfExists(column, "ORDINAL_POSITION"))
|
||||
.setColumnDefault(UtilityHashMap.getValueIfExists(column, "COLUMN_DEFAULT"))
|
||||
.setNullable(UtilityHashMap.getValueIfExists(column, "IS_NULLABLE"))
|
||||
.setPrimaryKey(UtilityHashMap.getValueIfExists(column, "IS_PRIMARY_KEY"))
|
||||
.setDataType(DatabaseTableColumnDataType.fromString(UtilityHashMap.getValueIfExists(column, "DATA_TYPE")))
|
||||
.setCharacterMaximumLength(UtilityHashMap.getValueIfExists(column, "CHARACTER_MAXIMUM_LENGTH"))
|
||||
.setCharacterOctetLength(UtilityHashMap.getValueIfExists(column, "CHARACTER_OCTET_LENGTH"))
|
||||
@@ -265,12 +135,6 @@ public class SQLServerDBSchemaManager {
|
||||
.setCharacterSetSchema(UtilityHashMap.getValueIfExists(column, "CHARACTER_SET_SCHEMA"))
|
||||
.setCharacterSetName(UtilityHashMap.getValueIfExists(column, "CHARACTER_SET_NAME"));
|
||||
|
||||
Boolean tableHasIdentity = UtilityHashMap.<Boolean>getValueIfExists(column, "TABLE_HAS_IDENTITY", false);
|
||||
databaseTableColumn.setIdentity(databaseTableColumn.isPrimaryKey() && tableHasIdentity != null && tableHasIdentity);
|
||||
|
||||
if (foreignKeysResults != null && foreignKeysResults.containsKey(databaseTableColumn.getColumnName()))
|
||||
databaseTableColumn.setForeignKeys(foreignKeysResults.get(databaseTableColumn.getColumnName()));
|
||||
|
||||
databaseTableColumns.add(databaseTableColumn);
|
||||
}
|
||||
|
||||
@@ -282,91 +146,7 @@ public class SQLServerDBSchemaManager {
|
||||
return tableList;
|
||||
}
|
||||
|
||||
|
||||
private HashMap<String, HashMap<String, ArrayList<DatabaseForeignKey>>> getForeignKeys() throws Exception {
|
||||
String sql = "SELECT DISTINCT\n" +
|
||||
" tab1.name AS [table],\n" +
|
||||
" col1.name AS [column],\n" +
|
||||
" tab2.name AS [referenced_table],\n" +
|
||||
" col2.name AS [referenced_column]\n" +
|
||||
" FROM sys.foreign_key_columns fkc\n" +
|
||||
" INNER JOIN sys.objects obj\n" +
|
||||
" ON obj.object_id = fkc.constraint_object_id\n" +
|
||||
" INNER JOIN sys.tables tab1\n" +
|
||||
" ON tab1.object_id = fkc.parent_object_id\n" +
|
||||
" INNER JOIN sys.schemas sch\n" +
|
||||
" ON tab1.schema_id = sch.schema_id\n" +
|
||||
" INNER JOIN sys.columns col1\n" +
|
||||
" ON col1.column_id = parent_column_id AND col1.object_id = tab1.object_id\n" +
|
||||
" INNER JOIN sys.tables tab2\n" +
|
||||
" ON tab2.object_id = fkc.referenced_object_id\n" +
|
||||
" INNER JOIN sys.columns col2\n" +
|
||||
" ON col2.column_id = referenced_column_id AND col2.object_id = tab2.object_id";
|
||||
|
||||
List<HashMap<String, Object>> resultList = UtilityDB.executeSimpleQuery(this.mConnection, sql);
|
||||
|
||||
HashMap<String, HashMap<String, ArrayList<DatabaseForeignKey>>> allTablesResult = new HashMap<>();
|
||||
|
||||
Stream.of(resultList)
|
||||
.groupBy(x -> UtilityHashMap.<String>getValueIfExists(x, "table"))
|
||||
.forEach(x -> {
|
||||
|
||||
HashMap<String, ArrayList<DatabaseForeignKey>> hashMap = new HashMap<>();
|
||||
for (HashMap<String, Object> resultRow : x.getValue()) {
|
||||
if (!hashMap.containsKey(UtilityHashMap.<String>getValueIfExists(resultRow, "column")))
|
||||
hashMap.put(UtilityHashMap.getValueIfExists(resultRow, "column"), new ArrayList<>());
|
||||
|
||||
hashMap.get(UtilityHashMap.<String>getValueIfExists(resultRow, "column"))
|
||||
.add(new DatabaseForeignKey()
|
||||
.setColumnName(UtilityHashMap.getValueIfExists(resultRow, "referenced_column"))
|
||||
.setTableName(UtilityHashMap.getValueIfExists(resultRow, "referenced_table")));
|
||||
|
||||
}
|
||||
allTablesResult.put(x.getKey(), hashMap);
|
||||
});
|
||||
return allTablesResult;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<DatabaseForeignKey>> getForeignKeys(String tableName) throws Exception {
|
||||
String sql = "SELECT DISTINCT\n" +
|
||||
" tab1.name AS [table],\n" +
|
||||
" col1.name AS [column],\n" +
|
||||
" tab2.name AS [referenced_table],\n" +
|
||||
" col2.name AS [referenced_column]\n" +
|
||||
" FROM sys.foreign_key_columns fkc\n" +
|
||||
" INNER JOIN sys.objects obj\n" +
|
||||
" ON obj.object_id = fkc.constraint_object_id\n" +
|
||||
" INNER JOIN sys.tables tab1\n" +
|
||||
" ON tab1.object_id = fkc.parent_object_id\n" +
|
||||
" INNER JOIN sys.schemas sch\n" +
|
||||
" ON tab1.schema_id = sch.schema_id\n" +
|
||||
" INNER JOIN sys.columns col1\n" +
|
||||
" ON col1.column_id = parent_column_id AND col1.object_id = tab1.object_id\n" +
|
||||
" INNER JOIN sys.tables tab2\n" +
|
||||
" ON tab2.object_id = fkc.referenced_object_id\n" +
|
||||
" INNER JOIN sys.columns col2\n" +
|
||||
" ON col2.column_id = referenced_column_id AND col2.object_id = tab2.object_id\n" +
|
||||
" WHERE tab1.name = " + UtilityDB.valueToString(tableName);
|
||||
|
||||
List<HashMap<String, Object>> resultList = UtilityDB.executeSimpleQuery(this.mConnection, sql);
|
||||
|
||||
HashMap<String, ArrayList<DatabaseForeignKey>> hashMap = new HashMap<>();
|
||||
|
||||
for (HashMap<String, Object> resultRow : resultList) {
|
||||
if (!hashMap.containsKey(UtilityHashMap.<String>getValueIfExists(resultRow, "column")))
|
||||
hashMap.put(UtilityHashMap.getValueIfExists(resultRow, "column"), new ArrayList<>());
|
||||
|
||||
hashMap.get(UtilityHashMap.<String>getValueIfExists(resultRow, "column"))
|
||||
.add(new DatabaseForeignKey()
|
||||
.setColumnName(UtilityHashMap.getValueIfExists(resultRow, "referenced_column"))
|
||||
.setTableName(UtilityHashMap.getValueIfExists(resultRow, "referenced_table")));
|
||||
|
||||
}
|
||||
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
public String createTableSyntax(DatabaseTableView databaseTable) throws Exception {
|
||||
public String createTableSyntax(DatabaseTable databaseTable) throws Exception {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("CREATE TABLE [" + databaseTable.getTableName() + "] (");
|
||||
|
||||
@@ -381,29 +161,14 @@ public class SQLServerDBSchemaManager {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void createTable(DatabaseTableView databaseTable) throws Exception {
|
||||
public void createTable(DatabaseTable databaseTable) throws Exception {
|
||||
String sql = createTableSyntax(databaseTable);
|
||||
|
||||
execTableAlterSQL(sql);
|
||||
this.mConnection.commit();
|
||||
}
|
||||
|
||||
|
||||
public void dropTable(DatabaseTable databaseTable) throws Exception {
|
||||
String dropSql = "DROP TABLE " + databaseTable.getTableName();
|
||||
execTableAlterSQL(dropSql);
|
||||
this.mConnection.commit();
|
||||
}
|
||||
|
||||
|
||||
public void dropView(DatabaseView databaseTable) throws Exception {
|
||||
String dropSql = "DROP VIEW " + databaseTable.getTableName();
|
||||
execTableAlterSQL(dropSql);
|
||||
this.mConnection.commit();
|
||||
}
|
||||
|
||||
|
||||
public String addTableColumnsSyntax(DatabaseTableView deltaTable) {
|
||||
public String addTableColumnsSyntax(DatabaseTable deltaTable) throws Exception {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("ALTER TABLE [" + deltaTable.getTableName() + "] ADD ");
|
||||
@@ -419,7 +184,7 @@ public class SQLServerDBSchemaManager {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void addTableColumns(DatabaseTableView deltaTable) throws Exception {
|
||||
public void addTableColumns(DatabaseTable deltaTable) throws Exception {
|
||||
|
||||
String sql = addTableColumnsSyntax(deltaTable);
|
||||
execTableAlterSQL(sql);
|
||||
@@ -427,74 +192,6 @@ public class SQLServerDBSchemaManager {
|
||||
}
|
||||
|
||||
|
||||
private String dropTableColumnsSyntax(DatabaseTableView deltaTable) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("ALTER TABLE [" + deltaTable.getTableName() + "] DROP COLUMN ");
|
||||
|
||||
List<DatabaseTableColumn> sourceColumns = deltaTable.getColumns();
|
||||
List<String> columnsTempSql = new ArrayList<>();
|
||||
for (DatabaseTableColumn sourceColumn : sourceColumns) {
|
||||
columnsTempSql.add(sourceColumn.getColumnName());
|
||||
}
|
||||
|
||||
sb.append(StringUtils.join(columnsTempSql, ", "));
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void dropTableColumns(DatabaseTableView deltaTable) throws Exception {
|
||||
|
||||
String sql = dropTableColumnsSyntax(deltaTable);
|
||||
execTableAlterSQL(sql);
|
||||
this.mConnection.commit();
|
||||
}
|
||||
|
||||
|
||||
private List<String> updateTableColumnsSyntax(DatabaseTableView deltaTable) {
|
||||
List<String> alterSqls = new ArrayList<>();
|
||||
|
||||
List<DatabaseTableColumn> sourceColumns = deltaTable.getColumns();
|
||||
|
||||
for (DatabaseTableColumn sourceColumn : sourceColumns) {
|
||||
alterSqls.add("ALTER TABLE [" + deltaTable.getTableName() + "] ALTER COLUMN " + generateAddColumnSyntax(sourceColumn));
|
||||
}
|
||||
|
||||
|
||||
return alterSqls;
|
||||
}
|
||||
|
||||
public void updateTableColumns(DatabaseTableView deltaTable) throws Exception {
|
||||
|
||||
List<String> sqls = updateTableColumnsSyntax(deltaTable);
|
||||
for (String sql : sqls)
|
||||
execTableAlterSQL(sql);
|
||||
|
||||
this.mConnection.commit();
|
||||
}
|
||||
|
||||
|
||||
public List<String> generateAlterTableToDisableAnsiPadding() throws SQLException {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstColumn(this.mConnection, "SELECT 'ALTER TABLE ' + OBJECT_SCHEMA_NAME(sys.objects.object_id) + '.' + \n" +
|
||||
" sys.objects.name + ' ALTER COLUMN [' + sys.columns.name + '] ' + \n" +
|
||||
" sys.types.name + CASE WHEN sys.types.name IN ('text','ntext') THEN ''\n" +
|
||||
" WHEN sys.types.name IN ('char','varchar') \n" +
|
||||
" THEN '('+IIF(sys.columns.max_length = -1, 'MAX', CAST(sys.columns.max_length AS varchar(10)))+')'\n" +
|
||||
" WHEN sys.types.name IN ('nchar','nvarchar') \n" +
|
||||
" THEN '('+CAST(sys.columns.max_length/2 AS varchar(10))+')' END +\n" +
|
||||
" ' ' + CASE WHEN sys.columns.is_nullable = 0 \n" +
|
||||
" THEN 'NOT NULL' ELSE 'NULL' END\n" +
|
||||
"FROM sys.columns\n" +
|
||||
"JOIN sys.types\n" +
|
||||
" ON sys.columns.user_type_id = sys.types.user_type_id\n" +
|
||||
"JOIN sys.objects\n" +
|
||||
" ON sys.columns.object_id = sys.objects.object_id\n" +
|
||||
"WHERE is_ansi_padded = 0\n" +
|
||||
" AND sys.types.name in ('char','varchar')\n" +
|
||||
" AND sys.objects.type = 'U'");
|
||||
}
|
||||
|
||||
|
||||
private String generateAddColumnSyntax(DatabaseTableColumn tableColumn) {
|
||||
String columnSize = null;
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package it.integry.ems.entity_logger.db_schema_manager.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
public class DatabaseForeignKey {
|
||||
@SqlField("referenced_table")
|
||||
private String tableName;
|
||||
|
||||
@SqlField("referenced_column")
|
||||
private String columnName;
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public DatabaseForeignKey setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getColumnName() {
|
||||
return columnName;
|
||||
}
|
||||
|
||||
public DatabaseForeignKey setColumnName(String columnName) {
|
||||
this.columnName = columnName;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,37 @@
|
||||
package it.integry.ems.entity_logger.db_schema_manager.dto;
|
||||
|
||||
public class DatabaseTable extends DatabaseTableView {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
private final DatabaseObjectTypeEnum type = DatabaseObjectTypeEnum.TABLE;
|
||||
public class DatabaseTable implements Cloneable {
|
||||
|
||||
public DatabaseObjectTypeEnum getType() {
|
||||
return type;
|
||||
private String tableName;
|
||||
private List<DatabaseTableColumn> columns = new ArrayList<>();
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public DatabaseTable setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<DatabaseTableColumn> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
public DatabaseTable setColumns(List<DatabaseTableColumn> columns) {
|
||||
this.columns = columns;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseTable clone() {
|
||||
try {
|
||||
return (DatabaseTable) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package it.integry.ems.entity_logger.db_schema_manager.dto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DatabaseTableColumn {
|
||||
|
||||
private String columnName;
|
||||
private Integer ordinalPosition;
|
||||
private String columnDefault;
|
||||
private boolean nullable;
|
||||
private boolean primaryKey;
|
||||
private boolean identity;
|
||||
private DatabaseTableColumnDataType dataType;
|
||||
private Integer characterMaximumLength;
|
||||
private Integer characterOctetLength;
|
||||
@@ -21,8 +17,6 @@ public class DatabaseTableColumn {
|
||||
private String characterSetSchema;
|
||||
private String characterSetName;
|
||||
|
||||
private ArrayList<DatabaseForeignKey> foreignKeys;
|
||||
|
||||
public String getColumnName() {
|
||||
return columnName;
|
||||
}
|
||||
@@ -148,31 +142,4 @@ public class DatabaseTableColumn {
|
||||
this.characterSetName = characterSetName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ArrayList<DatabaseForeignKey> getForeignKeys() {
|
||||
return foreignKeys;
|
||||
}
|
||||
|
||||
public DatabaseTableColumn setForeignKeys(ArrayList<DatabaseForeignKey> foreignKeys) {
|
||||
this.foreignKeys = foreignKeys;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isPrimaryKey() {
|
||||
return primaryKey;
|
||||
}
|
||||
|
||||
public DatabaseTableColumn setPrimaryKey(boolean primaryKey) {
|
||||
this.primaryKey = primaryKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isIdentity() {
|
||||
return identity;
|
||||
}
|
||||
|
||||
public DatabaseTableColumn setIdentity(boolean identity) {
|
||||
this.identity = identity;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package it.integry.ems.entity_logger.db_schema_manager.dto;
|
||||
|
||||
import java.sql.Types;
|
||||
|
||||
public enum DatabaseTableColumnDataType {
|
||||
|
||||
BIGINT("bigint"),
|
||||
@@ -40,7 +38,7 @@ public enum DatabaseTableColumnDataType {
|
||||
GEOGRAPHY("geography");
|
||||
|
||||
|
||||
private final String text;
|
||||
private String text;
|
||||
|
||||
private DatabaseTableColumnDataType(String text) {
|
||||
this.text = text;
|
||||
@@ -57,52 +55,4 @@ public enum DatabaseTableColumnDataType {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public int toSqlDataType() throws Exception {
|
||||
switch (this) {
|
||||
case BIGINT:
|
||||
return Types.BIGINT;
|
||||
case BIT:
|
||||
return Types.BIT;
|
||||
case DECIMAL:
|
||||
return Types.DECIMAL;
|
||||
case INT:
|
||||
return Types.INTEGER;
|
||||
case NUMERIC:
|
||||
return Types.NUMERIC;
|
||||
case SMALLINT:
|
||||
return Types.SMALLINT;
|
||||
case TINYINT:
|
||||
return Types.TINYINT;
|
||||
case FLOAT:
|
||||
return Types.FLOAT;
|
||||
case REAL:
|
||||
return Types.REAL;
|
||||
case DATE:
|
||||
case DATETIME:
|
||||
case DATETIME2:
|
||||
case SMALLDATETIME:
|
||||
return Types.DATE;
|
||||
case TIME:
|
||||
return Types.TIME;
|
||||
case TIMESTAMP:
|
||||
return Types.TIMESTAMP;
|
||||
case CHAR:
|
||||
return Types.CHAR;
|
||||
case NCHAR:
|
||||
return Types.NCHAR;
|
||||
case VARCHAR:
|
||||
case TEXT:
|
||||
return Types.VARCHAR;
|
||||
case NVARCHAR:
|
||||
case NTEXT:
|
||||
return Types.NVARCHAR;
|
||||
case BINARY:
|
||||
return Types.BINARY;
|
||||
case VARBINARY:
|
||||
return Types.VARBINARY;
|
||||
}
|
||||
|
||||
throw new Exception("Type not recognized");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package it.integry.ems.entity_logger.db_schema_manager.dto;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DatabaseTableView implements Cloneable {
|
||||
|
||||
private String tableName;
|
||||
private LocalDate creationDate;
|
||||
private List<DatabaseTableColumn> columns = new ArrayList<>();
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public DatabaseTableView setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getCreationDate() {
|
||||
return creationDate;
|
||||
}
|
||||
|
||||
public DatabaseTableView setCreationDate(LocalDate creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<DatabaseTableColumn> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
public DatabaseTableView setColumns(List<DatabaseTableColumn> columns) {
|
||||
this.columns = columns;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseTableView clone() {
|
||||
try {
|
||||
return (DatabaseTableView) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package it.integry.ems.entity_logger.db_schema_manager.dto;
|
||||
|
||||
public class DatabaseView extends DatabaseTableView {
|
||||
|
||||
private final DatabaseObjectTypeEnum type = DatabaseObjectTypeEnum.VIEW;
|
||||
|
||||
public DatabaseObjectTypeEnum getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,12 @@ package it.integry.ems.entity_logger.service;
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.ems.dynamic_cache.DynamicCacheService;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.component.SQLServerDBSchemaManager;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.*;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseFile;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTable;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableColumn;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableColumnDataType;
|
||||
import it.integry.ems.looper.service.LooperService;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
@@ -126,16 +130,16 @@ public class EntityLoggerComponent {
|
||||
|
||||
for (DatabaseTable sourceTable : sourceTables) {
|
||||
|
||||
java.util.Optional<DatabaseTable> optDestTable = destTables.stream()
|
||||
Optional<DatabaseTable> optDestTable = Stream.of(destTables)
|
||||
.filter(x -> x.getTableName().equalsIgnoreCase(sourceTable.getTableName()))
|
||||
.findFirst();
|
||||
DatabaseTableView destTable;
|
||||
DatabaseTable destTable;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (!optDestTable.isPresent()) {
|
||||
if (optDestTable.isEmpty()) {
|
||||
|
||||
sourceTable.getColumns()
|
||||
Stream.of(sourceTable.getColumns())
|
||||
.forEach(x -> x.setNullable(true));
|
||||
|
||||
int maxOrdinalPosition = Stream.of(sourceTable.getColumns())
|
||||
@@ -178,7 +182,7 @@ public class EntityLoggerComponent {
|
||||
} else {
|
||||
destTable = optDestTable.get();
|
||||
|
||||
DatabaseTable cloneDatabaseTableADD = (DatabaseTable) destTable.clone();
|
||||
DatabaseTable cloneDatabaseTableADD = destTable.clone();
|
||||
cloneDatabaseTableADD.setColumns(new ArrayList<>());
|
||||
|
||||
List<DatabaseTableColumn> sourceColumns = sourceTable.getColumns();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.integry.ems.exception;
|
||||
|
||||
public class MissingDataException extends Exception {
|
||||
public MissingDataException(String error) {
|
||||
super("Dati mancanti: " + error);
|
||||
public MissingDataException(String method) {
|
||||
super("Dati mancanti in " + method);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package it.integry.ems.expansion;
|
||||
|
||||
public interface RunnableArgsThrowable<T> {
|
||||
|
||||
T run() throws Exception;
|
||||
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
package it.integry.ems.expansion;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public interface RunnableArgsWithReturn<T, R> {
|
||||
|
||||
R run(T data) throws SQLException;
|
||||
R run(T data);
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user