Compare commits
1 Commits
master
...
20250218_1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a4184438f |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -119,8 +119,5 @@ fabric.properties
|
|||||||
# Integry
|
# Integry
|
||||||
*/target/*
|
*/target/*
|
||||||
*.ckie
|
*.ckie
|
||||||
|
/ts
|
||||||
/temp
|
/temp
|
||||||
/docker/tomcat/conf/integry/logs.db
|
|
||||||
/docker/tomcat/conf/integry/logs.db-journal
|
|
||||||
copilot.*.xml
|
|
||||||
/.idea/dataSources.xml
|
|
||||||
|
|||||||
0
.gitmodules
vendored
0
.gitmodules
vendored
6
.idea/copilot.data.migration.edit.xml
generated
6
.idea/copilot.data.migration.edit.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="EditMigrationStateService">
|
|
||||||
<option name="migrationStatus" value="COMPLETED" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
1822
.idea/inspectionProfiles/LocalDate_Checks.xml
generated
1822
.idea/inspectionProfiles/LocalDate_Checks.xml
generated
File diff suppressed because it is too large
Load Diff
2498
.idea/inspectionProfiles/Project_Default.xml
generated
2498
.idea/inspectionProfiles/Project_Default.xml
generated
File diff suppressed because it is too large
Load Diff
6
.idea/inspectionProfiles/profiles_settings.xml
generated
6
.idea/inspectionProfiles/profiles_settings.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<settings>
|
|
||||||
<option name="PROJECT_PROFILE" value="LocalDate Checks" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</settings>
|
|
||||||
</component>
|
|
||||||
18
.idea/runConfigurations/Tomcat.xml
generated
18
.idea/runConfigurations/Tomcat.xml
generated
@@ -16,30 +16,12 @@
|
|||||||
<log_file alias="Tomcat Localhost Access Log" path="%IDEA_RUN:CATALINA_BASE%/logs/localhost_access_log.*" />
|
<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" />
|
||||||
<predefined_log_file enabled="true" id="Tomcat Catalina" />
|
<predefined_log_file enabled="true" id="Tomcat Catalina" />
|
||||||
<RunnerSettings RunnerId="AppServerDebuggerRunner">
|
|
||||||
<option name="DEBUG_PORT" value="javadebug" />
|
|
||||||
</RunnerSettings>
|
|
||||||
<RunnerSettings RunnerId="Debug">
|
<RunnerSettings RunnerId="Debug">
|
||||||
<option name="DEBUG_PORT" value="javadebug" />
|
<option name="DEBUG_PORT" value="javadebug" />
|
||||||
</RunnerSettings>
|
</RunnerSettings>
|
||||||
<RunnerSettings RunnerId="JProfiler">
|
<RunnerSettings RunnerId="JProfiler">
|
||||||
<option name="jreHome" value="$USER_HOME$/.jdks/openjdk-21.0.2" />
|
<option name="jreHome" value="$USER_HOME$/.jdks/openjdk-21.0.2" />
|
||||||
</RunnerSettings>
|
</RunnerSettings>
|
||||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="AppServerDebuggerRunner">
|
|
||||||
<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="Cover">
|
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
|
||||||
<option name="USE_ENV_VARIABLES" value="true" />
|
<option name="USE_ENV_VARIABLES" value="true" />
|
||||||
<STARTUP>
|
<STARTUP>
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Tomcat9Import ( TomcatSrv)" type="Remote" folderName="Carelli">
|
|
||||||
<module name="ems-engine" />
|
|
||||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
|
||||||
<option name="SERVER_MODE" value="false" />
|
|
||||||
<option name="SHMEM_ADDRESS" />
|
|
||||||
<option name="HOST" value="172.16.30.239" />
|
|
||||||
<option name="PORT" value="8003" />
|
|
||||||
<option name="AUTO_RESTART" value="false" />
|
|
||||||
<RunnerSettings RunnerId="Debug">
|
|
||||||
<option name="DEBUG_PORT" value="8003" />
|
|
||||||
<option name="LOCAL" value="false" />
|
|
||||||
</RunnerSettings>
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
16
.idea/runConfigurations/Tomcat9__1__DBServer_.xml
generated
16
.idea/runConfigurations/Tomcat9__1__DBServer_.xml
generated
@@ -1,16 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Tomcat9 #1 (DBServer)" type="Remote" folderName="Lamonarca">
|
|
||||||
<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="8001" />
|
|
||||||
<option name="AUTO_RESTART" value="false" />
|
|
||||||
<RunnerSettings RunnerId="Debug">
|
|
||||||
<option name="DEBUG_PORT" value="8001" />
|
|
||||||
<option name="LOCAL" value="false" />
|
|
||||||
</RunnerSettings>
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
16
.idea/runConfigurations/Tomcat_9__1__Server_01_.xml
generated
16
.idea/runConfigurations/Tomcat_9__1__Server_01_.xml
generated
@@ -1,16 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Tomcat 9 #1 (Server-01)" type="Remote" folderName="VgAlimenti">
|
|
||||||
<module name="ems-engine" />
|
|
||||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
|
||||||
<option name="SERVER_MODE" value="false" />
|
|
||||||
<option name="SHMEM_ADDRESS" />
|
|
||||||
<option name="HOST" value="10.107.107.15" />
|
|
||||||
<option name="PORT" value="5005" />
|
|
||||||
<option name="AUTO_RESTART" value="false" />
|
|
||||||
<RunnerSettings RunnerId="Debug">
|
|
||||||
<option name="DEBUG_PORT" value="5005" />
|
|
||||||
<option name="LOCAL" value="false" />
|
|
||||||
</RunnerSettings>
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="Tomcat 9 (AnydeskTunnel)" type="Remote">
|
<configuration default="false" name="Tomcat 9 (RistoCash)" type="Remote">
|
||||||
<module name="ems-engine" />
|
<module name="ems-engine" />
|
||||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
<option name="SERVER_MODE" value="false" />
|
<option name="SERVER_MODE" value="false" />
|
||||||
<option name="SHMEM_ADDRESS" />
|
<option name="SHMEM_ADDRESS" />
|
||||||
<option name="HOST" value="localhost" />
|
<option name="HOST" value="127.0.0.1" />
|
||||||
<option name="PORT" value="8001" />
|
<option name="PORT" value="8001" />
|
||||||
<option name="AUTO_RESTART" value="false" />
|
<option name="AUTO_RESTART" value="false" />
|
||||||
<RunnerSettings RunnerId="Debug">
|
<RunnerSettings RunnerId="Debug">
|
||||||
15
.idea/runConfigurations/Tomcat__1__Gramm_.xml
generated
15
.idea/runConfigurations/Tomcat__1__Gramm_.xml
generated
@@ -1,15 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Tomcat #1 (Gramm)" type="Remote" folderName="Gramm">
|
|
||||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
|
||||||
<option name="SERVER_MODE" value="false" />
|
|
||||||
<option name="SHMEM_ADDRESS" />
|
|
||||||
<option name="HOST" value="192.168.50.17" />
|
|
||||||
<option name="PORT" value="8001" />
|
|
||||||
<option name="AUTO_RESTART" value="false" />
|
|
||||||
<RunnerSettings RunnerId="Debug">
|
|
||||||
<option name="DEBUG_PORT" value="8001" />
|
|
||||||
<option name="LOCAL" value="false" />
|
|
||||||
</RunnerSettings>
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="Tomcat #1 (Smetar) [VPN]" type="Remote" folderName="Smetar">
|
<configuration default="false" name="Tomcat (AnydeskTunnel)" type="Remote">
|
||||||
<module name="ems-engine" />
|
<module name="ems-engine" />
|
||||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
<option name="SERVER_MODE" value="false" />
|
<option name="SERVER_MODE" value="false" />
|
||||||
<option name="SHMEM_ADDRESS" />
|
<option name="SHMEM_ADDRESS" />
|
||||||
<option name="HOST" value="10.0.0.2" />
|
<option name="HOST" value="servertomcat" />
|
||||||
<option name="PORT" value="5005" />
|
<option name="PORT" value="8000" />
|
||||||
<option name="AUTO_RESTART" value="false" />
|
<option name="AUTO_RESTART" value="false" />
|
||||||
<RunnerSettings RunnerId="Debug">
|
<RunnerSettings RunnerId="Debug">
|
||||||
<option name="DEBUG_PORT" value="5005" />
|
<option name="DEBUG_PORT" value="8000" />
|
||||||
<option name="LOCAL" value="false" />
|
<option name="LOCAL" value="false" />
|
||||||
</RunnerSettings>
|
</RunnerSettings>
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
20
.idea/runConfigurations/Tomcat__FAST_.xml
generated
20
.idea/runConfigurations/Tomcat__FAST_.xml
generated
@@ -1,5 +1,5 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<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" show_console_on_std_err="true" show_console_on_std_out="true">
|
<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 -Xms1G -Xmx6G" />
|
<option name="COMMON_VM_ARGUMENTS" value="-DDISABLE_DROOLS_COMPILE=TRUE -Xms1G -Xmx6G" />
|
||||||
<deployment>
|
<deployment>
|
||||||
<artifact name="ems-engine:war exploded">
|
<artifact name="ems-engine:war exploded">
|
||||||
@@ -16,30 +16,12 @@
|
|||||||
<log_file alias="Tomcat Localhost Access Log" path="%IDEA_RUN:CATALINA_BASE%/logs/localhost_access_log.*" />
|
<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" />
|
||||||
<predefined_log_file enabled="true" id="Tomcat Catalina" />
|
<predefined_log_file enabled="true" id="Tomcat Catalina" />
|
||||||
<RunnerSettings RunnerId="AppServerDebuggerRunner">
|
|
||||||
<option name="DEBUG_PORT" value="63868" />
|
|
||||||
</RunnerSettings>
|
|
||||||
<RunnerSettings RunnerId="Debug">
|
<RunnerSettings RunnerId="Debug">
|
||||||
<option name="DEBUG_PORT" value="javadebug" />
|
<option name="DEBUG_PORT" value="javadebug" />
|
||||||
</RunnerSettings>
|
</RunnerSettings>
|
||||||
<RunnerSettings RunnerId="JProfiler">
|
<RunnerSettings RunnerId="JProfiler">
|
||||||
<option name="jreHome" value="$PROJECT_DIR$/../../../Program Files/Java/jdk1.8.0_202" />
|
<option name="jreHome" value="$PROJECT_DIR$/../../../Program Files/Java/jdk1.8.0_202" />
|
||||||
</RunnerSettings>
|
</RunnerSettings>
|
||||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="AppServerDebuggerRunner">
|
|
||||||
<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="Cover">
|
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
|
||||||
<option name="USE_ENV_VARIABLES" value="true" />
|
<option name="USE_ENV_VARIABLES" value="true" />
|
||||||
<STARTUP>
|
<STARTUP>
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="docker-compose.yml: Compose Deployment" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
|
|
||||||
<deployment type="docker-compose.yml">
|
|
||||||
<settings>
|
|
||||||
<option name="envFilePath" value="" />
|
|
||||||
<option name="commandLineOptions" value="--build" />
|
|
||||||
<option name="sourceFilePath" value="docker-compose.yml" />
|
|
||||||
</settings>
|
|
||||||
</deployment>
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
15
.idea/runConfigurations/tomcat9___TomcatSrv_.xml
generated
15
.idea/runConfigurations/tomcat9___TomcatSrv_.xml
generated
@@ -1,15 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="tomcat9 ( TomcatSrv)" type="Remote" folderName="Carelli">
|
|
||||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
|
||||||
<option name="SERVER_MODE" value="false" />
|
|
||||||
<option name="SHMEM_ADDRESS" />
|
|
||||||
<option name="HOST" value="172.16.30.239" />
|
|
||||||
<option name="PORT" value="8001" />
|
|
||||||
<option name="AUTO_RESTART" value="false" />
|
|
||||||
<RunnerSettings RunnerId="Debug">
|
|
||||||
<option name="DEBUG_PORT" value="8001" />
|
|
||||||
<option name="LOCAL" value="false" />
|
|
||||||
</RunnerSettings>
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
30
.idea/structuralSearch.xml
generated
30
.idea/structuralSearch.xml
generated
@@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="StructuralSearch">
|
|
||||||
<searchConfiguration name="LocalDate passato a SimpleDateFormat" text="$formatter$.format($date$)" recursive="true" caseInsensitive="true" type="JAVA" pattern_context="default">
|
|
||||||
<constraint name="__context__" within="" contains="" />
|
|
||||||
<constraint name="formatter" nameOfExprType="java\.text\.SimpleDateFormat" within="" contains="" />
|
|
||||||
<constraint name="date" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
|
||||||
</searchConfiguration>
|
|
||||||
<searchConfiguration name="LocalDate equals java.util.Date inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
|
||||||
<constraint name="__context__" within="" contains="" />
|
|
||||||
<constraint name="d1" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
|
||||||
<constraint name="d2" nameOfExprType="java\.util\.Date" within="" contains="" />
|
|
||||||
</searchConfiguration>
|
|
||||||
<searchConfiguration name="java.util.Date equals LocalDate inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
|
||||||
<constraint name="__context__" within="" contains="" />
|
|
||||||
<constraint name="d1" nameOfExprType="java\.util\.Date" within="" contains="" />
|
|
||||||
<constraint name="d2" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
|
||||||
</searchConfiguration>
|
|
||||||
<searchConfiguration name="java.util.Date equals LocalDateTime inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
|
||||||
<constraint name="__context__" within="" contains="" />
|
|
||||||
<constraint name="d1" nameOfExprType="java\.util\.Date" within="" contains="" />
|
|
||||||
<constraint name="d2" nameOfExprType="java\.time\.LocalDateTime" within="" contains="" />
|
|
||||||
</searchConfiguration>
|
|
||||||
<searchConfiguration name="LocalDateTime equals java.util.Date inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
|
||||||
<constraint name="__context__" within="" contains="" />
|
|
||||||
<constraint name="d1" nameOfExprType="java\.time\.LocalDateTime" within="" contains="" />
|
|
||||||
<constraint name="d2" nameOfExprType="java\.util\.Date" within="" contains="" />
|
|
||||||
</searchConfiguration>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
FROM tomcat:9-jre8-alpine
|
|
||||||
|
|
||||||
RUN apk add --no-cache fontconfig ttf-dejavu
|
|
||||||
|
|
||||||
ENV TZ="Europe/Rome"
|
|
||||||
ENV JAVA_OPTS="-DDISABLE_DROOLS_COMPILE=TRUE -Xms512M -Xmx1G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
|
|
||||||
ENV USERDOMAIN="STUDIO-ML"
|
|
||||||
|
|
||||||
COPY docker/tomcat/conf/integry/ems.properties /usr/local/tomcat/conf/integry/
|
|
||||||
COPY docker/tomcat/conf/integry/ems_automated_operations.json /usr/local/tomcat/conf/integry/
|
|
||||||
COPY docker/tomcat/conf/integry/ems_settings.json /usr/local/tomcat/conf/integry/
|
|
||||||
COPY ems-engine/target/ems-api.war /usr/local/tomcat/webapps/
|
|
||||||
|
|
||||||
#COPY docker/FontTest.class .
|
|
||||||
#ENTRYPOINT ["java","FontTest"]
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
EXPOSE 5005
|
|
||||||
18
Dockerfile
18
Dockerfile
@@ -1,18 +0,0 @@
|
|||||||
FROM tomcat:9-jre8-alpine
|
|
||||||
|
|
||||||
RUN apk add --no-cache fontconfig ttf-dejavu
|
|
||||||
|
|
||||||
ENV TZ="Europe/Rome"
|
|
||||||
ENV JAVA_OPTS="-DDISABLE_DROOLS_COMPILE=TRUE -Xms512M -Xmx2G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
|
|
||||||
ENV USERDOMAIN="STUDIO-ML"
|
|
||||||
|
|
||||||
COPY docker/tomcat/conf/integry/ems.properties /usr/local/tomcat/conf/integry/
|
|
||||||
COPY docker/tomcat/conf/integry/ems_automated_operations.json /usr/local/tomcat/conf/integry/
|
|
||||||
COPY docker/tomcat/conf/integry/ems_settings.json /usr/local/tomcat/conf/integry/
|
|
||||||
COPY ems-engine/target/ems-api.war /usr/local/tomcat/webapps/
|
|
||||||
|
|
||||||
#COPY docker/FontTest.class .
|
|
||||||
#ENTRYPOINT ["java","FontTest"]
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
EXPOSE 5005
|
|
||||||
@@ -10,51 +10,33 @@ pipeline {
|
|||||||
stage('PreBuild Steps (Master)') {
|
stage('PreBuild Steps (Master)') {
|
||||||
when {
|
when {
|
||||||
expression {
|
expression {
|
||||||
return env.GIT_BRANCH == "master" || env.GIT_BRANCH == "feature/RefactoringGestioneColli"
|
return env.GIT_BRANCH == "master"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
echo "Creo version tag su Git"
|
echo "Creo version tag su Git"
|
||||||
script {
|
bat 'build\\create_build_tag.bat'
|
||||||
def date = new Date()
|
|
||||||
def formattedDate = date.format('yyyyMMdd_HHmm')
|
|
||||||
|
|
||||||
def tagName = "${env.GIT_BRANCH.toLowerCase().replace('/', '-')}-${formattedDate}"
|
|
||||||
def tagMessage = "Build #${env.BUILD_NUMBER} - ${env.GIT_BRANCH}"
|
|
||||||
|
|
||||||
def envPropertiesText = "project.version=${formattedDate}"
|
|
||||||
|
|
||||||
writeFile(
|
|
||||||
'file': 'ems-core\\src\\main\\resources\\configs\\env.properties',
|
|
||||||
'text': envPropertiesText
|
|
||||||
)
|
|
||||||
|
|
||||||
bat "git add . -A"
|
|
||||||
bat "git tag -a ${tagName} -m \"${tagMessage}\""
|
|
||||||
bat "git push origin ${tagName}"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Maven Build') {
|
stage('Maven Build') {
|
||||||
steps {
|
steps {
|
||||||
echo "${WORKSPACE}"
|
echo "${WORKSPACE}"
|
||||||
withMaven(traceability: true, maven: 'Maven 3.9.5', options: [artifactsPublisher(disabled: true)]) {
|
withMaven(jdk: 'JDK 17.0.6 x64', traceability: true, maven: 'Maven 3.9.5') {
|
||||||
bat(script: 'mvn clean install -t toolchains-jenkins.xml', returnStdout: true)
|
bat(script: 'mvn clean install -t toolchains-jenkins.xml', returnStdout: true)
|
||||||
archiveArtifacts(artifacts: 'ems-engine/target/ems-api.war', onlyIfSuccessful: true)
|
archiveArtifacts(artifacts: 'ems-engine/target/*.war*', onlyIfSuccessful: true)
|
||||||
}
|
}
|
||||||
stash includes: 'ems-engine/target/ems-api.war,docker/**,Containerfile', name: 'container-files'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Publish') {
|
stage('Publish Develop') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
return env.GIT_BRANCH == "develop"
|
||||||
|
}
|
||||||
|
}
|
||||||
parallel {
|
parallel {
|
||||||
|
stage('Tomcat update') {
|
||||||
stage('Publish Develop') {
|
|
||||||
when {
|
|
||||||
expression {
|
|
||||||
return env.GIT_BRANCH == "develop"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stages {
|
stages {
|
||||||
stage('Update Tomcat 1') {
|
stage('Update Tomcat 1') {
|
||||||
steps {
|
steps {
|
||||||
@@ -66,19 +48,22 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
echo "Updating Tomcat9 from ${WORKSPACE}"
|
echo "Updating Tomcat9 from ${WORKSPACE}"
|
||||||
powershell returnStdout: true, script: "build\\update_tomcat.ps1 -serviceName \"Tomcat9Backup\" -httpPort \"8082\" -updatedArtifactPath \"${WORKSPACE}\\ems-engine\\target\\ems-api.war\""
|
powershell returnStdout: true, script: "build\\update_tomcat.ps1 -serviceName \"Tomcat9Backup\" -httpPort \"8082\" -updatedArtifactPath \"${WORKSPACE}\\ems-engine\\target\\ems-api.war\""
|
||||||
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
|
bat 'curl -k https://devservices.studioml.it/ems-api/updateWMSApp'
|
||||||
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Publish Master') {
|
stage('Publish Master') {
|
||||||
when {
|
when {
|
||||||
expression {
|
expression {
|
||||||
return env.GIT_BRANCH == "master"
|
return env.GIT_BRANCH == "master"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
parallel {
|
||||||
|
stage('Tomcat update') {
|
||||||
stages {
|
stages {
|
||||||
stage('Update Tomcat 1') {
|
stage('Update Tomcat 1') {
|
||||||
steps {
|
steps {
|
||||||
@@ -100,102 +85,34 @@ sudo /usr/bin/systemctl start tomcat9backup
|
|||||||
/home/studioml/./wait_tomcat_startup.sh 8082
|
/home/studioml/./wait_tomcat_startup.sh 8082
|
||||||
|
|
||||||
sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/tomcat9backup/webapps', remoteDirectorySDF: false, removePrefix: 'ems-engine/target/', sourceFiles: 'ems-engine/target/*.war*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/tomcat9backup/webapps', remoteDirectorySDF: false, removePrefix: 'ems-engine/target/', sourceFiles: 'ems-engine/target/*.war*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
||||||
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
|
bat 'curl -k https://services.studioml.it/ems-api/updateWMSApp'
|
||||||
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Publish Branch on Azure') {
|
|
||||||
steps {
|
|
||||||
azureUpload fileShareName: 'storage-ci', filesPath: 'ems-engine/target/*.war*', removePrefixPath: 'ems-engine/target/', storageCredentialId: '83a86793-c1d6-4776-b20f-1ff652a57fee', storageType: 'filestorage', uploadArtifactsOnlyIfSuccessful: true, verbose: true, virtualPath: "ems-api/${env.GIT_BRANCH}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Docker Build') {
|
|
||||||
steps {
|
|
||||||
node('server-build') {
|
|
||||||
echo "Building Docker image"
|
|
||||||
unstash 'container-files'
|
|
||||||
|
|
||||||
script {
|
|
||||||
def branchVersion = ""
|
|
||||||
|
|
||||||
if (env.GIT_BRANCH != "master") {
|
|
||||||
branchVersion = "-${env.GIT_BRANCH.toLowerCase().replace('/', '-')}"
|
|
||||||
}
|
|
||||||
|
|
||||||
// bat "docker buildx build --platform linux/amd64,linux/arm64 --push -t \"git.studioml.it/integry/ems-api${branchVersion}:latest\" ."
|
|
||||||
bat "podman build -f .\\Containerfile -t \"git.studioml.it/integry/ems-api${branchVersion}:latest\" ."
|
|
||||||
bat "podman push \"git.studioml.it/integry/ems-api${branchVersion}:latest\""
|
|
||||||
|
|
||||||
//containerImageLink "git.studioml.it/integry/ems-api-${env.GIT_BRANCH.toLowerCase().replace('/', '-')}:latest}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Publish TypeScript modules') {
|
stage('Publish on Azure') {
|
||||||
when {
|
|
||||||
expression {
|
|
||||||
return env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
script {
|
azureUpload fileShareName: 'storage-ci', filesPath: 'ems-engine/target/*.war*', removePrefixPath: 'ems-engine/target/', storageCredentialId: '83a86793-c1d6-4776-b20f-1ff652a57fee', storageType: 'filestorage', uploadArtifactsOnlyIfSuccessful: true, verbose: true, virtualPath: 'ems-api'
|
||||||
bat "IF EXIST IntegryManagementSystemTSModules RMDIR IntegryManagementSystemTSModules /S /Q"
|
|
||||||
|
|
||||||
// Clona la repository di destinazione
|
|
||||||
echo "Clonazione della repository di destinazione..."
|
|
||||||
bat 'git clone https://git.studioml.it/Integry/IntegryManagementSystemTSModules.git'
|
|
||||||
|
|
||||||
// Entra nella directory della repository di destinazione
|
|
||||||
dir('IntegryManagementSystemTSModules') {
|
|
||||||
if(env.GIT_BRANCH != "master") {
|
|
||||||
// Crea un nuovo branch se non è master o develop
|
|
||||||
bat "git checkout -b ${env.GIT_BRANCH} origin/${env.GIT_BRANCH}"
|
|
||||||
} else {
|
|
||||||
// Altrimenti, torna al branch master o develop
|
|
||||||
bat "git checkout ${env.GIT_BRANCH}"
|
|
||||||
}
|
|
||||||
|
|
||||||
//bat "git checkout -b ${env.GIT_BRANCH}"
|
|
||||||
bat "git pull origin ${env.GIT_BRANCH}"
|
|
||||||
|
|
||||||
// Copia i file .ts nella repository di destinazione
|
|
||||||
echo "Copia dei file .ts nella repository di destinazione..."
|
|
||||||
bat 'copy ..\\ts\\*.ts .'
|
|
||||||
|
|
||||||
// Aggiungi i file modificati
|
|
||||||
bat 'git add *.ts'
|
|
||||||
|
|
||||||
// Commit e push
|
|
||||||
bat 'git commit -m "Aggiornamento file .ts"'
|
|
||||||
bat 'git push https://git.studioml.it/Integry/IntegryManagementSystemTSModules.git --all'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
script {
|
script {
|
||||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") {
|
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") {
|
||||||
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'EMS-API è stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'EMS-API ` stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unstable {
|
unstable {
|
||||||
script {
|
script {
|
||||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") {
|
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") {
|
||||||
office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'EMS-API è INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'EMS-API ` INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,6 +122,7 @@ sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaul
|
|||||||
office365ConnectorSend adaptiveCards: true, color: '#FF2C2C', message: 'Errore di compilazione su EMS-API', status: 'FAILURE', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
office365ConnectorSend adaptiveCards: true, color: '#FF2C2C', message: 'Errore di compilazione su EMS-API', status: 'FAILURE', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
43
build/create_build_tag.bat
Normal file
43
build/create_build_tag.bat
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
REM SET YEAR
|
||||||
|
set YEAR=%date:~6,4%
|
||||||
|
|
||||||
|
REM SET MONTH
|
||||||
|
set MONTH=%date:~3,2%
|
||||||
|
if %MONTH% LSS 10 set MONTH=%MONTH:~1,2%
|
||||||
|
if %MONTH% LSS 10 set MONTH=0%MONTH%
|
||||||
|
|
||||||
|
REM SET DAY
|
||||||
|
set DAY=%date:~0,2%
|
||||||
|
if %DAY% LSS 10 set DAY=%DAY:~1,2%
|
||||||
|
if %DAY% LSS 10 set DAY=0%DAY%
|
||||||
|
|
||||||
|
REM SET HOUR
|
||||||
|
set HOUR=%time:~0,2%
|
||||||
|
if %HOUR% LSS 10 set HOUR=%HOUR:~1,2%
|
||||||
|
if %HOUR% LSS 10 set HOUR=0%HOUR%
|
||||||
|
|
||||||
|
REM SET MINUTE
|
||||||
|
set MINUTE=%time:~3,2%
|
||||||
|
if %MINUTE% LSS 10 set MINUTE=%MINUTE:~1,2%
|
||||||
|
if %MINUTE% LSS 10 set MINUTE=0%MINUTE%
|
||||||
|
|
||||||
|
REM SET SECOND
|
||||||
|
set SECOND=%time:~6,2%
|
||||||
|
if %SECOND% LSS 10 set SECOND=%SECOND:~1,2%
|
||||||
|
if %SECOND% LSS 10 set SECOND=0%SECOND%
|
||||||
|
|
||||||
|
set mydate=%YEAR%%MONTH%%DAY%_%HOUR%%MINUTE%%SECOND%
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo #spring.profiles.active=@activatedProperties@ > ems-core\src\main\resources\configs\env.properties
|
||||||
|
echo project.version=%mydate% >> ems-core\src\main\resources\configs\env.properties
|
||||||
|
|
||||||
|
|
||||||
|
git add . -A
|
||||||
|
git commit -m "%mydate%"
|
||||||
|
git tag "%mydate%"
|
||||||
|
|
||||||
|
|
||||||
|
git push https://git.studioml.it/Integry/IntegryManagementSystem.git --tags
|
||||||
|
git push https://git.studioml.it/Integry/IntegryManagementSystem.git --all
|
||||||
@@ -11,7 +11,7 @@ $webappsPath = "C:\Program Files\$serviceName\webapps"
|
|||||||
# Funzione per eseguire la chiamata GET e controllare lo status code
|
# Funzione per eseguire la chiamata GET e controllare lo status code
|
||||||
function Check-Status {
|
function Check-Status {
|
||||||
try {
|
try {
|
||||||
$request = Invoke-WebRequest -Uri "http://localhost:$httpPort/ems-api/system/ok" -Method Get -ErrorAction Stop -UseBasicParsing
|
$request = Invoke-WebRequest -Uri "http://localhost:$httpPort/ems-api/system/ok" -Method Get -ErrorAction Stop
|
||||||
$statusCode = $request.StatusCode
|
$statusCode = $request.StatusCode
|
||||||
if ($statusCode -eq 200) {
|
if ($statusCode -eq 200) {
|
||||||
Write-Host "Status code 200 ricevuto, processo completato."
|
Write-Host "Status code 200 ricevuto, processo completato."
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
services:
|
|
||||||
tomcat:
|
|
||||||
build: ./
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "8080:8080"
|
|
||||||
- "5005:5005"
|
|
||||||
volumes:
|
|
||||||
- ./docker/tomcat/conf/integry:/usr/local/tomcat/conf/integry
|
|
||||||
extra_hosts:
|
|
||||||
- host.docker.internal:host-gateway
|
|
||||||
Binary file not shown.
@@ -1,14 +0,0 @@
|
|||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class FontTest {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String[] names = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
|
|
||||||
|
|
||||||
System.out.println("Found " + names.length + " fonts:");
|
|
||||||
|
|
||||||
for (String name : names) {
|
|
||||||
System.out.println(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
ini.path=C:/MLSetupWS
|
|
||||||
global.connection.ini.path=C:/MLSetupWS/connectDB.ini
|
|
||||||
endpoint.ws=http://localhost:8080
|
|
||||||
endpoint.brt.ws=http://10.0.0.12:9005/easyspeddews?wsdl
|
|
||||||
receipts.folder=C:/WEB_SHARE/SCONTRINI
|
|
||||||
crontime.folder=
|
|
||||||
quartz.enabled=false
|
|
||||||
cron.expr=0 0/2 * 1/1 * ? *
|
|
||||||
default.printer.name=Samsung SCX-4x24 Series PCL 6
|
|
||||||
default.database=integry
|
|
||||||
default.nodatabase.login=integry_ems_psw_system_legacy
|
|
||||||
amazon.import.enabled=false
|
|
||||||
sh.import.enabled=false
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1,895 +0,0 @@
|
|||||||
{
|
|
||||||
"accessTokenExpireMinutes": 30,
|
|
||||||
"refreshTokenExpireDays": 14,
|
|
||||||
"defaultProfile": "INTEGRY",
|
|
||||||
"primaryInstance": true,
|
|
||||||
"enableTokenCaching": false,
|
|
||||||
"systemPassword": "?MF!jbI+&OkA",
|
|
||||||
"availableConnections": [
|
|
||||||
{
|
|
||||||
"profileName": "MAGGIOSRL",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "MaggioSRL",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "AGRICOPER",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "agricoper",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "MUCCI",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "MUCCI",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "RESINA_COLOR",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "RESINACOLOR",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "RESINA_COLOR_PASQUALE",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "RESINACOLOR_PASQUALE",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "ALAMBICCO",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "alambicco",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "AURICCHIO",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "auricchio",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "AURICCHIOSRL",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "auricchiosrl",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "AURICCHIO_MIKI",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "auricchio_miki",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "CARELLI",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "carelli",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "CSGR",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "csgr",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "CHIUSO",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "chiuso",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "COSMINT",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "cosmint",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "DAGA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "Daga",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "DIDONNA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "DIDONNA",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "DOLCE_BONTA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "DOLCE_BO",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "DULCIAR",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "dulciar",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "FLORAPULIA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "florapulia",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "FLORAPULIASRL",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "florapuliasrl",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "PAPARELLAD",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "PAPARELLAD",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "PAPARELLAP",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "PAPARELLAP",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "PAPARELLAPIETRO",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "PAPARELLAPIETRO",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "FOLLIESGROUP",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "folliesgroup",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "FORMAT",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "format",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "GESTFOOD",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "GESTFOOD",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "GIOVMAGGIO",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "giovmaggio",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "GRAMM",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "gramm",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "IDROTECNICA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "idrotecnica",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "IME_BA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "IME_BA",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "IME_TE",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "IME_TE",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "IND01",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "ind01",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "IND02",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "ind02",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "IND04",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "ind04",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "IND05",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "ind05",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "INTEGRY",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "studioml",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "LAMONARCA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "lamonarca",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "LEVANPLAST",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "levanplast",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "LICOR",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "licor",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "MIDEL",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "midel",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "MURGIA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "MURGIA",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "OF_DEMO",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "of_demo",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "PANIMAL",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "panimal",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "PAPARELLAD",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "paparellad",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "PAPARELLAP",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "paparellap",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "PAPARELLA_IMMOBILIARE",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "immobiliare",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "PAPARELLA_IMMOBILIARE_SRL",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "immobiliaresrl",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "RISTO_CASH",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "risto_cash",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SALPAR",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "salpar",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "MASABA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "masabasrl",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SABATO",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "SABATO",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SANTANTONIO",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "SANTANTONIO",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SARDINYA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "Sardinya",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SICILIANIDMSOLAP",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "SicilianiDMSOlap",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SICILIANIOLAP",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "SicilianiDMSOlap",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SICILIANITRAXAL",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "scambio_traxal",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SMETAR",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "smetar",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SUIT",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "SUIT",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TEMPESTA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tempesta",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TOSCA_BA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tosca_ba",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TOSCA_CE",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tosca_ce",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TOSCA_CZ",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tosca_cz",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TOSCA_FC",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tosca_fc",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TOSCA_MI",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tosca_mi",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TOSCA_RM",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tosca_rm",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TOSCA_RG",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tosca_rg",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TOSCA_VR",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tosca_vr",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TOSCA_CLOUD",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "tosca-primary-db",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "VGALIMENTI",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "vgalimenti",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "VINELLA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "VINELLA",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "LEVANPLASTSRL",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "levanplastsrl",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "BIOLEVANTE",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "biolevante",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "CAPELLI_MONELLI",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "capelli_monelli",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "PENELOPE_EXCHANGE",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "penelope_exchange",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "ROSSOGARGANO",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "RossoGargano",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "MORGANTE",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "morgante",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "WINACT",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "winact",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "FRUDIS",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "frudis",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SAPORI_VERI",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "SAPORI_VERI",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "DISPENSA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "DISPENSA",
|
|
||||||
"username": "SA",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "TWOBROTHERS",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "twobrothers",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "SGSRL",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "SGSRL",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "STUDIOML_HISTORY",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "studioml_history",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sa",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": false,
|
|
||||||
"internalDb": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "COSMAPACK",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "COSMINT",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "Aida",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "aida",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.220",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "VETTA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "vetta",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"profileName": "CARNI_SARDEGNA",
|
|
||||||
"connectionType": "MSSQL",
|
|
||||||
"dbName": "CARNI_SARDEGNA",
|
|
||||||
"username": "sa",
|
|
||||||
"password": "sZ",
|
|
||||||
"host": "192.168.2.214",
|
|
||||||
"encryptedDbPsw": true,
|
|
||||||
"internalDb": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"defaultMailConfiguration": {
|
|
||||||
"from": "internal@integry.it",
|
|
||||||
"smtp": "smtp.integry.it",
|
|
||||||
"port": 25,
|
|
||||||
"enableSSL": false,
|
|
||||||
"username": "sender@integry.it",
|
|
||||||
"password": "sendsqlml",
|
|
||||||
"encryptedPassword": false
|
|
||||||
},
|
|
||||||
"loggerConfiguration": {
|
|
||||||
"level": "DEBUG",
|
|
||||||
"deleteDays": 15,
|
|
||||||
"dbDeleteDays": 3,
|
|
||||||
"dbMaxSize": "500M"
|
|
||||||
},
|
|
||||||
"enablePermissionCheck": false,
|
|
||||||
"minioConfiguration": {
|
|
||||||
"host": "192.168.2.206",
|
|
||||||
"port": 9000,
|
|
||||||
"accessKey": "integry_minio",
|
|
||||||
"secretKey": "9yMd3@0.GPKf",
|
|
||||||
"enabled": true,
|
|
||||||
"enableOldSave": false,
|
|
||||||
"excludedEntities": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
220
ems-core/pom.xml
220
ems-core/pom.xml
@@ -60,6 +60,49 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>cz.habarta.typescript-generator</groupId>
|
||||||
|
<artifactId>typescript-generator-maven-plugin</artifactId>
|
||||||
|
<version>2.37.1128</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>generate</id>
|
||||||
|
<goals>
|
||||||
|
<goal>generate</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>process-classes</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<jsonLibrary>jackson2</jsonLibrary>
|
||||||
|
<classPatterns>it.integry.ems_model.entity.*</classPatterns>
|
||||||
|
<classes>
|
||||||
|
<class>it.integry.ems.response.ServiceRestResponse</class>
|
||||||
|
</classes>
|
||||||
|
<excludeClasses>
|
||||||
|
<excludeClass>it.integry.ems_model.base.EntityInterface</excludeClass>
|
||||||
|
</excludeClasses>
|
||||||
|
<outputFile>../ts/ems-core.module.ts</outputFile>
|
||||||
|
<outputKind>module</outputKind>
|
||||||
|
<outputFileType>implementationFile</outputFileType>
|
||||||
|
<customTypeNaming>
|
||||||
|
<naming>it.integry.ems_model.entity.AtbOfft$StatoOfferta:AtbOfftStatoOfferta</naming>
|
||||||
|
<naming>it.integry.ems_model.entity.VtbOfft$StatoOfferta:VtbOfftStatoOfferta</naming>
|
||||||
|
<naming>it.integry.ems_model.entity.GrlAnagJrept$Tipo:GrlAnagJreptTipo</naming>
|
||||||
|
<naming>it.integry.ems_model.entity.WtbJreptSetup$Tipo:WtbJreptSetupTipo</naming>
|
||||||
|
<naming>it.integry.ems_model.entity.MtbColr$Causale:MtbColrCausale</naming>
|
||||||
|
<naming>it.integry.ems_model.entity.MtbCols$Causale:MtbColsCausale</naming>
|
||||||
|
</customTypeNaming>
|
||||||
|
<generateConstructors>true</generateConstructors>
|
||||||
|
<mapClasses>asClasses</mapClasses>
|
||||||
|
<mapEnum>asEnum</mapEnum>
|
||||||
|
<optionalProperties>useLibraryDefinition</optionalProperties>
|
||||||
|
<optionalPropertiesDeclaration>questionMarkAndNullableType</optionalPropertiesDeclaration>
|
||||||
|
<sortDeclarations>true</sortDeclarations>
|
||||||
|
<sortTypeDeclarations>true</sortTypeDeclarations>
|
||||||
|
<tsNoCheck>true</tsNoCheck>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
@@ -68,7 +111,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-bom</artifactId>
|
<artifactId>log4j-bom</artifactId>
|
||||||
<version>2.25.0</version>
|
<version>2.21.1</version>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -155,6 +198,12 @@
|
|||||||
<version>20200518</version>
|
<version>20200518</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.reflections</groupId>
|
<groupId>org.reflections</groupId>
|
||||||
<artifactId>reflections</artifactId>
|
<artifactId>reflections</artifactId>
|
||||||
@@ -179,11 +228,11 @@
|
|||||||
<!-- <artifactId>itext</artifactId>-->
|
<!-- <artifactId>itext</artifactId>-->
|
||||||
<!-- <version>2.1.7.js8</version>-->
|
<!-- <version>2.1.7.js8</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>net.sf.jasperreports</groupId>-->
|
<!-- <groupId>net.sf.jasperreports</groupId>-->
|
||||||
<!-- <artifactId>jasperreports-htmlcomponent</artifactId>-->
|
<!-- <artifactId>jasperreports-htmlcomponent</artifactId>-->
|
||||||
<!-- <version>4.1.1</version>-->
|
<!-- <version>4.1.1</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sf.jasperreports</groupId>
|
<groupId>net.sf.jasperreports</groupId>
|
||||||
<artifactId>jasperreports-fonts</artifactId>
|
<artifactId>jasperreports-fonts</artifactId>
|
||||||
@@ -224,16 +273,6 @@
|
|||||||
<artifactId>Tahoma</artifactId>
|
<artifactId>Tahoma</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>it.integry.font</groupId>
|
|
||||||
<artifactId>arial-rounded</artifactId>
|
|
||||||
<version>1.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>it.integry.font</groupId>
|
|
||||||
<artifactId>NotoSerif</artifactId>
|
|
||||||
<version>1.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.groovy</groupId>
|
<groupId>org.apache.groovy</groupId>
|
||||||
@@ -242,61 +281,61 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SOSTITUISCONO batik-all -->
|
<!-- SOSTITUISCONO batik-all -->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-awt-util</artifactId>-->
|
<!-- <artifactId>batik-awt-util</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlgraphics</groupId>
|
<groupId>org.apache.xmlgraphics</groupId>
|
||||||
<artifactId>batik-bridge</artifactId>
|
<artifactId>batik-bridge</artifactId>
|
||||||
<version>1.17</version>
|
<version>1.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-css</artifactId>-->
|
<!-- <artifactId>batik-css</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-dom</artifactId>-->
|
<!-- <artifactId>batik-dom</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-ext</artifactId>-->
|
<!-- <artifactId>batik-ext</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-gvt</artifactId>-->
|
<!-- <artifactId>batik-gvt</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-parser</artifactId>-->
|
<!-- <artifactId>batik-parser</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-svg-dom</artifactId>-->
|
<!-- <artifactId>batik-svg-dom</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-transcoder</artifactId>-->
|
<!-- <artifactId>batik-transcoder</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-util</artifactId>-->
|
<!-- <artifactId>batik-util</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
|
||||||
<!-- <artifactId>batik-xml</artifactId>-->
|
<!-- <artifactId>batik-xml</artifactId>-->
|
||||||
<!-- <version>1.9</version>-->
|
<!-- <version>1.9</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||||
@@ -360,6 +399,11 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson.version}</version>
|
<version>${jackson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>${jackson.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
<artifactId>jackson-dataformat-csv</artifactId>
|
<artifactId>jackson-dataformat-csv</artifactId>
|
||||||
@@ -368,11 +412,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>2.20</version> <!-- Versione scritta a mano perché qui non hanno usato lo 0 finale -->
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
|
||||||
<version>${jackson.version}</version>
|
<version>${jackson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -386,12 +425,6 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-core</artifactId>
|
<artifactId>spring-core</artifactId>
|
||||||
<version>${spring.version}</version>
|
<version>${spring.version}</version>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>commons-logging</groupId>
|
|
||||||
<artifactId>commons-logging</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -449,7 +482,6 @@
|
|||||||
<groupId>com.lmax</groupId>
|
<groupId>com.lmax</groupId>
|
||||||
<artifactId>disruptor</artifactId>
|
<artifactId>disruptor</artifactId>
|
||||||
<version>3.4.4</version>
|
<version>3.4.4</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
@@ -464,16 +496,6 @@
|
|||||||
<artifactId>log4j-web</artifactId>
|
<artifactId>log4j-web</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
<artifactId>log4j-slf4j-impl</artifactId>
|
|
||||||
<version>2.17.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>jcl-over-slf4j</artifactId>
|
|
||||||
<version>1.7.36</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
@@ -490,7 +512,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.41.2.2</version>
|
<version>3.39.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -502,14 +524,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-text</artifactId>
|
<artifactId>commons-text</artifactId>
|
||||||
<version>1.10.0</version>
|
<version>1.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- UTILS -->
|
<!-- UTILS -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-beanutils</groupId>
|
<groupId>commons-beanutils</groupId>
|
||||||
<artifactId>commons-beanutils</artifactId>
|
<artifactId>commons-beanutils</artifactId>
|
||||||
<version>1.9.4</version>
|
<version>1.8.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax</groupId>
|
<groupId>javax</groupId>
|
||||||
@@ -524,12 +546,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-net</groupId>
|
<groupId>commons-net</groupId>
|
||||||
<artifactId>commons-net</artifactId>
|
<artifactId>commons-net</artifactId>
|
||||||
<version>3.9.0</version>
|
<version>3.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jdom</groupId>
|
<groupId>jdom</groupId>
|
||||||
<artifactId>jdom</artifactId>
|
<artifactId>jdom</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.maps</groupId>
|
<groupId>com.google.maps</groupId>
|
||||||
@@ -572,7 +594,7 @@
|
|||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt-jackson</artifactId>
|
<artifactId>jjwt-jackson</artifactId>
|
||||||
<version>0.11.5</version>
|
<version>0.11.5</version>
|
||||||
<scope>compile</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--Expiring Map-->
|
<!--Expiring Map-->
|
||||||
@@ -612,11 +634,11 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Needed for Firebase 9.4.2 -->
|
<!-- Needed for Firebase 9.4.2 -->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>com.google.auth</groupId>-->
|
<!-- <groupId>com.google.auth</groupId>-->
|
||||||
<!-- <artifactId>google-auth-library-credentials</artifactId>-->
|
<!-- <artifactId>google-auth-library-credentials</artifactId>-->
|
||||||
<!-- <version>1.28.0</version>-->
|
<!-- <version>1.28.0</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
|
||||||
<!-- Video -->
|
<!-- Video -->
|
||||||
|
|||||||
@@ -768,7 +768,7 @@ public class WooCommerceService {
|
|||||||
|
|
||||||
private void sendErrorMail(String errorMsg, String service, byte[] content, String filename, List<AnomalieDTO> anomalie) {
|
private void sendErrorMail(String errorMsg, String service, byte[] content, String filename, List<AnomalieDTO> anomalie) {
|
||||||
try {
|
try {
|
||||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager.getPrimaryConnection(), service, "WOOCOMMERCE", "Errore WooCommerce",
|
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, service, "WOOCOMMERCE", "Errore WooCommerce",
|
||||||
null, content, filename, anomalie);
|
null, content, filename, anomalie);
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
logger.error(service, exception);
|
logger.error(service, exception);
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package it.integry.annotations;
|
|
||||||
|
|
||||||
import it.integry.ems.migration._base.IntegryCustomer;
|
|
||||||
import org.springframework.stereotype.Indexed;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
@Target({ElementType.TYPE})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Documented
|
|
||||||
@Indexed
|
|
||||||
public @interface CustomerComponent {
|
|
||||||
IntegryCustomer value();
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package it.integry.annotations;
|
|
||||||
|
|
||||||
import it.integry.ems.migration._base.IntegryCustomer;
|
|
||||||
import org.springframework.core.annotation.AliasFor;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
@Target({ElementType.TYPE})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Documented
|
|
||||||
@CustomerComponent(IntegryCustomer.Integry) // Valore di default, verrà sovrascritto
|
|
||||||
public @interface CustomerService {
|
|
||||||
@AliasFor(
|
|
||||||
annotation = CustomerComponent.class
|
|
||||||
)
|
|
||||||
IntegryCustomer value();
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,6 @@ public class CommonConstants {
|
|||||||
|
|
||||||
public static final String INTEGRY = "integry";
|
public static final String INTEGRY = "integry";
|
||||||
public static final String PROFILE_DB = "profileDb";
|
public static final String PROFILE_DB = "profileDb";
|
||||||
public static final String COD_MDEP = "codMdep";
|
|
||||||
public static final String WHERE_COND = "whereCond";
|
public static final String WHERE_COND = "whereCond";
|
||||||
public static final String EMPTY_STRING = "";
|
public static final String EMPTY_STRING = "";
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@ public class CommonConstants {
|
|||||||
public static final String TIMESTAMP = "timestamp";
|
public static final String TIMESTAMP = "timestamp";
|
||||||
|
|
||||||
|
|
||||||
public static final String DATE_FORMAT_YMD_SLASHED = "yyyy/MM/dd";
|
|
||||||
public static final String DATE_FORMAT_YMD = "yyyy-MM-dd";
|
public static final String DATE_FORMAT_YMD = "yyyy-MM-dd";
|
||||||
public static final String DATE_FORMAT_DMY = "dd/MM/yyyy";
|
public static final String DATE_FORMAT_DMY = "dd/MM/yyyy";
|
||||||
public static final String DATE_FORMAT_DMY_DASHED = "dd-MM-yyyy";
|
public static final String DATE_FORMAT_DMY_DASHED = "dd-MM-yyyy";
|
||||||
@@ -29,7 +27,7 @@ public class CommonConstants {
|
|||||||
|
|
||||||
public static final String TIME_FORMAT = "HH:mm:ss";
|
public static final String TIME_FORMAT = "HH:mm:ss";
|
||||||
|
|
||||||
public static final String DATETIME_FORMAT_YMD = String.format("%s %s", DATE_FORMAT_YMD_SLASHED, TIME_FORMAT);
|
public static final String DATETIME_FORMAT_YMD = String.format("%s %s", DATE_FORMAT_YMD, TIME_FORMAT);
|
||||||
public static final String DATETIME_FORMAT_DMY = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT);
|
public static final String DATETIME_FORMAT_DMY = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT);
|
||||||
public static final String DATETIME_FORMAT_DMY_SLASHED = String.format("%s %s", DATE_FORMAT_DMY, TIME_FORMAT);
|
public static final String DATETIME_FORMAT_DMY_SLASHED = String.format("%s %s", DATE_FORMAT_DMY, TIME_FORMAT);
|
||||||
public static final String DATETIME_FORMAT_DMY_DASHED = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT);
|
public static final String DATETIME_FORMAT_DMY_DASHED = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT);
|
||||||
@@ -48,10 +46,6 @@ public class CommonConstants {
|
|||||||
.withZone(ZoneId.systemDefault());
|
.withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
|
|
||||||
public static final DateTimeFormatter DATE_YMD_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_YMD_SLASHED)
|
|
||||||
.withZone(ZoneId.systemDefault());
|
|
||||||
public static final DateTimeFormatter DATETIME_YMD_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_YMD)
|
|
||||||
.withZone(ZoneId.systemDefault());
|
|
||||||
public static final DateTimeFormatter DATE_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_YMD)
|
public static final DateTimeFormatter DATE_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_YMD)
|
||||||
.withZone(ZoneId.systemDefault());
|
.withZone(ZoneId.systemDefault());
|
||||||
public static final DateTimeFormatter DATETIME_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_YMD)
|
public static final DateTimeFormatter DATETIME_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_YMD)
|
||||||
@@ -59,13 +53,12 @@ public class CommonConstants {
|
|||||||
|
|
||||||
public static final DateTimeFormatter DATE_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY)
|
public static final DateTimeFormatter DATE_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY)
|
||||||
.withZone(ZoneId.systemDefault());
|
.withZone(ZoneId.systemDefault());
|
||||||
public static final DateTimeFormatter DATE_DMY_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY_DASHED)
|
|
||||||
.withZone(ZoneId.systemDefault());
|
|
||||||
public static final DateTimeFormatter DATETIME_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_DMY_SLASHED)
|
public static final DateTimeFormatter DATETIME_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_DMY_SLASHED)
|
||||||
.withZone(ZoneId.systemDefault());
|
.withZone(ZoneId.systemDefault());
|
||||||
public static final DateTimeFormatter DATETIME_DMY_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_DMY_DASHED)
|
public static final DateTimeFormatter DATETIME_DMY_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_DMY_DASHED)
|
||||||
.withZone(ZoneId.systemDefault());
|
.withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
|
|
||||||
public static final String ULTC = "ULTC";
|
public static final String ULTC = "ULTC";
|
||||||
public static final String DIST = "DIST";
|
public static final String DIST = "DIST";
|
||||||
public static final String CMPPF = "CMPPF";
|
public static final String CMPPF = "CMPPF";
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import it.integry.ems_model.entity.Azienda;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -29,15 +28,14 @@ public class EmsDBConst {
|
|||||||
String aziendaUp = dbName.toUpperCase();
|
String aziendaUp = dbName.toUpperCase();
|
||||||
|
|
||||||
datiAziendaLock.lock();
|
datiAziendaLock.lock();
|
||||||
try {
|
if (!datiAziendaBindingTable.containsKey(aziendaUp)) {
|
||||||
if (!datiAziendaBindingTable.containsKey(aziendaUp)) {
|
datiAziendaBindingTable.put(aziendaUp, new Const());
|
||||||
datiAziendaBindingTable.put(aziendaUp, new Const());
|
|
||||||
}
|
|
||||||
|
|
||||||
return datiAziendaBindingTable.get(aziendaUp);
|
|
||||||
} finally {
|
|
||||||
datiAziendaLock.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Const aConst = datiAziendaBindingTable.get(aziendaUp);
|
||||||
|
datiAziendaLock.unlock();
|
||||||
|
|
||||||
|
return aConst;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroyAll() {
|
public void destroyAll() {
|
||||||
@@ -46,6 +44,7 @@ public class EmsDBConst {
|
|||||||
datiAziendaLock.unlock();
|
datiAziendaLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Const {
|
public static class Const {
|
||||||
|
|
||||||
private String applicationDbName;
|
private String applicationDbName;
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ package it.integry.ems.Import.base;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
||||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
|
||||||
import it.integry.ems.json.JsonObjectMapperConfig;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
@@ -25,20 +22,10 @@ public abstract class BaseEntityImporter<T> implements IEntityImporter<T> {
|
|||||||
protected String format;
|
protected String format;
|
||||||
protected boolean headless;
|
protected boolean headless;
|
||||||
protected ImportRequestDTO requestDto;
|
protected ImportRequestDTO requestDto;
|
||||||
protected RequestDataDTO requestDataDTO;
|
|
||||||
protected MultiDBTransactionManager multiDBTransactionManager;
|
protected MultiDBTransactionManager multiDBTransactionManager;
|
||||||
protected List<AnomalieDTO> anomalie = new ArrayList<AnomalieDTO>();
|
protected List<AnomalieDTO> anomalie = new ArrayList<AnomalieDTO>();
|
||||||
|
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
protected BaseEntityImporter() {
|
|
||||||
objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
SimpleModule simpleModule = new SimpleModule();
|
|
||||||
JsonObjectMapperConfig.addDefaultAdapters(simpleModule);
|
|
||||||
|
|
||||||
objectMapper.registerModule(simpleModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEntityImporter<T> setSetupGest(SetupGest setupGest) {
|
public IEntityImporter<T> setSetupGest(SetupGest setupGest) {
|
||||||
this.setupGest = setupGest;
|
this.setupGest = setupGest;
|
||||||
@@ -79,12 +66,6 @@ public abstract class BaseEntityImporter<T> implements IEntityImporter<T> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IEntityImporter<T> setRequestDataDTO(RequestDataDTO requestDataDTO) {
|
|
||||||
this.requestDataDTO = requestDataDTO;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<AnomalieDTO> getAnomalie() {
|
public List<AnomalieDTO> getAnomalie() {
|
||||||
return anomalie;
|
return anomalie;
|
||||||
}
|
}
|
||||||
@@ -108,6 +89,4 @@ public abstract class BaseEntityImporter<T> implements IEntityImporter<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package it.integry.ems.Import.base;
|
|||||||
|
|
||||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
@@ -27,14 +26,10 @@ public interface IEntityImporter<T> {
|
|||||||
|
|
||||||
IEntityImporter<T> setRequestDTO(ImportRequestDTO requestDto);
|
IEntityImporter<T> setRequestDTO(ImportRequestDTO requestDto);
|
||||||
|
|
||||||
IEntityImporter<T> setRequestDataDTO(RequestDataDTO requestDataDTO);
|
|
||||||
|
|
||||||
List<AnomalieDTO> getAnomalie();
|
List<AnomalieDTO> getAnomalie();
|
||||||
|
|
||||||
T doImport() throws Exception;
|
T doImport() throws Exception;
|
||||||
|
|
||||||
String renameFile(String orginalFileName, List<EntityBase> entities) throws Exception;
|
String renameFile(String orginalFileName, List<EntityBase> entities) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ public enum EntityImportType {
|
|||||||
DOCUMENTI_VENDITA("DOCUMENTI VENDITA"),
|
DOCUMENTI_VENDITA("DOCUMENTI VENDITA"),
|
||||||
PROSPECT("PROSPECT"),
|
PROSPECT("PROSPECT"),
|
||||||
LISTINI_ACQUISTO("LISTINI ACQUISTO"),
|
LISTINI_ACQUISTO("LISTINI ACQUISTO"),
|
||||||
|
|
||||||
LISTINI_VENDITA("LISTINI VENDITA"),
|
LISTINI_VENDITA("LISTINI VENDITA"),
|
||||||
ACK("ACK"),
|
|
||||||
INVENTARIO("INVENTARIO"),
|
INVENTARIO("INVENTARIO"),
|
||||||
RAPPORTINI("RAPPORTINI"),
|
RAPPORTINI("RAPPORTINI"),
|
||||||
RAPPORTINI_FG("RAPPORTINI FG"),
|
RAPPORTINI_FG("RAPPORTINI FG"),
|
||||||
@@ -24,9 +25,7 @@ public enum EntityImportType {
|
|||||||
MOVIMENTI_CONTABILI("MOVIMENTI CONTABILI"),
|
MOVIMENTI_CONTABILI("MOVIMENTI CONTABILI"),
|
||||||
GRIGLIA_VENDITA("GRIGLIA VENDITA"),
|
GRIGLIA_VENDITA("GRIGLIA VENDITA"),
|
||||||
GRIGLIA_ACQUISTO("GRIGLIA ACQUISTO"),
|
GRIGLIA_ACQUISTO("GRIGLIA ACQUISTO"),
|
||||||
SCADENZE("SCADENZE"),
|
SCADENZE("SCADENZE");
|
||||||
BILANCE("BILANCE"),
|
|
||||||
BANCA("BANCA");
|
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,8 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.reflections.scanners.Scanners.TypesAnnotated;
|
import static org.reflections.scanners.Scanners.TypesAnnotated;
|
||||||
@@ -53,8 +51,6 @@ public class EmsCoreContext {
|
|||||||
private boolean contextInitialized = false;
|
private boolean contextInitialized = false;
|
||||||
|
|
||||||
private boolean firstStart = true;
|
private boolean firstStart = true;
|
||||||
@Autowired
|
|
||||||
private ExecutorService taskExecutor;
|
|
||||||
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
@@ -73,22 +69,6 @@ public class EmsCoreContext {
|
|||||||
@PreDestroy
|
@PreDestroy
|
||||||
public void preDestroy() {
|
public void preDestroy() {
|
||||||
contextInitialized = false;
|
contextInitialized = false;
|
||||||
|
|
||||||
|
|
||||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
|
||||||
Enumeration<java.sql.Driver> drivers = DriverManager.getDrivers();
|
|
||||||
logger.info("Deregister DB Drivers");
|
|
||||||
|
|
||||||
while (drivers.hasMoreElements()) {
|
|
||||||
java.sql.Driver driver = drivers.nextElement();
|
|
||||||
if (driver.getClass().getClassLoader() == cl) {
|
|
||||||
try {
|
|
||||||
DriverManager.deregisterDriver(driver);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// log error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//@EventListener(ContextRefreshedEvent.class)
|
//@EventListener(ContextRefreshedEvent.class)
|
||||||
@@ -99,7 +79,19 @@ public class EmsCoreContext {
|
|||||||
logger.debug("Init");
|
logger.debug("Init");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
emsCoreDBLoader.load(this::onPostDBLoaded);
|
//new Thread(() -> {
|
||||||
|
try {
|
||||||
|
emsCoreDBLoader.load((multiDBTransactionManager, onDone) -> {
|
||||||
|
try {
|
||||||
|
this.onPostDBLoaded(multiDBTransactionManager, onDone);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
//}).start();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(EmsCoreContext.class.getSimpleName(), e);
|
logger.error(EmsCoreContext.class.getSimpleName(), e);
|
||||||
@@ -108,10 +100,27 @@ public class EmsCoreContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onPostDBLoaded(MultiDBTransactionManager multiDBTransactionManager) throws InvocationTargetException, IllegalAccessException {
|
private void onPostDBLoaded(MultiDBTransactionManager multiDBTransactionManager, Runnable onDone) throws InterruptedException {
|
||||||
dispatchPostContextConstruct(multiDBTransactionManager);
|
|
||||||
contextInitialized = true;
|
// final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||||
dispatchPostWebServerConstruct(multiDBTransactionManager);
|
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
dispatchPostContextConstruct(multiDBTransactionManager);
|
||||||
|
|
||||||
|
contextInitialized = true;
|
||||||
|
|
||||||
|
dispatchPostWebServerConstruct(multiDBTransactionManager);
|
||||||
|
onDone.run();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("EmsCoreContext.onPostDBLoaded", e);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
// executorService.shutdown();
|
||||||
|
// executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package it.integry.ems._context;
|
|||||||
|
|
||||||
import it.integry.annotations.PostContextConstruct;
|
import it.integry.annotations.PostContextConstruct;
|
||||||
import it.integry.common.var.EmsDBConst;
|
import it.integry.common.var.EmsDBConst;
|
||||||
import it.integry.ems.expansion.RunnableArgsThrowable;
|
import it.integry.ems.datasource.DataSource;
|
||||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
import it.integry.ems.expansion.RunnableArgss;
|
||||||
|
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||||
import it.integry.ems.settings.Model.SettingsModel;
|
import it.integry.ems.settings.Model.SettingsModel;
|
||||||
import it.integry.ems.settings.SettingsController;
|
import it.integry.ems.settings.SettingsController;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool;
|
import it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
@@ -13,6 +15,7 @@ import it.integry.ems.task.TaskExecutorService;
|
|||||||
import it.integry.ems.user.service.UserCacheService;
|
import it.integry.ems.user.service.UserCacheService;
|
||||||
import it.integry.ems_model.entity.Azienda;
|
import it.integry.ems_model.entity.Azienda;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -55,8 +58,6 @@ public class EmsCoreDBLoader {
|
|||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
this.settingsController.addOnConfigUpdated(() -> {
|
this.settingsController.addOnConfigUpdated(() -> {
|
||||||
try {
|
try {
|
||||||
connectionPool.destroy();
|
|
||||||
connectionPool.init();
|
|
||||||
load(null);
|
load(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -64,31 +65,44 @@ public class EmsCoreDBLoader {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(final RunnableArgsThrowable<MultiDBTransactionManager> onComplete) throws Exception {
|
public void load(final RunnableArgss<MultiDBTransactionManager, Runnable> onComplete) throws Exception {
|
||||||
taskExecutorService.executeTask(() -> {
|
connectionPool.init();
|
||||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionPool)){
|
|
||||||
discoverAllConnections(multiDBTransactionManager);
|
|
||||||
setupAzienda(multiDBTransactionManager);
|
|
||||||
|
|
||||||
if (onComplete != null) onComplete.run(multiDBTransactionManager);
|
MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionPool);
|
||||||
} catch (Exception ex) {
|
try {
|
||||||
logger.error("EmsCoreDBLoader", ex);
|
discoverAllConnections(multiDBTransactionManager);
|
||||||
throw new RuntimeException(ex);
|
setupAzienda(multiDBTransactionManager);
|
||||||
}
|
userCacheService.discoverAllUsers(multiDBTransactionManager);
|
||||||
}, false);
|
|
||||||
|
|
||||||
|
if (onComplete != null) onComplete.run(multiDBTransactionManager, () -> {
|
||||||
|
try {
|
||||||
|
multiDBTransactionManager.closeAll();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
logger.error("EmsCoreDBLoader", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void discoverAllConnections(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
private void discoverAllConnections(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||||
|
|
||||||
ArrayList<Callable<Void>> futureTasks = new ArrayList<>();
|
ArrayList<Callable<Void>> futureTasks = new ArrayList<>();
|
||||||
for (AvailableConnectionModel model : settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true)) {
|
for (AvailableConnectionsModel model : settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true, settingsController.getHistoryProfileDb())) {
|
||||||
|
|
||||||
AtomicReference<AvailableConnectionModel> modelAtomicReference = new AtomicReference<>(model);
|
AtomicReference<AvailableConnectionsModel> modelAtomicReference = new AtomicReference<>(model);
|
||||||
|
|
||||||
futureTasks.add(() -> {
|
futureTasks.add(() -> {
|
||||||
try {
|
try {
|
||||||
multiDBTransactionManager.addConnection(modelAtomicReference.get());
|
final DataSource ds = connectionPool.getConnection(modelAtomicReference.get().getProfileName());
|
||||||
|
|
||||||
|
String sql = "SELECT db_distributore FROM azienda";
|
||||||
|
String dbDistributore = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(ds.getConnection(), sql);
|
||||||
|
|
||||||
|
multiDBTransactionManager.addConnection(modelAtomicReference.get().getProfileName(), ds, modelAtomicReference.get().getDbName().equalsIgnoreCase(dbDistributore));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw new Exception("[" + modelAtomicReference.get().getProfileName() + "] " + ex.getMessage(), ex.getCause());
|
throw new Exception("[" + modelAtomicReference.get().getProfileName() + "] " + ex.getMessage(), ex.getCause());
|
||||||
@@ -103,11 +117,13 @@ public class EmsCoreDBLoader {
|
|||||||
|
|
||||||
ArrayList<Callable<Void>> futureTasks = new ArrayList<>();
|
ArrayList<Callable<Void>> futureTasks = new ArrayList<>();
|
||||||
|
|
||||||
for (final Connection connection : multiDBTransactionManager.getActiveConnections()) {
|
for (final AdvancedDataSource advancedDataSource : multiDBTransactionManager.getActiveConnections()) {
|
||||||
|
AtomicReference<AdvancedDataSource> atomicAdvancedDataSource = new AtomicReference<>(advancedDataSource);
|
||||||
|
|
||||||
futureTasks.add(() -> {
|
futureTasks.add(() -> {
|
||||||
Azienda azienda = Azienda.getDefaultAzienda(connection);
|
Connection conn = atomicAdvancedDataSource.get().getConnection();
|
||||||
String dbName = connection.getDbName();
|
Azienda azienda = Azienda.getDefaultAzienda(conn);
|
||||||
|
String dbName = atomicAdvancedDataSource.get().getDataSource().getDbName();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (azienda != null) {
|
if (azienda != null) {
|
||||||
@@ -119,7 +135,7 @@ public class EmsCoreDBLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HashMap<String, String> gestSetupValues =
|
HashMap<String, String> gestSetupValues =
|
||||||
setupGest.getSetupSection(connection, "DATI_AZIENDA", "FATTURAZIONE_ELETTRONICA");
|
setupGest.getSetupSection(conn, "DATI_AZIENDA", "FATTURAZIONE_ELETTRONICA");
|
||||||
|
|
||||||
emsDBConst.getConsts(dbName)
|
emsDBConst.getConsts(dbName)
|
||||||
.setApplicationDbName(applicationDbName)
|
.setApplicationDbName(applicationDbName)
|
||||||
@@ -130,7 +146,7 @@ public class EmsCoreDBLoader {
|
|||||||
throw new Exception("Non è stato possibile leggere i dati dalla tabella azienda");
|
throw new Exception("Non è stato possibile leggere i dati dalla tabella azienda");
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw new Exception("[" + connection.getProfileName() + "] " + ex.getMessage(), ex.getCause());
|
throw new Exception("[" + atomicAdvancedDataSource.get().getProfileName() + "] " + ex.getMessage(), ex.getCause());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
package it.integry.ems.adapter;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
|
||||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
|
|
||||||
public class JsonLocalTimeAdapterDeserializer extends JsonDeserializer<LocalTime> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalTime deserialize(JsonParser jp, DeserializationContext arg1)
|
|
||||||
throws IOException {
|
|
||||||
|
|
||||||
if (UtilityString.isNullOrEmpty(jp.getText()))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (jp.getText().equalsIgnoreCase("null") || jp.getText().equalsIgnoreCase("1900-01-01"))
|
|
||||||
return EmsRestConstants.LOCAL_TIME_NULL;
|
|
||||||
|
|
||||||
|
|
||||||
return UtilityString.parseLocalTime(jp.getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package it.integry.ems.adapter;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
import it.integry.common.var.CommonConstants;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import java.time.LocalTime;
|
|
||||||
|
|
||||||
public class JsonLocalTimeAdapterSerializer extends JsonSerializer<LocalTime> {
|
|
||||||
@Override
|
|
||||||
public void serialize(LocalTime value, JsonGenerator gen,
|
|
||||||
SerializerProvider serializers) throws IOException {
|
|
||||||
|
|
||||||
if (value == null)
|
|
||||||
gen.writeNull();
|
|
||||||
else
|
|
||||||
gen.writeString(value.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package it.integry.ems.adapter;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
|
||||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class LongDeserializer extends JsonDeserializer<Long> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long deserialize(JsonParser parser, DeserializationContext context)
|
|
||||||
throws IOException {
|
|
||||||
String string = parser.getText();
|
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(string)) {
|
|
||||||
if (string.equalsIgnoreCase("null")) {
|
|
||||||
return EmsRestConstants.LONG_NULL;
|
|
||||||
}
|
|
||||||
return new Long(string);
|
|
||||||
} else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package it.integry.ems.adapter;
|
|
||||||
|
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
public class XmlLocalDateAdapter extends XmlAdapter<String, LocalDate> {
|
|
||||||
|
|
||||||
private DateTimeFormatter sdf;
|
|
||||||
|
|
||||||
public XmlLocalDateAdapter() {
|
|
||||||
sdf = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
|
||||||
}
|
|
||||||
|
|
||||||
public XmlLocalDateAdapter(String format) {
|
|
||||||
sdf = DateTimeFormatter.ofPattern(format);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String marshal(LocalDate arg0) throws Exception {
|
|
||||||
return arg0.format(sdf);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalDate unmarshal(String arg0) throws Exception {
|
|
||||||
String format = UtilityString.determineDateFormat(arg0);
|
|
||||||
if (format != null && !"dd-MM-yyyy".equals(format))
|
|
||||||
sdf = DateTimeFormatter.ofPattern(format);
|
|
||||||
return LocalDate.parse(arg0,sdf);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package it.integry.ems.adapter;
|
|
||||||
|
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
public class XmlLocalDateTimeAdapter extends XmlAdapter<String, LocalDateTime> {
|
|
||||||
|
|
||||||
private DateTimeFormatter sdf;
|
|
||||||
|
|
||||||
public XmlLocalDateTimeAdapter() {
|
|
||||||
sdf = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
|
|
||||||
}
|
|
||||||
|
|
||||||
public XmlLocalDateTimeAdapter(String format) {
|
|
||||||
sdf = DateTimeFormatter.ofPattern(format);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String marshal(LocalDateTime arg0) throws Exception {
|
|
||||||
return arg0.format(sdf);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalDateTime unmarshal(String arg0) throws Exception {
|
|
||||||
String format = UtilityString.determineDateFormat(arg0);
|
|
||||||
if (format != null && !"dd-MM-yyyy HH:mm:ss".equals(format))
|
|
||||||
sdf = DateTimeFormatter.ofPattern(format);
|
|
||||||
return LocalDateTime.parse(arg0,sdf);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
package it.integry.ems.configuration;
|
|
||||||
|
|
||||||
import it.integry.annotations.CustomerComponent;
|
|
||||||
import it.integry.annotations.CustomerService;
|
|
||||||
import it.integry.ems.migration._base.IntegryCustomer;
|
|
||||||
import it.integry.ems.settings.Model.SettingsModel;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
|
||||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
|
||||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.context.ApplicationListener;
|
|
||||||
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
|
||||||
import org.springframework.core.type.filter.AnnotationTypeFilter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configurazione per registrare gli scope personalizzati per customer specifici
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class CustomerServicesConfig implements ApplicationListener<ContextRefreshedEvent> {
|
|
||||||
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SettingsModel settingsModel;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ApplicationContext applicationContext;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
|
||||||
// Assicuriamoci che sia il context principale e non un sub-context
|
|
||||||
if (event.getApplicationContext() == applicationContext) {
|
|
||||||
registerCustomerBeans();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerCustomerBeans() {
|
|
||||||
ClassPathScanningCandidateComponentProvider scanner =
|
|
||||||
new ClassPathScanningCandidateComponentProvider(false);
|
|
||||||
|
|
||||||
// Aggiungo filtri per le annotazioni custom
|
|
||||||
scanner.addIncludeFilter(new AnnotationTypeFilter(CustomerService.class));
|
|
||||||
scanner.addIncludeFilter(new AnnotationTypeFilter(CustomerComponent.class));
|
|
||||||
|
|
||||||
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) applicationContext.getAutowireCapableBeanFactory();
|
|
||||||
|
|
||||||
// Scansiono tutti i package del progetto
|
|
||||||
for (BeanDefinition bd : scanner.findCandidateComponents("it.integry")) {
|
|
||||||
try {
|
|
||||||
Class<?> clazz = Class.forName(bd.getBeanClassName());
|
|
||||||
String beanName = generateBeanName(clazz);
|
|
||||||
|
|
||||||
IntegryCustomer customer = extractCustomer(clazz);
|
|
||||||
|
|
||||||
// Ora SettingsModel è completamente inizializzato con @PostConstruct chiamato
|
|
||||||
if (!settingsModel.getDefaultProfile().equalsIgnoreCase(customer.toString())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Evito duplicati controllando se il bean esiste già
|
|
||||||
if (!registry.containsBeanDefinition(beanName)) {
|
|
||||||
logger.trace("Registering custom bean for customer: " + customer + " - Class: " + clazz.getSimpleName());
|
|
||||||
|
|
||||||
// Creo la definizione del bean
|
|
||||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder
|
|
||||||
.genericBeanDefinition(clazz);
|
|
||||||
|
|
||||||
// Registro il bean nel registry di Spring
|
|
||||||
registry.registerBeanDefinition(beanName, builder.getBeanDefinition());
|
|
||||||
|
|
||||||
// Determino lo scope del bean per decidere se istanziarlo immediatamente
|
|
||||||
String beanScope = determineBeanScope(clazz);
|
|
||||||
|
|
||||||
if (shouldInstantiateImmediately(beanScope)) {
|
|
||||||
// Forzo l'istanziazione immediata solo per bean con scope appropriati
|
|
||||||
try {
|
|
||||||
Object beanInstance = applicationContext.getBean(beanName);
|
|
||||||
logger.info("Bean customer {} istanziato con successo: {} (scope: {})",
|
|
||||||
customer, beanInstance.getClass().getSimpleName(), beanScope);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("Errore durante l'istanziazione del bean {} (scope: {}): {}",
|
|
||||||
beanName, beanScope, e.getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.info("Bean customer {} registrato ma non istanziato (scope: {}). " +
|
|
||||||
"Verrà istanziato quando richiesto", customer, beanScope);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
logger.error("Impossibile caricare la classe: " + bd.getBeanClassName(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Genera il nome del bean basato sul nome della classe
|
|
||||||
*/
|
|
||||||
private String generateBeanName(Class<?> clazz) {
|
|
||||||
String simpleName = clazz.getSimpleName();
|
|
||||||
return Character.toLowerCase(simpleName.charAt(0)) + simpleName.substring(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IntegryCustomer extractCustomer(Class<?> clazz) {
|
|
||||||
if (clazz.isAnnotationPresent(CustomerService.class)) {
|
|
||||||
CustomerService cs = clazz.getAnnotation(CustomerService.class);
|
|
||||||
return cs.value();
|
|
||||||
} else if (clazz.isAnnotationPresent(CustomerComponent.class)) {
|
|
||||||
CustomerComponent cc = clazz.getAnnotation(CustomerComponent.class);
|
|
||||||
return cc.value();
|
|
||||||
}
|
|
||||||
return IntegryCustomer.Integry; // Valore di default
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determina lo scope del bean analizzando le annotazioni della classe
|
|
||||||
*/
|
|
||||||
private String determineBeanScope(Class<?> clazz) {
|
|
||||||
// Controllo per @Scope
|
|
||||||
if (clazz.isAnnotationPresent(org.springframework.context.annotation.Scope.class)) {
|
|
||||||
org.springframework.context.annotation.Scope scopeAnnotation =
|
|
||||||
clazz.getAnnotation(org.springframework.context.annotation.Scope.class);
|
|
||||||
return scopeAnnotation.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Controllo per @RequestScope
|
|
||||||
if (clazz.isAnnotationPresent(org.springframework.web.context.annotation.RequestScope.class)) {
|
|
||||||
return "request";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Controllo per @SessionScope
|
|
||||||
if (clazz.isAnnotationPresent(org.springframework.web.context.annotation.SessionScope.class)) {
|
|
||||||
return "session";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Controllo per @ApplicationScope
|
|
||||||
if (clazz.isAnnotationPresent(org.springframework.web.context.annotation.ApplicationScope.class)) {
|
|
||||||
return "application";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default è singleton
|
|
||||||
return "singleton";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determina se il bean può essere istanziato immediatamente in base al suo scope
|
|
||||||
*/
|
|
||||||
private boolean shouldInstantiateImmediately(String scope) {
|
|
||||||
switch (scope.toLowerCase()) {
|
|
||||||
case "request":
|
|
||||||
case "session":
|
|
||||||
// I bean con scope request/session non possono essere istanziati
|
|
||||||
// al di fuori del contesto web
|
|
||||||
return false;
|
|
||||||
case "prototype":
|
|
||||||
// I bean prototype non vengono istanziati automaticamente
|
|
||||||
return false;
|
|
||||||
case "singleton":
|
|
||||||
case "application":
|
|
||||||
default:
|
|
||||||
// Singleton e application possono essere istanziati immediatamente
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,15 +13,15 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class ExecutorServiceConfig {
|
public class ExecutorServiceConfig {
|
||||||
|
|
||||||
private final int corePoolSize = Runtime.getRuntime().availableProcessors();
|
private final int corePoolSize = Runtime.getRuntime().availableProcessors();
|
||||||
private final int maxPoolSize = (int) (corePoolSize * 1.5f);
|
private final int maxPoolSize = 20;
|
||||||
private final int queueSize = 1_000_000;
|
private final int queueSize = 500;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ExecutorService taskExecutor() {
|
public ExecutorService taskExecutor() {
|
||||||
return new ThreadPoolExecutor(
|
return new ThreadPoolExecutor(
|
||||||
corePoolSize,
|
corePoolSize,
|
||||||
maxPoolSize,
|
maxPoolSize,
|
||||||
5,
|
60L,
|
||||||
TimeUnit.SECONDS,
|
TimeUnit.SECONDS,
|
||||||
new LinkedBlockingQueue<>(queueSize),
|
new LinkedBlockingQueue<>(queueSize),
|
||||||
new ThreadFactoryBuilder()
|
new ThreadFactoryBuilder()
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package it.integry.ems.configuration;
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@EnableScheduling // Equivale a <task:annotation-driven/>
|
|
||||||
public class SchedulerConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ThreadPoolTaskScheduler taskScheduler() {
|
|
||||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
|
||||||
scheduler.setPoolSize(5); // Equivale a pool-size="5"
|
|
||||||
scheduler.setThreadNamePrefix("taskScheduler-");
|
|
||||||
scheduler.initialize();
|
|
||||||
return scheduler;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ package it.integry.ems.controller;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems.Import.base.EntityImportResponse;
|
import it.integry.ems.Import.base.EntityImportResponse;
|
||||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
|
||||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||||
import it.integry.ems.download.DownloadFileHandlerService;
|
import it.integry.ems.download.DownloadFileHandlerService;
|
||||||
import it.integry.ems.download.dto.DownloadFileDto;
|
import it.integry.ems.download.dto.DownloadFileDto;
|
||||||
@@ -70,8 +69,8 @@ import java.math.BigDecimal;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -223,11 +222,11 @@ public class EmsController {
|
|||||||
} else {
|
} else {
|
||||||
byte[] stream = Base64Utility.decodeBase64Zipped(encodedFile);
|
byte[] stream = Base64Utility.decodeBase64Zipped(encodedFile);
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
printerService.print(printerName, new ByteArrayInputStream(stream), mimeType, 1);
|
printerService.print(printerName, new ByteArrayInputStream(stream), mimeType);
|
||||||
response = new ServiceRestResponse(EsitoType.OK);
|
response = new ServiceRestResponse(EsitoType.OK);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
response = new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryConnection().getProfileName(), new Exception("Il contenuto del file non è valido"));
|
response = new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryDatasource().getProfile(), new Exception("Il contenuto del file non è valido"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,11 +297,11 @@ public class EmsController {
|
|||||||
sql = sql.replaceAll("select", "select TOP " + numResult + " ");
|
sql = sql.replaceAll("select", "select TOP " + numResult + " ");
|
||||||
sql = sql.replaceAll("SELECT", "SELECT TOP " + numResult + " ");
|
sql = sql.replaceAll("SELECT", "SELECT TOP " + numResult + " ");
|
||||||
}
|
}
|
||||||
objs = entityProcessor.selectRawData(sql, multiDBTransactionManager.getPrimaryConnection());
|
objs = entityProcessor.selectRawData(sql, multiDBTransactionManager.getPrimaryDatasource());
|
||||||
response = new ServiceRestResponse(EsitoType.OK, objs);
|
response = new ServiceRestResponse(EsitoType.OK, objs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(request.getRequestURI(), e);
|
logger.error(request.getRequestURI(), e);
|
||||||
response = new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryConnection().getProfileName(), e);
|
response = new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryDatasource().getProfile(), e);
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@@ -339,7 +338,7 @@ public class EmsController {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(request.getRequestURI(), e);
|
logger.error(request.getRequestURI(), e);
|
||||||
response = new ServiceRestResponse(EsitoType.KO, e, multiDBTransactionManager.getPrimaryConnection().getProfileName(), entity);
|
response = new ServiceRestResponse(EsitoType.KO, e, multiDBTransactionManager.getPrimaryDatasource().getProfile(), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.getOperation() == OperationType.SELECT_OBJECT) {
|
if (entity.getOperation() == OperationType.SELECT_OBJECT) {
|
||||||
@@ -386,7 +385,7 @@ public class EmsController {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(request.getRequestURI(), e);
|
logger.error(request.getRequestURI(), e);
|
||||||
response = new ServiceRestResponse(EsitoType.KO, e, multiDBTransactionManager.getPrimaryConnection().getProfileName(), entity);
|
response = new ServiceRestResponse(EsitoType.KO, e, multiDBTransactionManager.getPrimaryDatasource().getProfile(), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.getOperation() == OperationType.SELECT_OBJECT) {
|
if (entity.getOperation() == OperationType.SELECT_OBJECT) {
|
||||||
@@ -483,7 +482,7 @@ public class EmsController {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(request.getRequestURI(), e);
|
logger.error(request.getRequestURI(), e);
|
||||||
response = new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryConnection().getProfileName(), e);
|
response = new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryDatasource().getProfile(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@@ -519,14 +518,10 @@ public class EmsController {
|
|||||||
map.put(columnNameAltered, ((java.sql.Date) rs.getObject(columnName)).getTime() / 1000);
|
map.put(columnNameAltered, ((java.sql.Date) rs.getObject(columnName)).getTime() / 1000);
|
||||||
} else if (date2ts && metadata.getColumnType(i) == Types.TIMESTAMP) {
|
} else if (date2ts && metadata.getColumnType(i) == Types.TIMESTAMP) {
|
||||||
map.put(columnNameAltered, ((Timestamp) rs.getObject(columnName)).getTime() / 1000);
|
map.put(columnNameAltered, ((Timestamp) rs.getObject(columnName)).getTime() / 1000);
|
||||||
} else if (date2ts && metadata.getColumnType(i) == Types.TIME) {
|
|
||||||
map.put(columnNameAltered, ((Time) rs.getObject(columnName)).getTime() / 1000);
|
|
||||||
} else if (date2iso && metadata.getColumnType(i) == Types.DATE) {
|
} else if (date2iso && metadata.getColumnType(i) == Types.DATE) {
|
||||||
map.put(columnNameAltered, ((java.sql.Date) rs.getObject(columnName)).toLocalDate().format(DateTimeFormatter.ISO_DATE));
|
map.put(columnNameAltered, ((java.sql.Date) rs.getObject(columnName)).toLocalDate().format(DateTimeFormatter.ISO_DATE));
|
||||||
} else if (date2iso && metadata.getColumnType(i) == Types.TIMESTAMP) {
|
} else if (date2iso && metadata.getColumnType(i) == Types.TIMESTAMP) {
|
||||||
map.put(columnNameAltered, ((Timestamp) rs.getObject(columnName)).toLocalDateTime().format(DateTimeFormatter.ISO_DATE_TIME));
|
map.put(columnNameAltered, ((Timestamp) rs.getObject(columnName)).toLocalDateTime().format(DateTimeFormatter.ISO_DATE_TIME));
|
||||||
} else if (date2iso && metadata.getColumnType(i) == Types.TIME) {
|
|
||||||
map.put(columnNameAltered, ((Time) rs.getObject(columnName)).toLocalTime().format(DateTimeFormatter.ISO_LOCAL_TIME));
|
|
||||||
} else {
|
} else {
|
||||||
map.put(columnNameAltered, rs.getObject(columnName));
|
map.put(columnNameAltered, rs.getObject(columnName));
|
||||||
}
|
}
|
||||||
@@ -544,29 +539,20 @@ public class EmsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_EXPORT, method = RequestMethod.POST)
|
@RequestMapping(value = EmsRestConstants.PATH_EXPORT, method = RequestMethod.POST)
|
||||||
public @ResponseBody ServiceRestResponse export(HttpServletRequest request,
|
public @ResponseBody ServiceRestResponse export(
|
||||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
HttpServletRequest request,
|
||||||
@RequestParam(value = EmsRestConstants.TYPE) String typeExport,
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
@RequestParam(value = EmsRestConstants.FORMAT) String formatExport,
|
@RequestParam(value = EmsRestConstants.TYPE) String typeExport,
|
||||||
@RequestParam(required = false, defaultValue = "false") Boolean binaryDownload,
|
@RequestParam(value = EmsRestConstants.FORMAT) String formatExport,
|
||||||
@RequestParam(required = false, defaultValue = "true") boolean headless,
|
@RequestParam(required = false, defaultValue = "false") Boolean binaryDownload,
|
||||||
@RequestBody(required = false) JsonNode body) throws Exception {
|
@RequestParam(required = false, defaultValue = "true") boolean headless,
|
||||||
|
@RequestBody(required = false) JsonNode body) throws Exception {
|
||||||
|
|
||||||
EntityExportResponse<?> entityExportResponse = emsServices.export(multiDBTransactionManager, requestDataDTO, typeExport, formatExport, body, headless);
|
EntityExportResponse<?> entityExportResponse = emsServices.export(typeExport, formatExport, body, headless);
|
||||||
List<AnomalieDTO> anomalie = new ArrayList<>();
|
|
||||||
|
|
||||||
if (entityExportResponse != null && entityExportResponse.getAnomalie() != null && !entityExportResponse.getAnomalie().isEmpty())
|
|
||||||
anomalie = entityExportResponse.getAnomalie();
|
|
||||||
|
|
||||||
ServiceRestResponse sr;
|
|
||||||
if (!anomalie.isEmpty() && anomalie.stream().anyMatch(x -> x.getTipo() == (AnomalieDTO.Type.ERROR))) {
|
|
||||||
sr = ServiceRestResponse.createNegativeResponse();
|
|
||||||
} else {
|
|
||||||
sr = ServiceRestResponse.createPositiveResponse();
|
|
||||||
}
|
|
||||||
sr.setMessagesFromAnomalie(anomalie);
|
|
||||||
|
|
||||||
|
ServiceRestResponse sr = ServiceRestResponse.createPositiveResponse();
|
||||||
if (entityExportResponse != null) {
|
if (entityExportResponse != null) {
|
||||||
|
|
||||||
if (binaryDownload) {
|
if (binaryDownload) {
|
||||||
List<DownloadFileDto> downloadableFileList = new ArrayList<>();
|
List<DownloadFileDto> downloadableFileList = new ArrayList<>();
|
||||||
for (EntityExportedFile exportedFile : (List<EntityExportedFile>) entityExportResponse.getResponse()) {
|
for (EntityExportedFile exportedFile : (List<EntityExportedFile>) entityExportResponse.getResponse()) {
|
||||||
@@ -608,7 +594,7 @@ public class EmsController {
|
|||||||
@RequestParam(required = false, defaultValue = "true") boolean headless,
|
@RequestParam(required = false, defaultValue = "true") boolean headless,
|
||||||
@RequestBody(required = false) ImportRequestDTO requestBody) throws Exception {
|
@RequestBody(required = false) ImportRequestDTO requestBody) throws Exception {
|
||||||
|
|
||||||
EntityImportResponse<List<EntityBase>> importResponse = emsServices.importEntity(multiDBTransactionManager, requestDataDTO, importType, importFormat, requestBody, headless);
|
EntityImportResponse<List<EntityBase>> importResponse = emsServices.importEntity(importType, importFormat, requestBody, headless);
|
||||||
List<EntityBase> entities = importResponse.getResponse();
|
List<EntityBase> entities = importResponse.getResponse();
|
||||||
|
|
||||||
|
|
||||||
@@ -619,23 +605,48 @@ public class EmsController {
|
|||||||
.map(x -> MessageDTO.error(x.getException().getMessage()))
|
.map(x -> MessageDTO.error(x.getException().getMessage()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<AnomalieDTO> anomalie = importResponse.getAnomalie();
|
List<MessageDTO> messages = importResponse.getAnomalie().stream()
|
||||||
|
.filter(x -> x.getTipo() != null)
|
||||||
|
.map(x -> {
|
||||||
|
switch (x.getTipo()) {
|
||||||
|
case ERROR:
|
||||||
|
return MessageDTO.error(x.getMessage());
|
||||||
|
case WARNING:
|
||||||
|
default:
|
||||||
|
return MessageDTO.warning(x.getMessage());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!errorMessages.isEmpty() || (anomalie != null && !anomalie.isEmpty())) {
|
errorMessages.addAll(messages);
|
||||||
|
|
||||||
|
if (!errorMessages.isEmpty()) {
|
||||||
response = ServiceRestResponse.createNegativeResponse();
|
response = ServiceRestResponse.createNegativeResponse();
|
||||||
} else {
|
} else {
|
||||||
response = ServiceRestResponse.createPositiveResponse();
|
response = ServiceRestResponse.createPositiveResponse();
|
||||||
}
|
}
|
||||||
response.setMessages(errorMessages, importResponse.getAnomalie());
|
response.setMessages(errorMessages);
|
||||||
response.setEntityList(entities.stream().filter(x -> x.getException() == null).collect(Collectors.toList()));
|
response.setEntityList(entities.stream().filter(x -> x.getException() == null).collect(Collectors.toList()));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (importResponse.getAnomalie() != null) {
|
if (importResponse.getAnomalie() != null) {
|
||||||
|
|
||||||
if (!importResponse.getAnomalie().isEmpty()) {
|
if (!importResponse.getAnomalie().isEmpty()) {
|
||||||
|
|
||||||
response = ServiceRestResponse.createNegativeResponse()
|
List<MessageDTO> messages = importResponse.getAnomalie().stream()
|
||||||
.setMessagesFromAnomalie(importResponse.getAnomalie());
|
.map(x -> {
|
||||||
|
switch (x.getTipo()) {
|
||||||
|
case ERROR:
|
||||||
|
return MessageDTO.error(x.getMessage());
|
||||||
|
case WARNING:
|
||||||
|
default:
|
||||||
|
return MessageDTO.warning(x.getMessage());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
response = ServiceRestResponse.createNegativeResponse();
|
||||||
|
response.setMessages(messages);
|
||||||
} else response = ServiceRestResponse.createPositiveResponse();
|
} else response = ServiceRestResponse.createPositiveResponse();
|
||||||
|
|
||||||
} else throw new Exception("Non ci sono dati da importare");
|
} else throw new Exception("Non ci sono dati da importare");
|
||||||
@@ -687,7 +698,7 @@ public class EmsController {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error(request.getRequestURI(), e);
|
logger.error(request.getRequestURI(), e);
|
||||||
response = new ServiceRestResponse(EsitoType.KO, e, multiDBTransactionManager.getPrimaryConnection().getProfileName(), entity);
|
response = new ServiceRestResponse(EsitoType.KO, e, multiDBTransactionManager.getPrimaryDatasource().getProfile(), entity);
|
||||||
responseList.add(response);
|
responseList.add(response);
|
||||||
if (forceTransaction) {
|
if (forceTransaction) {
|
||||||
break;
|
break;
|
||||||
@@ -700,6 +711,16 @@ public class EmsController {
|
|||||||
logger.error(request.getRequestURI(), e);
|
logger.error(request.getRequestURI(), e);
|
||||||
ServiceRestResponse response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
ServiceRestResponse response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||||
responseList.add(response);
|
responseList.add(response);
|
||||||
|
} finally {
|
||||||
|
if (multiDBTransactionManager != null) {
|
||||||
|
try {
|
||||||
|
multiDBTransactionManager.closeAll();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(request.getRequestURI(), e);
|
||||||
|
ServiceRestResponse response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||||
|
responseList.add(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return responseList;
|
return responseList;
|
||||||
@@ -733,7 +754,7 @@ public class EmsController {
|
|||||||
@PathVariable String filename,
|
@PathVariable String filename,
|
||||||
@RequestParam(name = "contentDisposition", defaultValue = "attachment") String contentDispositionType,
|
@RequestParam(name = "contentDisposition", defaultValue = "attachment") String contentDispositionType,
|
||||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
||||||
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(multiDBTransactionManager, idAttach, requestThumbnail);
|
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(idAttach, requestThumbnail);
|
||||||
|
|
||||||
if (attachmentDTO != null) {
|
if (attachmentDTO != null) {
|
||||||
return ResponseEntity.ok()
|
return ResponseEntity.ok()
|
||||||
@@ -750,31 +771,13 @@ public class EmsController {
|
|||||||
return ResponseEntity.notFound().build();
|
return ResponseEntity.notFound().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "downloadFileFromRefUuid")
|
|
||||||
public ResponseEntity<byte[]> downloadFileFromRefUuid(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
|
||||||
@RequestParam() String refUuid,
|
|
||||||
@RequestParam() String fileName) throws Exception {
|
|
||||||
AttachmentDTO attached = emsServices.downloadFileFromRefUuid(multiDBTransactionManager, refUuid, fileName);
|
|
||||||
|
|
||||||
if (attached == null) return ResponseEntity.notFound().build();
|
|
||||||
|
|
||||||
return ResponseEntity.ok()
|
|
||||||
.contentType(MediaType.parseMediaType(attached.getMimeType()))
|
|
||||||
.contentLength(attached.getFileSize())
|
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
|
||||||
.attachment()
|
|
||||||
.filename(attached.getFileName())
|
|
||||||
.build()
|
|
||||||
.toString())
|
|
||||||
.body(attached.getFileContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.GET)
|
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.GET)
|
||||||
public ResponseEntity<byte[]> downloadStbFileAttachmentPath(
|
public ResponseEntity<byte[]> downloadStbFileAttachmentPath(
|
||||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||||
@RequestParam String idAttach,
|
@RequestParam String idAttach,
|
||||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
||||||
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(multiDBTransactionManager, idAttach, requestThumbnail);
|
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(idAttach, requestThumbnail);
|
||||||
|
|
||||||
if (attachmentDTO != null) {
|
if (attachmentDTO != null) {
|
||||||
return ResponseEntity.ok()
|
return ResponseEntity.ok()
|
||||||
@@ -793,8 +796,9 @@ public class EmsController {
|
|||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_EMAIL_CONTENT, method = RequestMethod.GET)
|
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_EMAIL_CONTENT, method = RequestMethod.GET)
|
||||||
public ResponseEntity<byte[]> downloadStbEmailContent(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
public byte[] downloadStbEmailContent(HttpServletRequest request, HttpServletResponse response,
|
||||||
@RequestParam Integer idEmail) throws Exception {
|
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||||
|
@RequestParam Integer idEmail) throws Exception {
|
||||||
StbEmailContent stbEmailContent = new StbEmailContent();
|
StbEmailContent stbEmailContent = new StbEmailContent();
|
||||||
stbEmailContent.setIdEmail(idEmail);
|
stbEmailContent.setIdEmail(idEmail);
|
||||||
stbEmailContent.setOperation(OperationType.SELECT_OBJECT);
|
stbEmailContent.setOperation(OperationType.SELECT_OBJECT);
|
||||||
@@ -802,7 +806,11 @@ public class EmsController {
|
|||||||
stbEmailContent = entityProcessor.processEntity(stbEmailContent, multiDBTransactionManager);
|
stbEmailContent = entityProcessor.processEntity(stbEmailContent, multiDBTransactionManager);
|
||||||
|
|
||||||
if (stbEmailContent != null) {
|
if (stbEmailContent != null) {
|
||||||
byte[] byteArr;
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
|
response.addHeader(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename("email.eml").build().toString());
|
||||||
|
|
||||||
|
byte[] byteArr = null;
|
||||||
|
|
||||||
String pattern = "[^\\x00-\\x7F]";
|
String pattern = "[^\\x00-\\x7F]";
|
||||||
Pattern pat = Pattern.compile(pattern);
|
Pattern pat = Pattern.compile(pattern);
|
||||||
@@ -814,30 +822,24 @@ public class EmsController {
|
|||||||
byteArr = Base64.decodeBase64(stbEmailContent.getEmailContent());
|
byteArr = Base64.decodeBase64(stbEmailContent.getEmailContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok()
|
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
return byteArr;
|
||||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
|
||||||
.builder("attachment")
|
|
||||||
.filename("email.eml")
|
|
||||||
.build()
|
|
||||||
.toString())
|
|
||||||
.body(byteArr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.notFound().build();
|
response.sendError(404, "Allegato non trovato");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_PDF, method = RequestMethod.GET)
|
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_PDF, method = RequestMethod.GET)
|
||||||
public ResponseEntity<byte[]> downloadDtbDocPdf(
|
public byte[] downloadDtbDocPdf(HttpServletResponse response,
|
||||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||||
@RequestParam(name = "contentDisposition", defaultValue = "attachment") String contentDispositionType,
|
@RequestParam String dataDoc,
|
||||||
@RequestParam String dataDoc,
|
@RequestParam String serDoc,
|
||||||
@RequestParam String serDoc,
|
@RequestParam Integer numDoc,
|
||||||
@RequestParam Integer numDoc,
|
@RequestParam String codAnag,
|
||||||
@RequestParam String codAnag,
|
@RequestParam String codDtip,
|
||||||
@RequestParam String codDtip,
|
@RequestParam Integer versione) throws Exception {
|
||||||
@RequestParam Integer versione) throws Exception {
|
|
||||||
|
|
||||||
DtbDocPdf dtbDocPdf = new DtbDocPdf();
|
DtbDocPdf dtbDocPdf = new DtbDocPdf();
|
||||||
dtbDocPdf.setDataDoc(UtilityDate.RecognizeDate(dataDoc));
|
dtbDocPdf.setDataDoc(UtilityDate.RecognizeDate(dataDoc));
|
||||||
@@ -851,7 +853,9 @@ public class EmsController {
|
|||||||
dtbDocPdf = entityProcessor.processEntity(dtbDocPdf, multiDBTransactionManager);
|
dtbDocPdf = entityProcessor.processEntity(dtbDocPdf, multiDBTransactionManager);
|
||||||
|
|
||||||
if (dtbDocPdf != null) {
|
if (dtbDocPdf != null) {
|
||||||
MediaType mimeType = mimeTypesHandler.getContentType(dtbDocPdf.getFilename());
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
|
response.addHeader(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename(dtbDocPdf.getFilename()).build().toString());
|
||||||
|
|
||||||
byte[] byteArr = null;
|
byte[] byteArr = null;
|
||||||
|
|
||||||
@@ -869,28 +873,21 @@ public class EmsController {
|
|||||||
byteArr = dtbDocPdf.getFilecontentByteArr(false);
|
byteArr = dtbDocPdf.getFilecontentByteArr(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok()
|
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||||
.contentType(mimeType)
|
return byteArr;
|
||||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
|
||||||
.builder(contentDispositionType)
|
|
||||||
.filename(dtbDocPdf.getFilename())
|
|
||||||
.build()
|
|
||||||
.toString())
|
|
||||||
.body(byteArr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.notFound().build();
|
response.sendError(404, "Allegato non trovato");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_ORD_PDF, method = RequestMethod.GET)
|
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_ORD_PDF, method = RequestMethod.GET)
|
||||||
public ResponseEntity<byte[]> downloadDtbOrdPdf(
|
public byte[] downloadDtbOrdPdf(HttpServletRequest request, HttpServletResponse response,
|
||||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||||
@RequestParam String gestione,
|
@RequestParam String gestione,
|
||||||
@RequestParam String dataOrd,
|
@RequestParam String dataOrd,
|
||||||
@RequestParam Integer numOrd,
|
@RequestParam Integer numOrd,
|
||||||
@RequestParam Integer versione) throws Exception {
|
@RequestParam Integer versione) throws Exception {
|
||||||
|
|
||||||
DtbOrdPdf dtbOrdPdf = new DtbOrdPdf();
|
DtbOrdPdf dtbOrdPdf = new DtbOrdPdf();
|
||||||
dtbOrdPdf.setGestione(gestione);
|
dtbOrdPdf.setGestione(gestione);
|
||||||
dtbOrdPdf.setDataOrd(UtilityDate.RecognizeDate(dataOrd));
|
dtbOrdPdf.setDataOrd(UtilityDate.RecognizeDate(dataOrd));
|
||||||
@@ -901,20 +898,17 @@ public class EmsController {
|
|||||||
dtbOrdPdf = entityProcessor.processEntity(dtbOrdPdf, multiDBTransactionManager);
|
dtbOrdPdf = entityProcessor.processEntity(dtbOrdPdf, multiDBTransactionManager);
|
||||||
|
|
||||||
if (dtbOrdPdf != null) {
|
if (dtbOrdPdf != null) {
|
||||||
byte[] byteArr = dtbOrdPdf.getFilecontentByteArr(true);
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
|
response.addHeader(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename(dtbOrdPdf.getFilename()).build().toString());
|
||||||
|
|
||||||
return ResponseEntity.ok()
|
byte[] byteArr = dtbOrdPdf.getFilecontentByteArr(true);
|
||||||
.contentType(MediaType.APPLICATION_PDF)
|
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
return byteArr;
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
|
||||||
.builder("attachment")
|
|
||||||
.filename(ContentDisposition.attachment().filename(dtbOrdPdf.getFilename()).build().toString())
|
|
||||||
.build()
|
|
||||||
.toString())
|
|
||||||
.body(byteArr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.notFound().build();
|
response.sendError(404, "Allegato non trovato");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.POST)
|
@RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.POST)
|
||||||
@@ -931,7 +925,7 @@ public class EmsController {
|
|||||||
throw new Exception("Sono stati inviati più file del previsto");
|
throw new Exception("Sono stati inviati più file del previsto");
|
||||||
}
|
}
|
||||||
|
|
||||||
StbFilesAttached stbFilesAttached = emsServices.uploadStbFilesAttached(multiDBTransactionManager, idAttach,
|
StbFilesAttached stbFilesAttached = emsServices.uploadStbFilesAttached(idAttach,
|
||||||
files[0].getOriginalFilename(),
|
files[0].getOriginalFilename(),
|
||||||
files[0].getBytes(),
|
files[0].getBytes(),
|
||||||
descrizione,
|
descrizione,
|
||||||
@@ -1077,59 +1071,10 @@ public class EmsController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "uploadDtbDocFileContent")
|
|
||||||
public ServiceRestResponse uploadDtbDocFileContent(HttpServletRequest request, HttpServletResponse response,
|
|
||||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
|
||||||
@RequestParam("dataDoc") String dataDocStr,
|
|
||||||
@RequestParam String serDoc,
|
|
||||||
@RequestParam Integer numDoc,
|
|
||||||
@RequestParam String codAnag,
|
|
||||||
@RequestParam String codDtip,
|
|
||||||
@RequestParam String descrizione,
|
|
||||||
@RequestPart MultipartFile[] files
|
|
||||||
) {
|
|
||||||
try {
|
|
||||||
if (files == null || files.length == 0) {
|
|
||||||
throw new Exception("Nessun file è stato rilevato");
|
|
||||||
} else if (files.length > 1) {
|
|
||||||
throw new Exception("Sono stati inviati più file del previsto");
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] content = files[0].getBytes();
|
|
||||||
|
|
||||||
String idAttach = null;
|
|
||||||
StbFilesAttached.TypeAttach typeAttach = null;
|
|
||||||
Date dataDoc = UtilityDate.RecognizeDate(dataDocStr);
|
|
||||||
|
|
||||||
DrlDocAttached drlDocAttached =
|
|
||||||
new DrlDocAttached()
|
|
||||||
.setDataDoc(dataDoc)
|
|
||||||
.setSerDoc(serDoc)
|
|
||||||
.setNumDoc(numDoc)
|
|
||||||
.setCodAnag(codAnag)
|
|
||||||
.setCodDtip(codDtip);
|
|
||||||
drlDocAttached.setOperation(OperationType.INSERT);
|
|
||||||
|
|
||||||
StbFilesAttached stbFilesAttached = emsServices.uploadStbFilesAttached(multiDBTransactionManager, idAttach,
|
|
||||||
files[0].getOriginalFilename(),
|
|
||||||
files[0].getBytes(),
|
|
||||||
descrizione,
|
|
||||||
files[0].getContentType(),
|
|
||||||
typeAttach,
|
|
||||||
null, drlDocAttached, null);
|
|
||||||
|
|
||||||
return ServiceRestResponse.createPositiveResponse(stbFilesAttached);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
return new ServiceRestResponse(EsitoType.KO, config, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "createZipFromFiles", method = RequestMethod.POST)
|
@RequestMapping(value = "createZipFromFiles", method = RequestMethod.POST)
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ServiceRestResponse createZipFromFiles(@RequestBody CreateZipDTO createZipDTO) throws Exception {
|
ServiceRestResponse createZipFromFiles(@RequestBody CreateZipDTO createZipDTO) throws Exception {
|
||||||
return ServiceRestResponse.createPositiveResponse(emsServices.createZipFromFiles(multiDBTransactionManager, createZipDTO));
|
return ServiceRestResponse.createPositiveResponse(emsServices.createZipFromFiles(createZipDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_EMAIL_CONTENT, method = RequestMethod.POST)
|
// @RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_EMAIL_CONTENT, method = RequestMethod.POST)
|
||||||
@@ -1175,10 +1120,22 @@ public class EmsController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = EmsRestConstants.PATH_CLEAN_DIRECTORIES, method = RequestMethod.POST)
|
||||||
|
public @ResponseBody
|
||||||
|
ServiceRestResponse cleanDirectories(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||||
|
try {
|
||||||
|
emsServices.cleanDirectories();
|
||||||
|
return ServiceRestResponse.createPositiveResponse();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryDatasource().getProfile(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_EXPORT_SERVER_INFO_ISCC, method = RequestMethod.POST)
|
@RequestMapping(value = EmsRestConstants.PATH_EXPORT_SERVER_INFO_ISCC, method = RequestMethod.POST)
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ServiceRestResponse exportServerInfoISCC(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
ServiceRestResponse exportServerInfoISCC(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||||
emsServices.checkServerVariables(multiDBTransactionManager);
|
emsServices.checkServerVariables();
|
||||||
return ServiceRestResponse.createPositiveResponse();
|
return ServiceRestResponse.createPositiveResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1190,7 +1147,7 @@ public class EmsController {
|
|||||||
return ServiceRestResponse.createPositiveResponse(mapping);
|
return ServiceRestResponse.createPositiveResponse(mapping);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryConnection().getProfileName(), e);
|
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryDatasource().getProfile(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1202,7 +1159,7 @@ public class EmsController {
|
|||||||
return ServiceRestResponse.createPositiveResponse(historyProfileDb);
|
return ServiceRestResponse.createPositiveResponse(historyProfileDb);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryConnection().getProfileName(), e);
|
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryDatasource().getProfile(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1219,7 +1176,7 @@ public class EmsController {
|
|||||||
return ServiceRestResponse.createPositiveResponse(entityFields);
|
return ServiceRestResponse.createPositiveResponse(entityFields);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryConnection().getProfileName(), e);
|
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryDatasource().getProfile(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package it.integry.ems.controller;
|
||||||
|
|
||||||
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
|
import it.integry.ems.service.MapService;
|
||||||
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
|
import it.integry.ems_model.types.LatLng;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Scope("request")
|
||||||
|
public class MapController {
|
||||||
|
|
||||||
|
|
||||||
|
private final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MapService mapService;
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = EmsRestConstants.PATH_MAP_GETCOORDINATE_BY_CITY, method = RequestMethod.GET)
|
||||||
|
public @ResponseBody
|
||||||
|
ServiceRestResponse getCoordinateByCity(HttpServletRequest request,
|
||||||
|
@RequestParam String cityName) {
|
||||||
|
ServiceRestResponse resp;
|
||||||
|
try {
|
||||||
|
LatLng coordinates = mapService.getCoordinateByCity(cityName);
|
||||||
|
resp = ServiceRestResponse.createPositiveResponse(coordinates);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(request.getRequestURI(), e);
|
||||||
|
resp = ServiceRestResponse.createNegativeResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,172 +1,140 @@
|
|||||||
package it.integry.ems.datasource;
|
package it.integry.ems.datasource;
|
||||||
|
|
||||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||||
import it.integry.ems.settings.Model.SettingsModel;
|
import it.integry.ems.settings.Model.SettingsModel;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityHashMap;
|
import it.integry.ems_model.utility.UtilityHashMap;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.apache.commons.dbcp2.BasicDataSource;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.HashMap;
|
import javax.annotation.PreDestroy;
|
||||||
|
import java.io.IOException;
|
||||||
public class DataSource extends BasicDataSource {
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
private final int POOL_SIZE;
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashMap;
|
||||||
private AvailableConnectionModel connectionModel;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
@Service
|
||||||
* Instanzia un nuovo datasource.
|
@Scope(value = "request")
|
||||||
*
|
public class DataSource {
|
||||||
* @deprecated Il datasource non deve essere istanziato direttamente ma bisogna utilizzare il metodo
|
|
||||||
* {@link it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool#getConnection(AvailableConnectionModel)} per ottenere una connessione.
|
private AvailableConnectionsModel connectionModel;
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public DataSource() {
|
private String profile;
|
||||||
super();
|
private Short sessionID;
|
||||||
POOL_SIZE = 5;
|
private Connection connection = null;
|
||||||
}
|
private String applicationName;
|
||||||
|
|
||||||
@Deprecated
|
public String getDbName() {
|
||||||
public DataSource(int poolSize) {
|
return connectionModel.getDbName();
|
||||||
super();
|
}
|
||||||
POOL_SIZE = poolSize;
|
|
||||||
}
|
public String getProfile() {
|
||||||
|
return profile;
|
||||||
public EmsRestConstants.DB_TYPE getTypeDB() {
|
}
|
||||||
return connectionModel.getConnectionType();
|
|
||||||
}
|
public EmsRestConstants.DB_TYPE getTypeDB() {
|
||||||
|
return connectionModel.getConnectionType();
|
||||||
/**
|
}
|
||||||
* Ottiene una connessione dal pool. La connessione è wrappata in it.integry.ems.sync.MultiDBTransaction.Connection.
|
|
||||||
* È responsabilità del chiamante chiudere la connessione per restituirla al pool.
|
public String getApplicationName() {
|
||||||
*
|
return applicationName;
|
||||||
* @return una connessione dal pool
|
}
|
||||||
* @throws SQLException se si verifica un errore di accesso al database
|
|
||||||
*/
|
public int getSessionID() {
|
||||||
|
return sessionID;
|
||||||
public Connection getConnection() throws SQLException {
|
}
|
||||||
// Restituisce una nuova connessione dal pool di BasicDataSource, wrappata nel nostro tipo Connection
|
|
||||||
final Connection connection = Connection.fromConnection(super.getConnection());
|
public synchronized Connection getConnection() throws IOException, SQLException {
|
||||||
// Prova a ottenere una connessione per verificare la configurazione e ottenere il sessionID
|
return connection;
|
||||||
|
}
|
||||||
if (connectionModel.getConnectionType() == EmsRestConstants.DB_TYPE.MSSQL) {
|
|
||||||
HashMap<String, Object> resultSessionData = UtilityDB.executeSimpleQueryOnlyFirstRow(connection, "select CAST(@@spid AS BIGINT) AS session_id," +
|
public boolean isClosed() throws SQLException {
|
||||||
" user_name() AS [user_name]," +
|
return !(connection != null && !connection.isClosed());
|
||||||
" suser_name() AS [suser_name]," +
|
}
|
||||||
" current_user AS [current_user]," +
|
|
||||||
" system_user AS [system_user]," +
|
private void init(String applicationName) throws SQLException, IOException {
|
||||||
" session_user AS [session_user]," +
|
this.applicationName = applicationName;
|
||||||
" user AS [user]");
|
|
||||||
|
connection = Connection.fromConnection(
|
||||||
connection.setSessionId(UtilityHashMap.getValueIfExists(resultSessionData, "session_id"));
|
DriverManager.getConnection(connectionModel.getDbConnectionString(applicationName), connectionModel.getUsername(), connectionModel.getPasswordDecrypted())
|
||||||
}
|
);
|
||||||
|
connection.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
|
||||||
connection.setProfileName(connectionModel.getProfileName())
|
connection.setAutoCommit(false);
|
||||||
.setInternalDb(connectionModel.getInternalDb());
|
|
||||||
|
if (connectionModel.getConnectionType() == EmsRestConstants.DB_TYPE.MSSQL) {
|
||||||
return connection;
|
try (final PreparedStatement setNocountOn = connection.prepareStatement("SET NOCOUNT ON")) {
|
||||||
}
|
boolean resultNoCount = setNocountOn.execute();
|
||||||
|
}
|
||||||
public synchronized void initialize(String profileDB) throws Exception {
|
|
||||||
initialize(profileDB, null);
|
HashMap<String, Object> resultSessionData = UtilityDB.executeSimpleQueryOnlyFirstRow(connection, "select @@spid AS session_id," +
|
||||||
}
|
" user_name() AS [user_name]," +
|
||||||
|
" suser_name() AS [suser_name]," +
|
||||||
public synchronized void initialize(String profileDB, String customAppName) throws Exception {
|
" current_user AS [current_user]," +
|
||||||
AvailableConnectionModel connectionsModel = SettingsModel.getInstance().findConnectionModel(profileDB);
|
" system_user AS [system_user]," +
|
||||||
|
" session_user AS [session_user]," +
|
||||||
initialize(connectionsModel, customAppName);
|
" user AS [user]");
|
||||||
}
|
|
||||||
|
this.sessionID = UtilityHashMap.getValueIfExists(resultSessionData, "session_id");
|
||||||
public synchronized void initialize(AvailableConnectionModel connectionModel) throws Exception {
|
}
|
||||||
initialize(connectionModel, null);
|
}
|
||||||
}
|
|
||||||
|
@PreDestroy
|
||||||
public synchronized void initialize(AvailableConnectionModel connectionModel, String customAppName) throws Exception {
|
private void destroy() throws SQLException {
|
||||||
if (connectionModel == null) {
|
forceClose();
|
||||||
throw new Exception("Configurazione DB non trovata");
|
}
|
||||||
}
|
|
||||||
|
public synchronized void initialize(String profileDB, String connectionName, boolean autoOpenConnection) throws Exception {
|
||||||
this.connectionModel = connectionModel;
|
if (UtilityString.isNullOrEmpty(profileDB)) {
|
||||||
|
throw new Exception("Profile DB non valorizzato - controllare la chiamata del servizio");
|
||||||
this.setDriverClassName(connectionModel.getDriverClassName());
|
}
|
||||||
|
|
||||||
this.setUrl(connectionModel.getDbConnectionString(UtilityString.isNull(customAppName, "EMS Connection")));
|
this.profile = profileDB;
|
||||||
this.setUsername(connectionModel.getUsername());
|
this.sessionID = -1;
|
||||||
this.setPassword(connectionModel.getPasswordDecrypted());
|
|
||||||
this.setDefaultCatalog(connectionModel.getDbName());
|
|
||||||
|
AvailableConnectionsModel connectionModel = null;
|
||||||
this.setDefaultTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
|
List<AvailableConnectionsModel> availableConnectionsModels = SettingsModel.getInstance().getAvailableConnections();
|
||||||
this.setDefaultAutoCommit(false);
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(profileDB)) {
|
||||||
// ===== OTTIMIZZAZIONI CRITICHE =====
|
for (AvailableConnectionsModel connectionsModel : availableConnectionsModels) {
|
||||||
|
if (connectionsModel.getProfileName().equalsIgnoreCase(profileDB)) {
|
||||||
// Pool sizing ottimizzato per READ_UNCOMMITTED (meno locking = più connessioni possibili)
|
connectionModel = connectionsModel;
|
||||||
this.setInitialSize(POOL_SIZE); // Inizia con più connessioni
|
}
|
||||||
this.setMaxTotal(-1); // Aumentato il massimo
|
}
|
||||||
this.setMinIdle(POOL_SIZE); // Non scendere sotto 5
|
}
|
||||||
this.setMaxIdle(-1); // Mantieni più connessioni idle
|
|
||||||
|
if (connectionModel == null) {
|
||||||
// Timeout ottimizzati per performance massime
|
throw new Exception(String.format("Configurazione DB non trovata o dati mancanti (%s)", profileDB));
|
||||||
// this.setMaxWaitMillis(-1L); // Infinito (DEFAULT)
|
}
|
||||||
|
|
||||||
// Validazione veloce ed efficiente
|
this.connectionModel = connectionModel;
|
||||||
this.setValidationQuery("SELECT 1");
|
|
||||||
this.setValidationQueryTimeout(30); // Ridotto a 1 secondo
|
if (autoOpenConnection) {
|
||||||
this.setTestWhileIdle(true); // Testa connessioni idle
|
init(connectionName);
|
||||||
|
}
|
||||||
// Eviction ottimizzata per READ_UNCOMMITTED
|
}
|
||||||
// this.setTimeBetweenEvictionRunsMillis(1 * 1000); // Ogni 30 secondi
|
|
||||||
// this.setMinEvictableIdleTimeMillis(1 * 60 * 1000); // 3 minuti (ridotto da 5)
|
public synchronized void initialize(String profileDB, boolean autoOpenConnection) throws Exception {
|
||||||
// this.setNumTestsPerEvictionRun(5); // Testa più connessioni per volta
|
initialize(profileDB, "EMS Connection", autoOpenConnection);
|
||||||
|
}
|
||||||
// Connection leak protection
|
|
||||||
this.setRemoveAbandonedOnBorrow(true);
|
public synchronized void initialize(String profileDB) throws Exception {
|
||||||
this.setRemoveAbandonedOnMaintenance(true);
|
initialize(profileDB, "EMS Connection", true);
|
||||||
this.setRemoveAbandonedTimeout(3 * 60 * 10); // 3 minuti
|
}
|
||||||
this.setLogAbandoned(true); // Disabilita in produzione per performance
|
|
||||||
|
public void forceClose() throws SQLException {
|
||||||
// Performance boosts massimi
|
if (connection != null) {
|
||||||
// this.setPoolPreparedStatements(true);
|
synchronized (connection) {
|
||||||
// this.setMaxOpenPreparedStatements(200);
|
connection.close();
|
||||||
// this.setCacheState(true);
|
}
|
||||||
this.setFastFailValidation(true);
|
}
|
||||||
|
|
||||||
// Ottimizzazioni specifiche per SQL Server con READ_UNCOMMITTED
|
}
|
||||||
if (connectionModel.getConnectionType() == EmsRestConstants.DB_TYPE.MSSQL) {
|
|
||||||
// Impostazioni connection specifiche per SQL Server
|
|
||||||
//this.setConnectionInitSqls(java.util.Arrays.asList(
|
|
||||||
//"SET NOCOUNT ON",
|
|
||||||
//"SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED",
|
|
||||||
//"SET ARITHABORT ON"
|
|
||||||
//));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logging ottimizzato (disabilita in produzione)
|
|
||||||
this.setLogExpiredConnections(true);
|
|
||||||
|
|
||||||
// ==================== ULTERIORI OTTIMIZZAZIONI ====================
|
|
||||||
|
|
||||||
// Connection properties specifiche per performance
|
|
||||||
this.setDefaultReadOnly(false);
|
|
||||||
|
|
||||||
// Ottimizzazioni DBCP2 avanzate
|
|
||||||
// this.setLifo(false); // FIFO per distribuzione equa delle connessioni
|
|
||||||
// this.setSoftMinEvictableIdleTimeMillis(120000); // 2 minuti soft eviction
|
|
||||||
|
|
||||||
|
|
||||||
// if (!connectionModel.getInternalDb() ||
|
|
||||||
// UtilityDebug.isDebugExecution() ||
|
|
||||||
// UtilityDebug.isIntegryServerDev() ||
|
|
||||||
// !SettingsModel.getInstance().isPrimaryInstance()) {
|
|
||||||
// this.setInitialSize(0);
|
|
||||||
//// this.setMaxTotal(5);
|
|
||||||
// this.setMinIdle(0);
|
|
||||||
// this.setMaxIdle(1);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,302 +0,0 @@
|
|||||||
package it.integry.ems.dbms_change_tracker.component;
|
|
||||||
|
|
||||||
import com.microsoft.sqlserver.jdbc.SQLServerConnection;
|
|
||||||
import it.integry.ems.datasource.DataSource;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.ChangeTrackingConfigDTO;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.DetectedChangeDataDTO;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
|
||||||
import it.integry.ems_model.utility.UtilityHashMap;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class DbmsChangeTracker {
|
|
||||||
|
|
||||||
private DataSource dataSource;
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
|
||||||
|
|
||||||
|
|
||||||
private final int CHANGE_RETENTION_HOURS = 1;
|
|
||||||
private final boolean AUTO_CLEANUP = true;
|
|
||||||
|
|
||||||
private Connection integryConnection;
|
|
||||||
private boolean trackerEnabled = false;
|
|
||||||
private long currentVersion;
|
|
||||||
|
|
||||||
|
|
||||||
private Listener eventListener;
|
|
||||||
|
|
||||||
public DbmsChangeTracker(String profileDb) throws Exception {
|
|
||||||
createDataSource(profileDb);
|
|
||||||
createConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createDataSource(String profileDb) throws Exception {
|
|
||||||
DataSource ds = new DataSource(1);
|
|
||||||
ds.initialize(profileDb, "Integry Changes Tracker");
|
|
||||||
this.dataSource = ds;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createConnection() throws SQLException {
|
|
||||||
integryConnection = dataSource.getConnection();
|
|
||||||
if (!(integryConnection.isWrapperFor(SQLServerConnection.class))) {
|
|
||||||
integryConnection.close();
|
|
||||||
|
|
||||||
throw new SQLException("Connection is not a SQL Server connection");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkConnection() {
|
|
||||||
try {
|
|
||||||
UtilityDB.executeSimpleQuery(integryConnection, "SELECT 1");
|
|
||||||
if (integryConnection.isClosed())
|
|
||||||
createConnection();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
try {
|
|
||||||
try {
|
|
||||||
integryConnection.close();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
createConnection();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
logger.error("Unable to reestablish DB connection for Change Tracker", ex);
|
|
||||||
throw new RuntimeException("Unable to reestablish DB connection for Change Tracker");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void enableTrackerInDbms() throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
|
||||||
final ChangeTrackingConfigDTO currentConfig = retrieveTrackerCurrentConfig();
|
|
||||||
if (currentConfig != null) {
|
|
||||||
logInfo("Changes Tracker is already enabled (with " + currentConfig.getRetentionPeriod() + " " + currentConfig.getRetentionPeriodUnit().toLowerCase() + " retention and auto cleanup " + (currentConfig.isAutoCleanupOn() ? "ON" : "OFF") + ")");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String enableSql = "ALTER DATABASE [" + integryConnection.getDbName() + "] \n" +
|
|
||||||
"SET CHANGE_TRACKING = ON (" +
|
|
||||||
"CHANGE_RETENTION = " + CHANGE_RETENTION_HOURS + " HOURS, " +
|
|
||||||
"AUTO_CLEANUP = " + (AUTO_CLEANUP ? "ON" : "OFF") +
|
|
||||||
");\n";
|
|
||||||
|
|
||||||
//COMMIT necessario perché ALTER DATABASE richiede che non ci siano altre transazioni attive
|
|
||||||
UtilityDB.executeStatement(integryConnection, "COMMIT", enableSql);
|
|
||||||
|
|
||||||
logInfo("Changes Tracker is now enabled (with " + CHANGE_RETENTION_HOURS + " hours retention and auto cleanup " + (AUTO_CLEANUP ? "ON" : "OFF") + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void enableTrackerOnTable(String tableName) throws SQLException {
|
|
||||||
if (isTableTrackingEnabled(tableName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UtilityDB.executeStatement(integryConnection, "ALTER TABLE dbo." + tableName + "\n" +
|
|
||||||
"ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = ON);", "COMMIT");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void disableTrackerOnNotUsedTables(List<String> usedTables) throws SQLException {
|
|
||||||
final List<String> trackedTables = retrieveTrackedTables();
|
|
||||||
|
|
||||||
trackedTables.removeAll(usedTables);
|
|
||||||
|
|
||||||
for (String tableName : trackedTables) {
|
|
||||||
disableTrackerOnTable(tableName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void disableTrackerOnTable(String tableName) throws SQLException {
|
|
||||||
if (!isTableTrackingEnabled(tableName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UtilityDB.executeStatement(integryConnection, "ALTER TABLE dbo." + tableName + "\n" +
|
|
||||||
"DISABLE CHANGE_TRACKING;", "COMMIT");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void startTracking() throws SQLException {
|
|
||||||
currentVersion = retrieveCurrentVersion();
|
|
||||||
trackerEnabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkForChanges() throws Exception {
|
|
||||||
if (!trackerEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
checkConnection();
|
|
||||||
|
|
||||||
final List<String> trackedTables = retrieveTrackedTables();
|
|
||||||
|
|
||||||
HashMap<Long, List<DetectedChangeDataDTO>> changesByVersion = new HashMap<>();
|
|
||||||
|
|
||||||
for (String trackedTable : trackedTables) {
|
|
||||||
long minValidVersion = getMinValidVersion(trackedTable);
|
|
||||||
|
|
||||||
if (currentVersion < minValidVersion) {
|
|
||||||
if (eventListener != null) {
|
|
||||||
eventListener.onTrackingResetted();
|
|
||||||
currentVersion = retrieveCurrentVersion();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<DetectedChangeDataDTO> detectedChanges = retrieveChangeList(trackedTable);
|
|
||||||
|
|
||||||
detectedChanges.forEach(detectedChangeDataDTO -> {
|
|
||||||
changesByVersion.putIfAbsent(detectedChangeDataDTO.getSysChangeVersion(), new ArrayList<>());
|
|
||||||
changesByVersion.get(detectedChangeDataDTO.getSysChangeVersion()).add(detectedChangeDataDTO);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
logTrace("Detected " + changesByVersion.size() + " changes since version " + currentVersion);
|
|
||||||
|
|
||||||
dispatchChanges(changesByVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dispatchChanges(HashMap<Long, List<DetectedChangeDataDTO>> changesByVersion) throws Exception {
|
|
||||||
final List<Long> sortedChanges = changesByVersion.keySet().stream()
|
|
||||||
.sorted()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
|
|
||||||
for (Long changeId : sortedChanges) {
|
|
||||||
final List<DetectedChangeDataDTO> detectedChanges = changesByVersion.get(changeId);
|
|
||||||
|
|
||||||
for (DetectedChangeDataDTO detectedChange : detectedChanges) {
|
|
||||||
switch (detectedChange.getSysChangeOperation()) {
|
|
||||||
case INSERT:
|
|
||||||
if (eventListener != null)
|
|
||||||
eventListener.onInsertDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UPDATE:
|
|
||||||
if (eventListener != null)
|
|
||||||
eventListener.onUpdateDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DELETE:
|
|
||||||
if (eventListener != null)
|
|
||||||
eventListener.onDeleteDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
currentVersion = changeId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<DetectedChangeDataDTO> retrieveChangeList(String tableName) throws SQLException {
|
|
||||||
String sql = "SELECT *\n" +
|
|
||||||
"FROM CHANGETABLE(CHANGES dbo." + tableName + ", " + currentVersion + ") AS c";
|
|
||||||
final List<HashMap<String, Object>> result = UtilityDB.executeSimpleQuery(integryConnection, sql);
|
|
||||||
|
|
||||||
return result.stream()
|
|
||||||
.map(x -> {
|
|
||||||
DetectedChangeDataDTO detectedChangeDataDTO = new DetectedChangeDataDTO()
|
|
||||||
.setTableName(tableName);
|
|
||||||
|
|
||||||
Long sysChangeVersion = UtilityHashMap.<Long>getValueIfExists(x, "SYS_CHANGE_VERSION");
|
|
||||||
detectedChangeDataDTO.setSysChangeVersion(sysChangeVersion);
|
|
||||||
|
|
||||||
|
|
||||||
Long sysChangeCreationVersion = UtilityHashMap.<Long>getValueIfExists(x, "SYS_CHANGE_CREATION_VERSION");
|
|
||||||
detectedChangeDataDTO.setSysChangeCreationVersion(sysChangeCreationVersion);
|
|
||||||
|
|
||||||
detectedChangeDataDTO.setSysChangeOperation(DetectedChangeDataDTO.Operation.from(UtilityHashMap.<String>getValueIfExists(x, "SYS_CHANGE_OPERATION")));
|
|
||||||
|
|
||||||
List<String> keysToRemove = new ArrayList<>();
|
|
||||||
for (String colName : x.keySet()) {
|
|
||||||
if (colName.startsWith("SYS_"))
|
|
||||||
keysToRemove.add(colName);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String colName : keysToRemove) {
|
|
||||||
x.remove(colName);
|
|
||||||
}
|
|
||||||
|
|
||||||
detectedChangeDataDTO.setPrimaryKey(x);
|
|
||||||
|
|
||||||
return detectedChangeDataDTO;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
private long retrieveCurrentVersion() throws SQLException {
|
|
||||||
String sql = "SELECT CHANGE_TRACKING_CURRENT_VERSION() AS current_version";
|
|
||||||
|
|
||||||
long currentVersion = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(integryConnection, sql);
|
|
||||||
return currentVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
private long getMinValidVersion(String table) throws SQLException {
|
|
||||||
String sql = "SELECT CHANGE_TRACKING_MIN_VALID_VERSION(OBJECT_ID(" + UtilityDB.valueToString(table) + "))";
|
|
||||||
|
|
||||||
long minValidVersion = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(integryConnection, sql);
|
|
||||||
return minValidVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> retrieveTrackedTables() throws SQLException {
|
|
||||||
String sql = "SELECT OBJECT_NAME(object_id) AS table_name\n" +
|
|
||||||
" FROM sys.change_tracking_tables";
|
|
||||||
|
|
||||||
List<String> trackedTables = UtilityDB.executeSimpleQueryOnlyFirstColumn(integryConnection, sql);
|
|
||||||
return trackedTables;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isTableTrackingEnabled(String tableName) throws SQLException {
|
|
||||||
String sql = "SELECT CAST(COUNT(is_track_columns_updated_on) AS BIT) AS enabled\n" +
|
|
||||||
" FROM sys.change_tracking_tables \n" +
|
|
||||||
" WHERE object_id = OBJECT_ID('dbo." + tableName + "')";
|
|
||||||
|
|
||||||
boolean enabled = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(integryConnection, sql);
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ChangeTrackingConfigDTO retrieveTrackerCurrentConfig() throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
|
||||||
String checkSql = "SELECT DB_NAME(database_id) as database_name,\n" +
|
|
||||||
"CAST(is_auto_cleanup_on AS BIT) AS is_auto_cleanup_on,\n" +
|
|
||||||
"retention_period,\n" +
|
|
||||||
"retention_period_units_desc,\n" +
|
|
||||||
"max_cleanup_version\n" +
|
|
||||||
"FROM sys.change_tracking_databases \n" +
|
|
||||||
"WHERE DB_NAME(database_id)=DB_NAME()";
|
|
||||||
|
|
||||||
final ChangeTrackingConfigDTO currentConfig = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(integryConnection, checkSql, ChangeTrackingConfigDTO.class);
|
|
||||||
|
|
||||||
return currentConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void logInfo(String message) {
|
|
||||||
logger.info("[" + integryConnection.getProfileName() + "] " + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void logTrace(String message) {
|
|
||||||
logger.trace("[" + integryConnection.getProfileName() + "] " + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public DbmsChangeTracker setEventListener(Listener eventListener) {
|
|
||||||
this.eventListener = eventListener;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface Listener {
|
|
||||||
void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
|
|
||||||
|
|
||||||
void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
|
|
||||||
|
|
||||||
void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
|
|
||||||
|
|
||||||
void onTrackingResetted() throws Exception;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
package it.integry.ems.dbms_change_tracker.component;
|
|
||||||
|
|
||||||
import it.integry.annotations.PostContextAutowired;
|
|
||||||
import it.integry.annotations.PostContextConstruct;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordDeletedEvent;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordInsertedEvent;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordUpdatedEvent;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.events.TableTrackingResettedEvent;
|
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
|
||||||
import it.integry.ems_model.entity.*;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class DbmsChangeTrackerComponent {
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
|
||||||
|
|
||||||
private final HashMap<IntegryCustomerDB, DbmsChangeTracker> activeChangeTrackers = new HashMap<>();
|
|
||||||
|
|
||||||
private final ArrayList<String> trackedTables = new ArrayList<String>() {{
|
|
||||||
add(MtbAart.ENTITY);
|
|
||||||
add(MtbAartBarCode.ENTITY);
|
|
||||||
add(MtbUntMis.ENTITY);
|
|
||||||
add(MtbDepo.ENTITY);
|
|
||||||
add(MtbDepoPosizioni.ENTITY);
|
|
||||||
add(StbEditLimit.ENTITY);
|
|
||||||
add(StbGestSetup.ENTITY);
|
|
||||||
add(StbGestSetupDepo.ENTITY);
|
|
||||||
add(StbUser.ENTITY);
|
|
||||||
add(WtbClie.ENTITY);
|
|
||||||
add(WtbDepo.ENTITY);
|
|
||||||
add(WtbGestSetupUser.ENTITY);
|
|
||||||
}};
|
|
||||||
|
|
||||||
|
|
||||||
private final ApplicationEventPublisher applicationEventPublisher;
|
|
||||||
|
|
||||||
@PostContextAutowired
|
|
||||||
private MultiDBTransactionManager multiDBTransactionManager;
|
|
||||||
|
|
||||||
public DbmsChangeTrackerComponent(ApplicationEventPublisher applicationEventPublisher) {
|
|
||||||
this.applicationEventPublisher = applicationEventPublisher;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostContextConstruct(priority = 10)
|
|
||||||
public void init() throws Exception {
|
|
||||||
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
|
|
||||||
IntegryCustomerDB customerDB = IntegryCustomerDB.parse(conn.getDbName());
|
|
||||||
activeChangeTrackers.put(customerDB, new DbmsChangeTracker(conn.getProfileName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
enableAllChangeTracking();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void enableAllChangeTracking() throws Exception {
|
|
||||||
for (Map.Entry<IntegryCustomerDB, DbmsChangeTracker> entrySet : activeChangeTrackers.entrySet()) {
|
|
||||||
final IntegryCustomerDB customerDB = entrySet.getKey();
|
|
||||||
final DbmsChangeTracker dbmsChangeTracker = entrySet.getValue();
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
dbmsChangeTracker.enableTrackerInDbms();
|
|
||||||
|
|
||||||
for (String tableName : trackedTables) {
|
|
||||||
dbmsChangeTracker.enableTrackerOnTable(tableName);
|
|
||||||
}
|
|
||||||
|
|
||||||
dbmsChangeTracker.disableTrackerOnNotUsedTables(trackedTables);
|
|
||||||
|
|
||||||
dbmsChangeTracker.setEventListener(new DbmsChangeTracker.Listener() {
|
|
||||||
@Override
|
|
||||||
public void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) {
|
|
||||||
onItemInserted(customerDB, tableName, primaryKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) {
|
|
||||||
onItemUpdated(customerDB, tableName, primaryKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) {
|
|
||||||
onItemDeleted(customerDB, tableName, primaryKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTrackingResetted() throws Exception {
|
|
||||||
requestGlobalReset(customerDB);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dbmsChangeTracker.startTracking();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new Exception("Errore durante l'abilitazione del DbmsChangeTracker per il customer: " + customerDB.getValue(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Scheduled(fixedDelay = 5, timeUnit = TimeUnit.SECONDS)
|
|
||||||
private void checkAllChanges() throws Exception {
|
|
||||||
for (DbmsChangeTracker dbmsChangeTracker : activeChangeTrackers.values()) {
|
|
||||||
try {
|
|
||||||
dbmsChangeTracker.checkForChanges();
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("Errore durante il controllo delle modifiche nel DbmsChangeTracker.", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void onItemInserted(IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
|
|
||||||
logger.trace("Item inserted in profileDb {} table {} with primaryKey {}", customerDB.getValue(), tableName, primaryKey);
|
|
||||||
applicationEventPublisher.publishEvent(new TableRecordInsertedEvent(this, customerDB, tableName, primaryKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onItemUpdated(IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
|
|
||||||
logger.trace("Item updated in profileDb {} table {} with primaryKey {}", customerDB.getValue(), tableName, primaryKey);
|
|
||||||
applicationEventPublisher.publishEvent(new TableRecordUpdatedEvent(this, customerDB, tableName, primaryKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onItemDeleted(IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
|
|
||||||
logger.trace("Item deleted in profileDb {} table {} with primaryKey {}", customerDB.getValue(), tableName, primaryKey);
|
|
||||||
applicationEventPublisher.publishEvent(new TableRecordDeletedEvent(this, customerDB, tableName, primaryKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void requestGlobalReset(IntegryCustomerDB customerDB) {
|
|
||||||
logger.warn("Table tracking resetted in profileDb {} ", customerDB.getValue());
|
|
||||||
applicationEventPublisher.publishEvent(new TableTrackingResettedEvent(this, customerDB));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package it.integry.ems.dbms_change_tracker.component.exception;
|
|
||||||
|
|
||||||
public class DbmsChangeTrackerInvalidMinVersionException extends Exception {
|
|
||||||
|
|
||||||
private final String tableName;
|
|
||||||
private final long currentVersion;
|
|
||||||
private final long minValidVersion;
|
|
||||||
|
|
||||||
public DbmsChangeTrackerInvalidMinVersionException(String tableName, long currentVersion, long minValidVersion) {
|
|
||||||
super("Change Tracking on table " + tableName + " has been reset. Current version: " + currentVersion + ", Min valid version: " + minValidVersion);
|
|
||||||
this.tableName = tableName;
|
|
||||||
this.minValidVersion = minValidVersion;
|
|
||||||
this.currentVersion = currentVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTableName() {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCurrentVersion() {
|
|
||||||
return currentVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getMinValidVersion() {
|
|
||||||
return minValidVersion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package it.integry.ems.dbms_change_tracker.model;
|
|
||||||
|
|
||||||
import it.integry.ems_model.annotation.SqlField;
|
|
||||||
|
|
||||||
public class ChangeTrackingConfigDTO {
|
|
||||||
|
|
||||||
@SqlField("database_name")
|
|
||||||
private String databaseName;
|
|
||||||
|
|
||||||
@SqlField("is_auto_cleanup_on")
|
|
||||||
private boolean autoCleanupOn;
|
|
||||||
|
|
||||||
@SqlField("retention_period")
|
|
||||||
private int retentionPeriod;
|
|
||||||
|
|
||||||
@SqlField("retention_period_units_desc")
|
|
||||||
private String retentionPeriodUnit;
|
|
||||||
|
|
||||||
// @SqlField("max_cleanup_version")
|
|
||||||
private Object maxCleanupVersion;
|
|
||||||
|
|
||||||
|
|
||||||
public String getDatabaseName() {
|
|
||||||
return databaseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChangeTrackingConfigDTO setDatabaseName(String databaseName) {
|
|
||||||
this.databaseName = databaseName;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoCleanupOn() {
|
|
||||||
return autoCleanupOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChangeTrackingConfigDTO setAutoCleanupOn(boolean autoCleanupOn) {
|
|
||||||
this.autoCleanupOn = autoCleanupOn;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRetentionPeriod() {
|
|
||||||
return retentionPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChangeTrackingConfigDTO setRetentionPeriod(int retentionPeriod) {
|
|
||||||
this.retentionPeriod = retentionPeriod;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRetentionPeriodUnit() {
|
|
||||||
return retentionPeriodUnit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChangeTrackingConfigDTO setRetentionPeriodUnit(String retentionPeriodUnit) {
|
|
||||||
this.retentionPeriodUnit = retentionPeriodUnit;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getMaxCleanupVersion() {
|
|
||||||
return maxCleanupVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChangeTrackingConfigDTO setMaxCleanupVersion(Object maxCleanupVersion) {
|
|
||||||
this.maxCleanupVersion = maxCleanupVersion;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
package it.integry.ems.dbms_change_tracker.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
|
||||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class DetectedChangeDataDTO {
|
|
||||||
|
|
||||||
private long sysChangeVersion;
|
|
||||||
private Long sysChangeCreationVersion;
|
|
||||||
private Operation sysChangeOperation;
|
|
||||||
|
|
||||||
private String tableName;
|
|
||||||
private HashMap<String, Object> primaryKey;
|
|
||||||
|
|
||||||
|
|
||||||
public long getSysChangeVersion() {
|
|
||||||
return sysChangeVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DetectedChangeDataDTO setSysChangeVersion(long sysChangeVersion) {
|
|
||||||
this.sysChangeVersion = sysChangeVersion;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getSysChangeCreationVersion() {
|
|
||||||
return sysChangeCreationVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DetectedChangeDataDTO setSysChangeCreationVersion(Long sysChangeCreationVersion) {
|
|
||||||
this.sysChangeCreationVersion = sysChangeCreationVersion;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Operation getSysChangeOperation() {
|
|
||||||
return sysChangeOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DetectedChangeDataDTO setSysChangeOperation(Operation sysChangeOperation) {
|
|
||||||
this.sysChangeOperation = sysChangeOperation;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTableName() {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DetectedChangeDataDTO setTableName(String tableName) {
|
|
||||||
this.tableName = tableName;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String, Object> getPrimaryKey() {
|
|
||||||
return primaryKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DetectedChangeDataDTO setPrimaryKey(HashMap<String, Object> primaryKey) {
|
|
||||||
this.primaryKey = primaryKey;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public enum Operation implements IBaseEnum<Operation> {
|
|
||||||
INSERT('I'),
|
|
||||||
UPDATE('U'),
|
|
||||||
DELETE('D');
|
|
||||||
|
|
||||||
private final char value;
|
|
||||||
|
|
||||||
Operation(char value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Operation from(Object value) {
|
|
||||||
if (value instanceof String && ((String) value).length() == 1) {
|
|
||||||
value = ((String) value).charAt(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
char castValue = (char) value;
|
|
||||||
for (Operation b : Operation.values()) {
|
|
||||||
if (b.value == castValue)
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonValue
|
|
||||||
public char getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object get() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Operation fromInternal(Object val) {
|
|
||||||
return from(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.valueOf(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package it.integry.ems.dbms_change_tracker.model.events;
|
|
||||||
|
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
|
||||||
import it.integry.event.BaseCustomerDBEvent;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class TableRecordDeletedEvent extends BaseCustomerDBEvent {
|
|
||||||
|
|
||||||
private final String tableName;
|
|
||||||
private final HashMap<String, Object> primaryKey;
|
|
||||||
|
|
||||||
public TableRecordDeletedEvent(Object source, IntegryCustomerDB integryCustomerDB, String tableName, HashMap<String, Object> primaryKey) {
|
|
||||||
super(source, integryCustomerDB);
|
|
||||||
|
|
||||||
this.tableName = tableName;
|
|
||||||
this.primaryKey = primaryKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTableName() {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String, Object> getPrimaryKey() {
|
|
||||||
return primaryKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package it.integry.ems.dbms_change_tracker.model.events;
|
|
||||||
|
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
|
||||||
import it.integry.event.BaseCustomerDBEvent;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class TableRecordInsertedEvent extends BaseCustomerDBEvent {
|
|
||||||
|
|
||||||
private final String tableName;
|
|
||||||
private final HashMap<String, Object> primaryKey;
|
|
||||||
|
|
||||||
public TableRecordInsertedEvent(Object source, IntegryCustomerDB integryCustomerDB, String tableName, HashMap<String, Object> primaryKey) {
|
|
||||||
super(source, integryCustomerDB);
|
|
||||||
|
|
||||||
this.tableName = tableName;
|
|
||||||
this.primaryKey = primaryKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTableName() {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String, Object> getPrimaryKey() {
|
|
||||||
return primaryKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package it.integry.ems.dbms_change_tracker.model.events;
|
|
||||||
|
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
|
||||||
import it.integry.event.BaseCustomerDBEvent;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class TableRecordUpdatedEvent extends BaseCustomerDBEvent {
|
|
||||||
|
|
||||||
private final String tableName;
|
|
||||||
private final HashMap<String, Object> primaryKey;
|
|
||||||
|
|
||||||
public TableRecordUpdatedEvent(Object source, IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
|
|
||||||
super(source, customerDB);
|
|
||||||
|
|
||||||
this.tableName = tableName;
|
|
||||||
this.primaryKey = primaryKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTableName() {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String, Object> getPrimaryKey() {
|
|
||||||
return primaryKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package it.integry.ems.dbms_change_tracker.model.events;
|
|
||||||
|
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
|
||||||
import it.integry.event.BaseCustomerDBEvent;
|
|
||||||
|
|
||||||
public class TableTrackingResettedEvent extends BaseCustomerDBEvent {
|
|
||||||
|
|
||||||
public TableTrackingResettedEvent(Object source, IntegryCustomerDB customerDB) {
|
|
||||||
super(source, customerDB);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,13 @@ package it.integry.ems.devices;
|
|||||||
|
|
||||||
|
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
|
import it.integry.ems.devices.dto.RegisterDeviceRequestDTO;
|
||||||
|
import it.integry.ems.javabeans.RequestDataDTO;
|
||||||
import it.integry.ems.response.ServiceRestResponse;
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
|
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.context.annotation.Scope;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -11,14 +17,42 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
@RequestMapping("device")
|
@RequestMapping("device")
|
||||||
public class DevicesController {
|
public class DevicesController {
|
||||||
|
|
||||||
@Deprecated
|
private final Logger logger = LogManager.getLogger();
|
||||||
@RequestMapping(value = "register", method = RequestMethod.POST)
|
|
||||||
public @ResponseBody ServiceRestResponse register(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
|
||||||
@RequestBody Object registerDeviceRequestDTO) throws Exception {
|
|
||||||
|
|
||||||
//TODO: To be removed
|
@Autowired
|
||||||
//Mantenuto solo per lasciare compatibilità con le vecchie versioni del WMS
|
private MultiDBTransactionManager multiDBTransactionManager;
|
||||||
//Non serve più per >= v1.45.00
|
|
||||||
|
@Autowired
|
||||||
|
private RequestDataDTO requestDataDTO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DevicesService devicesService;
|
||||||
|
|
||||||
|
@RequestMapping(value = "register", method = RequestMethod.POST)
|
||||||
|
public @ResponseBody
|
||||||
|
ServiceRestResponse register(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
|
@RequestBody RegisterDeviceRequestDTO registerDeviceRequestDTO) throws Exception {
|
||||||
|
|
||||||
|
DevicesService.App application = null;
|
||||||
|
switch (registerDeviceRequestDTO.getApp().toLowerCase()) {
|
||||||
|
case "wms":
|
||||||
|
application = DevicesService.App.WMS;
|
||||||
|
break;
|
||||||
|
case "wingest":
|
||||||
|
application = DevicesService.App.Wingest;
|
||||||
|
break;
|
||||||
|
case "textiles":
|
||||||
|
application = DevicesService.App.Textiles;
|
||||||
|
break;
|
||||||
|
case "agribook":
|
||||||
|
application = DevicesService.App.Agribook;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(application == null)
|
||||||
|
throw new Exception("Impossibile riconoscere l'applicativo");
|
||||||
|
|
||||||
|
devicesService.register(application, requestDataDTO.getDeviceId());
|
||||||
return ServiceRestResponse.createPositiveResponse();
|
return ServiceRestResponse.createPositiveResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,38 +1,46 @@
|
|||||||
package it.integry.ems.devices;
|
package it.integry.ems.devices;
|
||||||
|
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
import it.integry.ems.javabeans.RequestDataDTO;
|
||||||
import it.integry.security.service.DeviceService;
|
import it.integry.ems.settings.Model.SettingsModel;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.context.ContextLoader;
|
import org.springframework.web.context.ContextLoader;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope("request")
|
@Scope("request")
|
||||||
public class DevicesRequestInterceptor implements HandlerInterceptor {
|
public class DevicesRequestInterceptor extends HandlerInterceptorAdapter {
|
||||||
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
private final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
@Override
|
@Autowired
|
||||||
|
private SettingsModel settingsModel;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DevicesService devicesService;
|
||||||
|
|
||||||
public boolean preHandle(
|
public boolean preHandle(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response, Object handler) {
|
HttpServletResponse response, Object handler) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
DeviceService deviceService = ContextLoader.getCurrentWebApplicationContext().getBean(DeviceService.class);
|
|
||||||
RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||||
|
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||||
|
|
||||||
if (requestDataDTO.isValidProfileDB() && requestDataDTO.isValidDeviceId()) {
|
if (requestDataDTO.isValidProfileDB() && requestDataDTO.isValidDeviceId()) {
|
||||||
deviceService.updateUsage(requestDataDTO.getDeviceId());
|
devicesService.updateUsage(multiDBTransactionManager.getPrimaryConnection(), requestDataDTO.getDeviceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
logger.error(ex.getMessage(), ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package it.integry.ems.devices;
|
||||||
|
|
||||||
|
|
||||||
|
import it.integry.ems._context.ApplicationContextProvider;
|
||||||
|
import it.integry.ems.service.EntityProcessor;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
|
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.types.OperationType;
|
||||||
|
import it.integry.ems_model.utility.Query;
|
||||||
|
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.security.core.userdetails.UsernameNotFoundException;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.context.ContextLoader;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DevicesService {
|
||||||
|
|
||||||
|
public enum App {
|
||||||
|
WMS,
|
||||||
|
Wingest,
|
||||||
|
Textiles,
|
||||||
|
Agribook
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
|
public void register(App application, String deviceId) throws Exception {
|
||||||
|
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||||
|
EntityProcessor entityProcessor = ApplicationContextProvider.getApplicationContext().getBean(EntityProcessor.class);
|
||||||
|
UserSession userSession = ContextLoader.getCurrentWebApplicationContext().getBean(UserSession.class);
|
||||||
|
|
||||||
|
if (!userSession.isAttivo()) {
|
||||||
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
||||||
|
}
|
||||||
|
|
||||||
|
String appName = application.name();
|
||||||
|
|
||||||
|
String selectSql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM stb_devices " +
|
||||||
|
" WHERE identification_id = {}", deviceId);
|
||||||
|
|
||||||
|
boolean exists =
|
||||||
|
UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), selectSql);
|
||||||
|
|
||||||
|
if (!exists) {
|
||||||
|
StbDevices stbDevices = new StbDevices()
|
||||||
|
.setName(appName)
|
||||||
|
.setIdentificationId(deviceId)
|
||||||
|
.setCreatedAt(new Date())
|
||||||
|
.setLastUse(new Date());
|
||||||
|
|
||||||
|
stbDevices.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||||
|
entityProcessor.processEntity(stbDevices, multiDBTransactionManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateUsage(Connection connection, String deviceId) throws Exception {
|
||||||
|
String updateSql = Query.format("UPDATE stb_devices " +
|
||||||
|
" SET last_use = {}" +
|
||||||
|
" WHERE identification_id = {}", UtilityLocalDate.getNowTime(), deviceId);
|
||||||
|
|
||||||
|
UtilityDB.executeSimpleUpdate(connection, updateSql);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.ems.devices.dto;
|
||||||
|
|
||||||
|
public class RegisterDeviceRequestDTO {
|
||||||
|
|
||||||
|
private String app;
|
||||||
|
|
||||||
|
public String getApp() {
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterDeviceRequestDTO setApp(String app) {
|
||||||
|
this.app = app;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,16 +2,14 @@ package it.integry.ems.directory;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
|
import it.integry.ems.datasource.DataSource;
|
||||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||||
import it.integry.ems.properties.EmsProperties;
|
import it.integry.ems.properties.EmsProperties;
|
||||||
import it.integry.ems.response.EsitoType;
|
import it.integry.ems.response.EsitoType;
|
||||||
import it.integry.ems.response.FileItem;
|
import it.integry.ems.response.FileItem;
|
||||||
import it.integry.ems.response.ServiceRestResponse;
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
import it.integry.ems_model.utility.UtilityHashMap;
|
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import it.integry.security.utility.RestUtil;
|
import it.integry.security.utility.RestUtil;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
@@ -31,18 +29,17 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
public class EmailWatcherListener extends TimerTask {
|
public class EmailWatcherListener extends TimerTask {
|
||||||
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
private Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
private final EmailListenerInfo emailListenerInfo;
|
private EmailListenerInfo emailListenerInfo;
|
||||||
private final EmsProperties prop;
|
private EmsProperties prop;
|
||||||
private final SetupGest setupGest;
|
private SetupGest setupGest;
|
||||||
private final ResponseJSONObjectMapper jsonObjectMapper;
|
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||||
|
|
||||||
public EmailWatcherListener(EmailListenerInfo emailListenerInfo, EmsProperties prop,
|
public EmailWatcherListener(EmailListenerInfo emailListenerInfo, EmsProperties prop,
|
||||||
SetupGest setupGest, ResponseJSONObjectMapper jsonObjectMapper) {
|
SetupGest setupGest, ResponseJSONObjectMapper jsonObjectMapper) {
|
||||||
@@ -55,44 +52,42 @@ public class EmailWatcherListener extends TimerTask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(emailListenerInfo.getDatabase())) {
|
try {
|
||||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
|
||||||
|
|
||||||
String flagAttivo = null, username = null, password = null,
|
String flagAttivo = null, username = null, password = null,
|
||||||
imap = null, pop3 = null, pop3Port = null, imapPort = null;
|
imap = null, pop3 = null, pop3Port = null, imapPort = null;
|
||||||
|
|
||||||
|
DataSource ds = new DataSource();
|
||||||
|
ds.initialize(emailListenerInfo.getDatabase());
|
||||||
|
|
||||||
String[] params = emailListenerInfo.getSetupGestBranch().split("\\|");
|
String[] params = emailListenerInfo.getSetupGestBranch().split("\\|");
|
||||||
|
|
||||||
if (params.length >= 2) {
|
if (params.length >= 2) {
|
||||||
final HashMap<String, String> setupData = setupGest.getSetupSection(conn, params[0], params[1]);
|
flagAttivo = setupGest.getSetup(ds.getConnection(), params[0], params[1], "ATTIVO");
|
||||||
|
username = setupGest.getSetup(ds.getConnection(), params[0], params[1], "USERNAME");
|
||||||
flagAttivo = UtilityHashMap.getValueIfExists(setupData, "ATTIVO");
|
|
||||||
username = UtilityHashMap.getValueIfExists(setupData, "USERNAME");
|
|
||||||
if (UtilityString.isNullOrEmpty(username))
|
if (UtilityString.isNullOrEmpty(username))
|
||||||
throw new Exception(params[0] + "/" + params[1] + "/USERNAME non configurato correttamente");
|
throw new Exception(params[0] + "/" + params[1] + "/USERNAME non configurato correttamente");
|
||||||
|
|
||||||
password = UtilityHashMap.getValueIfExists(setupData, "PASSWORD");
|
password = setupGest.getSetup(ds.getConnection(), params[0], params[1], "PASSWORD");
|
||||||
if (UtilityString.isNullOrEmpty(password))
|
if (UtilityString.isNullOrEmpty(password))
|
||||||
throw new Exception(params[0] + "/" + params[1] + "/PASSWORD non configurato correttamente");
|
throw new Exception(params[0] + "/" + params[1] + "/PASSWORD non configurato correttamente");
|
||||||
|
|
||||||
pop3 = UtilityHashMap.getValueIfExists(setupData, "POP3");
|
pop3 = setupGest.getSetup(ds.getConnection(), params[0], params[1], "POP3");
|
||||||
if (UtilityString.isNullOrEmpty(pop3))
|
if (UtilityString.isNullOrEmpty(pop3))
|
||||||
throw new Exception(params[0] + "/" + params[1] + "/POP3 non configurato correttamente");
|
throw new Exception(params[0] + "/" + params[1] + "/POP3 non configurato correttamente");
|
||||||
|
|
||||||
pop3Port = UtilityHashMap.getValueIfExists(setupData, "POP3_PORT");
|
pop3Port = setupGest.getSetup(ds.getConnection(), params[0], params[1], "POP3_PORT");
|
||||||
if (UtilityString.isNullOrEmpty(pop3Port))
|
if (UtilityString.isNullOrEmpty(pop3Port))
|
||||||
throw new Exception(params[0] + "/" + params[1] + "/POP3_PORT non configurato correttamente");
|
throw new Exception(params[0] + "/" + params[1] + "/POP3_PORT non configurato correttamente");
|
||||||
|
|
||||||
imap = UtilityHashMap.getValueIfExists(setupData, "IMAP");
|
imap = setupGest.getSetup(ds.getConnection(), params[0], params[1], "IMAP");
|
||||||
if (UtilityString.isNullOrEmpty(imap))
|
if (UtilityString.isNullOrEmpty(imap))
|
||||||
throw new Exception(params[0] + "/" + params[1] + "/IMAP non configurato correttamente");
|
throw new Exception(params[0] + "/" + params[1] + "/IMAP non configurato correttamente");
|
||||||
|
|
||||||
imapPort = UtilityHashMap.getValueIfExists(setupData, "IMAP_PORT");
|
imapPort = setupGest.getSetup(ds.getConnection(), params[0], params[1], "IMAP_PORT");
|
||||||
if (UtilityString.isNullOrEmpty(imapPort))
|
if (UtilityString.isNullOrEmpty(imapPort))
|
||||||
throw new Exception(params[0] + "/" + params[1] + "/IMAP_PORT non configurato correttamente");
|
throw new Exception(params[0] + "/" + params[1] + "/IMAP_PORT non configurato correttamente");
|
||||||
}
|
}
|
||||||
|
ds.forceClose();
|
||||||
if (!UtilityString.isNullOrEmpty(flagAttivo) && "S".equals(flagAttivo)) {
|
if (!UtilityString.isNullOrEmpty(flagAttivo) && "S".equals(flagAttivo)) {
|
||||||
Properties sysProperties = System.getProperties();
|
Properties sysProperties = System.getProperties();
|
||||||
Session session = Session.getDefaultInstance(sysProperties);
|
Session session = Session.getDefaultInstance(sysProperties);
|
||||||
@@ -164,7 +159,7 @@ public class EmailWatcherListener extends TimerTask {
|
|||||||
|
|
||||||
String value = response.readEntity(String.class);
|
String value = response.readEntity(String.class);
|
||||||
|
|
||||||
String emailDbg = setupGest.getSetup(conn, params[0], params[1], "EMAIL_DBG");
|
String emailDbg = setupGest.getSetup(ds.getConnection(), params[0], params[1], "EMAIL_DBG");
|
||||||
if (value.charAt(0) == '{') {
|
if (value.charAt(0) == '{') {
|
||||||
ServiceRestResponse respWra = jsonObjectMapper.readValue(value, ServiceRestResponse.class);
|
ServiceRestResponse respWra = jsonObjectMapper.readValue(value, ServiceRestResponse.class);
|
||||||
if (respWra.getEsito() == EsitoType.KO) {
|
if (respWra.getEsito() == EsitoType.KO) {
|
||||||
@@ -197,66 +192,67 @@ public class EmailWatcherListener extends TimerTask {
|
|||||||
private void notifyErrorToEmail(String emailListen, String mittente, String messageObj, Date messageDate,
|
private void notifyErrorToEmail(String emailListen, String mittente, String messageObj, Date messageDate,
|
||||||
String emailDbg, String errorMessage) throws Exception {
|
String emailDbg, String errorMessage) throws Exception {
|
||||||
if (!UtilityString.isNullOrEmpty(emailDbg)) {
|
if (!UtilityString.isNullOrEmpty(emailDbg)) {
|
||||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(emailListenerInfo.getDatabase())) {
|
DataSource ds = new DataSource();
|
||||||
|
ds.initialize(emailListenerInfo.getDatabase());
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||||
|
|
||||||
String nomeAzienda = "";
|
String nomeAzienda = "";
|
||||||
PreparedStatement ps = mdb.prepareStatement("select nome_ditta from azienda");
|
PreparedStatement ps = ds.getConnection().prepareStatement("select nome_ditta from azienda");
|
||||||
ResultSet rs = ps.executeQuery();
|
ResultSet rs = ps.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
nomeAzienda = rs.getString("nome_ditta");
|
nomeAzienda = rs.getString("nome_ditta");
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
String htmlMailBody = "Gentile Amministratore,<br> si e' verificato il seguente errore <br><b>" + errorMessage + "</b><br> del servizio " + emailListenerInfo.getServiceRest() +
|
|
||||||
"<br> in ascolto sulla mail " + emailListen + " provocato dal messaggio (mittente " + mittente + ") con oggetto " + messageObj + " in data " + sdf.format(messageDate);
|
|
||||||
|
|
||||||
String mailSubject = nomeAzienda + " - ERRORE SU " + InetAddress.getLocalHost().getHostName() +
|
|
||||||
" Servizio " + emailListenerInfo.getServiceRest() + ";Database " + emailListenerInfo.getDatabase();
|
|
||||||
|
|
||||||
// AttachmentDTO dto = new AttachmentDTO();
|
|
||||||
// dto.setFileByte(files);
|
|
||||||
|
|
||||||
StringWriter writer = new StringWriter();
|
|
||||||
//jsonObjectMapper.writeValue(writer, dto);
|
|
||||||
|
|
||||||
String jsonBody = writer.toString();
|
|
||||||
|
|
||||||
String database = emailListenerInfo.getDatabase();
|
|
||||||
|
|
||||||
String auth = RestUtil.generateAuth(database, database, "POST", jsonBody,
|
|
||||||
"application/json", prop.getRootApi() + EmsRestConstants.PATH_SEND_MAIL);
|
|
||||||
|
|
||||||
final Client client = ClientBuilder.newClient();
|
|
||||||
WebTarget resource = client.target(prop.getEndPointWS()).path(
|
|
||||||
prop.getRootApi() + EmsRestConstants.PATH_SEND_MAIL)
|
|
||||||
.resolveTemplate("mode", "async");
|
|
||||||
resource = resource.queryParam(CommonConstants.PROFILE_DB, database)
|
|
||||||
.queryParam("from", "").queryParam("to", emailDbg)
|
|
||||||
.queryParam("subject", mailSubject).queryParam("msgText", htmlMailBody)
|
|
||||||
.queryParam("isHtml", true);
|
|
||||||
|
|
||||||
resource.request().header("Authorization", database + ":" + auth)
|
|
||||||
.async()
|
|
||||||
.post(Entity.json(jsonBody), new InvocationCallback<Response>() {
|
|
||||||
@Override
|
|
||||||
public void completed(Response response) {
|
|
||||||
String value = response.readEntity(String.class);
|
|
||||||
logger.info(response.getStatus() + " - " + value);
|
|
||||||
response.close();
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void failed(Throwable throwable) {
|
|
||||||
throwable.printStackTrace();
|
|
||||||
logger.error(throwable);
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
|
ps.close();
|
||||||
|
ds.forceClose();
|
||||||
|
|
||||||
|
String htmlMailBody = "Gentile Amministratore,<br> si e' verificato il seguente errore <br><b>" + errorMessage + "</b><br> del servizio " + emailListenerInfo.getServiceRest() +
|
||||||
|
"<br> in ascolto sulla mail " + emailListen + " provocato dal messaggio (mittente " + mittente + ") con oggetto " + messageObj + " in data " + sdf.format(messageDate);
|
||||||
|
|
||||||
|
String mailSubject = nomeAzienda + " - ERRORE SU " + InetAddress.getLocalHost().getHostName() +
|
||||||
|
" Servizio " + emailListenerInfo.getServiceRest() + ";Database " + emailListenerInfo.getDatabase();
|
||||||
|
|
||||||
|
// AttachmentDTO dto = new AttachmentDTO();
|
||||||
|
// dto.setFileByte(files);
|
||||||
|
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
//jsonObjectMapper.writeValue(writer, dto);
|
||||||
|
|
||||||
|
String jsonBody = writer.toString();
|
||||||
|
|
||||||
|
String database = emailListenerInfo.getDatabase();
|
||||||
|
|
||||||
|
String auth = RestUtil.generateAuth(database, database, "POST", jsonBody,
|
||||||
|
"application/json", prop.getRootApi() + EmsRestConstants.PATH_SEND_MAIL);
|
||||||
|
|
||||||
|
final Client client = ClientBuilder.newClient();
|
||||||
|
WebTarget resource = client.target(prop.getEndPointWS()).path(
|
||||||
|
prop.getRootApi() + EmsRestConstants.PATH_SEND_MAIL)
|
||||||
|
.resolveTemplate("mode", "async");
|
||||||
|
resource = resource.queryParam(CommonConstants.PROFILE_DB, database)
|
||||||
|
.queryParam("from", "").queryParam("to", emailDbg)
|
||||||
|
.queryParam("subject", mailSubject).queryParam("msgText", htmlMailBody)
|
||||||
|
.queryParam("isHtml", true);
|
||||||
|
|
||||||
|
resource.request().header("Authorization", database + ":" + auth)
|
||||||
|
.async()
|
||||||
|
.post(Entity.json(jsonBody), new InvocationCallback<Response>() {
|
||||||
|
@Override
|
||||||
|
public void completed(Response response) {
|
||||||
|
String value = response.readEntity(String.class);
|
||||||
|
logger.info(response.getStatus() + " - " + value);
|
||||||
|
response.close();
|
||||||
|
client.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failed(Throwable throwable) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
logger.error(throwable);
|
||||||
|
client.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,6 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.http.ContentDisposition;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
@@ -32,26 +28,26 @@ public class DownloadController {
|
|||||||
private MimeTypesHandler mimetypesFileTypeMap;
|
private MimeTypesHandler mimetypesFileTypeMap;
|
||||||
|
|
||||||
@RequestMapping(value = "download/{uuid}/{fileName}", method = RequestMethod.GET)
|
@RequestMapping(value = "download/{uuid}/{fileName}", method = RequestMethod.GET)
|
||||||
public ResponseEntity<byte[]> download(@PathVariable String uuid,
|
public byte[] download(HttpServletResponse response,
|
||||||
@PathVariable String fileName) throws Exception {
|
@PathVariable String uuid,
|
||||||
|
@PathVariable String fileName) throws Exception {
|
||||||
|
|
||||||
byte[] fileContent = downloadFileHandlerService.getDownloadFileContent(uuid);
|
byte[] fileContent = downloadFileHandlerService.getDownloadFileContent(uuid);
|
||||||
|
|
||||||
if (fileContent != null) {
|
if (fileContent != null) {
|
||||||
String filename = downloadFileHandlerService.getDownloadFileName(uuid);
|
String filename = downloadFileHandlerService.getDownloadFileName(uuid);
|
||||||
|
|
||||||
MediaType mediaType = mimetypesFileTypeMap.getContentType(fileName);
|
String mimeType = Files.probeContentType(Paths.get(fileName));
|
||||||
|
|
||||||
return ResponseEntity.ok()
|
response.setContentType(mimeType);
|
||||||
.contentType(mediaType)
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
.contentLength(fileContent.length)
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
|
||||||
.builder("attachment")
|
response.setContentLength(fileContent.length);
|
||||||
.filename(filename)
|
return fileContent;
|
||||||
.build()
|
|
||||||
.toString())
|
|
||||||
.body(fileContent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.notFound().build();
|
response.sendError(404, "File non trovato");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.ems.download;
|
package it.integry.ems.download;
|
||||||
|
|
||||||
|
import it.integry.annotations.PostContextConstruct;
|
||||||
import it.integry.ems.download.dto.CachedFileDto;
|
import it.integry.ems.download.dto.CachedFileDto;
|
||||||
import it.integry.ems.download.dto.DownloadFileDto;
|
import it.integry.ems.download.dto.DownloadFileDto;
|
||||||
import it.integry.ems.looper.service.LooperService;
|
import it.integry.ems.looper.service.LooperService;
|
||||||
@@ -24,6 +25,13 @@ public class DownloadFileHandlerService {
|
|||||||
|
|
||||||
private final HashMap<String, CachedFileDto> mFileMap = new HashMap<>();
|
private final HashMap<String, CachedFileDto> mFileMap = new HashMap<>();
|
||||||
|
|
||||||
|
@PostContextConstruct
|
||||||
|
public void init() {
|
||||||
|
looperService.add(() -> {
|
||||||
|
UtilityFile.cleanDirectory(getTempPath(), 1, "");
|
||||||
|
}, 60 * 60 * 1000, DownloadFileHandlerService.class.getName());
|
||||||
|
}
|
||||||
|
|
||||||
public DownloadFileDto generateDownloadItem(File file) throws IOException {
|
public DownloadFileDto generateDownloadItem(File file) throws IOException {
|
||||||
return generateDownloadItem(file.getName(), FileUtils.readFileToByteArray(file), false);
|
return generateDownloadItem(file.getName(), FileUtils.readFileToByteArray(file), false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.ems.dto.info;
|
package it.integry.ems.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ApplicationInfoDTO {
|
public class ApplicationInfoDTO {
|
||||||
private String name;
|
private String name;
|
||||||
@@ -9,6 +10,7 @@ public class ApplicationInfoDTO {
|
|||||||
private Short annoContab;
|
private Short annoContab;
|
||||||
|
|
||||||
private String loadMenuPvm;
|
private String loadMenuPvm;
|
||||||
|
private List<String> salvataggiSoap;
|
||||||
|
|
||||||
private boolean delimitedIdentifier;
|
private boolean delimitedIdentifier;
|
||||||
private boolean ansiPadding;
|
private boolean ansiPadding;
|
||||||
@@ -68,6 +70,15 @@ public class ApplicationInfoDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getSalvataggiSoap() {
|
||||||
|
return salvataggiSoap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationInfoDTO setSalvataggiSoap(List<String> salvataggiSoap) {
|
||||||
|
this.salvataggiSoap = salvataggiSoap;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isConcatNullYieldsNull() {
|
public boolean isConcatNullYieldsNull() {
|
||||||
return concatNullYieldsNull;
|
return concatNullYieldsNull;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package it.integry.ems.dto.info;
|
package it.integry.ems.dto;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package it.integry.ems.dto.info;
|
package it.integry.ems.dto;
|
||||||
|
|
||||||
public class DatabaseInfoDTO {
|
public class DatabaseInfoDTO {
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.ems.dto;
|
package it.integry.ems.dto;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class ExtendedStbActivity {
|
public class ExtendedStbActivity {
|
||||||
@@ -15,9 +14,11 @@ public class ExtendedStbActivity {
|
|||||||
private String userCreator;
|
private String userCreator;
|
||||||
private String note;
|
private String note;
|
||||||
private String activityDescription;
|
private String activityDescription;
|
||||||
|
private Date dataInsAct;
|
||||||
private int priorita;
|
private int priorita;
|
||||||
private LocalDateTime alarmTime;
|
private Date alarmDate;
|
||||||
private LocalDateTime oraInsAct;
|
private Date alarmTime;
|
||||||
|
private Date oraInsAct;
|
||||||
private String activityTypeId;
|
private String activityTypeId;
|
||||||
private String parentActivityId;
|
private String parentActivityId;
|
||||||
private StbActivityEmailObject emailObject;
|
private StbActivityEmailObject emailObject;
|
||||||
@@ -115,6 +116,15 @@ public class ExtendedStbActivity {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getDataInsAct() {
|
||||||
|
return dataInsAct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExtendedStbActivity setDataInsAct(Date dataInsAct) {
|
||||||
|
this.dataInsAct = dataInsAct;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public int getPriorita() {
|
public int getPriorita() {
|
||||||
return priorita;
|
return priorita;
|
||||||
}
|
}
|
||||||
@@ -124,20 +134,29 @@ public class ExtendedStbActivity {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDateTime getAlarmTime() {
|
public Date getAlarmDate() {
|
||||||
|
return alarmDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExtendedStbActivity setAlarmDate(Date alarmDate) {
|
||||||
|
this.alarmDate = alarmDate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getAlarmTime() {
|
||||||
return alarmTime;
|
return alarmTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExtendedStbActivity setAlarmTime(LocalDateTime alarmTime) {
|
public ExtendedStbActivity setAlarmTime(Date alarmTime) {
|
||||||
this.alarmTime = alarmTime;
|
this.alarmTime = alarmTime;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDateTime getOraInsAct() {
|
public Date getOraInsAct() {
|
||||||
return oraInsAct;
|
return oraInsAct;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExtendedStbActivity setOraInsAct(LocalDateTime oraInsAct) {
|
public ExtendedStbActivity setOraInsAct(Date oraInsAct) {
|
||||||
this.oraInsAct = oraInsAct;
|
this.oraInsAct = oraInsAct;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
package it.integry.ems.dto.info;
|
|
||||||
|
|
||||||
public class PvmInfoDTO {
|
|
||||||
private String phpVersion;
|
|
||||||
private String timezone;
|
|
||||||
private String imagick;
|
|
||||||
private boolean sodiumMissing;
|
|
||||||
private int maxExecutionTime;
|
|
||||||
private boolean magicQuotesGpc;
|
|
||||||
private String defaultCharset;
|
|
||||||
private String memoryLimit;
|
|
||||||
private String postMaxSize;
|
|
||||||
private String uploadMaxSize;
|
|
||||||
private int maxInputVars;
|
|
||||||
|
|
||||||
public String getPhpVersion() {
|
|
||||||
return phpVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setPhpVersion(String phpVersion) {
|
|
||||||
this.phpVersion = phpVersion;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTimezone() {
|
|
||||||
return timezone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setTimezone(String timezone) {
|
|
||||||
this.timezone = timezone;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImagick() {
|
|
||||||
return imagick;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setImagick(String imagick) {
|
|
||||||
this.imagick = imagick;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSodiumMissing() {
|
|
||||||
return sodiumMissing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setSodiumMissing(boolean sodiumMissing) {
|
|
||||||
this.sodiumMissing = sodiumMissing;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxExecutionTime() {
|
|
||||||
return maxExecutionTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setMaxExecutionTime(int maxExecutionTime) {
|
|
||||||
this.maxExecutionTime = maxExecutionTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMagicQuotesGpc() {
|
|
||||||
return magicQuotesGpc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setMagicQuotesGpc(boolean magicQuotesGpc) {
|
|
||||||
this.magicQuotesGpc = magicQuotesGpc;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefaultCharset() {
|
|
||||||
return defaultCharset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setDefaultCharset(String defaultCharset) {
|
|
||||||
this.defaultCharset = defaultCharset;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMemoryLimit() {
|
|
||||||
return memoryLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setMemoryLimit(String memoryLimit) {
|
|
||||||
this.memoryLimit = memoryLimit;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPostMaxSize() {
|
|
||||||
return postMaxSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setPostMaxSize(String postMaxSize) {
|
|
||||||
this.postMaxSize = postMaxSize;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUploadMaxSize() {
|
|
||||||
return uploadMaxSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setUploadMaxSize(String uploadMaxSize) {
|
|
||||||
this.uploadMaxSize = uploadMaxSize;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxInputVars() {
|
|
||||||
return maxInputVars;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PvmInfoDTO setMaxInputVars(int maxInputVars) {
|
|
||||||
this.maxInputVars = maxInputVars;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@ package it.integry.ems.dynamic_cache;
|
|||||||
import it.integry.ems.expansion.RunnableArgsWithReturn;
|
import it.integry.ems.expansion.RunnableArgsWithReturn;
|
||||||
import it.integry.ems.expansion.RunnableWithReturn;
|
import it.integry.ems.expansion.RunnableWithReturn;
|
||||||
import it.integry.ems.looper.service.LooperService;
|
import it.integry.ems.looper.service.LooperService;
|
||||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||||
import it.integry.ems.settings.Model.SettingsModel;
|
import it.integry.ems.settings.Model.SettingsModel;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
@@ -37,7 +37,8 @@ public class DynamicCacheService {
|
|||||||
DATI_AZIENDA_KEY,
|
DATI_AZIENDA_KEY,
|
||||||
ENTITY_LOGGER_SETUP,
|
ENTITY_LOGGER_SETUP,
|
||||||
GRIGLIA_ACQUISTO_KEY,
|
GRIGLIA_ACQUISTO_KEY,
|
||||||
ENTITY_SYNC_KEY
|
ENTITY_SYNC_KEY,
|
||||||
|
STB_GEST_SETUP_KEY
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(Keys key, int invalidateTimeInMins, RunnableWithReturn<Object> refreshAction) {
|
public void addItem(Keys key, int invalidateTimeInMins, RunnableWithReturn<Object> refreshAction) {
|
||||||
@@ -50,11 +51,11 @@ public class DynamicCacheService {
|
|||||||
List<String> finalDbNames = dbNames.stream().map(String::toLowerCase).collect(Collectors.toList());
|
List<String> finalDbNames = dbNames.stream().map(String::toLowerCase).collect(Collectors.toList());
|
||||||
RunnableWithReturn<Object> internalRefreshAction = () -> {
|
RunnableWithReturn<Object> internalRefreshAction = () -> {
|
||||||
|
|
||||||
Map<String, List<AvailableConnectionModel>> databases = settingsModel.getAvailableConnections()
|
Map<String, List<AvailableConnectionsModel>> databases = settingsModel.getAvailableConnections()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(AvailableConnectionModel::getInternalDb)
|
.filter(AvailableConnectionsModel::getInternalDb)
|
||||||
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
||||||
.collect(Collectors.groupingBy(AvailableConnectionModel::getDbName));
|
.collect(Collectors.groupingBy(AvailableConnectionsModel::getDbName));
|
||||||
|
|
||||||
final HashMap<String, T> cachedDataByDB = new HashMap<>();
|
final HashMap<String, T> cachedDataByDB = new HashMap<>();
|
||||||
|
|
||||||
@@ -82,11 +83,11 @@ public class DynamicCacheService {
|
|||||||
|
|
||||||
RunnableWithReturn<Object> refreshAction = () -> {
|
RunnableWithReturn<Object> refreshAction = () -> {
|
||||||
|
|
||||||
Map<String, List<AvailableConnectionModel>> databases = settingsModel.getAvailableConnections()
|
Map<String, List<AvailableConnectionsModel>> databases = settingsModel.getAvailableConnections()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(AvailableConnectionModel::getInternalDb)
|
.filter(AvailableConnectionsModel::getInternalDb)
|
||||||
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
||||||
.collect(Collectors.groupingBy(AvailableConnectionModel::getDbName));
|
.collect(Collectors.groupingBy(AvailableConnectionsModel::getDbName));
|
||||||
|
|
||||||
final HashMap<String, List<? extends EntityBase>> cachedEntitiesByDB = new HashMap<>();
|
final HashMap<String, List<? extends EntityBase>> cachedEntitiesByDB = new HashMap<>();
|
||||||
|
|
||||||
@@ -137,11 +138,11 @@ public class DynamicCacheService {
|
|||||||
|
|
||||||
RunnableWithReturn<Object> refreshAction = () -> {
|
RunnableWithReturn<Object> refreshAction = () -> {
|
||||||
|
|
||||||
Map<String, List<AvailableConnectionModel>> databases = settingsModel.getAvailableConnections()
|
Map<String, List<AvailableConnectionsModel>> databases = settingsModel.getAvailableConnections()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(AvailableConnectionModel::getInternalDb)
|
.filter(AvailableConnectionsModel::getInternalDb)
|
||||||
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
||||||
.collect(Collectors.groupingBy(AvailableConnectionModel::getDbName));
|
.collect(Collectors.groupingBy(AvailableConnectionsModel::getDbName));
|
||||||
|
|
||||||
final HashMap<String, List<?>> cacheQueryByDB = new HashMap<>();
|
final HashMap<String, List<?>> cacheQueryByDB = new HashMap<>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,325 +0,0 @@
|
|||||||
package it.integry.ems.dynamic_cache;
|
|
||||||
|
|
||||||
import it.integry.annotations.PostContextAutowired;
|
|
||||||
import it.integry.annotations.PostContextConstruct;
|
|
||||||
import it.integry.ems.dbms_change_tracker.component.DbmsChangeTrackerComponent;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordDeletedEvent;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordInsertedEvent;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordUpdatedEvent;
|
|
||||||
import it.integry.ems.dbms_change_tracker.model.events.TableTrackingResettedEvent;
|
|
||||||
import it.integry.ems.dto.EntityHierarchy;
|
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
|
||||||
import it.integry.ems.utility.UtilityDebug;
|
|
||||||
import it.integry.ems_model.base.EntityBase;
|
|
||||||
import it.integry.ems_model.base.EntityPropertyHolder;
|
|
||||||
import it.integry.ems_model.entity.*;
|
|
||||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
|
||||||
import it.integry.ems_model.utility.UtilityQuery;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
|
||||||
import org.springframework.context.ApplicationListener;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class EntityCacheComponent implements ApplicationListener {
|
|
||||||
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
|
||||||
|
|
||||||
private final DbmsChangeTrackerComponent dbmsChangeTrackerComponent;
|
|
||||||
private final EntityPropertyHolder entityPropertyHolder;
|
|
||||||
|
|
||||||
private final HashMap<IntegryCustomerDB, ConcurrentHashMap<String, ConcurrentHashMap<HashMap<String, Object>, EntityBase>>> entityCache = new HashMap<>();
|
|
||||||
|
|
||||||
// Lock per IntegryCustomerDB per garantire accessi sincronizzati alla cache di quel customer
|
|
||||||
private final ConcurrentHashMap<IntegryCustomerDB, Object> cacheLocks = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
private Object getCacheLock(IntegryCustomerDB customerDB) {
|
|
||||||
cacheLocks.putIfAbsent(customerDB, new Object());
|
|
||||||
return cacheLocks.get(customerDB);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final HashMap<String, Class<? extends EntityBase>> enabledEntities = new HashMap<String, Class<? extends EntityBase>>() {{
|
|
||||||
put(MtbAart.ENTITY, MtbAart.class);
|
|
||||||
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
|
|
||||||
put(MtbUntMis.ENTITY, MtbUntMis.class);
|
|
||||||
put(MtbDepo.ENTITY, MtbDepo.class);
|
|
||||||
put(MtbDepoPosizioni.ENTITY, MtbDepoPosizioni.class);
|
|
||||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
|
||||||
put(StbGestSetup.ENTITY, StbGestSetup.class);
|
|
||||||
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
|
|
||||||
put(StbUser.ENTITY, StbUser.class);
|
|
||||||
put(WtbDepo.ENTITY, WtbDepo.class);
|
|
||||||
put(WtbGestSetupUser.ENTITY, WtbGestSetupUser.class);
|
|
||||||
put(WtbClie.ENTITY, WtbClie.class);
|
|
||||||
}};
|
|
||||||
|
|
||||||
public EntityCacheComponent(DbmsChangeTrackerComponent dbmsChangeTrackerComponent, EntityPropertyHolder entityPropertyHolder) {
|
|
||||||
this.dbmsChangeTrackerComponent = dbmsChangeTrackerComponent;
|
|
||||||
this.entityPropertyHolder = entityPropertyHolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostContextAutowired
|
|
||||||
private MultiDBTransactionManager multiDBTransactionManager;
|
|
||||||
|
|
||||||
@PostContextConstruct
|
|
||||||
private void init() throws Exception {
|
|
||||||
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
|
|
||||||
IntegryCustomerDB customerDB = IntegryCustomerDB.parse(conn.getDbName());
|
|
||||||
|
|
||||||
if (customerDB == null)
|
|
||||||
throw new RuntimeException("Impossibile inizializzare IntegryCustomerDB per il database: " + conn.getDbName());
|
|
||||||
|
|
||||||
|
|
||||||
for (Map.Entry<String, Class<? extends EntityBase>> enabledEntity : enabledEntities.entrySet()) {
|
|
||||||
String tableName = enabledEntity.getKey();
|
|
||||||
|
|
||||||
refreshCacheForEntity(conn, customerDB, tableName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshCacheGlobal(IntegryCustomerDB customerDB) throws Exception {
|
|
||||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(customerDB)) {
|
|
||||||
Connection conn = mdb.getPrimaryConnection();
|
|
||||||
for (Map.Entry<String, Class<? extends EntityBase>> enabledEntity : enabledEntities.entrySet()) {
|
|
||||||
String tableName = enabledEntity.getKey();
|
|
||||||
refreshCacheForEntity(conn, customerDB, tableName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshCacheForEntity(IntegryCustomerDB customerDB, String tableName) throws Exception {
|
|
||||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(customerDB)) {
|
|
||||||
Connection conn = mdb.getPrimaryConnection();
|
|
||||||
refreshCacheForEntity(conn, customerDB, tableName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshCacheForEntity(Connection connection, IntegryCustomerDB customerDB, String tableName) throws Exception {
|
|
||||||
// Sincronizziamo l'intera operazione di refresh per il customerDB per evitare accessi concorrenti
|
|
||||||
synchronized (getCacheLock(customerDB)) {
|
|
||||||
Class<? extends EntityBase> clazz = enabledEntities.get(tableName);
|
|
||||||
// if (clazz == null)
|
|
||||||
// throw new RuntimeException("Entity cache is not enabled for table " + tableName);
|
|
||||||
|
|
||||||
entityCache.putIfAbsent(customerDB, new ConcurrentHashMap<>());
|
|
||||||
entityCache.get(customerDB).remove(tableName);
|
|
||||||
|
|
||||||
ConcurrentHashMap<HashMap<String, Object>, EntityBase> entities = retrieveEntityList(connection, tableName, clazz);
|
|
||||||
entityCache.get(customerDB).put(tableName, entities);
|
|
||||||
|
|
||||||
logger.trace(String.format("[%s] Cached %d records for entity %s",
|
|
||||||
customerDB.getValue(),
|
|
||||||
entities.size(),
|
|
||||||
clazz.getSimpleName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T extends EntityBase> List<T> getCachedEntitiesList(IntegryCustomerDB customerDB, String tableName, Predicate<T> filterPredicate) {
|
|
||||||
return getCachedEntitiesStream(customerDB, tableName, filterPredicate)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T extends EntityBase> Stream<T> getCachedEntitiesStream(IntegryCustomerDB customerDB, String tableName, Predicate<T> filterPredicate) {
|
|
||||||
// Per evitare accessi concorrenti leggiamo/snapshottiamo la cache sotto lock per quel customerDB
|
|
||||||
Stream<T> snapshot;
|
|
||||||
synchronized (getCacheLock(customerDB)) {
|
|
||||||
if (!isCacheEnabled(customerDB, tableName)) {
|
|
||||||
try {
|
|
||||||
refreshCacheForEntity(customerDB, tableName);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// prendo un'istantanea degli oggetti clonati per poter lavorare fuori dal lock
|
|
||||||
snapshot = entityCache.get(customerDB)
|
|
||||||
.get(tableName)
|
|
||||||
.values()
|
|
||||||
.parallelStream()
|
|
||||||
.map(x -> (T) x.clone());
|
|
||||||
|
|
||||||
if (filterPredicate != null)
|
|
||||||
snapshot = snapshot.filter(filterPredicate);
|
|
||||||
}
|
|
||||||
|
|
||||||
return snapshot;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onApplicationEvent(ApplicationEvent event) {
|
|
||||||
if (event instanceof TableRecordInsertedEvent) {
|
|
||||||
handleRecordInserted((TableRecordInsertedEvent) event);
|
|
||||||
|
|
||||||
} else if (event instanceof TableRecordUpdatedEvent) {
|
|
||||||
handleRecordUpdated((TableRecordUpdatedEvent) event);
|
|
||||||
|
|
||||||
} else if (event instanceof TableRecordDeletedEvent) {
|
|
||||||
handleRecordDeleted((TableRecordDeletedEvent) event);
|
|
||||||
|
|
||||||
} else if (event instanceof TableTrackingResettedEvent) {
|
|
||||||
try {
|
|
||||||
handleTableTrackingResetted((TableTrackingResettedEvent) event);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void handleRecordInserted(TableRecordInsertedEvent event) {
|
|
||||||
if (!isCacheEnabled(event.getCustomerDB(), event.getTableName()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
|
|
||||||
|
|
||||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
|
|
||||||
EntityBase newItem = retrieveEntityItem(mdb.getPrimaryConnection(), event.getTableName(),
|
|
||||||
enabledEntities.get(event.getTableName()),
|
|
||||||
event.getPrimaryKey());
|
|
||||||
|
|
||||||
|
|
||||||
// sincronizziamo la modifica per il customerDB
|
|
||||||
synchronized (getCacheLock(event.getCustomerDB())) {
|
|
||||||
entityCache.get(event.getCustomerDB())
|
|
||||||
.get(event.getTableName())
|
|
||||||
.put(entityPrimaryKey, newItem);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleRecordUpdated(TableRecordUpdatedEvent event) {
|
|
||||||
if (!isCacheEnabled(event.getCustomerDB(), event.getTableName()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
|
|
||||||
|
|
||||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
|
|
||||||
EntityBase newItem = retrieveEntityItem(mdb.getPrimaryConnection(), event.getTableName(),
|
|
||||||
enabledEntities.get(event.getTableName()),
|
|
||||||
event.getPrimaryKey());
|
|
||||||
|
|
||||||
|
|
||||||
// sincronizziamo la modifica per il customerDB
|
|
||||||
synchronized (getCacheLock(event.getCustomerDB())) {
|
|
||||||
entityCache.get(event.getCustomerDB())
|
|
||||||
.get(event.getTableName())
|
|
||||||
.put(entityPrimaryKey, newItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleRecordDeleted(TableRecordDeletedEvent event) {
|
|
||||||
if (!isCacheEnabled(event.getCustomerDB(), event.getTableName()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
|
|
||||||
|
|
||||||
// sincronizziamo la rimozione per il customerDB
|
|
||||||
final EntityBase removedItem;
|
|
||||||
synchronized (getCacheLock(event.getCustomerDB())) {
|
|
||||||
removedItem = entityCache.get(event.getCustomerDB())
|
|
||||||
.get(event.getTableName())
|
|
||||||
.remove(entityPrimaryKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleTableTrackingResetted(TableTrackingResettedEvent event) throws Exception {
|
|
||||||
// reset e refresh sono eseguiti in modo sincronizzato per quel customer
|
|
||||||
resetTablesCache(event.getCustomerDB());
|
|
||||||
refreshCacheGlobal(event.getCustomerDB());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ConcurrentHashMap<HashMap<String, Object>, EntityBase> retrieveEntityList(Connection connection, String tableName, Class<? extends EntityBase> clazz) throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
|
||||||
String sql = "SELECT * FROM " + tableName;
|
|
||||||
|
|
||||||
List<? extends EntityBase> objects = UtilityDB.executeSimpleQueryDTO(connection, sql, clazz);
|
|
||||||
if (objects == null)
|
|
||||||
objects = new ArrayList<>();
|
|
||||||
final List<EntityHierarchy.Field> pkFields = entityPropertyHolder.getEntityFields(clazz, EntityHierarchy.Field::isPrimaryKey);
|
|
||||||
|
|
||||||
|
|
||||||
ConcurrentHashMap<HashMap<String, Object>, EntityBase> objectsMap = new ConcurrentHashMap<>();
|
|
||||||
for (EntityBase object : objects) {
|
|
||||||
HashMap<String, Object> pkMap = new HashMap<>();
|
|
||||||
for (EntityHierarchy.Field pkField : pkFields) {
|
|
||||||
Object pkValue = pkField.getField().get(object);
|
|
||||||
pkMap.put(pkField.getFieldName(), pkValue);
|
|
||||||
}
|
|
||||||
objectsMap.put(pkMap, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
return objectsMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
private EntityBase retrieveEntityItem(Connection connection, String tableName, Class<?> clazz, HashMap<String, Object> primaryKey) throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
|
||||||
String sql = "SELECT * FROM " + tableName + "\n" +
|
|
||||||
" WHERE " + UtilityQuery.concatFieldsInWhereCond(primaryKey);
|
|
||||||
|
|
||||||
final EntityBase object = (EntityBase) UtilityDB.executeSimpleQueryOnlyFirstRowDTO(connection, sql, clazz);
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private HashMap<String, Object> convertSqlMapToEntityMap(HashMap<String, Object> sqlMap, Class<? extends EntityBase> clazz) {
|
|
||||||
HashMap<String, Object> entityMap = new HashMap<>();
|
|
||||||
for (Map.Entry<String, Object> entry : sqlMap.entrySet()) {
|
|
||||||
String fieldName = entityPropertyHolder.getEntityFields(clazz, f -> f.isSqlField() && f.getSqlField().value().equals(entry.getKey()))
|
|
||||||
.stream()
|
|
||||||
.findFirst()
|
|
||||||
.map(EntityHierarchy.Field::getFieldName)
|
|
||||||
.orElse(entry.getKey());
|
|
||||||
entityMap.put(fieldName, entry.getValue());
|
|
||||||
}
|
|
||||||
return entityMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void resetTableCache(IntegryCustomerDB customerDB, String tableName) {
|
|
||||||
synchronized (getCacheLock(customerDB)) {
|
|
||||||
if (entityCache.containsKey(customerDB) && entityCache.get(customerDB).containsKey(tableName)) {
|
|
||||||
entityCache.get(customerDB).remove(tableName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void resetTablesCache(IntegryCustomerDB customerDB) {
|
|
||||||
// sincronizziamo la rimozione dell'intera cache per il customer
|
|
||||||
synchronized (getCacheLock(customerDB)) {
|
|
||||||
entityCache.remove(customerDB);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private boolean isCacheEnabled(IntegryCustomerDB customerDB, String tableName) {
|
|
||||||
return (entityCache.containsKey(customerDB) && entityCache.get(customerDB).containsKey(tableName)) ||
|
|
||||||
!(UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import com.annimon.stream.Stream;
|
|||||||
import com.microsoft.sqlserver.jdbc.SQLServerException;
|
import com.microsoft.sqlserver.jdbc.SQLServerException;
|
||||||
import it.integry.ems.entity_logger.db_schema_manager.dto.*;
|
import it.integry.ems.entity_logger.db_schema_manager.dto.*;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems_model.types.TypeDbObject;
|
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityHashMap;
|
import it.integry.ems_model.utility.UtilityHashMap;
|
||||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||||
@@ -392,19 +391,15 @@ public class SQLServerDBSchemaManager {
|
|||||||
|
|
||||||
|
|
||||||
public void dropTable(DatabaseTable databaseTable) throws Exception {
|
public void dropTable(DatabaseTable databaseTable) throws Exception {
|
||||||
if (UtilityDB.existDatabaseObject(mConnection, databaseTable.getTableName(), TypeDbObject.TABLE)) {
|
String dropSql = "DROP TABLE " + databaseTable.getTableName();
|
||||||
String dropSql = "DROP TABLE " + databaseTable.getTableName();
|
execTableAlterSQL(dropSql);
|
||||||
execTableAlterSQL(dropSql);
|
|
||||||
}
|
|
||||||
this.mConnection.commit();
|
this.mConnection.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void dropView(DatabaseView databaseTable) throws Exception {
|
public void dropView(DatabaseView databaseTable) throws Exception {
|
||||||
if (UtilityDB.existDatabaseObject(mConnection, databaseTable.getTableName(), TypeDbObject.VIEW)) {
|
String dropSql = "DROP VIEW " + databaseTable.getTableName();
|
||||||
String dropSql = "DROP VIEW " + databaseTable.getTableName();
|
execTableAlterSQL(dropSql);
|
||||||
execTableAlterSQL(dropSql);
|
|
||||||
}
|
|
||||||
this.mConnection.commit();
|
this.mConnection.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ public class DatabaseTableColumn {
|
|||||||
private ArrayList<DatabaseForeignKey> foreignKeys;
|
private ArrayList<DatabaseForeignKey> foreignKeys;
|
||||||
|
|
||||||
public String getColumnName() {
|
public String getColumnName() {
|
||||||
if (!columnName.startsWith("[") && columnName.contains(" ")) columnName = "["+columnName +"]";
|
|
||||||
return columnName;
|
return columnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
package it.integry.ems.entity_logger.db_schema_manager.dto;
|
|
||||||
|
|
||||||
public enum DatabaseVersionEnum {
|
|
||||||
|
|
||||||
SQLServer2000((short) 80),
|
|
||||||
SQLServer2005((short) 90),
|
|
||||||
SQLServer2008((short) 100),
|
|
||||||
SQLServer2008R2((short) 105),
|
|
||||||
SQLServer2012((short) 110),
|
|
||||||
SQLServer2014((short) 120),
|
|
||||||
SQLServer2016((short) 130),
|
|
||||||
SQLServer2017((short) 140),
|
|
||||||
SQLServer2019((short) 150),
|
|
||||||
SQLServer2022((short) 160);
|
|
||||||
|
|
||||||
private short code;
|
|
||||||
|
|
||||||
private DatabaseVersionEnum(short code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DatabaseVersionEnum fromCode(short code) {
|
|
||||||
for (DatabaseVersionEnum b : DatabaseVersionEnum.values()) {
|
|
||||||
if (b.code == code) return b;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@ import it.integry.annotations.PostContextConstruct;
|
|||||||
import it.integry.ems.entity_logger.db_schema_manager.component.SQLServerDBSchemaManager;
|
import it.integry.ems.entity_logger.db_schema_manager.component.SQLServerDBSchemaManager;
|
||||||
import it.integry.ems.entity_logger.db_schema_manager.dto.*;
|
import it.integry.ems.entity_logger.db_schema_manager.dto.*;
|
||||||
import it.integry.ems.looper.service.LooperService;
|
import it.integry.ems.looper.service.LooperService;
|
||||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||||
import it.integry.ems.settings.Model.SettingsModel;
|
import it.integry.ems.settings.Model.SettingsModel;
|
||||||
import it.integry.ems.settings.SettingsController;
|
import it.integry.ems.settings.SettingsController;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
@@ -19,7 +19,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@@ -27,7 +26,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class EntityLoggerComponent {
|
public class EntityLoggerComponent {
|
||||||
@@ -46,8 +44,10 @@ public class EntityLoggerComponent {
|
|||||||
@PostContextConstruct(priority = 10)
|
@PostContextConstruct(priority = 10)
|
||||||
private void init() {
|
private void init() {
|
||||||
try {
|
try {
|
||||||
if (!UtilityDebug.isDebugExecution()) {
|
if (!UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer()) {
|
||||||
this.syncDBScheme();
|
this.syncDBScheme();
|
||||||
|
|
||||||
|
looperService.add(this::deleteOldlogs, 12 * 60 * 60 * 1000, EntityLoggerComponent.class.getName()); //Ogni 12 ore
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.error(getClass().getName(), ex);
|
logger.error(getClass().getName(), ex);
|
||||||
@@ -57,7 +57,7 @@ public class EntityLoggerComponent {
|
|||||||
|
|
||||||
private void syncDBScheme() throws Exception {
|
private void syncDBScheme() throws Exception {
|
||||||
|
|
||||||
AvailableConnectionModel connectionsModel = settingsModel.getDefaultConnectionModel();
|
AvailableConnectionsModel connectionsModel = settingsModel.getDefaultConnectionModel();
|
||||||
|
|
||||||
if (connectionsModel == null) {
|
if (connectionsModel == null) {
|
||||||
throw new Exception("Impossibile ricavare la default connection");
|
throw new Exception("Impossibile ricavare la default connection");
|
||||||
@@ -107,7 +107,7 @@ public class EntityLoggerComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (settingsModel.getAvailableConnections().stream().noneMatch(x -> x.getDbName().equalsIgnoreCase(destDBName))) {
|
if (settingsModel.getAvailableConnections().stream().noneMatch(x -> x.getDbName().equalsIgnoreCase(destDBName))) {
|
||||||
settingsModel.addAvailableConnection(new AvailableConnectionModel()
|
settingsModel.addAvailableConnection(new AvailableConnectionsModel()
|
||||||
.setInternalDb(false)
|
.setInternalDb(false)
|
||||||
.setHost(dbHost)
|
.setHost(dbHost)
|
||||||
.setUsername(dbUsername)
|
.setUsername(dbUsername)
|
||||||
@@ -204,53 +204,65 @@ public class EntityLoggerComponent {
|
|||||||
destDBSchema.close();
|
destDBSchema.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(fixedDelay = 12, timeUnit = TimeUnit.HOURS, zone = "Europe/Rome")
|
|
||||||
private void deleteOldlogs() {
|
private void deleteOldlogs() {
|
||||||
if (UtilityDebug.isDebugExecution())
|
MultiDBTransactionManager sourceMultiDB = null, historyMultiDB = null;
|
||||||
return;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<AvailableConnectionModel> connectionsModels = settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true);
|
List<AvailableConnectionsModel> connectionsModels = settingsModel.getAvailableConnections();
|
||||||
|
|
||||||
|
connectionsModels = Stream.of(connectionsModels)
|
||||||
|
.filter(AvailableConnectionsModel::getInternalDb)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
|
||||||
String historyProfileDB = settingsController.getHistoryProfileDb();
|
String historyProfileDB = settingsController.getHistoryProfileDb();
|
||||||
|
historyMultiDB = new MultiDBTransactionManager(historyProfileDB);
|
||||||
|
|
||||||
try (MultiDBTransactionManager historyMultiDB = new MultiDBTransactionManager(historyProfileDB)) {
|
for (AvailableConnectionsModel sourceConnectionModel : connectionsModels) {
|
||||||
|
String sql = "SELECT * FROM stb_log_entity_setup" +
|
||||||
|
" WHERE entity_name <> " + UtilityDB.valueToString(StbLogEntitySetup.ENTITY);
|
||||||
|
|
||||||
for (AvailableConnectionModel sourceConnectionModel : connectionsModels) {
|
sourceMultiDB = new MultiDBTransactionManager(sourceConnectionModel.getProfileName());
|
||||||
String sql = "SELECT * FROM stb_log_entity_setup" +
|
List<HashMap<String, Object>> result = UtilityDB.executeSimpleQuery(sourceMultiDB.getPrimaryConnection(), sql);
|
||||||
" WHERE entity_name <> " + UtilityDB.valueToString(StbLogEntitySetup.ENTITY);
|
sourceMultiDB.closeAll();
|
||||||
|
|
||||||
List<HashMap<String, Object>> result = null;
|
for (HashMap<String, Object> stbLogEntitySetup : result) {
|
||||||
|
String tableName = UtilityHashMap.getValueIfExists(stbLogEntitySetup, "entity_name");
|
||||||
|
int logDays = UtilityHashMap.getValueIfExists(stbLogEntitySetup, "log_days");
|
||||||
|
|
||||||
try (MultiDBTransactionManager sourceMultiDB = new MultiDBTransactionManager(sourceConnectionModel.getProfileName())) {
|
int i = 0;
|
||||||
result = UtilityDB.executeSimpleQuery(sourceMultiDB.getPrimaryConnection(), sql);
|
try {
|
||||||
}
|
do {
|
||||||
|
String checkSql = String.format("DELETE TOP ( 1000 ) FROM %s WHERE log_created_at < DATEADD(DAY, %d, GETDATE()) AND log_created_profile = %s",
|
||||||
|
tableName, -1 * logDays, UtilityDB.valueToString(sourceConnectionModel.getProfileName()));
|
||||||
|
|
||||||
for (HashMap<String, Object> stbLogEntitySetup : result) {
|
PreparedStatement ps = historyMultiDB.prepareStatement(checkSql);
|
||||||
String tableName = UtilityHashMap.getValueIfExists(stbLogEntitySetup, "entity_name");
|
i = ps.executeUpdate();
|
||||||
int logDays = UtilityHashMap.getValueIfExists(stbLogEntitySetup, "log_days");
|
ps.close();
|
||||||
|
historyMultiDB.commitAll();
|
||||||
|
} while (i > 0);
|
||||||
|
|
||||||
int i = 0;
|
} catch (Exception ex) {
|
||||||
try {
|
logger.error("EntityLogDeleter", "Errore durante la cancellazione dei vecchi record da " + tableName);
|
||||||
do {
|
logger.error("EntityLogDeleter", ex);
|
||||||
String checkSql = String.format("DELETE TOP ( 1000 ) FROM %s WHERE log_created_at < DATEADD(DAY, %d, GETDATE()) AND log_created_profile = %s",
|
|
||||||
tableName, -1 * logDays, UtilityDB.valueToString(sourceConnectionModel.getProfileName()));
|
|
||||||
|
|
||||||
PreparedStatement ps = historyMultiDB.prepareStatement(checkSql);
|
|
||||||
i = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
historyMultiDB.commitAll();
|
|
||||||
} while (i > 0);
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
logger.error("EntityLogDeleter", "Errore durante la cancellazione dei vecchi record da " + tableName);
|
|
||||||
logger.error("EntityLogDeleter", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
historyMultiDB.closeAll();
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.error("EntityLoggerComponent.deleteOldlogs", ex);
|
logger.error("EntityLoggerComponent.deleteOldlogs", ex);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (sourceMultiDB != null) sourceMultiDB.closeAll();
|
||||||
|
if (historyMultiDB != null) historyMultiDB.closeAll();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("EntityLoggerComponent.deleteOldlogs", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
package it.integry.ems.exception;
|
|
||||||
|
|
||||||
public class DistributoreDatabaseNotPresentException extends Exception {
|
|
||||||
|
|
||||||
public DistributoreDatabaseNotPresentException() {
|
|
||||||
super("Distributore database not present yet");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package it.integry.ems.exception;
|
|
||||||
|
|
||||||
public class InvalidCustomerDbException extends RuntimeException {
|
|
||||||
public InvalidCustomerDbException(String dbName) {
|
|
||||||
super("Invalid customer database name: " + dbName + ". Please check your ems_settings.json");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package it.integry.ems.exception;
|
|
||||||
|
|
||||||
public class InvalidDbNameException extends RuntimeException {
|
|
||||||
public InvalidDbNameException(String dbName) {
|
|
||||||
super("Invalid database name: " + dbName + ". Please check your ems_settings.json");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package it.integry.ems.exception;
|
|
||||||
|
|
||||||
public class InvalidProfileDbException extends RuntimeException {
|
|
||||||
public InvalidProfileDbException(String profileDb) {
|
|
||||||
super("Invalid profile db: " + profileDb + ". Please check your ems_settings.json");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
package it.integry.ems.expansion;
|
package it.integry.ems.expansion;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Observable;
|
||||||
|
import java.util.Observer;
|
||||||
|
|
||||||
public class ObservableArrayList<T> extends Observable {
|
public class ObservableArrayList<T> extends Observable {
|
||||||
|
|
||||||
@@ -119,16 +122,4 @@ public class ObservableArrayList<T> extends Observable {
|
|||||||
notifyObservers();
|
notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (!(o instanceof ObservableArrayList)) return false;
|
|
||||||
ObservableArrayList<?> that = (ObservableArrayList<?>) o;
|
|
||||||
return Objects.equals(value, that.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.ems.expansion;
|
package it.integry.ems.expansion;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Observable;
|
import java.util.Observable;
|
||||||
|
|
||||||
public class ObservableField<T> extends Observable {
|
public class ObservableField<T> extends Observable {
|
||||||
@@ -35,16 +34,4 @@ public class ObservableField<T> extends Observable {
|
|||||||
|
|
||||||
super.addObserver((o, arg) -> observerCallback.run());
|
super.addObserver((o, arg) -> observerCallback.run());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (!(o instanceof ObservableField)) return false;
|
|
||||||
ObservableField<?> that = (ObservableField<?>) o;
|
|
||||||
return Objects.equals(value, that.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package it.integry.ems.expansion;
|
|
||||||
|
|
||||||
public interface RunnableArgsReturnThrowable<T> {
|
|
||||||
|
|
||||||
T run() throws Exception;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,6 @@ package it.integry.ems.expansion;
|
|||||||
|
|
||||||
public interface RunnableArgsThrowable<T> {
|
public interface RunnableArgsThrowable<T> {
|
||||||
|
|
||||||
void run(T data) throws Exception;
|
T run() throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
|||||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||||
import it.integry.ems._context.ApplicationContextProvider;
|
|
||||||
import it.integry.ems.export.enums.EntityExportTipoInvio;
|
import it.integry.ems.export.enums.EntityExportTipoInvio;
|
||||||
import it.integry.ems.file_sharer.IFileSharer;
|
import it.integry.ems.file_sharer.IFileSharer;
|
||||||
import it.integry.ems.file_sharer.IFileSharerAttachment;
|
import it.integry.ems.file_sharer.IFileSharerAttachment;
|
||||||
@@ -174,7 +173,7 @@ public abstract class BaseEntityExporter implements IEntityExporter {
|
|||||||
.map(x -> (FileItem) x)
|
.map(x -> (FileItem) x)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
String pathFile = UtilityDirs.getDirectoryExport(multiDBTransactionManager.getPrimaryConnection().getDbName(), type, format).getAbsolutePath();
|
String pathFile = UtilityDirs.getDirectoryExport(multiDBTransactionManager.getPrimaryDatasource().getDbName(), type, format).getAbsolutePath();
|
||||||
|
|
||||||
for (FileItem file : files) {
|
for (FileItem file : files) {
|
||||||
File tempFile = new File(pathFile + File.separator + file.getFileName());
|
File tempFile = new File(pathFile + File.separator + file.getFileName());
|
||||||
@@ -252,7 +251,7 @@ public abstract class BaseEntityExporter implements IEntityExporter {
|
|||||||
|
|
||||||
case WEBSERVICES:
|
case WEBSERVICES:
|
||||||
|
|
||||||
ResponseJSONObjectMapper objectMapper = ApplicationContextProvider.getApplicationContext().getBean(ResponseJSONObjectMapper.class);
|
ResponseJSONObjectMapper objectMapper = new ResponseJSONObjectMapper();
|
||||||
|
|
||||||
String url = wtbUserInfo.getWsEndpoint();
|
String url = wtbUserInfo.getWsEndpoint();
|
||||||
|
|
||||||
@@ -369,7 +368,7 @@ public abstract class BaseEntityExporter implements IEntityExporter {
|
|||||||
entityExportResponse.setMessageContent("Messaggio creato automaticamente: " + "INVIO " + type + " formato " + format);
|
entityExportResponse.setMessageContent("Messaggio creato automaticamente: " + "INVIO " + type + " formato " + format);
|
||||||
}
|
}
|
||||||
|
|
||||||
fileSharerSettings = MailService.readParameter(multiDBTransactionManager.getPrimaryConnection(), null);
|
fileSharerSettings = MailService.readParameter(multiDBTransactionManager, null);
|
||||||
((EmailFileSharerSettings) fileSharerSettings)
|
((EmailFileSharerSettings) fileSharerSettings)
|
||||||
.withSubject(entityExportResponse.getMessageSubject())
|
.withSubject(entityExportResponse.getMessageSubject())
|
||||||
.withTextMessage(entityExportResponse.getMessageContent())
|
.withTextMessage(entityExportResponse.getMessageContent())
|
||||||
@@ -426,7 +425,7 @@ public abstract class BaseEntityExporter implements IEntityExporter {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
MailService mailService = ContextLoader.getCurrentWebApplicationContext().getBean(MailService.class);
|
MailService mailService = ContextLoader.getCurrentWebApplicationContext().getBean(MailService.class);
|
||||||
mailService.sendInfoMail(multiDBTransactionManager.getPrimaryConnection(), notificationEmail,
|
mailService.sendInfoMail(multiDBTransactionManager, notificationEmail,
|
||||||
String.format("Esportazione di %s - %s", getType(), getFormat()),
|
String.format("Esportazione di %s - %s", getType(), getFormat()),
|
||||||
String.format("come da accordi, l'esportazione %s - %s è stata completata.", getType(), getFormat()));
|
String.format("come da accordi, l'esportazione %s - %s è stata completata.", getType(), getFormat()));
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import it.integry.ems.response.FileItem;
|
|||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems_model.entity.WtbUsersInfo;
|
import it.integry.ems_model.entity.WtbUsersInfo;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityResultSet;
|
import it.integry.ems_model.utility.UtilityResultSet;
|
||||||
@@ -28,13 +27,8 @@ public class ExportFromQuery {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EntityProcessor entityProcessor;
|
private EntityProcessor entityProcessor;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SetupGest setupGest;
|
|
||||||
|
|
||||||
public EntityExportResponse export (String userName, String type, String format, String whereCond) throws Exception {
|
public EntityExportResponse export (String userName, String type, String format, String whereCond) throws Exception {
|
||||||
|
|
||||||
String query = setupGest.getExportSetup(multiDBTransactionManager.getPrimaryConnection(), type, format, "QUERY");
|
|
||||||
|
|
||||||
WtbUsersInfo wtbUsersInfo =
|
WtbUsersInfo wtbUsersInfo =
|
||||||
new WtbUsersInfo()
|
new WtbUsersInfo()
|
||||||
.setUserName(userName)
|
.setUserName(userName)
|
||||||
@@ -44,20 +38,18 @@ public class ExportFromQuery {
|
|||||||
|
|
||||||
entityProcessor.processEntity(wtbUsersInfo, multiDBTransactionManager);
|
entityProcessor.processEntity(wtbUsersInfo, multiDBTransactionManager);
|
||||||
|
|
||||||
if (UtilityString.isNullOrEmpty(wtbUsersInfo.getQueryCustom()) && UtilityString.isNullOrEmpty(query))
|
String queryCustom = wtbUsersInfo.getQueryCustom();
|
||||||
|
|
||||||
|
if (UtilityString.isNullOrEmpty(queryCustom))
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
String.format(
|
String.format(
|
||||||
"Query non configurata per l'utente %s tipo %s formato %s o per il formato.",
|
"Query non configurata per l'utente %s tipo %s formato %s",
|
||||||
userName, type, format));
|
userName, type, format));
|
||||||
|
|
||||||
|
queryCustom = UtilityDB.addwhereCond(queryCustom, whereCond, true);
|
||||||
if (!UtilityString.isNullOrEmpty(wtbUsersInfo.getQueryCustom())) {
|
|
||||||
query = wtbUsersInfo.getQueryCustom();
|
|
||||||
}
|
|
||||||
query = UtilityDB.addwhereCond(query, whereCond, true);
|
|
||||||
PreparedStatement stm = multiDBTransactionManager
|
PreparedStatement stm = multiDBTransactionManager
|
||||||
.getPrimaryConnection()
|
.getPrimaryConnection()
|
||||||
.prepareStatement(query,
|
.prepareStatement(queryCustom,
|
||||||
ResultSet.TYPE_SCROLL_INSENSITIVE,
|
ResultSet.TYPE_SCROLL_INSENSITIVE,
|
||||||
ResultSet.CONCUR_READ_ONLY);
|
ResultSet.CONCUR_READ_ONLY);
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ public enum EntityExportType {
|
|||||||
LISTINI_ACQUISTO("LISTINI ACQUISTO"),
|
LISTINI_ACQUISTO("LISTINI ACQUISTO"),
|
||||||
LISTINI_VENDITA("LISTINI VENDITA"),
|
LISTINI_VENDITA("LISTINI VENDITA"),
|
||||||
COLLI("COLLI"),
|
COLLI("COLLI"),
|
||||||
SCADENZE("SCADENZE"),
|
SCADENZE("SCADENZE");
|
||||||
SCONTRINI("SCONTRINI");
|
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
|
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
|
||||||
import com.fasterxml.jackson.dataformat.csv.CsvSchema.Column;
|
import com.fasterxml.jackson.dataformat.csv.CsvSchema.Column;
|
||||||
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems_model.ImportExport.Interfaces.IExportFormat;
|
import it.integry.ems_model.ImportExport.Interfaces.IExportFormat;
|
||||||
import it.integry.ems_model.ImportExport.Interfaces.IImportFormat;
|
import it.integry.ems_model.ImportExport.Interfaces.IImportFormat;
|
||||||
import it.integry.ems_model.annotation.DtoField;
|
import it.integry.ems_model.annotation.DtoField;
|
||||||
@@ -27,8 +28,7 @@ public class CsvMapper<T> {
|
|||||||
List<Field> declaredFields = Arrays.asList(dtoList.get(0).getClass().getDeclaredFields());
|
List<Field> declaredFields = Arrays.asList(dtoList.get(0).getClass().getDeclaredFields());
|
||||||
|
|
||||||
List<Field> sortedFields = Stream.of(declaredFields)
|
List<Field> sortedFields = Stream.of(declaredFields)
|
||||||
.filter(x -> x.getAnnotation(DtoField.class) != null &&
|
.filter(x -> x.getAnnotation(DtoField.class) != null && x.getAnnotation(DtoField.class).startPosition() >= 0)
|
||||||
x.getAnnotation(DtoField.class).startPosition() >= 0)
|
|
||||||
.sortBy(x -> x.getAnnotation(DtoField.class).startPosition())
|
.sortBy(x -> x.getAnnotation(DtoField.class).startPosition())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public class CsvMapper<T> {
|
|||||||
String header = StringUtils.join(Stream
|
String header = StringUtils.join(Stream
|
||||||
.of(sortedFields).map(
|
.of(sortedFields).map(
|
||||||
x -> x.getName()
|
x -> x.getName()
|
||||||
).toList(), splitChar);
|
).toList(), CommonConstants.TAB);
|
||||||
|
|
||||||
return serialize(dtoList, splitChar, header, hasHeader);
|
return serialize(dtoList, splitChar, header, hasHeader);
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public class CsvMapper<T> {
|
|||||||
builder.addColumn(new Column(i, columns[i]));
|
builder.addColumn(new Column(i, columns[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.setLineSeparator(System.lineSeparator());
|
builder.setLineSeparator(System.getProperty("line.separator"));
|
||||||
CsvSchema schema = builder.build().withoutQuoteChar();
|
CsvSchema schema = builder.build().withoutQuoteChar();
|
||||||
|
|
||||||
mapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true);
|
mapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true);
|
||||||
@@ -73,7 +73,6 @@ public class CsvMapper<T> {
|
|||||||
public List<T> deserialize(String csv, Class<T> dtoClass, String splitChar) throws Exception {
|
public List<T> deserialize(String csv, Class<T> dtoClass, String splitChar) throws Exception {
|
||||||
List<T> outputList = null;
|
List<T> outputList = null;
|
||||||
String[] headers = null;
|
String[] headers = null;
|
||||||
Integer rows = 0;
|
|
||||||
|
|
||||||
String delimiter = UtilityString.identifyLineDelimiter(csv);
|
String delimiter = UtilityString.identifyLineDelimiter(csv);
|
||||||
ByteBuffer byteBuffer = ByteBuffer.wrap(csv.getBytes());
|
ByteBuffer byteBuffer = ByteBuffer.wrap(csv.getBytes());
|
||||||
@@ -83,7 +82,6 @@ public class CsvMapper<T> {
|
|||||||
for (int i = 0; i < byteBuffer.capacity(); i++) {
|
for (int i = 0; i < byteBuffer.capacity(); i++) {
|
||||||
line.append((char) byteBuffer.get());
|
line.append((char) byteBuffer.get());
|
||||||
if (line.toString().endsWith(delimiter)) {
|
if (line.toString().endsWith(delimiter)) {
|
||||||
rows++;
|
|
||||||
if (firstLine) {
|
if (firstLine) {
|
||||||
firstLine = false;
|
firstLine = false;
|
||||||
headers = line.toString().replace(delimiter, "").split(splitChar);
|
headers = line.toString().replace(delimiter, "").split(splitChar);
|
||||||
@@ -106,44 +104,37 @@ public class CsvMapper<T> {
|
|||||||
line = new StringBuilder();
|
line = new StringBuilder();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
String[] datas = line.toString().replace(delimiter, "").split(splitChar);
|
||||||
|
T bean = (T) dtoClass.newInstance();
|
||||||
|
for (int j = 0; j < datas.length; j++) {
|
||||||
|
String header = headers[j].trim();
|
||||||
|
if (header.compareTo("") != 0) {
|
||||||
|
Field field = map.get(header.toLowerCase());
|
||||||
|
|
||||||
try {
|
if (field != null) {
|
||||||
String[] datas = line.toString().replace(delimiter, "").split(splitChar);
|
|
||||||
T bean = (T) dtoClass.newInstance();
|
|
||||||
for (int j = 0; j < datas.length; j++) {
|
|
||||||
String header = headers[j].trim();
|
|
||||||
if (header.compareTo("") != 0) {
|
|
||||||
Field field = map.get(header.toLowerCase());
|
|
||||||
|
|
||||||
if (field != null) {
|
DtoField dtoField = field.getAnnotation(DtoField.class);
|
||||||
|
|
||||||
DtoField dtoField = field.getAnnotation(DtoField.class);
|
field.setAccessible(true);
|
||||||
|
|
||||||
field.setAccessible(true);
|
|
||||||
|
|
||||||
Object columnValue;
|
|
||||||
if (field.getGenericType() != String.class && UtilityString.isNullOrEmpty(datas[j].trim())) {
|
|
||||||
columnValue = null;
|
|
||||||
} else {
|
|
||||||
columnValue = datas[j].trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
Object o = SqlFieldHolder.applyConvert(columnValue, field.getGenericType());
|
|
||||||
field.set(bean, o);
|
|
||||||
|
|
||||||
|
Object columnValue;
|
||||||
|
if (field.getGenericType() != String.class && UtilityString.isNullOrEmpty(datas[j].trim())) {
|
||||||
|
columnValue = null;
|
||||||
|
} else {
|
||||||
|
columnValue = datas[j].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object o = SqlFieldHolder.applyConvert(columnValue, field.getGenericType());
|
||||||
|
field.set(bean, o);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
line = new StringBuilder();
|
|
||||||
if (outputList == null) {
|
|
||||||
outputList = new ArrayList<T>();
|
|
||||||
}
|
|
||||||
outputList.add(bean);
|
|
||||||
|
|
||||||
} catch(Exception e) {
|
|
||||||
throw new Exception("ERRORE DI SINTASSI SU RIGA " + rows);
|
|
||||||
}
|
}
|
||||||
|
line = new StringBuilder();
|
||||||
|
if (outputList == null) {
|
||||||
|
outputList = new ArrayList<T>();
|
||||||
|
}
|
||||||
|
outputList.add(bean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
byteBuffer.clear();
|
byteBuffer.clear();
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package it.integry.ems.file_formatter.txt;
|
|||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import it.integry.ems_model.annotation.DtoField;
|
import it.integry.ems_model.annotation.DtoField;
|
||||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -11,7 +10,6 @@ import java.lang.reflect.Field;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -78,16 +76,8 @@ public class TxtMapper<T> {
|
|||||||
|
|
||||||
if (ignorePosition)
|
if (ignorePosition)
|
||||||
stringBuilder.append(value).append(fieldsSplitChar);
|
stringBuilder.append(value).append(fieldsSplitChar);
|
||||||
else {
|
else
|
||||||
if ( stringBuilder.length() > 0 && stringBuilder.length() < dtoField.startPosition() ) {
|
|
||||||
int numChar = dtoField.startPosition() - stringBuilder.length();
|
|
||||||
for (int i = 0; i < numChar; i++) {
|
|
||||||
stringBuilder.append(fieldsSplitChar);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
stringBuilder.insert(dtoField.startPosition(), value).append(fieldsSplitChar);
|
stringBuilder.insert(dtoField.startPosition(), value).append(fieldsSplitChar);
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e);
|
logger.error(e);
|
||||||
@@ -218,8 +208,6 @@ public class TxtMapper<T> {
|
|||||||
if (value != null) {
|
if (value != null) {
|
||||||
if (!UtilityString.isNullOrEmpty(dtoField.format()) && value instanceof Date) {
|
if (!UtilityString.isNullOrEmpty(dtoField.format()) && value instanceof Date) {
|
||||||
value = new SimpleDateFormat(dtoField.format()).format(value);
|
value = new SimpleDateFormat(dtoField.format()).format(value);
|
||||||
} else if (!UtilityString.isNullOrEmpty(dtoField.format()) && value instanceof LocalDate) {
|
|
||||||
value = UtilityLocalDate.formatDate((LocalDate) value, dtoField.format() );
|
|
||||||
} else if (!UtilityString.isNullOrEmpty(dtoField.formula()) && value instanceof BigDecimal) {
|
} else if (!UtilityString.isNullOrEmpty(dtoField.formula()) && value instanceof BigDecimal) {
|
||||||
value = ((BigDecimal) value).setScale(dtoField.scale(), RoundingMode.HALF_DOWN);
|
value = ((BigDecimal) value).setScale(dtoField.scale(), RoundingMode.HALF_DOWN);
|
||||||
String formula = dtoField.formula().replaceAll("this", value.toString());
|
String formula = dtoField.formula().replaceAll("this", value.toString());
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ package it.integry.ems.javabeans;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems._context.ApplicationContextProvider;
|
|
||||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
|
||||||
import it.integry.ems.model.IntegryApplicationEnum;
|
import it.integry.ems.model.IntegryApplicationEnum;
|
||||||
import it.integry.ems.settings.Model.SettingsModel;
|
|
||||||
import it.integry.ems.user.dto.UserDTO;
|
import it.integry.ems.user.dto.UserDTO;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
@@ -40,30 +37,26 @@ public class RequestDataDTO {
|
|||||||
private String requestClientIP;
|
private String requestClientIP;
|
||||||
|
|
||||||
private String profileDB;
|
private String profileDB;
|
||||||
|
private String deviceId;
|
||||||
//Indica il codice deposito reale dell'utente che effettua la richiesta, ovvero la posizione fisica dell'utente
|
|
||||||
private String codMdep;
|
|
||||||
|
|
||||||
private Long deviceId;
|
|
||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
private boolean includeNulls = false;
|
private boolean includeNulls = false;
|
||||||
|
|
||||||
private IntegryApplicationEnum integryApplication;
|
private IntegryApplicationEnum integryApplication = IntegryApplicationEnum.PVM;
|
||||||
|
|
||||||
private UserDTO userDTO;
|
private UserDTO userDTO;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() throws IOException, InterruptedException {
|
public void init() throws IOException, InterruptedException {
|
||||||
|
|
||||||
if (request != null && request.getParameter(CommonConstants.PROFILE_DB) != null) {
|
if (request != null && request.getQueryString() != null && request.getQueryString().contains(CommonConstants.PROFILE_DB)) {
|
||||||
profileDB = request.getParameter(CommonConstants.PROFILE_DB);
|
profileDB = request.getParameter(CommonConstants.PROFILE_DB);
|
||||||
} else if (request != null && request.getHeader(CommonConstants.PROFILE_DB) != null) {
|
} else if (request != null && request.getHeader(CommonConstants.PROFILE_DB) != null) {
|
||||||
profileDB = request.getHeader(CommonConstants.PROFILE_DB);
|
profileDB = request.getHeader(CommonConstants.PROFILE_DB);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request != null && request.getHeader(CommonConstants.COD_MDEP) != null) {
|
if (request != null && request.getHeader(EmsRestConstants.DEVICE_ID) != null) {
|
||||||
codMdep = request.getHeader(CommonConstants.COD_MDEP);
|
deviceId = request.getHeader(EmsRestConstants.DEVICE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
@@ -109,22 +102,12 @@ public class RequestDataDTO {
|
|||||||
.setPassword("sql");
|
.setPassword("sql");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RequestDataDTO scheduledOperationsMockupData() {
|
|
||||||
return new RequestDataDTO()
|
|
||||||
.setUsername("INTEGRY")
|
|
||||||
.setPassword("INTEGRY");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidProfileDB() {
|
public boolean isValidProfileDB() {
|
||||||
return !UtilityString.isNullOrEmpty(profileDB);
|
return !UtilityString.isNullOrEmpty(profileDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValidCodMdep() {
|
|
||||||
return !UtilityString.isNullOrEmpty(codMdep);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidDeviceId() {
|
public boolean isValidDeviceId() {
|
||||||
return deviceId != null;
|
return !UtilityString.isNullOrEmpty(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValidUsername() {
|
public boolean isValidUsername() {
|
||||||
@@ -153,21 +136,7 @@ public class RequestDataDTO {
|
|||||||
return profileDB;
|
return profileDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodMdep() {
|
public String getDeviceId() {
|
||||||
return codMdep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IntegryCustomerDB getCustomerDB() {
|
|
||||||
if (UtilityString.isNullOrEmpty(profileDB))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
final SettingsModel settingsModel = ApplicationContextProvider.getApplicationContext().getBean(SettingsModel.class);
|
|
||||||
final String dbName = settingsModel.getDbNameFromProfileDb(profileDB);
|
|
||||||
|
|
||||||
return IntegryCustomerDB.parse(dbName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getDeviceId() {
|
|
||||||
return deviceId;
|
return deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,10 +173,10 @@ public class RequestDataDTO {
|
|||||||
|
|
||||||
private void readAuthenticationClaims(Authentication authentication) {
|
private void readAuthenticationClaims(Authentication authentication) {
|
||||||
username = authentication.getName();
|
username = authentication.getName();
|
||||||
|
//final UsernamePasswordAuthenticationToken principal = (UsernamePasswordAuthenticationToken) authentication.getPrincipal();
|
||||||
final AuthTokenDetails authTokenDetails = (AuthTokenDetails) authentication.getDetails();
|
final AuthTokenDetails authTokenDetails = (AuthTokenDetails) authentication.getDetails();
|
||||||
|
|
||||||
userDTO = authTokenDetails.getUserDTO();
|
userDTO = authTokenDetails.getUserDTO();
|
||||||
deviceId = authTokenDetails.getDeviceId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
package it.integry.ems.json;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
||||||
import it.integry.ems.adapter.*;
|
|
||||||
import it.integry.ems.response.EsitoType;
|
|
||||||
import it.integry.ems.schedule.new_cron_job.controller.AutomatedOperationController;
|
|
||||||
import it.integry.ems.schedule.new_cron_job.dto.operations.base_classes.BaseAutomatedOperationDTO;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class JsonObjectMapperConfig {
|
|
||||||
|
|
||||||
|
|
||||||
public static SimpleModule addDefaultAdapters(SimpleModule module) {
|
|
||||||
module.addSerializer(Date.class, new JsonDateAdapterSerializer());
|
|
||||||
module.addDeserializer(Date.class, new JsonDateAdapterDeserializer());
|
|
||||||
|
|
||||||
module.addSerializer(LocalDate.class, new JsonLocalDateAdapterSerializer());
|
|
||||||
module.addDeserializer(LocalDate.class, new JsonLocalDateAdapterDeserializer());
|
|
||||||
|
|
||||||
module.addSerializer(LocalDateTime.class, new JsonLocalDateTimeAdapterSerializer());
|
|
||||||
module.addDeserializer(LocalDateTime.class, new JsonLocalDateTimeAdapterDeserializer());
|
|
||||||
|
|
||||||
module.addSerializer(LocalTime.class, new JsonLocalTimeAdapterSerializer());
|
|
||||||
module.addDeserializer(LocalTime.class, new JsonLocalTimeAdapterDeserializer());
|
|
||||||
|
|
||||||
module.addSerializer(EsitoType.class, new EsitoSerialize());
|
|
||||||
module.addDeserializer(EsitoType.class, new EsitoDeserialize());
|
|
||||||
|
|
||||||
module.addDeserializer(BigDecimal.class, new BigDecimalDeserialize());
|
|
||||||
module.addDeserializer(Integer.class, new IntegerDeserializer());
|
|
||||||
module.addDeserializer(Long.class, new LongDeserializer());
|
|
||||||
|
|
||||||
module.addDeserializer(String.class, new StringUnicodeDeserialize());
|
|
||||||
|
|
||||||
module.addDeserializer(Boolean.class, new BooleanDeserializer());
|
|
||||||
|
|
||||||
|
|
||||||
module.addDeserializer(BaseAutomatedOperationDTO.class, new AutomatedOperationController.AutomatedOperationsDeserializer());
|
|
||||||
return module;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
|||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
|
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
|
||||||
@@ -13,6 +12,10 @@ import com.fasterxml.jackson.databind.ser.PropertyFilter;
|
|||||||
import com.fasterxml.jackson.databind.ser.PropertyWriter;
|
import com.fasterxml.jackson.databind.ser.PropertyWriter;
|
||||||
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
|
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
|
||||||
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
|
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
|
||||||
|
import it.integry.ems.adapter.*;
|
||||||
|
import it.integry.ems.response.EsitoType;
|
||||||
|
import it.integry.ems.schedule.new_cron_job.controller.AutomatedOperationController;
|
||||||
|
import it.integry.ems.schedule.new_cron_job.dto.operations.base_classes.BaseAutomatedOperationDTO;
|
||||||
import it.integry.ems_model.annotation.EntityChild;
|
import it.integry.ems_model.annotation.EntityChild;
|
||||||
import it.integry.ems_model.annotation.PK;
|
import it.integry.ems_model.annotation.PK;
|
||||||
import it.integry.ems_model.annotation.SqlField;
|
import it.integry.ems_model.annotation.SqlField;
|
||||||
@@ -24,7 +27,11 @@ import it.integry.ems_model.types.OperationType;
|
|||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -34,7 +41,30 @@ public class ResponseJSONObjectMapper extends ObjectMapper {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public SimpleModule addDefaultAdapters(SimpleModule module) {
|
||||||
|
module.addSerializer(Date.class, new JsonDateAdapterSerializer());
|
||||||
|
module.addDeserializer(Date.class, new JsonDateAdapterDeserializer());
|
||||||
|
|
||||||
|
module.addSerializer(LocalDate.class, new JsonLocalDateAdapterSerializer());
|
||||||
|
module.addDeserializer(LocalDate.class, new JsonLocalDateAdapterDeserializer());
|
||||||
|
|
||||||
|
module.addSerializer(LocalDateTime.class, new JsonLocalDateTimeAdapterSerializer());
|
||||||
|
module.addDeserializer(LocalDateTime.class, new JsonLocalDateTimeAdapterDeserializer());
|
||||||
|
|
||||||
|
module.addSerializer(EsitoType.class, new EsitoSerialize());
|
||||||
|
module.addDeserializer(EsitoType.class, new EsitoDeserialize());
|
||||||
|
|
||||||
|
module.addDeserializer(BigDecimal.class, new BigDecimalDeserialize());
|
||||||
|
module.addDeserializer(Integer.class, new IntegerDeserializer());
|
||||||
|
|
||||||
|
module.addDeserializer(String.class, new StringUnicodeDeserialize());
|
||||||
|
|
||||||
|
module.addDeserializer(Boolean.class, new BooleanDeserializer());
|
||||||
|
|
||||||
|
|
||||||
|
module.addDeserializer(BaseAutomatedOperationDTO.class, new AutomatedOperationController.AutomatedOperationsDeserializer());
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public ResponseJSONObjectMapper() {
|
public ResponseJSONObjectMapper() {
|
||||||
@@ -106,13 +136,11 @@ public class ResponseJSONObjectMapper extends ObjectMapper {
|
|||||||
|
|
||||||
|
|
||||||
SimpleModule simpleModule = new SimpleModule();
|
SimpleModule simpleModule = new SimpleModule();
|
||||||
JsonObjectMapperConfig.addDefaultAdapters(simpleModule);
|
simpleModule = addDefaultAdapters(simpleModule);
|
||||||
|
|
||||||
setupEntityModules(simpleModule);
|
setupEntityModules(simpleModule);
|
||||||
registerModule(simpleModule);
|
registerModule(simpleModule);
|
||||||
|
|
||||||
configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
|
|
||||||
|
|
||||||
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
|
configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
|
||||||
configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
|
configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package it.integry.ems.license;
|
package it.integry.ems.license;
|
||||||
|
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
import it.integry.common.var.CommonConstants;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.context.ContextLoader;
|
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -12,6 +11,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
public class LicenseCheckInterceptor extends HandlerInterceptorAdapter {
|
public class LicenseCheckInterceptor extends HandlerInterceptorAdapter {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LicenseComponent licenseComponent;
|
private LicenseComponent licenseComponent;
|
||||||
|
|
||||||
@@ -19,9 +19,13 @@ public class LicenseCheckInterceptor extends HandlerInterceptorAdapter {
|
|||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response, Object handler) {
|
HttpServletResponse response, Object handler) {
|
||||||
|
|
||||||
RequestDataDTO requestData = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
|
||||||
|
|
||||||
String profileDB = requestData.getProfileDB();
|
String profileDB = null;
|
||||||
|
if (request != null && request.getQueryString() != null && request.getQueryString().contains(CommonConstants.PROFILE_DB)) {
|
||||||
|
profileDB = request.getParameter(CommonConstants.PROFILE_DB);
|
||||||
|
} else if (request != null && request.getHeader(CommonConstants.PROFILE_DB) != null) {
|
||||||
|
profileDB = request.getHeader(CommonConstants.PROFILE_DB);
|
||||||
|
}
|
||||||
|
|
||||||
LicenseStatusDTO licenseStatusDTO = null;
|
LicenseStatusDTO licenseStatusDTO = null;
|
||||||
if (profileDB != null) licenseStatusDTO = licenseComponent.getLicenseStatus(profileDB);
|
if (profileDB != null) licenseStatusDTO = licenseComponent.getLicenseStatus(profileDB);
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import it.integry.ems.json.ResponseJSONObjectMapper;
|
|||||||
import it.integry.ems.response.EsitoType;
|
import it.integry.ems.response.EsitoType;
|
||||||
import it.integry.ems.response.ServiceRestResponse;
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
import it.integry.ems.service.HttpRestWrapper;
|
import it.integry.ems.service.HttpRestWrapper;
|
||||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||||
import it.integry.ems.settings.Model.SettingsModel;
|
import it.integry.ems.settings.Model.SettingsModel;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityDebug;
|
import it.integry.ems.utility.UtilityDebug;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
@@ -25,7 +25,6 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -60,11 +59,11 @@ public class LicenseComponent {
|
|||||||
if (!canStart)
|
if (!canStart)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<AvailableConnectionModel> availableConnectionModels = settingsModel.getAvailableConnections(true);
|
List<AvailableConnectionsModel> availableConnectionsModels = settingsModel.getAvailableConnections(true);
|
||||||
|
|
||||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager()) {
|
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager()) {
|
||||||
|
|
||||||
for (AvailableConnectionModel model : availableConnectionModels) {
|
for (AvailableConnectionsModel model : availableConnectionsModels) {
|
||||||
multiDBTransactionManager.addConnection(model);
|
multiDBTransactionManager.addConnection(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,18 +82,18 @@ public class LicenseComponent {
|
|||||||
|
|
||||||
final HashMap<String, String> listAziende = new HashMap<>();
|
final HashMap<String, String> listAziende = new HashMap<>();
|
||||||
|
|
||||||
for (Connection connection : multiDBTransactionManager.getActiveConnections()) {
|
for (AdvancedDataSource model : multiDBTransactionManager.getActiveConnections()) {
|
||||||
String sql = "SELECT part_iva FROM azienda WHERE part_iva is not null";
|
String sql = "SELECT part_iva FROM azienda WHERE part_iva is not null";
|
||||||
String partIva = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
String partIva = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(model.getConnection(), sql);
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(partIva))
|
if (!UtilityString.isNullOrEmpty(partIva))
|
||||||
listAziende.put(connection.getProfileName(), partIva);
|
listAziende.put(model.getProfileName(), partIva);
|
||||||
}
|
}
|
||||||
|
|
||||||
String jsonBody = jsonObjectMapper.writeValueAsString(listAziende.values());
|
String jsonBody = jsonObjectMapper.writeValueAsString(listAziende.values());
|
||||||
|
|
||||||
StringBuilder responseBody = new StringBuilder();
|
StringBuilder responseBody = new StringBuilder();
|
||||||
int status = HttpRestWrapper.callGeneric(url, "dba", "username", jsonBody, ContentType.APPLICATION_JSON, responseBody, null, 20);
|
int status = HttpRestWrapper.callGeneric(url, "dba", "username", jsonBody, ContentType.APPLICATION_JSON, responseBody, null);
|
||||||
|
|
||||||
if (status != 200)
|
if (status != 200)
|
||||||
throw new Exception("La richiesta \"" + url + "\" ha generato status code: " + status + " [" + responseBody + "]");
|
throw new Exception("La richiesta \"" + url + "\" ha generato status code: " + status + " [" + responseBody + "]");
|
||||||
@@ -106,19 +105,14 @@ public class LicenseComponent {
|
|||||||
} else {
|
} else {
|
||||||
List<LicenseStatusDTO> licenses = response.getDTO(new TypeReference<List<LicenseStatusDTO>>() {
|
List<LicenseStatusDTO> licenses = response.getDTO(new TypeReference<List<LicenseStatusDTO>>() {
|
||||||
});
|
});
|
||||||
if (licenses == null || licenses.isEmpty()) return;
|
if (licenses == null) return;
|
||||||
|
|
||||||
listAziende.forEach((key, value) -> {
|
listAziende.forEach((key, value) -> {
|
||||||
cachedLicenseStatus.remove(key);
|
cachedLicenseStatus.remove(key);
|
||||||
|
|
||||||
final Optional<LicenseStatusDTO> licenseSearch = licenses.stream().filter(x -> x.getPartIva().equalsIgnoreCase(value))
|
licenses.stream().filter(x -> x.getPartIva().equalsIgnoreCase(value))
|
||||||
.findFirst();
|
.findFirst()
|
||||||
|
.ifPresent(license -> cachedLicenseStatus.put(key, license));
|
||||||
if (licenseSearch.isPresent()) {
|
|
||||||
cachedLicenseStatus.put(key, licenseSearch.get());
|
|
||||||
} else {
|
|
||||||
cachedLicenseStatus.put(key, licenses.get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class LicenseController {
|
|||||||
|
|
||||||
@RequestMapping(value = "", method = RequestMethod.GET)
|
@RequestMapping(value = "", method = RequestMethod.GET)
|
||||||
public @ResponseBody ServiceRestResponse retrieve(@RequestParam(CommonConstants.PROFILE_DB) String profile) {
|
public @ResponseBody ServiceRestResponse retrieve(@RequestParam(CommonConstants.PROFILE_DB) String profile) {
|
||||||
LicenseStatusDTO licenseStatusDTO = licenseComponent.getLicenseStatus(profile.toUpperCase());
|
LicenseStatusDTO licenseStatusDTO = licenseComponent.getLicenseStatus(profile);
|
||||||
|
|
||||||
if(licenseStatusDTO == null) return ServiceRestResponse.createPositiveResponse();
|
if(licenseStatusDTO == null) return ServiceRestResponse.createPositiveResponse();
|
||||||
return ServiceRestResponse.createPositiveResponse(licenseStatusDTO);
|
return ServiceRestResponse.createPositiveResponse(licenseStatusDTO);
|
||||||
|
|||||||
@@ -10,13 +10,10 @@ import java.util.Date;
|
|||||||
public class LicenseStatusDTO {
|
public class LicenseStatusDTO {
|
||||||
@SqlField("part_iva")
|
@SqlField("part_iva")
|
||||||
private String partIva;
|
private String partIva;
|
||||||
|
|
||||||
@SqlField("classe_merito")
|
@SqlField("classe_merito")
|
||||||
private Quality quality;
|
private Quality quality;
|
||||||
|
|
||||||
@SqlField
|
@SqlField
|
||||||
private Status status;
|
private Status status;
|
||||||
|
|
||||||
@SqlField("data_scad_license")
|
@SqlField("data_scad_license")
|
||||||
private Date expiringDate;
|
private Date expiringDate;
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
package it.integry.ems.listener;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContextEvent;
|
|
||||||
import javax.servlet.ServletContextListener;
|
|
||||||
|
|
||||||
public class Log4jShutdownListener implements ServletContextListener {
|
|
||||||
@Override
|
|
||||||
public void contextInitialized(ServletContextEvent servletContextEvent) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void contextDestroyed(ServletContextEvent sce) {
|
|
||||||
try {
|
|
||||||
// Pulizia esplicita del ThreadLocal
|
|
||||||
// ContextAnchor.THREAD_CONTEXT.remove();
|
|
||||||
|
|
||||||
// Shutdown completo di Log4j
|
|
||||||
LogManager.shutdown();
|
|
||||||
|
|
||||||
// Attesa per completamento shutdown
|
|
||||||
Thread.sleep(500);
|
|
||||||
|
|
||||||
// Forza garbage collection
|
|
||||||
System.gc();
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println("Errore durante la pulizia dei ThreadLocal di Log4j: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,8 +15,6 @@ public class TaskModel implements Runnable {
|
|||||||
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
private final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
private boolean mInterrupted = false;
|
|
||||||
|
|
||||||
public TaskModel(Runnable runnable, long delayTimeInMillis, String tagName) {
|
public TaskModel(Runnable runnable, long delayTimeInMillis, String tagName) {
|
||||||
mRunnable = runnable;
|
mRunnable = runnable;
|
||||||
mDelayTime = delayTimeInMillis;
|
mDelayTime = delayTimeInMillis;
|
||||||
@@ -30,14 +28,14 @@ public class TaskModel implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
Date lastExecution = new Date(0L);
|
Date lastExecution = new Date(0L);
|
||||||
|
|
||||||
while (!mInterrupted) {
|
while (!mThread.isInterrupted()) {
|
||||||
try {
|
try {
|
||||||
if (new Date().getTime() - lastExecution.getTime() > mDelayTime) {
|
if (new Date().getTime() - lastExecution.getTime() > mDelayTime) {
|
||||||
mRunnable.run();
|
mRunnable.run();
|
||||||
lastExecution = new Date();
|
lastExecution = new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mInterrupted) Thread.sleep(10);
|
Thread.sleep(10);
|
||||||
} catch (InterruptedException iex) {
|
} catch (InterruptedException iex) {
|
||||||
//Do nothing
|
//Do nothing
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@@ -48,7 +46,7 @@ public class TaskModel implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void interrupt() {
|
public void interrupt() {
|
||||||
mInterrupted = true;
|
this.mThread.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTagName() {
|
public String getTagName() {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user