Compare commits
2 Commits
20240410_1
...
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
|
||||
|
||||
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
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>
|
||||
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>
|
||||
8
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
8
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<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,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" />
|
||||
|
||||
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -7,6 +7,7 @@
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<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>
|
||||
12
.idea/runConfigurations/Tomcat_9__1__ServerDev_.xml
generated
12
.idea/runConfigurations/Tomcat_9__1__ServerDev_.xml
generated
@@ -1,12 +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" />
|
||||
<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>
|
||||
12
.idea/runConfigurations/Tomcat__1__ServerTomcat_.xml
generated
12
.idea/runConfigurations/Tomcat__1__ServerTomcat_.xml
generated
@@ -1,12 +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" />
|
||||
<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 -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="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>
|
||||
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
@@ -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>
|
||||
@@ -389,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>
|
||||
|
||||
|
||||
@@ -701,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>
|
||||
@@ -714,11 +730,5 @@
|
||||
<version>0.27.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.javaparser</groupId>
|
||||
<artifactId>javaparser-symbol-solver-core</artifactId>
|
||||
<version>3.25.9</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -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>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -108,7 +108,6 @@ public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent
|
||||
dispatchPostWebServerConstruct(multiDBTransactionManager);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("EmsCoreContext.onPostDBLoaded", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,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,
|
||||
@@ -1147,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();
|
||||
@@ -1166,7 +1167,9 @@ 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<EntityHierarchyDTO> mapping = emsServices.getEntityMapping();
|
||||
return ServiceRestResponse.createPositiveResponse(mapping);
|
||||
@@ -1178,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);
|
||||
@@ -1190,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,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,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,240 +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.DatabaseTable;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableColumn;
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
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.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.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
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 DatabaseTable 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 DatabaseTable databaseTable, final List<CreateEntityItemRequestDTO> childEntities) throws Exception {
|
||||
CompilationUnit javaClassCompilation = new CompilationUnit();
|
||||
// addImportInstructions(javaClassCompilation);
|
||||
|
||||
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.addField(String.class, "ENTITY", PUBLIC, FINAL, STATIC);
|
||||
ClassOrInterfaceType entityFieldType = entityField.getElementType().asClassOrInterfaceType();
|
||||
entityFieldType.setName("String");
|
||||
|
||||
entityField.setVariable(0, new VariableDeclarator(entityFieldType, "ENTITY",
|
||||
new StringLiteralExpr(databaseTable.getTableName())));
|
||||
|
||||
|
||||
final FieldDeclaration serialVersionUIDField = javaClass.addField(Long.class, "serialVersionUID", PRIVATE, FINAL, STATIC);
|
||||
ClassOrInterfaceType serialVersionUIDFieldType = serialVersionUIDField.getElementType().asClassOrInterfaceType();
|
||||
serialVersionUIDFieldType.setName("long");
|
||||
|
||||
serialVersionUIDField.setVariable(0, new VariableDeclarator(serialVersionUIDFieldType, "serialVersionUID",
|
||||
new LongLiteralExpr("1L")));
|
||||
|
||||
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);
|
||||
|
||||
final FieldDeclaration fieldDeclaration = javaClass.addField(
|
||||
"List<" + entityChildClassName + ">",
|
||||
entityChildClassName.substring(0, 1).toLowerCase() + entityChildClassName.substring(1),
|
||||
PRIVATE);
|
||||
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 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()));
|
||||
|
||||
// if (databaseColumn.getColumnDefault() != null)
|
||||
// sqlFieldValues.add(new MemberValuePair("defaultObjectValue", new StringLiteralExpr(databaseColumn.getColumnDefault())));
|
||||
|
||||
|
||||
|
||||
//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;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.orm.jpa.vendor.Database;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
@@ -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);
|
||||
@@ -83,133 +78,37 @@ public class SQLServerDBSchemaManager {
|
||||
}
|
||||
|
||||
|
||||
public DatabaseTable getTable(String tableName) 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(DatabaseObjectTypeEnum.TABLE.getText()) +
|
||||
" AND COLUMNS.TABLE_NAME = " + UtilityDB.valueToString(tableName);
|
||||
|
||||
List<HashMap<String, Object>> result = UtilityDB.executeSimpleQuery(this.mConnection, sql);
|
||||
|
||||
if (result.isEmpty())
|
||||
return null;
|
||||
|
||||
HashMap<String, ArrayList<DatabaseForeignKey>> foreignKeysResults = getForeignKeys(tableName);
|
||||
|
||||
DatabaseTable databaseTable = new DatabaseTable()
|
||||
.setTableName(tableName);
|
||||
|
||||
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 {
|
||||
List<DatabaseTable> 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" +
|
||||
"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" +
|
||||
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"))
|
||||
@@ -217,8 +116,6 @@ public class SQLServerDBSchemaManager {
|
||||
DatabaseTable databaseTable = new DatabaseTable()
|
||||
.setTableName(x.getKey());
|
||||
|
||||
HashMap<String, ArrayList<DatabaseForeignKey>> foreignKeysResults = foreignKeys.getOrDefault(x.getKey(), new HashMap<>());
|
||||
|
||||
List<DatabaseTableColumn> databaseTableColumns = new ArrayList<>();
|
||||
for (HashMap<String, Object> column : x.getValue()) {
|
||||
|
||||
@@ -227,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"))
|
||||
@@ -239,11 +135,6 @@ public class SQLServerDBSchemaManager {
|
||||
.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 != null && foreignKeysResults.containsKey(databaseTableColumn.getColumnName()))
|
||||
databaseTableColumn.setForeignKeys(foreignKeysResults.get(databaseTableColumn.getColumnName()));
|
||||
|
||||
databaseTableColumns.add(databaseTableColumn);
|
||||
}
|
||||
|
||||
@@ -255,90 +146,6 @@ 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(DatabaseTable databaseTable) throws Exception {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("CREATE TABLE [" + databaseTable.getTableName() + "] (");
|
||||
|
||||
@@ -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,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,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);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ public enum EntityExportType {
|
||||
ORDINI("ORDINI"),
|
||||
ORDINI_ACQUISTO("ORDINI ACQUISTO"),
|
||||
ORDINI_VENDITA("ORDINI VENDITA"),
|
||||
RISORSE_UMANE("RISORSE UMANE"),
|
||||
MOVIMENTI_CONTABILI("MOVIMENTI CONTABILI"),
|
||||
OFFERTE("OFFERTE"),
|
||||
RAPPORTINI("RAPPORTINI"),
|
||||
|
||||
@@ -6,15 +6,12 @@ import it.integry.ems.menu.dto.MenuConfigDTO;
|
||||
import it.integry.ems.menu.dto.StbMenuDTO;
|
||||
import it.integry.ems.menu.dto.StbMenuOpzDTO;
|
||||
import it.integry.ems.menu.dto.StbTipoAziendaDTO;
|
||||
import it.integry.ems.utility.UtilityDirs;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.util.List;
|
||||
@@ -34,11 +31,9 @@ public class MenuStaticCreator {
|
||||
connection.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
|
||||
connection.setAutoCommit(false);
|
||||
|
||||
createMenu(connection, UtilityDirs.getDevelopmentMenusFolder());
|
||||
}
|
||||
final String baseProjectPath = new File("").getAbsolutePath() + "\\ems-core\\src\\main\\";
|
||||
final String menuJsonResourceFolder = baseProjectPath + "resources\\menus\\";
|
||||
|
||||
|
||||
public static void createMenu(Connection connection, String menuJsonResourceFolder) throws Exception {
|
||||
ObjectMapper jsonObjectMapper = new ObjectMapper();
|
||||
|
||||
final List<StbMenuOpzDTO> stbMenuOpzs = UtilityDB.executeSimpleQueryDTO(connection, "SELECT * FROM stb_menu_opz", StbMenuOpzDTO.class);
|
||||
@@ -48,7 +43,8 @@ public class MenuStaticCreator {
|
||||
final List<StbMenuDTO> stbMenus = UtilityDB.executeSimpleQueryDTO(connection, "SELECT * FROM stb_menu", StbMenuDTO.class);
|
||||
final Map<String, List<StbMenuDTO>> menusByAzienda = stbMenus.stream().collect(Collectors.groupingBy(StbMenuDTO::getTipoAzienda));
|
||||
|
||||
MenuConfigDTO menuConfigDTO = new MenuConfigDTO(Integer.parseInt(CommonConstants.DATESTAMP_YMD_FORMATTER.format(UtilityLocalDate.getNow())))
|
||||
|
||||
MenuConfigDTO menuConfigDTO = new MenuConfigDTO(Integer.parseInt(CommonConstants.DATESTAMP_FORMATTER.format(UtilityLocalDate.getNow())))
|
||||
.setStbMenuOpz(stbMenuOpzs)
|
||||
.setStbTipoAzienda(stbTipoAziendas)
|
||||
.setMenusByAzienda(menusByAzienda);
|
||||
@@ -59,15 +55,15 @@ public class MenuStaticCreator {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void writeContentToFile(String filePath, String content, boolean overwrite) throws IOException {
|
||||
File f = new File(filePath);
|
||||
if (overwrite && f.exists()) f.delete();
|
||||
|
||||
FileOutputStream outputStream = new FileOutputStream(filePath);
|
||||
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8);
|
||||
outputStreamWriter.write(content);
|
||||
byte[] strToBytes = content.getBytes();
|
||||
outputStream.write(strToBytes);
|
||||
|
||||
outputStreamWriter.close();
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.menu.service.MenuConfigurationService;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -31,17 +30,4 @@ public class MenuConfigurationController {
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "generate", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse generate() 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!");
|
||||
|
||||
menuConfigurationService.generate();
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,8 +23,36 @@ public class StbMenuDTO {
|
||||
@SqlField(value = "descrizione_estesa", maxLength = 8000, nullable = true)
|
||||
private String descrizioneEstesa;
|
||||
|
||||
@SqlField(value = "entity_name", maxLength = 40, nullable = true)
|
||||
private String entityName;
|
||||
|
||||
@SqlField(value = "flag_attivo", maxLength = 1, nullable = true, defaultObjectValue = "S")
|
||||
private String flagAttivo;
|
||||
|
||||
@SqlField(value = "flag_printer_setup", maxLength = 1, nullable = true, defaultObjectValue = "N")
|
||||
private String flagPrinterSetup;
|
||||
|
||||
@SqlField(value = "gest_name", maxLength = 40, nullable = true)
|
||||
private String gestName;
|
||||
|
||||
@SqlField(value = "note", maxLength = 255, nullable = true)
|
||||
private String note;
|
||||
|
||||
@SqlField(value = "object_type", maxLength = 5, nullable = true)
|
||||
private String objectType;
|
||||
|
||||
@SqlField(value = "open_type", maxLength = 1, nullable = true)
|
||||
private String openType;
|
||||
|
||||
@SqlField(value = "parameter", maxLength = 255, nullable = true)
|
||||
private String parameter;
|
||||
|
||||
@SqlField(value = "picture_menu", maxLength = 1024, nullable = true)
|
||||
private String pictureMenu;
|
||||
|
||||
@SqlField(value = "picture_select", maxLength = 1024, nullable = true)
|
||||
private String pictureSelect;
|
||||
|
||||
@SqlField(value = "pos", nullable = true)
|
||||
private Integer pos;
|
||||
|
||||
@@ -34,6 +62,9 @@ public class StbMenuDTO {
|
||||
@SqlField(value = "pos_tipo_azienda", nullable = true)
|
||||
private Integer posTipoAzienda;
|
||||
|
||||
@SqlField(value = "type", maxLength = -1, nullable = true, defaultObjectValue = "F")
|
||||
private String menuType;
|
||||
|
||||
@SqlField(value = "url_descrizione", maxLength = 1024, nullable = true)
|
||||
private String urlDescrizione;
|
||||
|
||||
@@ -91,6 +122,15 @@ public class StbMenuDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEntityName() {
|
||||
return entityName;
|
||||
}
|
||||
|
||||
public StbMenuDTO setEntityName(String entityName) {
|
||||
this.entityName = entityName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagAttivo() {
|
||||
return flagAttivo;
|
||||
}
|
||||
@@ -100,6 +140,78 @@ public class StbMenuDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagPrinterSetup() {
|
||||
return flagPrinterSetup;
|
||||
}
|
||||
|
||||
public StbMenuDTO setFlagPrinterSetup(String flagPrinterSetup) {
|
||||
this.flagPrinterSetup = flagPrinterSetup;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestName() {
|
||||
return gestName;
|
||||
}
|
||||
|
||||
public StbMenuDTO setGestName(String gestName) {
|
||||
this.gestName = gestName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public StbMenuDTO setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public StbMenuDTO setObjectType(String objectType) {
|
||||
this.objectType = objectType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOpenType() {
|
||||
return openType;
|
||||
}
|
||||
|
||||
public StbMenuDTO setOpenType(String openType) {
|
||||
this.openType = openType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getParameter() {
|
||||
return parameter;
|
||||
}
|
||||
|
||||
public StbMenuDTO setParameter(String parameter) {
|
||||
this.parameter = parameter;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPictureMenu() {
|
||||
return pictureMenu;
|
||||
}
|
||||
|
||||
public StbMenuDTO setPictureMenu(String pictureMenu) {
|
||||
this.pictureMenu = pictureMenu;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPictureSelect() {
|
||||
return pictureSelect;
|
||||
}
|
||||
|
||||
public StbMenuDTO setPictureSelect(String pictureSelect) {
|
||||
this.pictureSelect = pictureSelect;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPos() {
|
||||
return pos;
|
||||
}
|
||||
@@ -127,6 +239,15 @@ public class StbMenuDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMenuType() {
|
||||
return menuType;
|
||||
}
|
||||
|
||||
public StbMenuDTO setMenuType(String menuType) {
|
||||
this.menuType = menuType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUrlDescrizione() {
|
||||
return urlDescrizione;
|
||||
}
|
||||
@@ -143,10 +264,20 @@ public class StbMenuDTO {
|
||||
.setTipoAzienda(getTipoAzienda())
|
||||
.setDescrizione(getDescrizione())
|
||||
.setDescrizioneEstesa(getDescrizioneEstesa())
|
||||
.setEntityName(getEntityName())
|
||||
.setFlagAttivo(getFlagAttivo())
|
||||
.setFlagPrinterSetup(getFlagPrinterSetup())
|
||||
.setGestName(getGestName())
|
||||
.setNote(getNote())
|
||||
.setObjectType(getObjectType())
|
||||
.setOpenType(getOpenType())
|
||||
.setParameter(getParameter())
|
||||
.setPictureMenu(getPictureMenu())
|
||||
.setPictureSelect(getPictureSelect())
|
||||
.setPos(getPos())
|
||||
.setPosCliente(getPosCliente())
|
||||
.setPosTipoAzienda(getPosTipoAzienda())
|
||||
.setMenuType(getMenuType())
|
||||
.setUrlDescrizione(getUrlDescrizione());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package it.integry.ems.menu.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement;
|
||||
import it.integry.annotations.PostContextAutowired;
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.ems.menu.MenuStaticCreator;
|
||||
import it.integry.ems.menu.dto.MenuConfigDTO;
|
||||
import it.integry.ems.menu.dto.StbMenuDTO;
|
||||
import it.integry.ems.menu.dto.StbMenuOpzDTO;
|
||||
@@ -13,11 +11,12 @@ 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 it.integry.ems.utility.UtilityDirs;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity.Azienda;
|
||||
import it.integry.ems_model.entity.StbMenu;
|
||||
import it.integry.ems_model.entity.StbMenuOpz;
|
||||
import it.integry.ems_model.entity.StbTipoAzienda;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
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;
|
||||
@@ -26,8 +25,6 @@ import org.springframework.stereotype.Service;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.sql.Connection;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
import static it.integry.ems_model.utility.UtilityDB.executeStatement;
|
||||
@@ -46,7 +43,7 @@ public class MenuConfigurationService {
|
||||
|
||||
@PostContextConstruct(priority = 5)
|
||||
public void init() throws Exception {
|
||||
//if(UtilityDebug.isDebugExecution()) return;
|
||||
if(UtilityDebug.isDebugExecution()) return;
|
||||
|
||||
logger.debug(MenuConfigurationService.class.getSimpleName() + ": Refresh menu");
|
||||
|
||||
@@ -66,8 +63,6 @@ public class MenuConfigurationService {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug(MenuConfigurationService.class.getSimpleName() + ": Fine refresh menu");
|
||||
}
|
||||
|
||||
private boolean isHistoryDB(AdvancedDataSource advancedDataSource) throws Exception {
|
||||
@@ -103,30 +98,10 @@ public class MenuConfigurationService {
|
||||
"DELETE FROM stb_tipo_azienda",
|
||||
"DELETE FROM stb_menu_opz");
|
||||
|
||||
String insertStbMenuOpzSQL = "INSERT INTO " + StbMenuOpz.ENTITY + " (cod_opz, " +
|
||||
"descrizione, gest_name, entity_name, picture_menu, picture_select, object_type, flag_printer_setup, parameter, note, open_type, is_deprecated)" +
|
||||
" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
try (SQLServerPreparedStatement insertBulkPs = (SQLServerPreparedStatement) connection.prepareStatement(insertStbMenuOpzSQL)) {
|
||||
for (StbMenuOpzDTO stbMenuOpzDto : menuConfig.getStbMenuOpz()) {
|
||||
|
||||
insertBulkPs.setString(1, stbMenuOpzDto.getCodOpz());
|
||||
insertBulkPs.setString(2, stbMenuOpzDto.getDescrizione());
|
||||
insertBulkPs.setString(3, stbMenuOpzDto.getGestName());
|
||||
insertBulkPs.setString(4, stbMenuOpzDto.getEntityName());
|
||||
insertBulkPs.setString(5, stbMenuOpzDto.getPictureMenu());
|
||||
insertBulkPs.setString(6, stbMenuOpzDto.getPictureSelect());
|
||||
insertBulkPs.setString(7, stbMenuOpzDto.getObjectType());
|
||||
insertBulkPs.setString(8, stbMenuOpzDto.getFlagPrinterSetup());
|
||||
insertBulkPs.setString(9, stbMenuOpzDto.getParameter());
|
||||
insertBulkPs.setString(10, stbMenuOpzDto.getNote());
|
||||
insertBulkPs.setString(11, stbMenuOpzDto.getOpenType());
|
||||
insertBulkPs.setString(12, stbMenuOpzDto.getIsDeprecated());
|
||||
|
||||
insertBulkPs.addBatch();
|
||||
}
|
||||
|
||||
insertBulkPs.executeLargeBatch();
|
||||
for (StbMenuOpzDTO stbMenuOpzDto : menuConfig.getStbMenuOpz()) {
|
||||
StbMenuOpz stbMenuOpz = stbMenuOpzDto.toEntity();
|
||||
stbMenuOpz.setOperation(OperationType.INSERT);
|
||||
stbMenuOpz.manageWithParentConnection(connection);
|
||||
}
|
||||
|
||||
for (StbTipoAziendaDTO stbTipoAziendaDto : menuConfig.getStbTipoAzienda()) {
|
||||
@@ -139,39 +114,12 @@ public class MenuConfigurationService {
|
||||
|
||||
if (stbMenus == null)
|
||||
logger.error("Nessuna configurazione trovata per il menu " + azienda.getTipoAzienda() + " di " + azienda.getNomeDitta());
|
||||
else {
|
||||
String insertStbMenuSql = "INSERT INTO " + StbMenu.ENTITY + " (cod_opz, descrizione, cod_parent, pos, tipo_azienda, flag_attivo, url_descrizione, " +
|
||||
"pos_tipo_azienda, pos_cliente, descrizione_estesa) " +
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
try (SQLServerPreparedStatement insertBulkPs = (SQLServerPreparedStatement) connection.prepareStatement(insertStbMenuSql)) {
|
||||
for (StbMenuDTO stbMenuDto : stbMenus) {
|
||||
|
||||
insertBulkPs.setString(1, stbMenuDto.getCodOpz());
|
||||
insertBulkPs.setString(2, stbMenuDto.getDescrizione());
|
||||
insertBulkPs.setString(3, stbMenuDto.getCodParent());
|
||||
|
||||
if(stbMenuDto.getPos() != null) insertBulkPs.setInt(4, stbMenuDto.getPos());
|
||||
else insertBulkPs.setObject(4, null);
|
||||
|
||||
insertBulkPs.setString(5, stbMenuDto.getTipoAzienda());
|
||||
insertBulkPs.setString(6, stbMenuDto.getFlagAttivo());
|
||||
insertBulkPs.setString(7, stbMenuDto.getUrlDescrizione());
|
||||
|
||||
if(stbMenuDto.getPosTipoAzienda() != null) insertBulkPs.setInt(8, stbMenuDto.getPosTipoAzienda());
|
||||
else insertBulkPs.setObject(8, null);
|
||||
|
||||
if(stbMenuDto.getPosCliente() != null) insertBulkPs.setInt(9, stbMenuDto.getPosCliente());
|
||||
else insertBulkPs.setObject(9, null);
|
||||
|
||||
insertBulkPs.setString(10, stbMenuDto.getDescrizioneEstesa());
|
||||
|
||||
insertBulkPs.addBatch();
|
||||
}
|
||||
|
||||
insertBulkPs.executeLargeBatch();
|
||||
else
|
||||
for (StbMenuDTO stbMenuDto : stbMenus) {
|
||||
StbMenu stbMenu = stbMenuDto.toEntity();
|
||||
stbMenu.setOperation(OperationType.INSERT);
|
||||
stbMenu.manageWithParentConnection(connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
executeStatement(connection, "ALTER TABLE azienda ADD CONSTRAINT FK_azienda_stb_tipo_azienda FOREIGN KEY (tipo_azienda) REFERENCES stb_tipo_azienda ( tipo_azienda )",
|
||||
@@ -194,10 +142,4 @@ public class MenuConfigurationService {
|
||||
|
||||
connection.commit();
|
||||
}
|
||||
|
||||
public void generate() throws Exception {
|
||||
try (MultiDBTransactionManager studioMlMultiDb = new MultiDBTransactionManager("INTEGRY")) {
|
||||
MenuStaticCreator.createMenu(studioMlMultiDb.getPrimaryConnection(), UtilityDirs.getDevelopmentMenusFolder());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.reflections.Reflections;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
@@ -32,8 +32,8 @@ import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class MigrationComponent {
|
||||
@Service
|
||||
public class MigrationService {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@@ -161,7 +161,9 @@ public class MigrationComponent {
|
||||
.setSkipped(false);
|
||||
stbMigrationStatus.setOperation(OperationType.INSERT);
|
||||
} else {
|
||||
stbMigrationStatus.setCompleted(true);
|
||||
stbMigrationStatus.setCompleted(true)
|
||||
.setSkipped(false)
|
||||
.setErrorMessage(EmsRestConstants.NULL);
|
||||
stbMigrationStatus.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
|
||||
@@ -1,29 +1,22 @@
|
||||
package it.integry.ems.migration._base;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import it.integry.ems.migration.dto.SqlObjectTypeEnum;
|
||||
import it.integry.ems.schedule.new_cron_job.dto.operations.base_classes.BaseScheduledOperationDTO;
|
||||
import it.integry.ems.schedule.new_cron_job.service.AutomatedOperationHandlerComponent;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.settings.SettingsController;
|
||||
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import it.integry.ems_model.entity.Azienda;
|
||||
import it.integry.ems_model.entity.StbGestSetup;
|
||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
||||
import it.integry.ems_model.types.ApplicationName;
|
||||
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.UtilityString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseMigration implements MigrationModelInterface {
|
||||
@@ -59,10 +52,6 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
}
|
||||
|
||||
|
||||
protected void executeStatement(String... sqls) throws SQLException, IOException {
|
||||
executeStatement(advancedDataSource.getConnection(), sqls);
|
||||
}
|
||||
|
||||
protected void executeStatement(Connection connection, String... sqls) throws SQLException {
|
||||
Statement statement = connection.createStatement();
|
||||
|
||||
@@ -73,10 +62,32 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
statement.close();
|
||||
}
|
||||
|
||||
protected long executeInsertStatement(String sql) throws SQLException {
|
||||
protected boolean existsColumn(Connection connection, String tableName, String columnName) throws SQLException {
|
||||
String sql = Query.format("SELECT 1 FROM sys.columns\n" +
|
||||
" WHERE Name = N{}\n" +
|
||||
" AND Object_ID = Object_ID(N{})", columnName, "dbo." + tableName);
|
||||
|
||||
Integer val = UtilityDB.<Integer>executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
|
||||
return val != null && val == 1;
|
||||
}
|
||||
|
||||
protected void renameColumn(Connection connection, String tableName, String oldColumnname, String newColumnName) throws SQLException {
|
||||
String sql = "exec sp_rename 'dbo." + tableName + "." + oldColumnname + "', " + newColumnName + ", 'COLUMN'";
|
||||
executeStatement(connection, sql);
|
||||
}
|
||||
|
||||
protected boolean existsTable(Connection connection, String tableName) throws SQLException {
|
||||
String sql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N%s", tableName);
|
||||
|
||||
return UtilityDB.<Boolean>executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
|
||||
protected long executeInsertStatement(Connection connection, String sql) throws SQLException {
|
||||
long generatedId = -1;
|
||||
|
||||
try (PreparedStatement pstmt = advancedDataSource.getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
|
||||
try (PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
|
||||
|
||||
int affectedRows = pstmt.executeUpdate();
|
||||
|
||||
@@ -88,214 +99,51 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return generatedId;
|
||||
}
|
||||
|
||||
|
||||
protected void createOrUpdateFunction(String objectName, String createFunctionSql) throws SQLException, IOException {
|
||||
alterObject(SqlObjectTypeEnum.FUNCTION, objectName, createFunctionSql);
|
||||
public void updateFunction(Connection connection, String sql) throws SQLException {
|
||||
executeStatement(connection, sql);
|
||||
}
|
||||
|
||||
protected void createOrUpdateView(String objectName, String createViewSql) throws SQLException, IOException {
|
||||
alterObject(SqlObjectTypeEnum.VIEW, objectName, createViewSql);
|
||||
}
|
||||
|
||||
protected void createOrUpdateProcedure(String objectName, String createProcedureSql) throws SQLException, IOException {
|
||||
alterObject(SqlObjectTypeEnum.PROCEDURE, objectName, createProcedureSql);
|
||||
}
|
||||
|
||||
protected void createOrUpdateTrigger(String objectName, String createTriggerSql) throws SQLException, IOException {
|
||||
alterObject(SqlObjectTypeEnum.TRIGGER, objectName, createTriggerSql);
|
||||
}
|
||||
|
||||
private void alterObject(SqlObjectTypeEnum sqlObject, String objectName, String sql) throws SQLException, IOException {
|
||||
executeStatement("IF EXISTS (SELECT * FROM SYSOBJECTS WHERE id = object_id('" + objectName + "'))\r\n" +
|
||||
"\tDROP " + sqlObject.toString() + " " + objectName,
|
||||
sql);
|
||||
}
|
||||
|
||||
|
||||
protected boolean existsColumn(String tableName, String columnName) throws SQLException, IOException {
|
||||
String schema = null;
|
||||
if (tableName.contains(".")) {
|
||||
schema = tableName.substring(0, tableName.indexOf("."));
|
||||
tableName = tableName.replace(schema + ".", "");
|
||||
}
|
||||
|
||||
String sql = Query.format("SELECT 1 FROM sys.columns\n" +
|
||||
" WHERE Name = N{}\n" +
|
||||
" AND Object_ID = Object_ID(N{})", columnName, (schema != null ? schema : "dbo") + "." + tableName);
|
||||
|
||||
Integer val = UtilityDB.<Integer>executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(), sql);
|
||||
|
||||
return val != null && val == 1;
|
||||
}
|
||||
|
||||
protected void renameColumn(String tableName, String oldColumnname, String newColumnName) throws SQLException, IOException {
|
||||
String sql = "exec sp_rename 'dbo." + tableName + "." + oldColumnname + "', " + newColumnName + ", 'COLUMN'";
|
||||
executeStatement(sql);
|
||||
}
|
||||
|
||||
protected void dropColumn(String tableName, String columnName) throws SQLException, IOException {
|
||||
executeStatement("EXEC DropDefault '" + tableName + "', '" + columnName + "'",
|
||||
"ALTER TABLE " + tableName + " DROP COLUMN " + columnName);
|
||||
}
|
||||
|
||||
protected <T> void addDefault(String tableName, String columnName, T defaultValue) throws SQLException, IOException {
|
||||
boolean existDefault = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(),
|
||||
Query.format("SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||
"FROM sys.syscolumns\n" +
|
||||
"WHERE name = %s\n" +
|
||||
" AND OBJECT_NAME(id) = %s\n" +
|
||||
" AND cdefault <> 0", columnName, tableName));
|
||||
if (!existDefault)
|
||||
executeStatement(Query.format("ALTER TABLE dbo." + tableName + " ADD DEFAULT (%s) FOR "+ columnName, defaultValue));
|
||||
}
|
||||
|
||||
protected boolean existsTable(String tableName) throws SQLException, IOException {
|
||||
String schema = null;
|
||||
if (tableName.contains(".")) {
|
||||
schema = tableName.substring(0, tableName.indexOf("."));
|
||||
tableName = tableName.replace(schema + ".", "");
|
||||
}
|
||||
|
||||
String sql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM INFORMATION_SCHEMA.TABLES " +
|
||||
"WHERE TABLE_NAME = N%s ", tableName);
|
||||
|
||||
if (schema != null)
|
||||
sql += Query.format("AND TABLE_SCHEMA = N%s", schema);
|
||||
|
||||
return UtilityDB.<Boolean>executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(), sql);
|
||||
}
|
||||
|
||||
protected void dropTable(String tableName) throws SQLException, IOException {
|
||||
protected void dropTable(Connection connection, String tableName) throws SQLException {
|
||||
String dropSql = "DROP TABLE " + tableName;
|
||||
executeStatement(dropSql);
|
||||
executeStatement(connection, dropSql);
|
||||
}
|
||||
|
||||
|
||||
protected void createSetupQuery(String codQuery, String name, String query, boolean override) throws SQLException, IOException {
|
||||
if(override)
|
||||
executeStatement(Query.format("DELETE FROM stb_gest_setup_query WHERE cod_query = %s", codQuery));
|
||||
|
||||
executeStatement(Query.format("INSERT INTO stb_gest_setup_query (cod_query, query_default, description)"+
|
||||
" VALUES (%s, %s, %s);", codQuery, query, name));
|
||||
|
||||
|
||||
protected void createSetup(Connection connection, String gestName, String section, String keySection, String value, String description, String codQuery) throws Exception {
|
||||
StbGestSetup stbGestSetup = new StbGestSetup()
|
||||
.setGestName(gestName)
|
||||
.setSection(section)
|
||||
.setKeySection(keySection)
|
||||
.setValue(value)
|
||||
.setDescription(description)
|
||||
.setQueryDefault(codQuery);
|
||||
|
||||
stbGestSetup.setOperation(OperationType.INSERT);
|
||||
|
||||
stbGestSetup.manageWithParentConnection(connection);
|
||||
}
|
||||
|
||||
protected boolean existsSetup(String gestName, String section, String keySection) throws SQLException, IOException {
|
||||
String sql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM " + StbGestSetup.ENTITY +
|
||||
" WHERE gest_name = %s AND" +
|
||||
" section = %s AND" +
|
||||
" key_section = %s", gestName, section, keySection);
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(), sql);
|
||||
}
|
||||
|
||||
protected void createSetup(String gestName, String section, String keySection, String value, String description, String codQuery) throws Exception {
|
||||
if (existsSetup(gestName, section, keySection))
|
||||
return;
|
||||
|
||||
String insertSql = "INSERT INTO " + StbGestSetup.ENTITY +
|
||||
"(gest_name, section, key_section, value, description, query_default) VALUES (?, ?, ?, ?, ?, ?)";
|
||||
|
||||
try (PreparedStatement ps = advancedDataSource.getConnection().prepareStatement(insertSql)) {
|
||||
ps.setString(1, gestName);
|
||||
ps.setString(2, section);
|
||||
ps.setString(3, keySection);
|
||||
ps.setString(4, value);
|
||||
ps.setString(5, description);
|
||||
ps.setString(6, codQuery);
|
||||
|
||||
ps.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
protected void createSetup(String gestName, String section, String keySection, String value, String description, String codQuery, boolean flagMultiValue) throws Exception {
|
||||
if (existsSetup(gestName, section, keySection))
|
||||
return;
|
||||
|
||||
String insertSql = "INSERT INTO " + StbGestSetup.ENTITY +
|
||||
"(gest_name, section, key_section, value, description, query_default, flag_multi_value) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
try (PreparedStatement ps = advancedDataSource.getConnection().prepareStatement(insertSql)) {
|
||||
ps.setString(1, gestName);
|
||||
ps.setString(2, section);
|
||||
ps.setString(3, keySection);
|
||||
ps.setString(4, value);
|
||||
ps.setString(5, description);
|
||||
ps.setString(6, codQuery);
|
||||
ps.setBoolean(7, flagMultiValue);
|
||||
|
||||
ps.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
protected void createSetup(String gestName, String section, String keySection, String value, String description, String codQuery, boolean flagMultiValue, boolean flagSetupUserWeb) throws Exception {
|
||||
if (existsSetup(gestName, section, keySection))
|
||||
return;
|
||||
|
||||
String insertSql = "INSERT INTO " + StbGestSetup.ENTITY +
|
||||
"(gest_name, section, key_section, value, description, query_default, flag_multi_value, flag_setup_user_web) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
try (PreparedStatement ps = advancedDataSource.getConnection().prepareStatement(insertSql)) {
|
||||
ps.setString(1, gestName);
|
||||
ps.setString(2, section);
|
||||
ps.setString(3, keySection);
|
||||
ps.setString(4, value);
|
||||
ps.setString(5, description);
|
||||
ps.setString(6, codQuery);
|
||||
ps.setBoolean(7, flagMultiValue);
|
||||
ps.setString(8, flagSetupUserWeb ? "S" : "N");
|
||||
|
||||
ps.executeUpdate();
|
||||
}
|
||||
}
|
||||
protected void createSetup(String gestName, String section, String keySection, String value, String description, boolean flagSync,
|
||||
String codQuery, boolean flagUserView, boolean flagSetupDepo, boolean flagSetupUserWeb,
|
||||
boolean flagTipoJson, boolean flagTipoColore, String tipoSetup, boolean flagMultiValue ) throws Exception {
|
||||
if (existsSetup(gestName, section, keySection))
|
||||
return;
|
||||
|
||||
String insertSql = "INSERT INTO " + StbGestSetup.ENTITY +
|
||||
" (gest_name, section, key_section, value, description, flag_sync, query_default,\n" +
|
||||
"flag_user_view, flag_setup_depo, flag_setup_user_web,\n" +
|
||||
"flag_tipo_json, flag_tipo_colore, tipo_setup, flag_multi_value) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
try (PreparedStatement ps = advancedDataSource.getConnection().prepareStatement(insertSql)) {
|
||||
ps.setString(1, gestName);
|
||||
ps.setString(2, section);
|
||||
ps.setString(3, keySection);
|
||||
ps.setString(4, value);
|
||||
ps.setString(5, description);
|
||||
ps.setString(6, (flagSync?"S":"N"));
|
||||
ps.setString(7, codQuery);
|
||||
ps.setString(8, (flagUserView?"S":"N"));
|
||||
ps.setString(9, (flagSetupDepo?"S":"N"));
|
||||
ps.setString(10, (flagSetupUserWeb?"S":"N"));
|
||||
ps.setString(11, (flagTipoJson?"S":"N"));
|
||||
ps.setString(12, (flagTipoColore?"S":"N"));
|
||||
ps.setString(13, tipoSetup);
|
||||
ps.setBoolean(14, flagMultiValue);
|
||||
|
||||
ps.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
protected void deleteSetup(String gestName, String section, String keySection) throws Exception {
|
||||
protected void deleteSetup(Connection connection, String gestName, String section, String keySection) throws Exception {
|
||||
StbGestSetup stbGestSetup = new StbGestSetup()
|
||||
.setGestName(gestName)
|
||||
.setSection(section)
|
||||
.setKeySection(keySection);
|
||||
|
||||
stbGestSetup.setOperation(OperationType.DELETE);
|
||||
stbGestSetup.manageWithParentConnection(advancedDataSource.getConnection());
|
||||
stbGestSetup.manageWithParentConnection(connection);
|
||||
}
|
||||
|
||||
protected void updateSetupValue(String gestName, String section, String keySection, String newValue) throws Exception {
|
||||
protected void updateSetupValue(Connection connection, String gestName, String section, String keySection, String newValue) throws Exception {
|
||||
StbGestSetup stbGestSetup = new StbGestSetup()
|
||||
.setGestName(gestName)
|
||||
.setSection(section)
|
||||
@@ -303,10 +151,9 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
.setValue(newValue);
|
||||
|
||||
stbGestSetup.setOperation(OperationType.UPDATE);
|
||||
stbGestSetup.manageWithParentConnection(advancedDataSource.getConnection());
|
||||
stbGestSetup.manageWithParentConnection(connection);
|
||||
}
|
||||
|
||||
|
||||
protected void addAutomatedOperation(BaseScheduledOperationDTO operation) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
@@ -335,33 +182,4 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
protected boolean isCustomer(IntegryCustomer... customers) {
|
||||
String currentDbName = advancedDataSource.getDataSource().getDbName();
|
||||
|
||||
return Arrays.stream(customers)
|
||||
.anyMatch(x ->
|
||||
Arrays.stream(x.getValues())
|
||||
.anyMatch(y -> y.getValue().equalsIgnoreCase(currentDbName)));
|
||||
}
|
||||
|
||||
protected boolean isCustomerDb(IntegryCustomerDB... customersDbs) {
|
||||
String currentDbName = advancedDataSource.getDataSource().getDbName();
|
||||
|
||||
return Arrays.stream(customersDbs)
|
||||
.anyMatch(y -> y.getValue().equalsIgnoreCase(currentDbName));
|
||||
}
|
||||
|
||||
|
||||
protected boolean isWingest() throws SQLException, IOException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
Azienda currentAzienda = Azienda.getDefaultAzienda(advancedDataSource.getConnection());
|
||||
return currentAzienda.getApplicationNameEnum() == ApplicationName.WINGEST;
|
||||
}
|
||||
|
||||
protected boolean isTextiles() throws SQLException, IOException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
Azienda currentAzienda = Azienda.getDefaultAzienda(advancedDataSource.getConnection());
|
||||
return currentAzienda.getApplicationNameEnum() == ApplicationName.TEXTILES;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
package it.integry.ems.migration._base;
|
||||
|
||||
public enum IntegryCustomer {
|
||||
|
||||
Agricoper(IntegryCustomerDB.Agricoper_Agricoper,
|
||||
IntegryCustomerDB.Agricoper_IlVisone,
|
||||
IntegryCustomerDB.Agricoper_Luva),
|
||||
Auricchio(IntegryCustomerDB.Auricchio_Auricchio,
|
||||
IntegryCustomerDB.Auricchio_AuricchioMiki,
|
||||
IntegryCustomerDB.Auricchio_AuricchioSrl,
|
||||
IntegryCustomerDB.Auricchio_Ind01,
|
||||
IntegryCustomerDB.Auricchio_Ind02,
|
||||
IntegryCustomerDB.Auricchio_Ind04,
|
||||
IntegryCustomerDB.Auricchio_Ind05,
|
||||
IntegryCustomerDB.Auricchio_AuricchioSons),
|
||||
Biolevante(IntegryCustomerDB.Biolevante_Biolevante),
|
||||
Carelli(IntegryCustomerDB.Carelli_Carelli,
|
||||
IntegryCustomerDB.Carelli_GestFood,
|
||||
IntegryCustomerDB.Carelli_Chiuso,
|
||||
IntegryCustomerDB.Carelli_Format,
|
||||
IntegryCustomerDB.Carelli_Murgia,
|
||||
IntegryCustomerDB.Carelli_Panimal,
|
||||
IntegryCustomerDB.Carelli_Winact,
|
||||
IntegryCustomerDB.Carelli_Csgr),
|
||||
Cosmapack(IntegryCustomerDB.Cosmapack_Cosmint,
|
||||
IntegryCustomerDB.Cosmapack_MrSolution),
|
||||
Didonna(
|
||||
IntegryCustomerDB.Didonna_Didonna,
|
||||
IntegryCustomerDB.Didonna_AADidonna,
|
||||
IntegryCustomerDB.Didonna_Badessa,
|
||||
IntegryCustomerDB.Didonna_DidonnaBio,
|
||||
IntegryCustomerDB.Didonna_FlliDidonna,
|
||||
IntegryCustomerDB.Didonna_Messapi,
|
||||
IntegryCustomerDB.Didonna_Nicola,
|
||||
IntegryCustomerDB.Didonna_OpDidonna,
|
||||
IntegryCustomerDB.Didonna_Piervito,
|
||||
IntegryCustomerDB.Didonna_Pietro,
|
||||
IntegryCustomerDB.Didonna_SanGiuliano,
|
||||
IntegryCustomerDB.Didonna_Treddi,
|
||||
IntegryCustomerDB.Didonna_SanGiuseppe,
|
||||
IntegryCustomerDB.Didonna_Mediimpex,
|
||||
IntegryCustomerDB.Didonna_Raffaella,
|
||||
IntegryCustomerDB.Didonna_Diba,
|
||||
IntegryCustomerDB.Didonna_MediimpexLiq,
|
||||
IntegryCustomerDB.Didonna_DibaLiq),
|
||||
DolceBonta(IntegryCustomerDB.DolceBonta_DolceBo,
|
||||
IntegryCustomerDB.DolceBonta_Emanuela),
|
||||
Dulciar(IntegryCustomerDB.Dulciar_Dulciar,
|
||||
IntegryCustomerDB.Dulciar_Lanciok),
|
||||
Fiume(IntegryCustomerDB.Fiume_Alambicco,
|
||||
IntegryCustomerDB.Fiume_Licor,
|
||||
IntegryCustomerDB.Fiume_LicorFood),
|
||||
Florapulia(IntegryCustomerDB.Florapulia_Immobiliare,
|
||||
IntegryCustomerDB.Florapulia_ImmobiliareSrl,
|
||||
IntegryCustomerDB.Florapulia_Florapulia,
|
||||
IntegryCustomerDB.Florapulia_FlorapuliaSrl,
|
||||
IntegryCustomerDB.Florapulia_PaparellaP,
|
||||
IntegryCustomerDB.Florapulia_PaparellaPietro,
|
||||
IntegryCustomerDB.Florapulia_PaparellaD),
|
||||
FolliesGroup(IntegryCustomerDB.FolliesGroup_FolliesGroup),
|
||||
Frudis(IntegryCustomerDB.Frudis_Frudis),
|
||||
Gramm(IntegryCustomerDB.Gramm_Gramm,
|
||||
IntegryCustomerDB.Gramm_PrimeOlive,
|
||||
IntegryCustomerDB.Gramm_ProveStage),
|
||||
Idrotecnica(IntegryCustomerDB.Idrotecnica_Idrotecnica),
|
||||
Igood(IntegryCustomerDB.Igood_Igood,
|
||||
IntegryCustomerDB.Igood_ShopService),
|
||||
Ime(IntegryCustomerDB.Ime_ImeTe),
|
||||
Ivr(IntegryCustomerDB.Ivr_Vetta, IntegryCustomerDB.Ivr_Varci),
|
||||
Lamonarca(IntegryCustomerDB.Lamonarca_Lamonarca),
|
||||
Levanplast(IntegryCustomerDB.Levanplast_Levanplast,
|
||||
IntegryCustomerDB.Levanplast_Perilflor,
|
||||
IntegryCustomerDB.Levanplast_PerilflorSrl),
|
||||
Maggio(IntegryCustomerDB.Maggio_MaggioSrl,
|
||||
IntegryCustomerDB.Maggio_GiovMaggio),
|
||||
Materica(IntegryCustomerDB.Materica_ImeBa),
|
||||
MFI(IntegryCustomerDB.MFI_FashionGroup),
|
||||
Midel(IntegryCustomerDB.Midel_Midel),
|
||||
Morgante(IntegryCustomerDB.Morgante_Morgante),
|
||||
ResinaColor(IntegryCustomerDB.ResinaColor_ResinaColor),
|
||||
RistoCash(IntegryCustomerDB.RistoCash_RistoCash),
|
||||
RossoGargano(IntegryCustomerDB.RossoGargano_RossoGargano),
|
||||
Salpar(IntegryCustomerDB.Salpar_AlfaImmobiliare,
|
||||
IntegryCustomerDB.Salpar_MasabaSrl,
|
||||
IntegryCustomerDB.Salpar_Salpar,
|
||||
IntegryCustomerDB.Salpar_VgAlimenti),
|
||||
Santoro(IntegryCustomerDB.Santoro_ApuliaEngineering),
|
||||
SaporiVeri(IntegryCustomerDB.SaporiVeri_SaporiVeri,
|
||||
IntegryCustomerDB.SaporiVeri_Dispensa),
|
||||
Sardinya(IntegryCustomerDB.Sardinya_Daga,
|
||||
IntegryCustomerDB.Sardinya_Demetra,
|
||||
IntegryCustomerDB.Sardinya_Sarca,
|
||||
IntegryCustomerDB.Sardinya_Sardinya),
|
||||
Smetar(IntegryCustomerDB.Smetar_Smetar),
|
||||
Suit(IntegryCustomerDB.Suit_BioSuit,
|
||||
IntegryCustomerDB.Suit_CarniSardegna,
|
||||
IntegryCustomerDB.Suit_Granlucano,
|
||||
IntegryCustomerDB.Suit_Puglia,
|
||||
IntegryCustomerDB.Suit_SantAntonio,
|
||||
IntegryCustomerDB.Suit_Suit,
|
||||
IntegryCustomerDB.Suit_TenutaArianna,
|
||||
IntegryCustomerDB.Suit_Valpietro),
|
||||
Tempesta(IntegryCustomerDB.Tempesta_Tempesta,
|
||||
IntegryCustomerDB.Tempesta_VivaiTempesta),
|
||||
Tosca(IntegryCustomerDB.Tosca_Ba,
|
||||
IntegryCustomerDB.Tosca_Ce,
|
||||
IntegryCustomerDB.Tosca_Cz,
|
||||
IntegryCustomerDB.Tosca_Fc,
|
||||
IntegryCustomerDB.Tosca_Mi,
|
||||
IntegryCustomerDB.Tosca_Rg,
|
||||
IntegryCustomerDB.Tosca_Rm,
|
||||
IntegryCustomerDB.Tosca_Vr,
|
||||
IntegryCustomerDB.Tosca_Cloud),
|
||||
TwoBrothers(IntegryCustomerDB.TwoBrothers_TwoBrothers),
|
||||
Vinella(IntegryCustomerDB.Vinella_Vinella,
|
||||
IntegryCustomerDB.Vinella_VQuadro,
|
||||
IntegryCustomerDB.Vinella_TeknoSport);
|
||||
|
||||
|
||||
private final IntegryCustomerDB[] values;
|
||||
|
||||
IntegryCustomer(IntegryCustomerDB... values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
|
||||
public IntegryCustomerDB[] getValues() {
|
||||
return values;
|
||||
}
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
package it.integry.ems.migration._base;
|
||||
|
||||
public enum IntegryCustomerDB {
|
||||
Agricoper_Agricoper("agricoper"),
|
||||
Agricoper_IlVisone("ilvisone"),
|
||||
Agricoper_Luva("ilvisone"),
|
||||
|
||||
|
||||
Auricchio_Auricchio("auricchio"),
|
||||
Auricchio_AuricchioMiki("auricchio_miki"),
|
||||
Auricchio_AuricchioSrl("auricchiosrl"),
|
||||
Auricchio_Ind01("ind01"),
|
||||
Auricchio_Ind02("ind02"),
|
||||
Auricchio_Ind04("ind04"),
|
||||
Auricchio_Ind05("ind05"),
|
||||
Auricchio_AuricchioSons("auricchiosons"),
|
||||
|
||||
|
||||
Biolevante_Biolevante("biolevante"),
|
||||
|
||||
|
||||
Carelli_Carelli("carelli"),
|
||||
Carelli_GestFood("gestfood"),
|
||||
Carelli_Chiuso("chiuso"),
|
||||
Carelli_Format("format"),
|
||||
Carelli_Murgia("murgia"),
|
||||
Carelli_Panimal("panimal"),
|
||||
Carelli_Winact("winact"),
|
||||
Carelli_Csgr("csgr"),
|
||||
|
||||
|
||||
|
||||
Cosmapack_Cosmint("cosmint"),
|
||||
Cosmapack_MrSolution("mrsolution"),
|
||||
|
||||
Didonna_Didonna("didonna"),
|
||||
Didonna_AADidonna("aadidonna"),
|
||||
Didonna_Badessa("badessa"),
|
||||
Didonna_DidonnaBio("didonnabio"),
|
||||
Didonna_FlliDidonna("fllididonna"),
|
||||
Didonna_Messapi("messapi"),
|
||||
Didonna_Nicola("nicola"),
|
||||
Didonna_OpDidonna("opdidonna"),
|
||||
Didonna_Piervito("piervito"),
|
||||
Didonna_Pietro("pietro"),
|
||||
Didonna_SanGiuliano("sangiuliano"),
|
||||
Didonna_Treddi("treddi"),
|
||||
Didonna_SanGiuseppe("sangiuseppe"),
|
||||
Didonna_Mediimpex("mediimpex"),
|
||||
Didonna_Raffaella("raffaella"),
|
||||
Didonna_Diba("diba"),
|
||||
Didonna_MediimpexLiq("mediimpexliq"),
|
||||
Didonna_DibaLiq("dibaliq"),
|
||||
|
||||
|
||||
DolceBonta_DolceBo("dolce_bo"),
|
||||
DolceBonta_Emanuela("emanuela"),
|
||||
|
||||
|
||||
Dulciar_Dulciar("dulciar"),
|
||||
Dulciar_Lanciok("lanciok"),
|
||||
|
||||
|
||||
Fiume_Alambicco("alambicco"),
|
||||
Fiume_Licor("licor"),
|
||||
Fiume_LicorFood("licorFood"),
|
||||
|
||||
|
||||
Florapulia_Immobiliare("immobiliare"),
|
||||
Florapulia_Florapulia("florapulia"),
|
||||
Florapulia_FlorapuliaSrl("florapuliasrl"),
|
||||
Florapulia_PaparellaP("paparellap"),
|
||||
Florapulia_PaparellaPietro("paparellapietro"),
|
||||
Florapulia_ImmobiliareSrl("immobiliaresrl"),
|
||||
Florapulia_PaparellaD("paparellad"),
|
||||
|
||||
|
||||
FolliesGroup_FolliesGroup("folliesgroup"),
|
||||
|
||||
|
||||
Frudis_Frudis("frudis"),
|
||||
|
||||
|
||||
Gramm_Gramm("gramm"),
|
||||
Gramm_PrimeOlive("primeolive"),
|
||||
Gramm_ProveStage("grammprovestage"),
|
||||
|
||||
|
||||
Idrotecnica_Idrotecnica("idrotecnica"),
|
||||
|
||||
|
||||
Igood_Igood("igood"),
|
||||
Igood_ShopService("shop_service"),
|
||||
|
||||
|
||||
Ime_ImeTe("ime_te"),
|
||||
|
||||
|
||||
Ivr_Vetta("vetta"),
|
||||
Ivr_Varci("varci"),
|
||||
|
||||
|
||||
Lamonarca_Lamonarca("lamonarca"),
|
||||
|
||||
|
||||
Levanplast_Perilflor("perilflor"),
|
||||
Levanplast_PerilflorSrl("perilflorsrl"),
|
||||
Levanplast_Levanplast("levanplast"),
|
||||
|
||||
Maggio_MaggioSrl("maggiosrl"),
|
||||
Maggio_GiovMaggio("giovmaggio"),
|
||||
|
||||
|
||||
|
||||
Materica_ImeBa("ime_ba"),
|
||||
|
||||
|
||||
MFI_FashionGroup("fashiongroup"),
|
||||
|
||||
|
||||
Midel_Midel("midel"),
|
||||
|
||||
|
||||
Morgante_Morgante("morgante"),
|
||||
|
||||
|
||||
ResinaColor_ResinaColor("resinacolor"),
|
||||
|
||||
|
||||
RistoCash_RistoCash("risto_cash"),
|
||||
|
||||
|
||||
RossoGargano_RossoGargano("rossogargano"),
|
||||
|
||||
|
||||
Salpar_VgAlimenti("vgalimenti"),
|
||||
Salpar_Salpar("salpar"),
|
||||
Salpar_MasabaSrl("masabasrl"),
|
||||
Salpar_AlfaImmobiliare("alfaimmobiliare"),
|
||||
|
||||
|
||||
Santoro_ApuliaEngineering("apuliaengineering"),
|
||||
|
||||
|
||||
SaporiVeri_SaporiVeri("sapori_veri"),
|
||||
SaporiVeri_Dispensa("dispensa"),
|
||||
|
||||
|
||||
Sardinya_Sardinya("sardinya"),
|
||||
Sardinya_Demetra("demetra"),
|
||||
Sardinya_Daga("daga"),
|
||||
Sardinya_Sarca("sarca"),
|
||||
|
||||
|
||||
Smetar_Smetar("smetar"),
|
||||
|
||||
|
||||
Suit_Suit("suit"),
|
||||
Suit_SantAntonio("santantonio"),
|
||||
Suit_BioSuit("biosuit"),
|
||||
Suit_Granlucano("granlucano"),
|
||||
Suit_Puglia("suit_puglia"),
|
||||
Suit_TenutaArianna("tenuta_arianna"),
|
||||
Suit_CarniSardegna("carni_sardegna"),
|
||||
Suit_Valpietro("valpietro"),
|
||||
|
||||
|
||||
Tempesta_Tempesta("tempesta"),
|
||||
Tempesta_VivaiTempesta("vivaitempesta"),
|
||||
|
||||
|
||||
Tosca_Ba("tosca_ba"),
|
||||
Tosca_Cz("tosca_cz"),
|
||||
Tosca_Rm("tosca_rm"),
|
||||
Tosca_Mi("tosca_mi"),
|
||||
Tosca_Ce("tosca_ce"),
|
||||
Tosca_Vr("tosca_vr"),
|
||||
Tosca_Rg("tosca_rg"),
|
||||
Tosca_Fc("tosca_fc"),
|
||||
Tosca_Cloud("tosca_cloud"),
|
||||
|
||||
|
||||
TwoBrothers_TwoBrothers("twobrothers"),
|
||||
|
||||
|
||||
Vinella_Vinella("vinella"),
|
||||
Vinella_VQuadro("vquadro"),
|
||||
Vinella_TeknoSport("teknosport");
|
||||
|
||||
|
||||
private final String value;
|
||||
|
||||
IntegryCustomerDB(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,6 @@ public class MigrationStatusDTO {
|
||||
private MigrationStatusEnum status;
|
||||
private String errorMessage;
|
||||
|
||||
public String getId() {
|
||||
return this.profileDb + "-" + this.migrationCode;
|
||||
}
|
||||
|
||||
public long getMigrationCode() {
|
||||
return migrationCode;
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package it.integry.ems.migration.dto;
|
||||
|
||||
public enum SqlObjectTypeEnum {
|
||||
VIEW,
|
||||
FUNCTION,
|
||||
PROCEDURE,
|
||||
TRIGGER
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class Migration_20221128123233 extends BaseMigration implements Migration
|
||||
secretKeyToUse = Encoders.BASE64.encode(key.getEncoded());
|
||||
}
|
||||
|
||||
executeStatement(
|
||||
executeStatement(advancedDataSource.getConnection(),
|
||||
"ALTER TABLE azienda\n" +
|
||||
" ADD jwt_secret_key VARCHAR(MAX)");
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ public class Migration_20221128132717 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
executeStatement(advancedDataSource.getConnection(),
|
||||
"CREATE TABLE dbo.stb_devices\n" +
|
||||
"(\n" +
|
||||
" id BIGINT IDENTITY\n" +
|
||||
|
||||
@@ -11,7 +11,7 @@ public class Migration_20230406164731 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
executeStatement(advancedDataSource.getConnection(),
|
||||
"UPDATE mtb_partita_mag_carat" +
|
||||
" SET carat = 'qta-residua'" +
|
||||
" WHERE carat = 'qta_residua'",
|
||||
|
||||
@@ -20,8 +20,8 @@ public class Migration_20230411163906 extends BaseMigration implements Migration
|
||||
|
||||
MimeTypesHandler mimeTypesHandler = getContextBean(MimeTypesHandler.class);
|
||||
|
||||
if (!existsColumn("stb_files_attached", "mime_type"))
|
||||
executeStatement(
|
||||
if (!existsColumn(advancedDataSource.getConnection(), "stb_files_attached", "mime_type"))
|
||||
executeStatement(advancedDataSource.getConnection(),
|
||||
"ALTER TABLE stb_files_attached\n" +
|
||||
" ADD mime_type VARCHAR(MAX)");
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ public class Migration_20230414183851 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
executeStatement(advancedDataSource.getConnection(),
|
||||
"ALTER TABLE stb_files_attached\n" +
|
||||
" ADD ref_uuid1 VARCHAR(36)");
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public class Migration_20230419161529 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
executeStatement(advancedDataSource.getConnection(),
|
||||
"ALTER TABLE stb_devices\n" +
|
||||
" ADD created_at DATETIME",
|
||||
"ALTER TABLE stb_devices\n" +
|
||||
|
||||
@@ -18,7 +18,7 @@ public class Migration_20231201094005 extends BaseMigration implements Migration
|
||||
boolean existColumn = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(), sql);
|
||||
|
||||
if (!existColumn )
|
||||
executeStatement(
|
||||
executeStatement(advancedDataSource.getConnection(),
|
||||
"ALTER TABLE mtb_colt\n" +
|
||||
" ADD id_lotto INT");
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class Migration_20231201161808 extends BaseMigration implements Migration
|
||||
|
||||
for (String query : queries) {
|
||||
System.out.println(query);
|
||||
executeStatement(query);
|
||||
executeStatement(advancedDataSource.getConnection(), query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Migration_20240125114347 extends BaseMigration implements Migration
|
||||
|
||||
for (String query : queries) {
|
||||
System.out.println(query);
|
||||
executeStatement(query);
|
||||
executeStatement(advancedDataSource.getConnection(), query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Migration_20240201160125 extends BaseMigration implements Migration
|
||||
" skipped BIT DEFAULT 0 NOT NULL\n" +
|
||||
")";
|
||||
|
||||
executeStatement(createTable);
|
||||
executeStatement(advancedDataSource.getConnection(), createTable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,7 @@ public class Migration_20240205105025 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("f_getEAN128UL", "CREATE FUNCTION [dbo].[f_getEAN128UL](@gestione VARCHAR(1), @dataCollo DATETIME, @serCollo VARCHAR(2), @numCollo int, @customPrefissoEan VARCHAR(7))\n" +
|
||||
updateFunction(advancedDataSource.getConnection(), "ALTER FUNCTION [dbo].[f_getEAN128UL](@gestione VARCHAR(1), @dataCollo DATETIME, @serCollo VARCHAR(2), @numCollo int, @customPrefissoEan VARCHAR(7))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
"\n" +
|
||||
|
||||
@@ -7,7 +7,6 @@ import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
@@ -26,7 +25,7 @@ public class Migration_20240212000000 extends BaseMigration implements Migration
|
||||
sql = "SELECT * FROM stb_publications_detail";
|
||||
final List<HashMap<String, Object>> oldStbPublicationsDetails = UtilityDB.executeSimpleQuery(advancedDataSource.getConnection(), sql);
|
||||
|
||||
dropOldTables();
|
||||
dropOldTables(advancedDataSource.getConnection());
|
||||
createNewTables(advancedDataSource.getConnection());
|
||||
|
||||
|
||||
@@ -34,7 +33,7 @@ public class Migration_20240212000000 extends BaseMigration implements Migration
|
||||
String publicationDescription = UtilityHashMap.getValueIfExists(oldStbPublication, "publication_description");
|
||||
|
||||
String insertSql = Query.format("INSERT INTO stb_publications (publication_description) VALUES (%s)", publicationDescription);
|
||||
long generatedId = executeInsertStatement(insertSql);
|
||||
long generatedId = executeInsertStatement(advancedDataSource.getConnection(), insertSql);
|
||||
oldStbPublication.putIfAbsent("id", generatedId);
|
||||
}
|
||||
|
||||
@@ -59,7 +58,7 @@ public class Migration_20240212000000 extends BaseMigration implements Migration
|
||||
active.equalsIgnoreCase("S") || active.equalsIgnoreCase("R"),
|
||||
whereCond,
|
||||
true);
|
||||
long generatedId = executeInsertStatement(insertSql);
|
||||
long generatedId = executeInsertStatement(advancedDataSource.getConnection(), insertSql);
|
||||
oldStbPublicationDetail.putIfAbsent("id", generatedId);
|
||||
}
|
||||
}
|
||||
@@ -70,9 +69,9 @@ public class Migration_20240212000000 extends BaseMigration implements Migration
|
||||
}
|
||||
|
||||
|
||||
private void dropOldTables() throws SQLException, IOException {
|
||||
dropTable("stb_publications_detail");
|
||||
dropTable("stb_publications");
|
||||
private void dropOldTables(@NotNull Connection connection) throws SQLException {
|
||||
dropTable(connection, "stb_publications_detail");
|
||||
dropTable(connection, "stb_publications");
|
||||
}
|
||||
|
||||
private void createNewTables(@NotNull Connection connection) throws SQLException {
|
||||
|
||||
@@ -10,11 +10,11 @@ public class Migration_20240212000001 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if(!existsTable("stb_transaction_log_db"))
|
||||
if(!existsTable(advancedDataSource.getConnection(), "stb_transaction_log_db"))
|
||||
return;
|
||||
|
||||
dropTable("stb_transaction_log_db");
|
||||
dropTable("stb_transaction_log");
|
||||
dropTable(advancedDataSource.getConnection(), "stb_transaction_log_db");
|
||||
dropTable(advancedDataSource.getConnection(), "stb_transaction_log");
|
||||
|
||||
String createTransactionTableSql = "\n" +
|
||||
"CREATE TABLE dbo.stb_transaction_log\n" +
|
||||
@@ -30,7 +30,7 @@ public class Migration_20240212000001 extends BaseMigration implements Migration
|
||||
" group_id BIGINT NOT NULL\n" +
|
||||
")";
|
||||
|
||||
executeStatement(createTransactionTableSql);
|
||||
executeStatement(advancedDataSource.getConnection(), createTransactionTableSql);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Migration_20240212000002 extends BaseMigration implements Migration
|
||||
String sql = "ALTER TABLE dbo.stb_publications_detail\n" +
|
||||
" ADD export_history BIT DEFAULT 0 NOT NULL";
|
||||
|
||||
executeStatement(sql);
|
||||
executeStatement(advancedDataSource.getConnection(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Migration_20240219094933 extends BaseMigration implements Migration
|
||||
String sql = "ALTER TABLE mtb_colt\n" +
|
||||
" ADD barcode_ul VARCHAR(20)";
|
||||
|
||||
executeStatement(sql);
|
||||
executeStatement(advancedDataSource.getConnection(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,8 @@ public class Migration_20240219103840 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("PICKING", "ACCETTAZIONE", "FLAG_ALLOW_BARCODE_FORNITORE", "N",
|
||||
createSetup(advancedDataSource.getConnection(),
|
||||
"PICKING", "ACCETTAZIONE", "FLAG_ALLOW_BARCODE_FORNITORE", "N",
|
||||
"Abilita la possibilità di effettuare l'accettazione merci utilizzando direttamente l'SSCC del fornitore (salvato poi nella colonna barcode_pedana)",
|
||||
"SI_NO");
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Migration_20240220114903 extends BaseMigration implements Migration
|
||||
"ALTER TABLE mtb_colr\n" +
|
||||
" ADD DEFAULT 0 FOR causale;";
|
||||
|
||||
executeStatement(sql);
|
||||
executeStatement(advancedDataSource.getConnection(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,11 +10,13 @@ public class Migration_20240221190821 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("DATI_AZIENDA", "SETUP", "FLAG_ANSI_PADDING", "N",
|
||||
createSetup(advancedDataSource.getConnection(),
|
||||
"DATI_AZIENDA", "SETUP", "FLAG_ANSI_PADDING", "N",
|
||||
"Abilita l'ansi padding nella connessione del gestionale. Il valore suggerito è ON (prima era OFF).",
|
||||
"SI_NO");
|
||||
|
||||
createSetup("DATI_AZIENDA", "SETUP", "FLAG_CONCAT_NULL_YIELDS_NULL", "N",
|
||||
createSetup(advancedDataSource.getConnection(),
|
||||
"DATI_AZIENDA", "SETUP", "FLAG_CONCAT_NULL_YIELDS_NULL", "N",
|
||||
"Abilita il concat null yields null nella connessione del gestionale. Il valore suggerito è ON (prima era OFF).",
|
||||
"SI_NO");
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ public class Migration_20240228160024 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
dropTable("stb_subscriptions_user_detail");
|
||||
dropTable("stb_subscriptions_user");
|
||||
dropTable(advancedDataSource.getConnection(), "stb_subscriptions_user_detail");
|
||||
dropTable(advancedDataSource.getConnection(), "stb_subscriptions_user");
|
||||
|
||||
executeStatement(
|
||||
executeStatement(advancedDataSource.getConnection(),
|
||||
|
||||
"CREATE TABLE dbo.stb_remote_subscription\n" +
|
||||
"(\n" +
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
|
||||
public class Migration_20240304165725 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@@ -18,7 +19,7 @@ public class Migration_20240304165725 extends BaseMigration implements Migration
|
||||
"SET tipo_car = 'R'\n" +
|
||||
"WHERE tipo_car = 'C'";
|
||||
|
||||
executeStatement(sql);
|
||||
executeStatement(advancedDataSource.getConnection(), sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20240307123633 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
@@ -11,13 +13,16 @@ public class Migration_20240307123633 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(
|
||||
IntegryCustomerDB.Carelli_Carelli,
|
||||
IntegryCustomerDB.Carelli_GestFood,
|
||||
IntegryCustomerDB.Carelli_Panimal))
|
||||
List<String> elencoDb = new ArrayList<String>() {{
|
||||
add("CARELLI");
|
||||
add("GESTFOOD");
|
||||
add("PANIMAL");
|
||||
}};
|
||||
|
||||
if (elencoDb.stream().noneMatch(x -> x.equalsIgnoreCase(advancedDataSource.getDataSource().getDbName())))
|
||||
return;
|
||||
|
||||
executeStatement("UPDATE vtb_promo SET flag_tipo_promo = 'T' WHERE cod_promo like '%TAGLIO%'");
|
||||
executeStatement(advancedDataSource.getConnection(), "UPDATE vtb_promo SET flag_tipo_promo = 'T' WHERE cod_promo like '%TAGLIO%'");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240311102717 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createSetup("PICKING", "ACCETTAZIONE_BOLLA", "FLAG_USE_QTA_ORD", "S",
|
||||
"Questo flag permette, durante il picking, di proporre automaticamente la qta ordinata al posto del valore di default di 1 confezione",
|
||||
"SI_NO");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
|
||||
import java.sql.Statement;
|
||||
|
||||
public class Migration_20240312093539 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
String tableName = "wtb_jrept_setup";
|
||||
boolean existTable = existsTable(tableName);
|
||||
|
||||
if (existTable) {
|
||||
boolean existRow = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(), "SELECT cast(count(*) as bit) FROM " + tableName);
|
||||
if (existRow) return;
|
||||
dropTable(tableName);
|
||||
}
|
||||
|
||||
String createSql = "create table wtb_jrept_setup\n" +
|
||||
"(\n" +
|
||||
" id bigint identity\n" +
|
||||
" constraint wtb_jrept_setup_pk\n" +
|
||||
" primary key,\n" +
|
||||
" report_id bigint not null\n" +
|
||||
" constraint wtb_jrept_setup_wtb_jrept_id_fk\n" +
|
||||
" references wtb_jrept,\n" +
|
||||
" cod_mdep varchar(5)\n" +
|
||||
" constraint wtb_jrept_setup_mtb_depo_cod_mdep_fk\n" +
|
||||
" references mtb_depo,\n" +
|
||||
" cod_anag varchar(5)\n" +
|
||||
" constraint wtb_jrept_setup_gtb_anag_cod_anag_fk\n" +
|
||||
" foreign key (cod_anag) references gtb_anag," +
|
||||
" tipo int not null,\n" +
|
||||
" printer_name varchar(255),\n" +
|
||||
" print_quantity int default 1 not null,\n" +
|
||||
" orientation int default 0 not null\n" +
|
||||
")";
|
||||
|
||||
executeStatement(advancedDataSource.getConnection(), createSql);
|
||||
|
||||
String createIndex = "create unique index wtb_jrept_setup_cod_mdep_tipo_cod_anag_uindex" +
|
||||
" on wtb_jrept_setup (cod_mdep, tipo, cod_anag)";
|
||||
|
||||
executeStatement(advancedDataSource.getConnection(), createIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240312161313 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
String value = "N";
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Gramm_Gramm)){
|
||||
value = "S";
|
||||
}
|
||||
|
||||
createSetup("PICKING", "SETUP", "FLAG_WARNING_NEW_PARTITA_MAG", value,
|
||||
"Questo flag permette di avvisare l'utente se è stato inserito un nuovo lotto per quell'articolo",
|
||||
"SI_NO");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240312175552 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("MES_MachineStatusByOrder", "CREATE VIEW MES_MachineStatusByOrder AS\n" +
|
||||
"WITH base AS (\n" +
|
||||
" SELECT gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" id_riga,\n" +
|
||||
" data_mov,\n" +
|
||||
" ISNULL(LEAD(data_mov)\n" +
|
||||
" OVER (PARTITION BY cod_cmac, data_ord, num_ord, gestione ORDER BY id_riga),\n" +
|
||||
" DATEADD(MINUTE, 1, data_mov)) AS data_mov_fine,\n" +
|
||||
" cod_cmac,\n" +
|
||||
" CASE WHEN evento <> 'START' THEN 'STOP' ELSE evento END as evento,\n" +
|
||||
" evento AS causale,\n" +
|
||||
" descrizione,\n" +
|
||||
" qta_mov,\n" +
|
||||
" num_fase,\n" +
|
||||
" activity_id\n" +
|
||||
" FROM dtb_ord_macc\n" +
|
||||
"),\n" +
|
||||
"\n" +
|
||||
" statuses AS (\n" +
|
||||
" SELECT cod_cmac,\n" +
|
||||
" id_riga,\n" +
|
||||
" LAG(evento)\n" +
|
||||
" OVER (PARTITION BY cod_cmac, data_ord, num_ord, gestione ORDER BY id_riga) AS prev_evento,\n" +
|
||||
" evento,\n" +
|
||||
" num_ord,\n" +
|
||||
" data_ord,\n" +
|
||||
" gestione,\n" +
|
||||
" data_mov,\n" +
|
||||
" data_mov_fine,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN MAX(id_riga) OVER ( PARTITION BY cod_cmac, data_ord, num_ord, gestione ) = id_riga\n" +
|
||||
" THEN evento END AS last_evento\n" +
|
||||
" FROM base\n" +
|
||||
" WHERE DATEDIFF(MINUTE, data_mov, data_mov_fine) > 0\n" +
|
||||
" ),\n" +
|
||||
" steps AS (\n" +
|
||||
" SELECT data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" gestione,\n" +
|
||||
" MIN(data_iniz) AS data_iniz,\n" +
|
||||
" MAX(ISNULL(data_fine, GETDATE())) AS data_fine,\n" +
|
||||
" cod_jfas\n" +
|
||||
" FROM dtb_ord_steps\n" +
|
||||
" WHERE data_iniz IS NOT NULL\n" +
|
||||
" GROUP BY data_ord, num_ord, gestione, cod_jfas\n" +
|
||||
" ),\n" +
|
||||
" advanced_statuses AS (\n" +
|
||||
" SELECT statuses.cod_cmac,\n" +
|
||||
" statuses.id_riga,\n" +
|
||||
" statuses.prev_evento,\n" +
|
||||
" statuses.evento,\n" +
|
||||
" MAX(last_evento)\n" +
|
||||
" OVER ( PARTITION BY statuses.cod_cmac, statuses.data_ord, statuses.num_ord, statuses.gestione) AS last_evento,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN statuses.evento = 'START' AND ISNULL(statuses.prev_evento, '') <> 'START' THEN 1\n" +
|
||||
" ELSE\n" +
|
||||
" CASE\n" +
|
||||
" WHEN statuses.evento <> 'START' AND ISNULL(statuses.prev_evento, '') = 'START' THEN -1\n" +
|
||||
" ELSE 0 END\n" +
|
||||
" END AS value,\n" +
|
||||
" DATEADD(MINUTE, DATEDIFF(MINUTE, 0, ISNULL(statuses.data_mov, steps.data_iniz)),\n" +
|
||||
" 0) as data_mov,\n" +
|
||||
" DATEADD(MINUTE, DATEDIFF(MINUTE, 0, ISNULL(statuses.data_mov_fine, steps.data_fine)),\n" +
|
||||
" 0) as data_mov_fine,\n" +
|
||||
" statuses.num_ord,\n" +
|
||||
" statuses.data_ord,\n" +
|
||||
" statuses.gestione,\n" +
|
||||
" steps.cod_jfas\n" +
|
||||
" FROM statuses\n" +
|
||||
" INNER JOIN steps ON statuses.num_ord = steps.num_ord\n" +
|
||||
" AND statuses.data_ord = steps.data_ord\n" +
|
||||
" AND statuses.gestione = steps.gestione\n" +
|
||||
" ),\n" +
|
||||
" grouped_events AS (\n" +
|
||||
" SELECT cod_cmac,\n" +
|
||||
" evento,\n" +
|
||||
" value,\n" +
|
||||
" SUM(ABS(value))\n" +
|
||||
" OVER (PARTITION BY cod_cmac, num_ord, data_ord, gestione ORDER BY cod_cmac, num_ord, data_ord, gestione, data_mov\n" +
|
||||
" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS event_groups,\n" +
|
||||
" data_mov,\n" +
|
||||
" data_mov_fine,\n" +
|
||||
" DATEDIFF(SECOND, data_mov, data_mov_fine) AS duration_seconds,\n" +
|
||||
" DATEDIFF(MINUTE, data_mov, data_mov_fine) AS duration_minutes,\n" +
|
||||
" num_ord,\n" +
|
||||
" data_ord,\n" +
|
||||
" gestione,\n" +
|
||||
" cod_jfas\n" +
|
||||
" FROM advanced_statuses\n" +
|
||||
" WHERE DATEDIFF(MINUTE, data_mov, data_mov_fine) > 0\n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
"SELECT cod_cmac,\n" +
|
||||
" evento,\n" +
|
||||
" value,\n" +
|
||||
" MIN(data_mov) AS data_mov_iniz,\n" +
|
||||
" MAX(data_mov_fine) AS data_mov_fine,\n" +
|
||||
" SUM(duration_minutes) AS duration_minutes,\n" +
|
||||
" num_ord,\n" +
|
||||
" data_ord,\n" +
|
||||
" gestione,\n" +
|
||||
" cod_jfas\n" +
|
||||
"FROM grouped_events\n" +
|
||||
"group by cod_cmac, evento, value, event_groups, num_ord, data_ord, gestione, cod_jfas");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
import java.sql.Statement;
|
||||
|
||||
public class Migration_20240313163623 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!existsColumn("stb_gest_setup", "flag_multi_value")) {
|
||||
executeStatement("ALTER TABLE stb_gest_setup ADD flag_multi_value BIT DEFAULT 0");
|
||||
}
|
||||
|
||||
createSetup("PVM", "PIAN_ACC_ROSSG", "TIPI_FORN_ACQ", null,
|
||||
"Identifica i tipi di fornitore su cui è possibile creare un ordine di acquisto per la materia prima.",
|
||||
"COD_ATIP", true);
|
||||
|
||||
createSetup(
|
||||
"PVM", "PIAN_ACC_ROSSG", "COD_MGRP_MP", null,
|
||||
"Identifica i gruppi merceologici di materia prima per cui è possibile creare un ordine di acquisto",
|
||||
"COD_MGRP", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240314133221 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("TIPI_DEPO", "Tipi deposito", "SELECT cod_tipo_depo FROM mtb_depo_tipi", true);
|
||||
|
||||
createSetup("PVM", "PIAN_ACC_ROSSG", "TIPI_DEPO_LAV", null,
|
||||
"Identifica i tipi di deposito dove è possibile far arrivare la materia prima per la produzione.",
|
||||
"TIPI_DEPO", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240314135021 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
final String gestName = "IMPORT_LISTINI ACQUISTO";
|
||||
final String section = "APULIA_CARREFOUR";
|
||||
createSetup(gestName, section, "PREZZO_NETTO", "S",
|
||||
"Importazione prezzo netto dai listini di apulia.",
|
||||
"SI_NO", true);
|
||||
|
||||
deleteSetup(gestName, section, "PREZZO_NETTO_NETTO");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240314141529 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (existsTable("dbo.mtb_lisa_apulia_succ")) {
|
||||
if (!existsColumn("dbo.mtb_lisa_apulia_succ", "perc_premio"))
|
||||
executeStatement("ALTER TABLE mtb_lisa_apulia_succ ADD perc_premio numeric(5,2)");
|
||||
|
||||
if (!existsColumn("dbo.mtb_lisa_apulia_succ", "val_premio"))
|
||||
executeStatement("ALTER TABLE mtb_lisa_apulia_succ ADD val_premio numeric(20,5)");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240315132158 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("getTreeViewMenu", "CREATE FUNCTION [dbo].[getTreeViewMenu]( @tipoazienda VARCHAR(40))\n" +
|
||||
" RETURNS\n" +
|
||||
" @treeviewmenu TABLE\n" +
|
||||
" (\n" +
|
||||
" cod_opz VARCHAR(5),\n" +
|
||||
" descrizione VARCHAR(255),\n" +
|
||||
" cod_parent VARCHAR(5),\n" +
|
||||
" gest_name VARCHAR(40),\n" +
|
||||
" entity_name VARCHAR(40),\n" +
|
||||
" type VARCHAR(5),\n" +
|
||||
" picture_menu VARCHAR(1024),\n" +
|
||||
" picture_select VARCHAR(1024),\n" +
|
||||
" pos INT,\n" +
|
||||
" tipo_azienda VARCHAR(40),\n" +
|
||||
" flag_attivo VARCHAR(1),\n" +
|
||||
" descrizione_estesa IMAGE,\n" +
|
||||
" url_descrizione VARCHAR(1024),\n" +
|
||||
" object_type VARCHAR(5),\n" +
|
||||
" flag_printer_setup VARCHAR(1),\n" +
|
||||
" parameter VARCHAR(255),\n" +
|
||||
" note VARCHAR(255),\n" +
|
||||
" open_type VARCHAR(1),\n" +
|
||||
" pos_tipo_azienda INT,\n" +
|
||||
" pos_cliente INT\n" +
|
||||
" ) AS\n" +
|
||||
" BEGIN \n" +
|
||||
" WITH opzioni (cod_opz, descrizione, cod_parent, gest_name, entity_name, type,\n" +
|
||||
" picture_menu, picture_select, pos, tipo_azienda, flag_attivo, descrizione_estesa,\n" +
|
||||
" url_descrizione, object_type, flag_printer_setup, parameter, note, open_type,\n" +
|
||||
" pos_tipo_azienda, pos_cliente, ordinamento) AS\n" +
|
||||
" (SELECT menu.cod_opz,\n" +
|
||||
" menu.descrizione,\n" +
|
||||
" menu.cod_parent,\n" +
|
||||
" opz.gest_name,\n" +
|
||||
" opz.entity_name,\n" +
|
||||
" CASE WHEN opz.object_type = 'D' THEN 'S' ELSE 'F' END AS type,\n" +
|
||||
" opz.picture_menu,\n" +
|
||||
" opz.picture_select,\n" +
|
||||
" menu.pos,\n" +
|
||||
" menu.tipo_azienda,\n" +
|
||||
" menu.flag_attivo,\n" +
|
||||
" menu.descrizione_estesa,\n" +
|
||||
" menu.url_descrizione,\n" +
|
||||
" opz.object_type,\n" +
|
||||
" opz.flag_printer_setup,\n" +
|
||||
" opz.parameter,\n" +
|
||||
" opz.note,\n" +
|
||||
" opz.open_type,\n" +
|
||||
" menu.pos_tipo_azienda,\n" +
|
||||
" menu.pos_cliente,\n" +
|
||||
" CAST(CAST(menu.pos AS BINARY(15)) + CAST(menu.cod_parent AS BINARY(15)) +\n" +
|
||||
" CAST(menu.cod_opz AS BINARY(15)) AS VARBINARY(900)) AS ordinamento\n" +
|
||||
" FROM stb_menu AS menu INNER JOIN stb_menu_opz AS opz ON menu.cod_opz = opz.cod_opz\n" +
|
||||
" WHERE cod_parent = 'ROOT'\n" +
|
||||
" AND (@tipoazienda IS NULL OR menu.tipo_azienda = @tipoazienda) \n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT menu.cod_opz,\n" +
|
||||
" menu.descrizione,\n" +
|
||||
" menu.cod_parent,\n" +
|
||||
" opz.gest_name,\n" +
|
||||
" opz.entity_name,\n" +
|
||||
" CASE WHEN opz.object_type = 'D' THEN 'S' ELSE 'F' END AS type,\n" +
|
||||
" opz.picture_menu,\n" +
|
||||
" opz.picture_select,\n" +
|
||||
" menu.pos,\n" +
|
||||
" menu.tipo_azienda,\n" +
|
||||
" menu.flag_attivo,\n" +
|
||||
" menu.descrizione_estesa,\n" +
|
||||
" menu.url_descrizione,\n" +
|
||||
" opz.object_type,\n" +
|
||||
" opz.flag_printer_setup,\n" +
|
||||
" opz.parameter,\n" +
|
||||
" opz.note,\n" +
|
||||
" opz.open_type,\n" +
|
||||
" menu.pos_tipo_azienda,\n" +
|
||||
" menu.pos_cliente,\n" +
|
||||
" CAST(opzioni.ordinamento + CAST(menu.pos AS BINARY(15)) AS VARBINARY(900)) AS ordinamento\n" +
|
||||
" FROM stb_menu AS menu\n" +
|
||||
" INNER JOIN opzioni ON menu.cod_parent = opzioni.cod_opz\n" +
|
||||
" INNER JOIN stb_menu_opz AS opz ON menu.cod_opz = opz.cod_opz\n" +
|
||||
" WHERE (@tipoazienda IS NULL OR menu.tipo_azienda = @tipoazienda))\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" INSERT\n" +
|
||||
" INTO @treeviewmenu (cod_opz, descrizione, cod_parent, gest_name, entity_name, type,\n" +
|
||||
" picture_menu, picture_select, pos, tipo_azienda, flag_attivo, descrizione_estesa,\n" +
|
||||
" url_descrizione, object_type, flag_printer_setup, parameter, note, open_type,\n" +
|
||||
" pos_tipo_azienda, pos_cliente) \n" +
|
||||
" SELECT cod_opz,\n" +
|
||||
" descrizione,\n" +
|
||||
" cod_parent,\n" +
|
||||
" gest_name,\n" +
|
||||
" entity_name,\n" +
|
||||
" type,\n" +
|
||||
" picture_menu,\n" +
|
||||
" picture_select,\n" +
|
||||
" ROW_NUMBER() OVER (ORDER BY ordinamento) AS pos,\n" +
|
||||
" tipo_azienda,\n" +
|
||||
" flag_attivo,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" url_descrizione,\n" +
|
||||
" object_type,\n" +
|
||||
" flag_printer_setup,\n" +
|
||||
" parameter,\n" +
|
||||
" note,\n" +
|
||||
" open_type,\n" +
|
||||
" pos_tipo_azienda,\n" +
|
||||
" pos_cliente\n" +
|
||||
" FROM opzioni\n" +
|
||||
" ORDER BY ordinamento\n" +
|
||||
" RETURN\n" +
|
||||
" END");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240318134309 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (existsColumn("stb_menu", "gest_name"))
|
||||
dropColumn("stb_menu", "gest_name");
|
||||
if (existsColumn("stb_menu", "entity_name"))
|
||||
dropColumn("stb_menu", "entity_name");
|
||||
if (existsColumn("stb_menu", "type"))
|
||||
dropColumn("stb_menu", "type");
|
||||
if (existsColumn("stb_menu", "picture_menu"))
|
||||
dropColumn("stb_menu", "picture_menu");
|
||||
if (existsColumn("stb_menu", "picture_select"))
|
||||
dropColumn("stb_menu", "picture_select");
|
||||
if (existsColumn("stb_menu", "object_type"))
|
||||
dropColumn("stb_menu", "object_type");
|
||||
if (existsColumn("stb_menu", "flag_printer_setup"))
|
||||
dropColumn("stb_menu", "flag_printer_setup");
|
||||
if (existsColumn("stb_menu", "parameter"))
|
||||
dropColumn("stb_menu", "parameter");
|
||||
if (existsColumn("stb_menu", "note"))
|
||||
dropColumn("stb_menu", "note");
|
||||
if (existsColumn("stb_menu", "open_type"))
|
||||
dropColumn("stb_menu", "open_type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240319171620 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
String value = "S";
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Gramm_Gramm)){
|
||||
value = "N";
|
||||
}
|
||||
|
||||
createSetup("PVM", "MONITORAGGIO_LINEE_V2", "ABILITA_MODIFICA_ARTICOLI", value,
|
||||
"Se la setup è abilitata permette di attivare il pulsante di modifica dell'articolo nel dettaglio del monitoraggio linee",
|
||||
"SI_NO", false, true);
|
||||
|
||||
createSetup("PVM", "MONITORAGGIO_LINEE_V2", "ABILITA_DUPLICA_ORDINE", value,
|
||||
"Se la setup è abilitata permette di attivare il pulsante di duplicazione dell'ordine in storico ordini del monitoraggio linee",
|
||||
"SI_NO", false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240320120818 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
String sql = "ALTER TABLE dtb_fatture_passive_ddt ALTER COLUMN numero VARCHAR(40)";
|
||||
|
||||
executeStatement(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240320141352 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("svw_menu_no_pb", "CREATE view [dbo].[svw_menu_no_pb] as \n" +
|
||||
"WITH GerarchiaMenu AS (SELECT sm.cod_opz,\n" +
|
||||
" sm.descrizione,\n" +
|
||||
" sm.cod_parent,\n" +
|
||||
" smo.gest_name,\n" +
|
||||
" CASE WHEN smo.object_type = 'D' THEN 'S' ELSE 'F' END AS type,\n" +
|
||||
" sm.tipo_azienda,\n" +
|
||||
" sm.flag_attivo,\n" +
|
||||
" sm.pos,\n" +
|
||||
" sm_g.pos AS pos_gruppo,\n" +
|
||||
" sm_g.descrizione AS gruppo\n" +
|
||||
" FROM stb_menu sm\n" +
|
||||
" INNER JOIN stb_menu_opz smo ON sm.cod_opz = smo.cod_opz \n" +
|
||||
" INNER JOIN stb_menu sm_g ON sm.cod_parent = sm_g.cod_opz AND\n" +
|
||||
" sm.tipo_azienda = sm_g.tipo_azienda\n" +
|
||||
" WHERE sm.cod_parent in ( 'MM007', 'WM002')\n" +
|
||||
" AND sm.tipo_azienda = (select tipo_azienda from azienda)\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT sm_c.cod_opz,\n" +
|
||||
" sm_c.descrizione,\n" +
|
||||
" sm_c.cod_parent,\n" +
|
||||
" smo.gest_name,\n" +
|
||||
" CASE WHEN smo.object_type = 'D' THEN 'S' ELSE 'F' END AS type,\n" +
|
||||
" sm_c.tipo_azienda,\n" +
|
||||
" sm_c.flag_attivo,\n" +
|
||||
" sm_c.pos,\n" +
|
||||
" sm_g.pos AS pos_gruppo,\n" +
|
||||
" sm_g.descrizione AS gruppo\n" +
|
||||
" FROM stb_menu sm_c\n" +
|
||||
" INNER JOIN GerarchiaMenu gm ON sm_c.cod_parent = gm.cod_opz\n" +
|
||||
" INNER JOIN stb_menu_opz smo on sm_c.cod_opz = smo.cod_opz\n" +
|
||||
" INNER JOIN stb_menu sm_g ON sm_c.cod_parent = sm_g.cod_opz AND\n" +
|
||||
" sm_c.tipo_azienda = sm_g.tipo_azienda\n" +
|
||||
" WHERE sm_c.tipo_azienda = gm.tipo_azienda)\n" +
|
||||
"SELECT DISTINCT gm.cod_opz,\n" +
|
||||
" descrizione,\n" +
|
||||
" cod_parent,\n" +
|
||||
" gm.gest_name,\n" +
|
||||
" gm.type,\n" +
|
||||
" tipo_azienda,\n" +
|
||||
" gm.pos,\n" +
|
||||
" gm.pos_gruppo,\n" +
|
||||
" gm.gruppo\n" +
|
||||
"FROM GerarchiaMenu gm\n" +
|
||||
"WHERE gm.gest_name IS NOT NULL\n" +
|
||||
" AND gm.flag_attivo = 'S'");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.entity.StbCalrOreGg;
|
||||
import it.integry.ems_model.entity.StbCalt;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
public class Migration_20240321144750 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB()) return;
|
||||
if (!isCustomer(IntegryCustomer.Tosca)) return;
|
||||
|
||||
|
||||
String currentDbName = advancedDataSource.getDataSource().getDbName();
|
||||
IntegryCustomerDB db = Arrays.stream(IntegryCustomer.Tosca.getValues()).filter(x -> x.getValue().equalsIgnoreCase(currentDbName)).findFirst().orElse(null);
|
||||
|
||||
LocalDate giorno = UtilityLocalDate.getNow();
|
||||
LocalTime ora;
|
||||
switch (db) {
|
||||
|
||||
case Tosca_Ce:
|
||||
ora = LocalTime.of(7, 0);
|
||||
|
||||
break;
|
||||
case Tosca_Mi:
|
||||
ora = LocalTime.of(6, 30);
|
||||
break;
|
||||
case Tosca_Fc:
|
||||
ora = LocalTime.of(4, 0);
|
||||
break;
|
||||
case Tosca_Vr:
|
||||
case Tosca_Cz:
|
||||
case Tosca_Rg:
|
||||
case Tosca_Rm:
|
||||
case Tosca_Ba:
|
||||
default:
|
||||
ora = LocalTime.of(6, 0);
|
||||
}
|
||||
|
||||
String sql = "SELECT MAX(id_riga) from stb_calr_ore_gg where cod_Cal = 'DEFAULT'";
|
||||
Integer idRiga = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(), sql);
|
||||
|
||||
if (idRiga == null) {
|
||||
throw new Exception("Calendario DEFAULT non configurato!");
|
||||
}
|
||||
|
||||
StbCalt calendario = new StbCalt();
|
||||
calendario.setOperation(OperationType.NO_OP);
|
||||
calendario.setCodCal("DEFAULT");
|
||||
calendario.setStbCalrOreGg(new ArrayList<>());
|
||||
StbCalrOreGg firstWorkingHour = new StbCalrOreGg();
|
||||
firstWorkingHour
|
||||
.setCodCal("DEFAULT")
|
||||
.setOra(Date.from(giorno.atTime(ora).atZone(ZoneId.systemDefault()).toInstant()))
|
||||
.setFlagTipoOra("L")
|
||||
.setIdRiga(idRiga + 1)
|
||||
.setOperation(OperationType.INSERT);
|
||||
calendario.getStbCalrOreGg().add(firstWorkingHour);
|
||||
|
||||
calendario.manageWithParentConnection(advancedDataSource.getConnection());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240321153954 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (existsTable("ttb_style")){
|
||||
createOrUpdateFunction("ftx_getDisponibilitaArticoli", "CREATE FUNCTION [dbo].[ftx_getDisponibilitaArticoli](@dataValidita datetime,\n" +
|
||||
" @codMdep varchar(8000),\n" +
|
||||
" @annoStag varchar(10),\n" +
|
||||
" @codMart varchar(15),\n" +
|
||||
" @codTagl varchar(15),\n" +
|
||||
" @codCol varchar(15),\n" +
|
||||
" @barcode varchar(15))\n" +
|
||||
" RETURNS TABLE AS \n" +
|
||||
" return \n" +
|
||||
" (WITH articoli AS (\n" +
|
||||
" SELECT ttb_style.anno_stag,\n" +
|
||||
" ttb_style.cod_style,\n" +
|
||||
" ttb_style_colori.cod_col,\n" +
|
||||
" ttb_style_taglie.cod_tagl,\n" +
|
||||
" mtb_part_dt.qta_ord_for,\n" +
|
||||
" mtb_part_dt.cod_mdep\n" +
|
||||
" FROM ttb_style,\n" +
|
||||
" ttb_style_colori,\n" +
|
||||
" ttb_style_taglie,\n" +
|
||||
" mtb_part_dt\n" +
|
||||
" WHERE (@codMdep is null or mtb_part_dt.cod_mdep IN ( SELECT value_string as cod_mdep FROM ParseStringIntoArray(@codMdep, ',')))\n" +
|
||||
" AND (@codMart is null or ttb_style.cod_style = @codMart)\n" +
|
||||
" AND (@codCol is null or ttb_style_colori.cod_col = @codCol)\n" +
|
||||
" AND (@codTagl is null or ttb_style_taglie.cod_tagl = @codTagl)\n" +
|
||||
" AND (@annoStag is null or ttb_style.anno_stag = @annoStag)\n" +
|
||||
" AND ttb_style.cod_style = mtb_part_dt.cod_mart\n" +
|
||||
" AND ttb_style_colori.cod_col = mtb_part_dt.cod_col\n" +
|
||||
" AND ttb_style_taglie.cod_tagl = mtb_part_dt.cod_tagl\n" +
|
||||
" AND ttb_style.cod_style = ttb_style_colori.cod_style\n" +
|
||||
" AND ttb_style.cod_style = ttb_style_taglie.cod_style\n" +
|
||||
" ),\n" +
|
||||
" colli AS (\n" +
|
||||
" SELECT mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" sum(mtb_colr.qta_col) AS qta,\n" +
|
||||
" mtb_colt.cod_mdep\n" +
|
||||
" FROM mtb_colt left outer join dtb_tipi on mtb_colt.cod_dtip = dtb_tipi.cod_dtip,\n" +
|
||||
" mtb_colr\n" +
|
||||
" WHERE mtb_colt.gestione = mtb_colr.gestione\n" +
|
||||
" AND mtb_colt.data_collo = mtb_colr.data_collo\n" +
|
||||
" AND mtb_colt.ser_collo = mtb_colr.ser_collo\n" +
|
||||
" AND mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||
" AND mtb_colt.gestione = 'V'\n" +
|
||||
" AND (@codMdep is null or mtb_colt.cod_mdep IN ( SELECT value_string as cod_mdep FROM ParseStringIntoArray(@codMdep, ','))) \n" +
|
||||
" AND (mtb_colt.cod_dtip IS NULL OR (dtb_tipi.segno_qta_car = 0 AND dtb_tipi.segno_qta_scar = 0 ))\n" +
|
||||
" AND (@codMart is null or mtb_colr.cod_mart = @codMart) \n" +
|
||||
" AND (@codCol is null or mtb_colr.cod_col = @codCol) \n" +
|
||||
" AND (@codTagl is null or mtb_colr.cod_tagl = @codTagl)\n" +
|
||||
" GROUP BY mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colt.cod_mdep\n" +
|
||||
" ),\n" +
|
||||
" prenotazione AS (\n" +
|
||||
" SELECT wdtb_ordr.cod_mart,\n" +
|
||||
" wdtb_ordr.cod_col,\n" +
|
||||
" wdtb_ordr.cod_tagl,\n" +
|
||||
" sum(wdtb_ordr.qta_ord) AS qta,\n" +
|
||||
" Wdtb_ordt.cod_mdep\n" +
|
||||
" FROM wdtb_ordt,\n" +
|
||||
" wdtb_ordr\n" +
|
||||
" WHERE wdtb_ordt.gestione = wdtb_ordr.gestione\n" +
|
||||
" AND wdtb_ordt.data_ord = wdtb_ordr.data_ord\n" +
|
||||
" AND wdtb_ordt.num_ord = wdtb_ordr.num_ord\n" +
|
||||
" AND wdtb_ordt.gestione = 'V'\n" +
|
||||
" AND (@codMdep is null or wdtb_ordt.cod_mdep IN ( SELECT value_string as cod_mdep FROM ParseStringIntoArray(@codMdep, ','))) \n" +
|
||||
" AND wdtb_ordt.flag_elaborato = 'N' AND\n" +
|
||||
" (@codMart is null or wdtb_ordr.cod_mart = @codMart) AND\n" +
|
||||
" (@codCol is null or wdtb_ordr.cod_col = @codCol) AND\n" +
|
||||
" (@codTagl is null or wdtb_ordr.cod_tagl = @codTagl)\n" +
|
||||
" GROUP BY wdtb_ordr.cod_mart,\n" +
|
||||
" wdtb_ordr.cod_col,\n" +
|
||||
" wdtb_ordr.cod_tagl,\n" +
|
||||
" Wdtb_ordt.cod_mdep\n" +
|
||||
" ),\n" +
|
||||
" ordine AS (\n" +
|
||||
" SELECT dtb_ordr.cod_mart,\n" +
|
||||
" dtb_ordr.cod_col,\n" +
|
||||
" dtb_ordr.cod_tagl,\n" +
|
||||
" CASE WHEN sum(CASE WHEN dtb_ordr.flag_evaso = 'I' OR ( dtb_ordr.flag_evaso = 'A' AND dtb_ordr.qta_acc > 0 ) THEN dtb_ordr.qta_ord - dtb_ordr.qta_evasa - dtb_ordr.qta_col ELSE 0 END ) > 0 THEN \n" +
|
||||
" sum(CASE WHEN dtb_ordr.flag_evaso = 'I' OR ( dtb_ordr.flag_evaso= 'A' AND dtb_ordr.qta_acc > 0 ) THEN dtb_ordr.qta_ord - dtb_ordr.qta_evasa - dtb_ordr.qta_col ELSE 0 END ) ELSE 0 END as qta, \n" +
|
||||
" sum(dtb_ordr.qta_acc) as qta_acc,\n" +
|
||||
" /*sum(dtb_ordr.qta_acc - dtb_ordr.qta_col) as qta_acc,*/\n" +
|
||||
" dtb_ordt.cod_mdep\n" +
|
||||
" FROM dtb_ordt,\n" +
|
||||
" dtb_ordr\n" +
|
||||
" WHERE dtb_ordt.gestione = dtb_ordr.gestione\n" +
|
||||
" AND dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||
" AND dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
" AND dtb_ordt.gestione = 'V'\n" +
|
||||
" AND (@codMdep is null or dtb_ordt.cod_mdep IN ( SELECT value_string as cod_mdep FROM ParseStringIntoArray(@codMdep, ','))) \n" +
|
||||
" /* AND dtb_ordr.flag_evaso = 'I'*/\n" +
|
||||
" AND dtb_ordt.flag_annulla = 'N' AND\n" +
|
||||
" (@codMart is null or dtb_ordr.cod_mart = @codMart) AND\n" +
|
||||
" (@codCol is null or dtb_ordr.cod_col = @codCol) AND\n" +
|
||||
" (@codTagl is null or dtb_ordr.cod_tagl = @codTagl)\n" +
|
||||
" GROUP BY dtb_ordr.cod_mart,\n" +
|
||||
" dtb_ordr.cod_col,\n" +
|
||||
" dtb_ordr.cod_tagl,\n" +
|
||||
" dtb_ordt.cod_mdep\n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
" /* INSERT\n" +
|
||||
" INTO @returnTable */\n" +
|
||||
" SELECT articoli.anno_stag,\n" +
|
||||
" articoli.cod_style,\n" +
|
||||
" articoli.cod_col,\n" +
|
||||
" articoli.cod_tagl,\n" +
|
||||
" ttb_bar_code.cod_barre,\n" +
|
||||
" articoli.cod_mdep,\n" +
|
||||
" IsNull(giacenza.qta_fine, 0) as giacenza,\n" +
|
||||
" ISNULL(articoli.qta_ord_for, 0) as ord_forn,\n" +
|
||||
" IsNull(ordine.qta, 0) as ordini,\n" +
|
||||
" IsNull(prenotazione.qta, 0) as ordini_web,\n" +
|
||||
" IsNull(ordine.qta_acc, 0) as accant_su_ordine,\n" +
|
||||
" IsNull(colli.qta, 0) as colli,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN \n" +
|
||||
" (SELECT value AS flag FROM stb_gest_setup WHERE gest_name = 'DATI_AZIENDA' AND SECTION = 'CALCOLO_DISPONIBILITA' AND key_section = 'INCLUDI_QTA_ORD_FOR') = 'S'\n" +
|
||||
" THEN \n" +
|
||||
" CASE WHEN (SELECT value AS flag FROM stb_gest_setup WHERE gest_name = 'DATI_AZIENDA' AND SECTION = 'CALCOLO_DISPONIBILITA' AND key_section = 'INCLUDI_QTA_COLLI') = 'S' THEN\n" +
|
||||
" IsNull(giacenza.qta_fine, 0) + ISNULL(articoli.qta_ord_for, 0) - IsNull(ordine.qta, 0) - IsNull(prenotazione.qta, 0) - IsNull(colli.qta, 0)\n" +
|
||||
" ELSE\n" +
|
||||
" IsNull(giacenza.qta_fine, 0) + ISNULL(articoli.qta_ord_for, 0) - IsNull(ordine.qta, 0) - IsNull(prenotazione.qta, 0)\n" +
|
||||
" END \n" +
|
||||
" ELSE \n" +
|
||||
" CASE WHEN (SELECT value AS flag FROM stb_gest_setup WHERE gest_name = 'DATI_AZIENDA' AND SECTION = 'CALCOLO_DISPONIBILITA' AND key_section = 'INCLUDI_QTA_COLLI') = 'S' THEN\n" +
|
||||
" IsNull(giacenza.qta_fine, 0) - IsNull(ordine.qta, 0) - IsNull(prenotazione.qta, 0) - IsNull(colli.qta, 0)\n" +
|
||||
" ELSE\n" +
|
||||
" IsNull(giacenza.qta_fine, 0) - IsNull(ordine.qta, 0) - IsNull(prenotazione.qta, 0)\n" +
|
||||
" END \n" +
|
||||
" END AS qta_disp,\n" +
|
||||
" IsNull(giacenza.qta_fine, 0) - IsNull(ordine.qta_acc, 0) - IsNull(colli.qta, 0) as qta_distrib_su_ordini\n" +
|
||||
" FROM articoli\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN ttb_bar_code ON articoli.cod_style = ttb_bar_code.cod_style\n" +
|
||||
" AND articoli.cod_col = ttb_bar_code.cod_col\n" +
|
||||
" AND articoli.cod_tagl = ttb_bar_code.cod_tagl\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN getsitartadataDett(@dataValidita, @codMdep) giacenza ON articoli.cod_style = giacenza.cod_mart\n" +
|
||||
" AND articoli.cod_col = giacenza.cod_col\n" +
|
||||
" AND articoli.cod_tagl = giacenza.cod_tagl\n" +
|
||||
" AND articoli.cod_mdep = giacenza.cod_mdep\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN ordine ON articoli.cod_style = ordine.cod_mart\n" +
|
||||
" AND articoli.cod_col = ordine.cod_col\n" +
|
||||
" AND articoli.cod_tagl = ordine.cod_tagl\n" +
|
||||
" AND articoli.cod_mdep = ordine.cod_mdep\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN prenotazione ON articoli.cod_style = prenotazione.cod_mart\n" +
|
||||
" AND articoli.cod_col = prenotazione.cod_col\n" +
|
||||
" AND articoli.cod_tagl = prenotazione.cod_tagl\n" +
|
||||
" AND articoli.cod_mdep = prenotazione.cod_mdep\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN colli ON articoli.cod_style = colli.cod_mart\n" +
|
||||
" AND articoli.cod_col = colli.cod_col\n" +
|
||||
" AND articoli.cod_tagl = colli.cod_tagl\n" +
|
||||
" AND articoli.cod_mdep = colli.cod_mdep\n" +
|
||||
" WHERE (@barcode is null or ttb_bar_code.cod_barre = @barcode)\n" +
|
||||
" \n" +
|
||||
" )");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240322100900 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
addDefault("azienda", "flag_regime_speciale_iva", "N");
|
||||
executeStatement(
|
||||
"UPDATE azienda SET flag_regime_speciale_iva = 'N' WHERE flag_regime_speciale_iva is null ",
|
||||
"ALTER TABLE azienda ALTER COLUMN flag_regime_speciale_iva varchar(1) NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240322152821 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("PVM", "MRP", "GRUPPI_CONTROLLO_DATI_SCHEDATECNICA", "",
|
||||
"Se la setup è abilitata attiva un controllo, sui gruppi merceologici selezionati, per dei campi nell'anagrafica dell'articolo",
|
||||
"COD_MGRP", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240325130406 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE dtb_doct\n" +
|
||||
" ALTER COLUMN annotazioni VARCHAR(1024)",
|
||||
"ALTER TABLE dtb_dift\n" +
|
||||
" ALTER COLUMN annotazioni VARCHAR(1024)",
|
||||
"ALTER TABLE dtb_dif_bolle\n" +
|
||||
" ALTER COLUMN annotazioni VARCHAR(1024)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240326120018 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
executeStatement("ALTER TABLE vtb_agen_budget ADD flag_tipologia varchar(1) null default 'B'",
|
||||
"UPDATE vtb_agen_budget SET flag_tipologia = 'B'",
|
||||
"ALTER TABLE vtb_agen_budget ALTER COLUMN flag_tipologia varchar(1) not null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240326123713 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("ordify_getScontiCliente", "CREATE FUNCTION [dbo].[ordify_getScontiCliente](@dataValidita datetime, @codVage varchar(5), @codAnag varchar(5), @codVdes varchar(5),\n" +
|
||||
" @codMart varchar(15))\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS\n" +
|
||||
" RETURN\n" +
|
||||
" (\n" +
|
||||
"\n" +
|
||||
" with promo as (\n" +
|
||||
" select vtb_promo.cod_promo,\n" +
|
||||
" vtb_promo.descrizione,\n" +
|
||||
" vtb_promo.flag_sconto_contrattuale,\n" +
|
||||
" vtb_promo.data_iniz_sell_in,\n" +
|
||||
" vtb_promo.data_fine_sell_in,\n" +
|
||||
" vtb_promo.flag_tipo_promo,\n" +
|
||||
" vtb_promo.um_vend,\n" +
|
||||
" vtb_promo.qta_vend,\n" +
|
||||
" vtb_promo.um_omaggio,\n" +
|
||||
" vtb_promo.qta_omaggio,\n" +
|
||||
" vtb_promo.prz_bloccato\n" +
|
||||
" from vtb_promo\n" +
|
||||
" where vtb_promo.flag_attivo = 'S'\n" +
|
||||
" AND ISNULL(@dataValidita, dbo.f_convertDatetimeToDate(GETDATE())) BETWEEN vtb_promo.data_iniz_sell_in AND vtb_promo.data_fine_sell_in\n" +
|
||||
" and vtb_promo.cod_promo not in (select cod_promo from vtb_list_data WHERE cod_promo is not null)),\n" +
|
||||
" clienti AS (\n" +
|
||||
" select vtb_promo_clienti.*\n" +
|
||||
" from vtb_promo_clienti\n" +
|
||||
" inner join vtb_clie on vtb_promo_clienti.cod_anag = vtb_clie.cod_anag\n" +
|
||||
" inner join vtb_dest on vtb_promo_clienti.cod_anag = vtb_dest.cod_anag and\n" +
|
||||
" vtb_promo_clienti.cod_vdes = vtb_dest.cod_vdes\n" +
|
||||
" where (@codAnag is null or vtb_promo_clienti.cod_anag = @codAnag)\n" +
|
||||
" AND (@codVdes is null or vtb_promo_clienti.cod_vdes = @codVdes)\n" +
|
||||
" AND (@codVage is null or IsNull(vtb_dest.cod_vage, vtb_clie.cod_vage) = @codVage)\n" +
|
||||
" AND vtb_clie.flag_stato = 'A'\n" +
|
||||
" AND vtb_dest.flag_attivo = 'S'),\n" +
|
||||
" articoli as (\n" +
|
||||
" select vtb_promo_articoli.*\n" +
|
||||
" from vtb_promo_articoli\n" +
|
||||
" inner join mtb_aart on vtb_promo_articoli.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" where (@codMart is null or vtb_promo_articoli.cod_mart = @codMart)\n" +
|
||||
" AND mtb_aart.flag_stato = 'A'),\n" +
|
||||
" promo_sconti as (\n" +
|
||||
" select vtb_promo_sconti.cod_promo,\n" +
|
||||
" promo.descrizione,\n" +
|
||||
" promo.um_vend,\n" +
|
||||
" promo.um_omaggio,\n" +
|
||||
" vtb_promo_sconti.da_qta,\n" +
|
||||
" vtb_promo_sconti.a_qta,\n" +
|
||||
" case\n" +
|
||||
" when promo.flag_sconto_contrattuale = 'S' THEN perc_sco1\n" +
|
||||
" else null end as perc_sco1,\n" +
|
||||
" case\n" +
|
||||
" when promo.flag_sconto_contrattuale = 'S' THEN perc_sco2\n" +
|
||||
" else null end as perc_sco2,\n" +
|
||||
" case\n" +
|
||||
" when promo.flag_sconto_contrattuale = 'S' THEN perc_sco3\n" +
|
||||
" else null end as perc_sco3,\n" +
|
||||
" case\n" +
|
||||
" when promo.flag_sconto_contrattuale = 'S' THEN NULL\n" +
|
||||
" else perc_sco4 end as perc_sco4,\n" +
|
||||
" null as prz_bloccato,\n" +
|
||||
" Cast(case when promo.flag_tipo_promo = 'M' THEN 1 ELSE 0 END as bit) as is_omaggio,\n" +
|
||||
" promo.qta_omaggio,\n" +
|
||||
" promo.flag_tipo_promo,\n" +
|
||||
" promo.flag_sconto_contrattuale\n" +
|
||||
" from promo\n" +
|
||||
" inner join vtb_promo_sconti on promo.cod_promo = vtb_promo_sconti.cod_promo\n" +
|
||||
" where promo.flag_tipo_promo = 'E'\n" +
|
||||
" union all\n" +
|
||||
" select promo.cod_promo,\n" +
|
||||
" promo.descrizione,\n" +
|
||||
" promo.um_vend as um_vend,\n" +
|
||||
" promo.um_omaggio,\n" +
|
||||
" promo.qta_vend as da_qta,\n" +
|
||||
" 0 as a_qta,\n" +
|
||||
" null as perc_sco1,\n" +
|
||||
" null as perc_sco2,\n" +
|
||||
" null as perc_sco3,\n" +
|
||||
" null as perc_sco4,\n" +
|
||||
" promo.prz_bloccato as prz_bloccato,\n" +
|
||||
" Cast(case when promo.flag_tipo_promo = 'M' THEN 1 ELSE 0 END as bit) as is_omaggio,\n" +
|
||||
" promo.qta_omaggio,\n" +
|
||||
" promo.flag_tipo_promo,\n" +
|
||||
" promo.flag_sconto_contrattuale\n" +
|
||||
" from promo\n" +
|
||||
" where promo.flag_tipo_promo <> 'E'\n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
" select clienti.cod_anag,\n" +
|
||||
" clienti.cod_vdes,\n" +
|
||||
" articoli.cod_mart,\n" +
|
||||
" promo_sconti.*\n" +
|
||||
" from promo_sconti\n" +
|
||||
" inner join clienti on promo_sconti.cod_promo = clienti.cod_promo\n" +
|
||||
" inner join articoli on promo_sconti.cod_promo = articoli.cod_promo \n" +
|
||||
" )");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240326130416 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
if (!isCustomerDb(
|
||||
IntegryCustomerDB.Salpar_VgAlimenti))
|
||||
return;
|
||||
|
||||
executeStatement("UPDATE vtb_agen_budget SET flag_tipologia = 'S' where flag_tipologia = 'B'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240326131400 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(
|
||||
IntegryCustomerDB.Salpar_VgAlimenti))
|
||||
return;
|
||||
|
||||
createOrUpdateProcedure("x_puddy3_prev_popolate_plafond_reso", "CREATE PROCEDURE [dbo].[x_puddy3_prev_popolate_plafond_reso] AS\n" +
|
||||
"BEGIN\n" +
|
||||
" create table #tempTable\n" +
|
||||
" ( cod_vage varchar(5) not null, \n" +
|
||||
" anno integer not null, \n" +
|
||||
" mese integer not null,\n" +
|
||||
" importo_plafond numeric(20,5) not null default 0, \n" +
|
||||
" importo_plafond_residuo numeric(20, 5) not null default 0);\n" +
|
||||
"\n" +
|
||||
" insert into #tempTable\n" +
|
||||
" select vtb_agen_budget.cod_vage,\n" +
|
||||
" vtb_agen_budget.anno, \n" +
|
||||
" vtb_agen_budget.mese,\n" +
|
||||
" vtb_agen_budget.importo as importo_plafond,\n" +
|
||||
" vtb_agen_budget.importo - ISNULL(plafondMensile.importo_plafond_utilizzato, 0) as importo_plafond_utilizzato\n" +
|
||||
" from vtb_agen_budget left outer join (select dtb_doct.cod_vage, \n" +
|
||||
" DATEPART(YEAR, dtb_doct.data_doc) as anno, \n" +
|
||||
" DATEPART(month, dtb_doct.data_doc) as mese, \n" +
|
||||
" sum(round(qta_doc * val_unt, 2)) as importo_plafond_utilizzato\n" +
|
||||
" from dtb_doct inner join dtb_docr on dtb_doct.cod_dtip = dtb_docr.cod_dtip and\n" +
|
||||
" dtb_doct.cod_anag = dtb_docr.cod_anag and\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc and\n" +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc and\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc \n" +
|
||||
" inner join dtb_tipi on dtb_doct.cod_dtip = dtb_tipi.cod_dtip \n" +
|
||||
" where tipo_emissione = 'DIRETTA' and\n" +
|
||||
" dtb_doct.gestione = 'V' and\n" +
|
||||
" dtb_doct.data_doc >= CONVERT(datetime, CONVERT(varchar, DATEPART(year, DATEADD(MONTH, -9, GETDATE()))) + '-' + CONVERT(varchar, DATEPART(month, DATEADD(MONTH, -9, GETDATE()))) + '-01') and\n" +
|
||||
" dtb_tipi.segno_qta_scar = -1 and\n" +
|
||||
" dtb_doct.cod_vage is not null and\n" +
|
||||
" dtb_doct.cod_anag not in (select cod_anag from x_puddy3_prev_plafond_reso_clienti_esclusi)\n" +
|
||||
" group by dtb_doct.cod_vage, \n" +
|
||||
" DATEPART(YEAR, dtb_doct.data_doc),\n" +
|
||||
" DATEPART(month, dtb_doct.data_doc))plafondMensile on plafondMensile.cod_vage = vtb_agen_budget.cod_vage and\n" +
|
||||
" plafondMensile.anno = vtb_agen_budget.anno and\n" +
|
||||
" plafondMensile.mese = vtb_agen_budget.mese\n" +
|
||||
" where vtb_agen_budget.flag_tipologia = 'R'\n" +
|
||||
"\n" +
|
||||
" delete from x_puddy3_prev_plafond_reso \n" +
|
||||
" from x_puddy3_prev_plafond_reso inner join (select distinct cod_vage, anno, mese from #tempTable)mesi on x_puddy3_prev_plafond_reso.cod_vage = mesi.cod_vage and\n" +
|
||||
" x_puddy3_prev_plafond_reso.anno = mesi.anno and\n" +
|
||||
" x_puddy3_prev_plafond_reso.mese = mesi.mese\n" +
|
||||
"\n" +
|
||||
" insert into x_puddy3_prev_plafond_reso \n" +
|
||||
" select * from #tempTable;\n" +
|
||||
"END");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240326131414 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(
|
||||
IntegryCustomerDB.Salpar_VgAlimenti))
|
||||
return;
|
||||
|
||||
createOrUpdateProcedure("x_puddy3_prev_popolate_plafond_sconto_fresc", "CREATE PROCEDURE [dbo].[x_puddy3_prev_popolate_plafond_sconto_fresc] AS\n" +
|
||||
"BEGIN\n" +
|
||||
" create table #tempTable\n" +
|
||||
" ( cod_vage varchar(5) not null, \n" +
|
||||
" anno integer not null, \n" +
|
||||
" mese integer not null,\n" +
|
||||
" importo_plafond numeric(20,5) not null default 0, \n" +
|
||||
" importo_plafond_residuo numeric(20, 5) not null default 0);\n" +
|
||||
"\n" +
|
||||
" insert into #tempTable\n" +
|
||||
" select vtb_agen_budget.cod_vage,\n" +
|
||||
" vtb_agen_budget.anno, \n" +
|
||||
" vtb_agen_budget.mese,\n" +
|
||||
" vtb_agen_budget.importo as importo_plafond,\n" +
|
||||
" vtb_agen_budget.importo - ISNULL(plafondMensile.importo_plafond_utilizzato, 0) as importo_plafond_utilizzato\n" +
|
||||
" from vtb_agen_budget left outer join (select dtb_doct.cod_vage, \n" +
|
||||
" DATEPART(YEAR, dtb_doct.data_doc) as anno, \n" +
|
||||
" DATEPART(month, dtb_doct.data_doc) as mese, \n" +
|
||||
" sum(round(qta_doc * val_unt, 2)) as importo_plafond_utilizzato\n" +
|
||||
" from dtb_doct inner join dtb_docr on dtb_doct.cod_dtip = dtb_docr.cod_dtip and\n" +
|
||||
" dtb_doct.cod_anag = dtb_docr.cod_anag and\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc and\n" +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc and\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc \n" +
|
||||
" inner join dtb_tipi on dtb_doct.cod_dtip = dtb_tipi.cod_dtip \n" +
|
||||
" where tipo_emissione = 'DIRETTA' and\n" +
|
||||
" dtb_doct.gestione = 'V' and\n" +
|
||||
" dtb_doct.data_doc >= CONVERT(datetime, CONVERT(varchar, DATEPART(year, DATEADD(MONTH, -9, GETDATE()))) + '-' + CONVERT(varchar, DATEPART(month, DATEADD(MONTH, -9, GETDATE()))) + '-01') and\n" +
|
||||
" dtb_docr.sconto8 = 100 and\n" +
|
||||
" dtb_doct.cod_vage is not null and\n" +
|
||||
" dtb_doct.cod_anag not in (select cod_anag from x_puddy3_prev_plafond_sconto_fresc_clienti_esclusi)\n" +
|
||||
" group by dtb_doct.cod_vage, \n" +
|
||||
" DATEPART(YEAR, dtb_doct.data_doc),\n" +
|
||||
" DATEPART(month, dtb_doct.data_doc))plafondMensile on plafondMensile.cod_vage = vtb_agen_budget.cod_vage and\n" +
|
||||
" plafondMensile.anno = vtb_agen_budget.anno and\n" +
|
||||
" plafondMensile.mese = vtb_agen_budget.mese\n" +
|
||||
" where vtb_agen_budget.flag_tipologia = 'S'\n" +
|
||||
"\n" +
|
||||
" delete from x_puddy3_prev_plafond_sconto_fresc \n" +
|
||||
" from x_puddy3_prev_plafond_sconto_fresc inner join (select distinct cod_vage, anno, mese from #tempTable)mesi on x_puddy3_prev_plafond_sconto_fresc.cod_vage = mesi.cod_vage and\n" +
|
||||
" x_puddy3_prev_plafond_sconto_fresc.anno = mesi.anno and\n" +
|
||||
" x_puddy3_prev_plafond_sconto_fresc.mese = mesi.mese\n" +
|
||||
"\n" +
|
||||
" insert into x_puddy3_prev_plafond_sconto_fresc \n" +
|
||||
" select * from #tempTable;\n" +
|
||||
"END");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240326221910 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("PVM", "DOC_INTERNI", "GG_CHK_RESO", null,
|
||||
"Range di date per verificare la data di scadenza della partita di magazzino", true,
|
||||
null, true, false, false, false, false, "mtb_grup", false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240327101005 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Tosca,
|
||||
IntegryCustomer.Biolevante,
|
||||
IntegryCustomer.Cosmapack,
|
||||
IntegryCustomer.Dulciar,
|
||||
IntegryCustomer.Lamonarca,
|
||||
IntegryCustomer.RossoGargano))
|
||||
{
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "DELIMITED_IDENTIFIER", "1");
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "FLAG_ANSI_PADDING", "S");
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "FLAG_CONCAT_NULL_YIELDS_NULL", "S");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240328160115 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB()) return;
|
||||
|
||||
|
||||
createSetup("DATI_AZIENDA", "CHECK_VERSIONE_APP", "AGGIORNAMENTO_AUTO_NEW", "N",
|
||||
"Permette ai client di effettuare l'aggiornamento tramite la nuova procedura automatica. Disabilitare prima il flag AGGIORNAMENTO_AUTO",
|
||||
"SI_NO");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240402105910 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("ORDIFY", "SETUP", "ABILITA_SCONTO", "N",
|
||||
"Abilita i campi di inserimento sconto",
|
||||
"SI_NO");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240403140725 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB()) return;
|
||||
|
||||
|
||||
createSetup("IMPORT_DOCUMENTI VENDITA", "GELORENT", "ARTICOLO", "COD_MART",
|
||||
"Inserire COD_MART per cercare codice artioclo interno COD_ART_FOR per utlizzare codice articolo del fornitore", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240404122305 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
executeStatement(
|
||||
"UPDATE ctb_scad SET ctb_scad.data_doc = ctb_part.data_doc\n" +
|
||||
"FROM ctb_part\n" +
|
||||
" INNER JOIN ctb_scad ON ctb_part.tipo_anag = ctb_scad.tipo_anag AND ctb_part.cod_anag = ctb_scad.cod_anag AND\n" +
|
||||
" ctb_part.anno_part = ctb_scad.anno_part AND ctb_part.ser_doc = ctb_scad.ser_doc AND\n" +
|
||||
" ctb_part.num_doc = ctb_scad.num_doc\n" +
|
||||
" WHERE ctb_part.data_doc <> ctb_scad.data_doc\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240404131851 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Tosca,
|
||||
IntegryCustomer.Biolevante,
|
||||
IntegryCustomer.Cosmapack,
|
||||
IntegryCustomer.Dulciar,
|
||||
IntegryCustomer.Lamonarca,
|
||||
IntegryCustomer.RossoGargano,
|
||||
IntegryCustomer.Salpar,
|
||||
IntegryCustomer.FolliesGroup,
|
||||
IntegryCustomer.Vinella))
|
||||
{
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "DELIMITED_IDENTIFIER", "1");
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "FLAG_ANSI_PADDING", "S");
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "FLAG_CONCAT_NULL_YIELDS_NULL", "S");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240404171522 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("w_dordi_rc", "CHECK_DUPLICA", "ANNULLA_SERIE_AGENTE", "N",
|
||||
"Se impostata a S quando si duplica l''ordine viene annullata la serie dell''agente", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240404171949 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(
|
||||
IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
updateSetupValue("w_dordi_rc", "CHECK_DUPLICA", "ANNULLA_SERIE_AGENTE", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240404174428 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("w_ddocu_rc", "SETUP", "CHECK_DATA_REG_FUTURA", "S",
|
||||
"Se impostata a S quando si inserisce un documento con data registrazione o data documento futura chiede conferma", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user