Compare commits

..

1 Commits

Author SHA1 Message Date
jenkins
79b0baf162 20240911_163115 2024-09-11 16:31:15 +02:00
2823 changed files with 90504 additions and 220559 deletions

5
.gitignore vendored
View File

@@ -119,8 +119,5 @@ fabric.properties
# Integry
*/target/*
*.ckie
/ts
/temp
/docker/tomcat/conf/integry/logs.db
/docker/tomcat/conf/integry/logs.db-journal
copilot.*.xml
/.idea/dataSources.xml

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EditMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

12
.idea/dataSources.xml generated
View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="@SERVERDB2019" uuid="ff4f0bad-7271-429e-a4e1-bae28629efc8">
<driver-ref>sqlserver.ms</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
<jdbc-url>jdbc:sqlserver://SERVERDB2019</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

View File

@@ -3,8 +3,6 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import it.integry.ems_model.annotation.*;
import it.integry.ems_model.base.EntityBase;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kie.api.definition.type.PropertyReactive;
#parse("File Header.java")
@@ -13,15 +11,9 @@ import org.kie.api.definition.type.PropertyReactive;
@Table(${NAME}.ENTITY)
@JsonTypeName(${NAME}.ENTITY)
public class ${NAME} extends EntityBase {
public static final String ENTITY = "${TABLE}";
private static final Logger logger = LogManager.getLogger();
private static final long serialVersionUID = 1L;
public ${NAME}() {
super(logger);
}
private static final long serialVerionUID = 1L;
}

View File

@@ -3,8 +3,6 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import it.integry.ems_model.annotation.*;
import it.integry.ems_model.base.EntityBase;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kie.api.definition.type.PropertyReactive;
#parse("File Header.java")
@@ -14,11 +12,5 @@ import org.kie.api.definition.type.PropertyReactive;
public class ${NAME} extends EntityBase {
public static final String ENTITY = "${TABLE}";
private static final Logger logger = LogManager.getLogger();
public ${NAME}() {
super(logger);
}
#[[$END$]]#
}

View File

@@ -1,5 +1,5 @@
#if(${PACKAGE_NAME}&&${PACKAGE_NAME}!="")package ${PACKAGE_NAME};#end
#parse("File Header.java")
#parse("File Header.java")
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
@@ -12,6 +12,8 @@ public class ${NAME} extends BaseMigration implements MigrationModelInterface{
}
@Override
public void down()throws Exception {
public void down()throws Exception{
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="LocalDate Checks" />
<version value="1.0" />
</settings>
</component>

View File

@@ -6,11 +6,6 @@
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="repo.jenkins-ci.org" />
<option name="name" value="repo.jenkins-ci.org" />
<option name="url" value="https://repo.jenkins-ci.org/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />

View File

@@ -1,17 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="KieStaticCompiler" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="it.integry.ems_model.rulescompleting.KieStaticCompiler" />
<module name="ems-core" />
<shortenClasspath name="MANIFEST" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="it.integry.ems_model.rulescompleting.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat" ALTERNATIVE_JRE_ENABLED="false" ALTERNATIVE_JRE_PATH="1.8" nameIsGenerated="true">
<option name="COMMON_VM_ARGUMENTS" value="-DDISABLE_DROOLS_COMPILE=TRUE -Xms1G -Xmx6G" />
<option name="COMMON_VM_ARGUMENTS" value="-Xms512m -Xmx2048m" />
<deployment>
<artifact name="ems-engine:war exploded">
<settings>
@@ -16,30 +16,12 @@
<log_file alias="Tomcat Localhost Access Log" path="%IDEA_RUN:CATALINA_BASE%/logs/localhost_access_log.*" />
<predefined_log_file enabled="true" id="Tomcat" />
<predefined_log_file enabled="true" id="Tomcat Catalina" />
<RunnerSettings RunnerId="AppServerDebuggerRunner">
<option name="DEBUG_PORT" value="javadebug" />
</RunnerSettings>
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="javadebug" />
</RunnerSettings>
<RunnerSettings RunnerId="JProfiler">
<option name="jreHome" value="$USER_HOME$/.jdks/openjdk-21.0.2" />
</RunnerSettings>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="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">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
@@ -100,21 +82,6 @@
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Profile ">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
@@ -131,7 +98,6 @@
</SHUTDOWN>
</ConfigurationWrapper>
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="KieStaticCompiler" run_configuration_type="Application" />
<option name="Make" enabled="true" />
<option name="BuildArtifacts" enabled="true">
<artifact name="ems-engine:war exploded" />

View File

@@ -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>

View File

@@ -1,16 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat9 #1" type="Remote" folderName="Frudis">
<module name="ems-engine" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="127.0.0.1" />
<option name="PORT" value="8001" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="8001" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2" />
</configuration>
</component>

View File

@@ -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>

View File

@@ -1,16 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat 9 #1 (DBServer2019)" type="Remote" folderName="Biolevante">
<module name="ims" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="192.168.10.6" />
<option name="PORT" value="8001" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="8001" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2" />
</configuration>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat 9 #1 (ServerDev)" type="Remote" folderName="Integry">
<configuration default="false" name="Tomcat 9 #1 (ServerDev)" type="Remote">
<module name="ems-engine" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />

View File

@@ -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>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat 9 #2 (ServerDev)" type="Remote" folderName="Integry">
<configuration default="false" name="Tomcat 9 #2 (ServerDev)" type="Remote">
<module name="ems-engine" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
@@ -7,10 +7,6 @@
<option name="HOST" value="serverdev" />
<option name="PORT" value="8002" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="8002" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2" />
</configuration>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat9 (GestSRV)" type="Remote" folderName="Carelli">
<configuration default="false" name="Tomcat #1 (GestSRV)" type="Remote" folderName="Carelli">
<module name="ems-engine" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />

View File

@@ -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>

View File

@@ -4,7 +4,7 @@
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="172.16.10.51" />
<option name="HOST" value="192.168.1.13" />
<option name="PORT" value="8001" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">

View File

@@ -1,10 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat #1 (ServerTomcat)" type="Remote" folderName="Integry">
<configuration default="false" name="Tomcat #1 (ServerTomcat)" type="Remote">
<module name="ems-engine" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="192.168.3.16" />
<option name="HOST" value="localhost" />
<option name="PORT" value="8000" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">

View File

@@ -1,16 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat #1 (Smetar) [VPN]" type="Remote" folderName="Smetar">
<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.0.0.2" />
<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>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat9Wingest (GestSRV)" type="Remote" folderName="Carelli">
<configuration default="false" name="Tomcat #2 (GestSRV)" type="Remote" folderName="Carelli">
<module name="ems-engine" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />

View File

@@ -1,16 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat #2 (ServerTomcat)" type="Remote" folderName="Integry">
<module name="ems-engine" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="192.168.3.16" />
<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>

View File

@@ -1,14 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tomcat 9 (AnydeskTunnel)" type="Remote">
<configuration default="false" name="Tomcat (AnydeskTunnel)" type="Remote">
<module name="ems-engine" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="localhost" />
<option name="PORT" value="8001" />
<option name="HOST" value="servertomcat" />
<option name="PORT" value="8000" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="8001" />
<option name="DEBUG_PORT" value="8000" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2" />

View File

@@ -1,6 +1,6 @@
<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">
<option name="COMMON_VM_ARGUMENTS" value="-DDISABLE_DROOLS_COMPILE=TRUE -Xms1G -Xmx6G" />
<configuration default="false" name="Tomcat (FAST)" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat" ALTERNATIVE_JRE_ENABLED="false">
<option name="COMMON_VM_ARGUMENTS" value="-DDISABLE_DROOLS_COMPILE=TRUE -Xms6G -Xmx6G -XX:MaxPermSize=1G -XX:PermSize=512M" />
<deployment>
<artifact name="ems-engine:war exploded">
<settings>
@@ -16,30 +16,12 @@
<log_file alias="Tomcat Localhost Access Log" path="%IDEA_RUN:CATALINA_BASE%/logs/localhost_access_log.*" />
<predefined_log_file enabled="true" id="Tomcat" />
<predefined_log_file enabled="true" id="Tomcat Catalina" />
<RunnerSettings RunnerId="AppServerDebuggerRunner">
<option name="DEBUG_PORT" value="63868" />
</RunnerSettings>
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="javadebug" />
</RunnerSettings>
<RunnerSettings RunnerId="JProfiler">
<option name="jreHome" value="$PROJECT_DIR$/../../../Program Files/Java/jdk1.8.0_202" />
</RunnerSettings>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="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">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
@@ -100,21 +82,6 @@
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Profile ">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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

View File

@@ -1,210 +0,0 @@
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
disableConcurrentBuilds()
}
stages {
stage('PreBuild Steps (Master)') {
when {
expression {
return env.GIT_BRANCH == "master" || env.GIT_BRANCH == "feature/RefactoringGestioneColli"
}
}
steps {
echo "Creo version tag su Git"
script {
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') {
steps {
echo "${WORKSPACE}"
withMaven(traceability: true, maven: 'Maven 3.9.5', options: [artifactsPublisher(disabled: true)]) {
bat(script: 'mvn clean install -t toolchains-jenkins.xml', returnStdout: true)
archiveArtifacts(artifacts: 'ems-engine/target/ems-api.war', onlyIfSuccessful: true)
}
stash includes: 'ems-engine/target/ems-api.war,docker/**,Containerfile', name: 'container-files'
}
}
stage('Publish') {
parallel {
stage('Publish Develop') {
when {
expression {
return env.GIT_BRANCH == "develop"
}
}
stages {
stage('Update Tomcat 1') {
steps {
echo "Updating Tomcat9 from ${WORKSPACE}"
powershell returnStdout: true, script: "build\\update_tomcat.ps1 -serviceName \"Tomcat9\" -httpPort \"8081\" -updatedArtifactPath \"${WORKSPACE}\\ems-engine\\target\\ems-api.war\""
}
}
stage('Update Tomcat 2') {
steps {
echo "Updating Tomcat9 from ${WORKSPACE}"
powershell returnStdout: true, script: "build\\update_tomcat.ps1 -serviceName \"Tomcat9Backup\" -httpPort \"8082\" -updatedArtifactPath \"${WORKSPACE}\\ems-engine\\target\\ems-api.war\""
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
}
}
}
}
stage('Publish Master') {
when {
expression {
return env.GIT_BRANCH == "master"
}
}
stages {
stage('Update Tomcat 1') {
steps {
echo "Updating Tomcat9 from ${WORKSPACE}"
sshPublisher(publishers: [sshPublisherDesc(configName: 'Production Linux Tomcat Server (192.168.3.16)', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''sudo /usr/bin/systemctl stop tomcat9
rm -R tomcat9/webapps/ems-api
sudo /usr/bin/systemctl start tomcat9
/home/studioml/./wait_tomcat_startup.sh 8081''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/tomcat9/webapps', remoteDirectorySDF: false, removePrefix: 'ems-engine/target/', sourceFiles: 'ems-engine/target/*.war*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
}
}
stage('Update Tomcat 2') {
steps {
echo "Updating Tomcat9 from ${WORKSPACE}"
sshPublisher(publishers: [sshPublisherDesc(configName: 'Production Linux Tomcat Server (192.168.3.16)', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''sudo /usr/bin/systemctl stop tomcat9backup
rm -R tomcat9backup/webapps/ems-api
sudo /usr/bin/systemctl start tomcat9backup
/home/studioml/./wait_tomcat_startup.sh 8082
sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/tomcat9backup/webapps', remoteDirectorySDF: false, removePrefix: 'ems-engine/target/', sourceFiles: 'ems-engine/target/*.war*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
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') {
when {
expression {
return env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop"
}
}
steps {
script {
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 {
success {
script {
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'
}
}
}
unstable {
script {
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'
}
}
}
failure {
script {
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") {
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'
}
}
}
}
}

View File

@@ -1,153 +0,0 @@
Param(
[string]$serviceName, #Argomento passato dal chiamante
[Int32]$httpPort, #Argomento passato dal chiamante
[string]$updatedArtifactPath #Argomento passato dal chiamante
)
$max_attempts = 48
$attempt = 0
$webappsPath = "C:\Program Files\$serviceName\webapps"
# Funzione per eseguire la chiamata GET e controllare lo status code
function Check-Status {
try {
$request = Invoke-WebRequest -Uri "http://localhost:$httpPort/ems-api/system/ok" -Method Get -ErrorAction Stop -UseBasicParsing
$statusCode = $request.StatusCode
if ($statusCode -eq 200) {
Write-Host "Status code 200 ricevuto, processo completato."
exit 0
} else {
Write-Host "Status code $statusCode ricevuto, continuo a provare..."
}
} catch {
Write-Host "Errore: $_"
}
}
# Funzione per cancellare una cartella e un file
function Delete-FilesAndFolder
{
param (
[string]$folderPath,
[string]$filePath
)
try {
# Cancellare la cartella specificata
if (Test-Path -Path $folderPath) {
Remove-Item -Path $folderPath -Recurse -Force
Write-Host "Cartella $folderPath eliminata con successo."
} else {
Write-Host "La cartella $folderPath non esiste."
}
# Cancellare il file specificato
if (Test-Path -Path $filePath) {
Remove-Item -Path $filePath -Force
Write-Host "File $filePath eliminato con successo."
} else {
Write-Host "Il file $filePath non esiste."
}
} catch {
Write-Host "Errore nella cancellazione di file o cartella: $_"
exit 1
}
}
# Funzione per copiare un file
function Copy-File {
param (
[string]$sourceFilePath,
[string]$destinationFilePath
)
try {
if (Test-Path -Path $sourceFilePath) {
Copy-Item -Path $sourceFilePath -Destination $destinationFilePath -Force
Write-Host "File copiato da $sourceFilePath a $destinationFilePath con successo."
} else {
Write-Host "Il file sorgente $sourceFilePath non esiste."
}
} catch {
Write-Host "Errore nella copia del file: $_"
exit 1
}
}
# Funzione per stoppare un servizio e attendere che sia completamente fermato
function Stop-ServiceAndWait {
param (
[string]$serviceName
)
# Tentativo di stoppare il servizio
try {
Write-Host "Sto stoppando il servizio $serviceName..."
Stop-Service -Name $serviceName -Force
# Attesa finché il servizio non viene stoppato
$service = Get-Service -Name $serviceName
while ($service.Status -ne 'Stopped') {
Write-Host "Attendo che il servizio $serviceName si fermi..."
Start-Sleep -Seconds 5
$service = Get-Service -Name $serviceName
}
Write-Host "Il servizio $serviceName è stato fermato con successo."
} catch {
Write-Host "Errore nello stoppare il servizio ${serviceName}: $_"
exit 1
}
}
# Funzione per avviare nuovamente un servizio e attendere che sia in esecuzione
function Start-ServiceAndWait {
param (
[string]$serviceName
)
try {
Write-Host "Sto avviando il servizio $serviceName..."
Start-Service -Name $serviceName
# Attesa finché il servizio non viene avviato
$service = Get-Service -Name $serviceName
while ($service.Status -ne 'Running') {
Write-Host "Attendo che il servizio $serviceName si avvii..."
Start-Sleep -Seconds 5
$service = Get-Service -Name $serviceName
}
Write-Host "Il servizio $serviceName è stato avviato con successo."
} catch {
Write-Host "Errore nell'avvio del servizio ${serviceName}: $_"
exit 1
}
}
# Chiamare la funzione per stoppare il servizio
Stop-ServiceAndWait -serviceName $serviceName
# Subito dopo lo stop, cancellare la cartella e il file
$emsApiPath = "$webappsPath\ems-api"
$emsWarFilePath = "$webappsPath\ems-api.war"
Delete-FilesAndFolder -folderPath $emsApiPath -filePath $emsWarFilePath
# Chiamare la funzione per copiare il file
Write-Host "Copio $updatedArtifactPath in $emsWarFilePath"
Copy-File -sourceFilePath $updatedArtifactPath -destinationFilePath $emsWarFilePath
# Avvia nuovamente il servizio
Start-ServiceAndWait -serviceName $serviceName
# Ciclo fino a quando lo status code non è 200 o superiamo il numero massimo di tentativi
while ($attempt -lt $max_attempts) {
$attempt++
Check-Status
Start-Sleep -Seconds 5 # Attendere per 5 secondi prima di fare un altro tentativo
}
Write-Host "Numero massimo di tentativi superato. Nessuna risposta 200 ricevuta."
exit 1

View File

@@ -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.

View File

@@ -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);
}
}
}

View File

@@ -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

View File

@@ -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": []
}
}

View File

@@ -13,7 +13,25 @@
<name>Ems Core</name>
<repositories>
<repository>
<id>maven-public</id>
<url>https://maven.studioml.it/repository/maven-public/</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -43,7 +61,7 @@
<classpath/>
<argument>it.integry.ems_model.rulescompleting.KieStaticCompiler</argument>
<argument>src/main/resources/rules/</argument>
<argument>../ems-engine/src/main/resources/drools/</argument>
<argument>../ems-engine/src/main/webapp/drools/</argument>
</arguments>
<systemProperties>
<projectProperties/>
@@ -60,26 +78,68 @@
</execution>
</executions>
</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>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-bom</artifactId>
<version>2.25.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>prod</id>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.16.1</version>
<version>2.11.0</version>
<scope>compile</scope>
</dependency>
@@ -100,7 +160,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.8.0.jre8</version>
<version>9.4.1.jre8</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
@@ -116,7 +176,7 @@
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.5.14</version>
<version>8.4.3</version>
</dependency>
<!-- SWAGGER -->
@@ -149,12 +209,34 @@
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20200518</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
@@ -179,11 +261,11 @@
<!-- <artifactId>itext</artifactId>-->
<!-- <version>2.1.7.js8</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>net.sf.jasperreports</groupId>-->
<!-- <artifactId>jasperreports-htmlcomponent</artifactId>-->
<!-- <version>4.1.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-htmlcomponent</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
@@ -199,11 +281,6 @@
<artifactId>Arial</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>it.integry.font</groupId>
<artifactId>Aptos</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>it.integry.font</groupId>
<artifactId>ArialBlack</artifactId>
@@ -224,93 +301,83 @@
<artifactId>Tahoma</artifactId>
<version>1.1</version>
</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>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>4.0.16</version>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.7.5</version>
</dependency>
<!-- SOSTITUISCONO batik-all -->
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-awt-util</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-awt-util</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-bridge</artifactId>
<version>1.17</version>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-css</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-dom</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-ext</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-gvt</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-parser</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-svg-dom</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-transcoder</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-util</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-xml</artifactId>
<version>1.9</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-css</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-dom</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-ext</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-gvt</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-parser</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-svg-dom</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-transcoder</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-util</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.xmlgraphics</groupId>-->
<!-- <artifactId>batik-xml</artifactId>-->
<!-- <version>1.9</version>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.5</version>
<version>5.2.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.5</version>
<version>5.2.3</version>
</dependency>
<dependency>
@@ -347,7 +414,13 @@
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.24</version>
<version>2.0.22</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
@@ -360,6 +433,11 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
@@ -368,14 +446,15 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<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>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>2.0.47</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
@@ -386,12 +465,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@@ -449,30 +522,16 @@
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>3.4.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.19.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<scope>runtime</scope>
</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>
<version>2.19.0</version>
</dependency>
<dependency>
@@ -490,7 +549,7 @@
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.41.2.2</version>
<version>3.39.2.0</version>
</dependency>
<dependency>
@@ -502,14 +561,22 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.10.0</version>
<version>1.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
<!-- UTILS -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>javax</groupId>
@@ -521,20 +588,30 @@
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.9.0</version>
<version>3.5</version>
</dependency>
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.google.maps</groupId>
<artifactId>google-maps-services</artifactId>
<version>2.2.0</version>
<version>0.2.7</version>
</dependency>
<!-- File manipulation -->
@@ -572,7 +649,7 @@
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.5</version>
<scope>compile</scope>
<scope>runtime</scope>
</dependency>
<!--Expiring Map-->
@@ -584,18 +661,18 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.78.1</version>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.70</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcmail-jdk18on</artifactId>
<version>1.78.1</version>
<artifactId>bcmail-jdk15on</artifactId>
<version>1.70</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.78.1</version>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
</dependency>
@@ -605,19 +682,26 @@
<version>1.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.http-client/google-http-client -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.34.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.http-client/google-http-client-xml -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-xml</artifactId>
<version>1.34.0</version>
</dependency>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>9.2.0</version>
</dependency>
<!-- Needed for Firebase 9.4.2 -->
<!-- <dependency>-->
<!-- <groupId>com.google.auth</groupId>-->
<!-- <artifactId>google-auth-library-credentials</artifactId>-->
<!-- <version>1.28.0</version>-->
<!-- </dependency>-->
<!-- Video -->
<dependency>
@@ -640,7 +724,7 @@
<dependency>
<groupId>com.hierynomus</groupId>
<artifactId>sshj</artifactId>
<version>0.39.0</version>
<version>0.27.0</version>
</dependency>
<dependency>

View File

@@ -152,7 +152,7 @@ public class CollectionsUtils {
}
if (objs.isEmpty()) {
if (objs.size() == 0) {
return;

View File

@@ -441,7 +441,7 @@ public class GeneralComparator implements Comparator,
}
if (this.fields.isEmpty()) {
if (this.fields.size() == 0) {
this.fields.add(0,
new SortField(field,

View File

@@ -526,7 +526,7 @@ public class ObjectCache implements ObjectCacheManager {
public boolean isEmpty() {
return this.keys.isEmpty();
return this.keys.size() == 0;
}

View File

@@ -208,7 +208,7 @@ public class DefaultHttpClient implements HttpClient {
private List<NameValuePair> getParametersAsList(Map<String, String> params) {
List<NameValuePair> postParameters = new ArrayList<>();
if (params != null && !params.isEmpty()) {
if (params != null && params.size() > 0) {
for (String key : params.keySet()) {
postParameters.add(new BasicNameValuePair(key, params.get(key)));
}

View File

@@ -12,7 +12,6 @@ import it.integry.WooCommerce.dto.order.WooCommerceBillingDTO;
import it.integry.WooCommerce.dto.order.WooCommerceShippingDTO;
import it.integry.WooCommerce.dto.product.WooCommerceImageDTO;
import it.integry.WooCommerce.dto.product.WooCommerceProductAttributeDTO;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.db.ResultSetMapper;
import it.integry.ems_model.service.SetupGest;
@@ -29,6 +28,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
@@ -305,7 +305,7 @@ public class WooCommerceArticoliDataManager {
List<CategoriaDTO> categorieList = UtilityDB.executeSimpleQueryDTO(conn, sql, CategoriaDTO.class);
if (categorieList != null && !categorieList.isEmpty()) {
if (categorieList != null && categorieList.size() > 0) {
return categorieList;
} else {
return null;
@@ -320,7 +320,7 @@ public class WooCommerceArticoliDataManager {
List<CategoriaDTO> categorieList = UtilityDB.executeSimpleQueryDTO(conn, sql, CategoriaDTO.class);
if (categorieList != null && !categorieList.isEmpty()) {
if (categorieList != null && categorieList.size() > 0) {
return categorieList;
} else {
return null;
@@ -333,7 +333,7 @@ public class WooCommerceArticoliDataManager {
List<ArticoloListino> list = getArticoliListino(codMarts);
if (list != null && !list.isEmpty()) return list.get(0);
if (list != null && list.size() > 0) return list.get(0);
return null;
}
@@ -358,7 +358,7 @@ public class WooCommerceArticoliDataManager {
" left join gtb_aliq on mtb_aart.cod_aliq = gtb_aliq.cod_aliq" +
" where cod_mdep = dbo.getGestSetup('WOOCOMMERCE','SETUP','COD_MDEP')";
if (codMarts != null && !codMarts.isEmpty()) {
if (codMarts != null && codMarts.size() > 0) {
sql += " AND lisv.cod_mart IN (" + UtilityQuery.concatStringFieldsWithSeparator(codMarts, ",") + ")";
}
@@ -451,11 +451,11 @@ public class WooCommerceArticoliDataManager {
}
public boolean getBooleanSetup(String keySection) throws Exception {
return setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "WOOCOMMERCE", "SETUP", keySection);
return setupGest.getSetupBoolean("WOOCOMMERCE", "SETUP", keySection);
}
public int getSetupInteger(String keySection) throws Exception {
return setupGest.getSetupInteger(multiDBTransactionManager.getPrimaryConnection(), "WOOCOMMERCE", "SETUP", keySection);
return setupGest.getSetupInteger("WOOCOMMERCE", "SETUP", keySection);
}
public List<WooCommerceImageDTO> getImagesArticolo(String codMart) throws Exception {

View File

@@ -33,7 +33,7 @@ public class WooCommerceDataFactory {
List<WooCommerceProductCategoryDTO> result = new ArrayList<>();
for (CategoryDTO toConvert : toConvertList) {
WooCommerceProductCategoryDTO convCat = new WooCommerceProductCategoryDTO();
if (remoteCategories != null && !remoteCategories.isEmpty()) {
if (remoteCategories != null && remoteCategories.size() > 0) {
convCat = remoteCategories.stream().filter(
rmt -> rmt.getName().equalsIgnoreCase(toConvert.getCodice() != null ? toConvert.getCodice() : toConvert.getDescrizione())
).findFirst().orElse(new WooCommerceProductCategoryDTO());

View File

@@ -206,7 +206,7 @@ public class WooCommerceRestService {
categorie = instance.getAll(EndpointBaseType.PRODUCTS_CATEGORIES.getValue(), params, new TypeReference<List<WooCommerceProductCategoryDTO>>() {
});
totRemoteCategories.addAll(categorie);
} while (!categorie.isEmpty() && categorie.size() == per_page);
} while (categorie.size() > 0 && categorie.size() == per_page);
return totRemoteCategories;
}
@@ -301,7 +301,7 @@ public class WooCommerceRestService {
}
}
if (!exceptionList.isEmpty()) throw new Exception(exceptionList.get(0).getError());
if (exceptionList.size() > 0) throw new Exception(exceptionList.get(0).getError());
List<UpdateArticoloDTO> syncedArts = new ArrayList<>(artsToCreate);
syncedArts.addAll(artsToUpdate);

View File

@@ -86,7 +86,7 @@ public class WooCommerceService {
///trasmetto articoli
List<ArticoloException> errors = syncProdotti(restInstance, attributes, categories);
if (!errors.isEmpty()) {
if (errors.size() > 0) {
StringBuilder builder = new StringBuilder("Uno o più errori sono avvenuti durante l'esecuzione dello script: \n\r");
Stream.of(errors).forEach(err -> {
@@ -108,7 +108,7 @@ public class WooCommerceService {
List<WooCommerceProductAttributeDTO> finalAttributes = new ArrayList<>();
List<AttributeDTO> localAttributes = dataManager.getAttributes();
List<WooCommerceProductAttributeDTO> attributes = restService.getAttributes(restInstance);
if (!localAttributes.isEmpty()) {
if (localAttributes.size() > 0) {
List<AttributeDTO> localAttrTypes = localAttributes.stream().filter(UtilityStream.distinctByKey(AttributeDTO::getAttributo)).collect(Collectors.toList());
if (syncAttributi) {
for (AttributeDTO type : localAttrTypes) {
@@ -160,7 +160,7 @@ public class WooCommerceService {
term -> term.getName().equalsIgnoreCase(attribute.getCodice())
)
).collect(Collectors.toList());
if (!toCreateAttrs.isEmpty()) {
if (toCreateAttrs.size() > 0) {
AttributeTermsBatchUpdateRequest request = dataFactory.createTermsBatchRequest(toCreateAttrs, null, null);
AttributeTermsBatchUpdateRequest response = restService.batchUpdateAttribute(restInstance, attr, request);
@@ -176,12 +176,12 @@ public class WooCommerceService {
if (syncCategorie) {
List<CategoryDTO> localCategories = dataManager.getCategories();
if (!localCategories.isEmpty()) {
if (localCategories.size() > 0) {
List<WooCommerceProductCategoryDTO> remoteCategories = restService.getCategories(restInstance);
List<WooCommerceProductCategoryDTO> convertList = dataFactory.convertLocalToRemoteCategory(localCategories, remoteCategories);
List<WooCommerceProductCategoryDTO> toCreate = convertList.stream().filter(conv -> conv.getId() == null).collect(Collectors.toList());
CategoryBatchUpdateRequest request = new CategoryBatchUpdateRequest();
if (!toCreate.isEmpty()) {
if (toCreate.size() > 0) {
request.setCreate(toCreate);
remoteCategories.addAll(restService.batchUpdateCategories(restInstance, request).getCreate());
convertList = dataFactory.convertLocalToRemoteCategory(localCategories, remoteCategories);
@@ -290,7 +290,7 @@ public class WooCommerceService {
.setSku(art.getSku());
batch.add(updateDTO);
if (art.getVariations() != null && !art.getVariations().isEmpty()) {
if (art.getVariations() != null && art.getVariations().size() > 0) {
List<WooCommerceProductVariationDTO> variations = restService.getVariazioniArticolo(restInstance, art.getId());
List<UpdateArticoloDTO> variazioni = Stream.of(variations)
.map(x -> new UpdateArticoloDTO()
@@ -347,7 +347,7 @@ public class WooCommerceService {
}
//creo varianti
if (textilesArt.getVariazioni() != null && !textilesArt.getVariazioni().isEmpty()) {
if (textilesArt.getVariazioni() != null && textilesArt.getVariazioni().size() > 0) {
List<UpdateArticoloDTO> varianti = new ArrayList<>();
List<WooCommerceProductVariationDTO> variations = new ArrayList<>();
@@ -648,7 +648,7 @@ public class WooCommerceService {
error.setError(e.getMessage());
errorArts.add(error);
}
} else if (!dto.getVariations().isEmpty()) {
} else if (dto.getVariations().size() > 0) {
BatchUpdateRequest updateVariazioni = new BatchUpdateRequest();
dto.getVariations().forEach(variation -> {
@@ -768,7 +768,7 @@ public class WooCommerceService {
private void sendErrorMail(String errorMsg, String service, byte[] content, String filename, List<AnomalieDTO> anomalie) {
try {
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager.getPrimaryConnection(), service, "WOOCOMMERCE", "Errore WooCommerce",
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, service, "WOOCOMMERCE", "Errore WooCommerce",
null, content, filename, anomalie);
} catch (Exception exception) {
logger.error(service, exception);

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -11,7 +11,6 @@ public class CommonConstants {
public static final String INTEGRY = "integry";
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 EMPTY_STRING = "";
@@ -21,7 +20,6 @@ public class CommonConstants {
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_DMY = "dd/MM/yyyy";
public static final String DATE_FORMAT_DMY_DASHED = "dd-MM-yyyy";
@@ -29,10 +27,9 @@ public class CommonConstants {
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_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 DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.TIME_FORMAT)
@@ -48,10 +45,6 @@ public class CommonConstants {
.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)
.withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATETIME_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_YMD)
@@ -59,12 +52,9 @@ public class CommonConstants {
public static final DateTimeFormatter DATE_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY)
.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)
.withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATETIME_DMY_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_DMY_DASHED)
.withZone(ZoneId.systemDefault());
public static final String ULTC = "ULTC";
public static final String DIST = "DIST";

View File

@@ -1,52 +1,33 @@
package it.integry.common.var;
import it.integry.ems._context.ApplicationContextProvider;
import it.integry.ems.settings.Model.SettingsModel;
import it.integry.ems_model.entity.Azienda;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.concurrent.locks.ReentrantLock;
@Service
public class EmsDBConst {
private final ReentrantLock datiAziendaLock = new ReentrantLock();
private HashMap<String, Const> datiAziendaBindingTable = new HashMap<String, Const>() {{
}};
public Const getConstsByProfile(String profileDb) {
profileDb = profileDb.toUpperCase();
public Const getConsts(String profileDb) {
String aziendaUp = profileDb.toUpperCase();
final SettingsModel settingsModel = ApplicationContextProvider.getApplicationContext().getBean(SettingsModel.class);
final String dbName = settingsModel.getDbNameFromProfileDb(profileDb);
return getConsts(dbName);
}
public Const getConsts(String dbName) {
String aziendaUp = dbName.toUpperCase();
datiAziendaLock.lock();
try {
if (!datiAziendaBindingTable.containsKey(aziendaUp)) {
datiAziendaBindingTable.put(aziendaUp, new Const());
}
return datiAziendaBindingTable.get(aziendaUp);
} finally {
datiAziendaLock.unlock();
if (!datiAziendaBindingTable.containsKey(aziendaUp)) {
datiAziendaBindingTable.put(aziendaUp, new Const());
}
return datiAziendaBindingTable.get(aziendaUp);
}
public void destroyAll() {
datiAziendaLock.lock();
datiAziendaBindingTable = new HashMap<>();
datiAziendaLock.unlock();
datiAziendaBindingTable = new HashMap<String, Const>();
}
public static class Const {
public class Const {
private String applicationDbName;
private String nomeAzienda;

View File

@@ -2,11 +2,8 @@ package it.integry.ems.Import.base;
import com.fasterxml.jackson.core.type.TypeReference;
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.ImportRequestDTO;
import it.integry.ems.javabeans.RequestDataDTO;
import it.integry.ems.json.JsonObjectMapperConfig;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.base.EntityBase;
import it.integry.ems_model.service.SetupGest;
@@ -25,20 +22,10 @@ public abstract class BaseEntityImporter<T> implements IEntityImporter<T> {
protected String format;
protected boolean headless;
protected ImportRequestDTO requestDto;
protected RequestDataDTO requestDataDTO;
protected MultiDBTransactionManager multiDBTransactionManager;
protected List<AnomalieDTO> anomalie = new ArrayList<AnomalieDTO>();
private final ObjectMapper objectMapper;
protected BaseEntityImporter() {
objectMapper = new ObjectMapper();
SimpleModule simpleModule = new SimpleModule();
JsonObjectMapperConfig.addDefaultAdapters(simpleModule);
objectMapper.registerModule(simpleModule);
}
private final ObjectMapper objectMapper = new ObjectMapper();
public IEntityImporter<T> setSetupGest(SetupGest setupGest) {
this.setupGest = setupGest;
@@ -79,12 +66,6 @@ public abstract class BaseEntityImporter<T> implements IEntityImporter<T> {
return this;
}
@Override
public IEntityImporter<T> setRequestDataDTO(RequestDataDTO requestDataDTO) {
this.requestDataDTO = requestDataDTO;
return this;
}
public List<AnomalieDTO> getAnomalie() {
return anomalie;
}
@@ -108,6 +89,4 @@ public abstract class BaseEntityImporter<T> implements IEntityImporter<T> {
}
}

View File

@@ -2,7 +2,6 @@ package it.integry.ems.Import.base;
import it.integry.ems.Import.dto.AnomalieDTO;
import it.integry.ems.Import.dto.ImportRequestDTO;
import it.integry.ems.javabeans.RequestDataDTO;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.base.EntityBase;
import it.integry.ems_model.service.SetupGest;
@@ -27,14 +26,10 @@ public interface IEntityImporter<T> {
IEntityImporter<T> setRequestDTO(ImportRequestDTO requestDto);
IEntityImporter<T> setRequestDataDTO(RequestDataDTO requestDataDTO);
List<AnomalieDTO> getAnomalie();
T doImport() throws Exception;
String renameFile(String orginalFileName, List<EntityBase> entities) throws Exception;
}

View File

@@ -15,18 +15,16 @@ public enum EntityImportType {
DOCUMENTI_VENDITA("DOCUMENTI VENDITA"),
PROSPECT("PROSPECT"),
LISTINI_ACQUISTO("LISTINI ACQUISTO"),
LISTINI_VENDITA("LISTINI VENDITA"),
ACK("ACK"),
INVENTARIO("INVENTARIO"),
RAPPORTINI("RAPPORTINI"),
RAPPORTINI_FG("RAPPORTINI FG"),
SCONTRINI("SCONTRINI"),
MOVIMENTI_CONTABILI("MOVIMENTI CONTABILI"),
GRIGLIA_VENDITA("GRIGLIA VENDITA"),
GRIGLIA_ACQUISTO("GRIGLIA ACQUISTO"),
SCADENZE("SCADENZE"),
BILANCE("BILANCE"),
BANCA("BANCA");
GRIGLIA_ACQUISTO("GRIGLIA ACQUISTO");
private String text;

View File

@@ -1,20 +0,0 @@
package it.integry.ems._context;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class ApplicationContextProvider implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ApplicationContextProvider.applicationContext = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
}

View File

@@ -13,8 +13,11 @@ import org.apache.logging.log4j.Logger;
import org.postgresql.Driver;
import org.reflections.Reflections;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.context.ContextLoader;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -23,23 +26,17 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.DriverManager;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import static org.reflections.scanners.Scanners.TypesAnnotated;
@Component
public class EmsCoreContext {
public class EmsCoreContext implements ApplicationListener<ContextRefreshedEvent> {
private final Logger logger = LogManager.getLogger();
//Aggiunta dipendenza non utilizzata per forzare spring al caricamento di essa
@Autowired
private ApplicationContextProvider applicationContextProvider;
@Autowired
private SettingsController settingsController;
@@ -53,8 +50,6 @@ public class EmsCoreContext {
private boolean contextInitialized = false;
private boolean firstStart = true;
@Autowired
private ExecutorService taskExecutor;
@PostConstruct
@@ -64,7 +59,6 @@ public class EmsCoreContext {
DriverManager.registerDriver(new Driver());
settingsController.init();
onApplicationEvent();
} catch (Exception e) {
logger.error(EmsCoreContext.class.getSimpleName(), e);
}
@@ -73,33 +67,20 @@ public class EmsCoreContext {
@PreDestroy
public void preDestroy() {
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)
public void onApplicationEvent() {
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
if (firstStart) {
firstStart = false;
logger.debug("Init");
try {
emsCoreDBLoader.load(this::onPostDBLoaded);
new Thread(() -> {
emsCoreDBLoader.load(this::onPostDBLoaded);
}).start();
} catch (Exception e) {
logger.error(EmsCoreContext.class.getSimpleName(), e);
@@ -108,10 +89,19 @@ public class EmsCoreContext {
}
private void onPostDBLoaded(MultiDBTransactionManager multiDBTransactionManager) throws InvocationTargetException, IllegalAccessException {
dispatchPostContextConstruct(multiDBTransactionManager);
contextInitialized = true;
dispatchPostWebServerConstruct(multiDBTransactionManager);
private void onPostDBLoaded(MultiDBTransactionManager multiDBTransactionManager) {
try {
dispatchPostContextConstruct(multiDBTransactionManager);
contextInitialized = true;
dispatchPostWebServerConstruct(multiDBTransactionManager);
} catch (Exception e) {
e.printStackTrace();
logger.error("EmsCoreContext.onPostDBLoaded", e);
}
}
@@ -131,7 +121,7 @@ public class EmsCoreContext {
for (Class<?> classType : classesWithPostContextConstruct) {
logger.debug("PostContextConstruct - " + classType.getSimpleName() + " - START");
Object beanInstance = ApplicationContextProvider.getApplicationContext().getBean(classType);
Object beanInstance = ContextLoader.getCurrentWebApplicationContext().getBean(classType);
List<Field> fieldsToInject = Arrays.stream(classType.getDeclaredFields())
.filter(y -> y.isAnnotationPresent(PostContextAutowired.class))
@@ -172,7 +162,7 @@ public class EmsCoreContext {
for (Class<?> classType : classesWithPostWebServerConstruct) {
logger.debug("PostWebServerConstruct - " + classType.getSimpleName() + " - START");
Object beanInstance = ApplicationContextProvider.getApplicationContext().getBean(classType);
Object beanInstance = ContextLoader.getCurrentWebApplicationContext().getBean(classType);
List<Field> fieldsToInject = Arrays.stream(classType.getDeclaredFields())
.filter(y -> y.isAnnotationPresent(PostContextAutowired.class))

View File

@@ -2,34 +2,32 @@ package it.integry.ems._context;
import it.integry.annotations.PostContextConstruct;
import it.integry.common.var.EmsDBConst;
import it.integry.ems.expansion.RunnableArgsThrowable;
import it.integry.ems.settings.Model.AvailableConnectionModel;
import it.integry.ems.datasource.DataSource;
import it.integry.ems.expansion.RunnableArgs;
import it.integry.ems.settings.Model.AvailableConnectionsModel;
import it.integry.ems.settings.Model.SettingsModel;
import it.integry.ems.settings.SettingsController;
import it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool;
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.task.TaskExecutorService;
import it.integry.ems.user.service.UserCacheService;
import it.integry.ems_model.entity.Azienda;
import it.integry.ems_model.service.SetupGest;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityString;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.sql.Connection;
import java.util.HashMap;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicReference;
@Component
public class EmsCoreDBLoader {
private final Logger logger = LogManager.getLogger();
//private MultiDBTransactionManager multiDBTransactionManager;
private MultiDBTransactionManager multiDBTransactionManager;
@Autowired
private SetupGest setupGest;
@@ -45,98 +43,109 @@ public class EmsCoreDBLoader {
@Autowired
private UserCacheService userCacheService;
@Autowired
private BasicConnectionPool connectionPool;
@Autowired
private TaskExecutorService taskExecutorService;
@PostContextConstruct(priority = 10)
public void init() throws Exception {
public void init() {
this.settingsController.addOnConfigUpdated(() -> {
try {
connectionPool.destroy();
connectionPool.init();
load(null);
} catch (Exception e) {
throw new RuntimeException(e);
}
load(null);
});
}
public void load(final RunnableArgsThrowable<MultiDBTransactionManager> onComplete) throws Exception {
taskExecutorService.executeTask(() -> {
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionPool)){
discoverAllConnections(multiDBTransactionManager);
setupAzienda(multiDBTransactionManager);
public void load(final RunnableArgs<MultiDBTransactionManager> onComplete) {
multiDBTransactionManager = new MultiDBTransactionManager();
try {
discoverAllConnections();
setupAzienda();
userCacheService.discoverAllUsers(multiDBTransactionManager);
} catch (Exception ex) {
ex.printStackTrace();
logger.error("EmsCoreDBLoader", ex);
} finally {
try {
if (onComplete != null) onComplete.run(multiDBTransactionManager);
} catch (Exception ex) {
logger.error("EmsCoreDBLoader", ex);
throw new RuntimeException(ex);
multiDBTransactionManager.closeAll();
} catch (Exception e) {
logger.error("EmsCoreDBLoader", e);
}
}, false);
}
private void discoverAllConnections(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
ArrayList<Callable<Void>> futureTasks = new ArrayList<>();
for (AvailableConnectionModel model : settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true)) {
AtomicReference<AvailableConnectionModel> modelAtomicReference = new AtomicReference<>(model);
futureTasks.add(() -> {
try {
multiDBTransactionManager.addConnection(modelAtomicReference.get());
return null;
} catch (Exception ex) {
throw new Exception("[" + modelAtomicReference.get().getProfileName() + "] " + ex.getMessage(), ex.getCause());
}
});
}
taskExecutorService.executeTasks(futureTasks);
}
private void setupAzienda(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
private boolean checkIfDatabaseConnectionExists(String dbName) throws Exception {
boolean exists = true;
if (multiDBTransactionManager != null) {
ArrayList<Callable<Void>> futureTasks = new ArrayList<>();
if (!multiDBTransactionManager.containsDB(dbName)) {
multiDBTransactionManager.Destroy();
for (final Connection connection : multiDBTransactionManager.getActiveConnections()) {
emsDBConst.destroyAll();
futureTasks.add(() -> {
Azienda azienda = Azienda.getDefaultAzienda(connection);
String dbName = connection.getDbName();
exists = false;
}
} else exists = false;
return exists;
}
private void discoverAllConnections() {
for (AvailableConnectionsModel model : settingsModel.getAvailableConnections()) {
if ( !model.getInternalDb() )
continue;
try {
DataSource ds = new DataSource();
ds.initialize(model.getProfileName());
String dbDistributore = null;
boolean isInternalDb = model.getInternalDb();
if (isInternalDb) {
String sql = "SELECT db_distributore FROM azienda";
dbDistributore = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(ds.getConnection(), sql);
}
multiDBTransactionManager.addConnection(model.getProfileName(), ds, model.getDbName().equalsIgnoreCase(dbDistributore));
} catch (Exception ex) {
logger.error(String.format("La connessione al DB \"%s\" non è valida. %s", model.getProfileName(), ex.getMessage()), ex);
}
}
}
private void setupAzienda() throws Exception {
for (final AdvancedDataSource advancedDataSource : multiDBTransactionManager.getActiveConnections()) {
try {
if (azienda != null) {
String applicationDbName = azienda.getApplicationName();
String nomeAzienda = azienda.getNomeDitta();
Connection conn = advancedDataSource.getConnection();
if (advancedDataSource.isInternalDb()) {
Azienda azienda = Azienda.getDefaultAzienda(conn);
if (UtilityString.isNullOrEmpty(applicationDbName)) {
throw new Exception("Impostare il campo \"Application Name\"");
if (azienda != null) {
String applicationDbName = azienda.getApplicationName();
String nomeAzienda = azienda.getNomeDitta();
if(UtilityString.isNullOrEmpty(applicationDbName)) {
throw new Exception("Impostare il campo \"Application Name\"");
}
HashMap<String, String> gestSetupValues =
setupGest.getSetupSection(conn, "DATI_AZIENDA", "FATTURAZIONE_ELETTRONICA");
emsDBConst.getConsts(advancedDataSource.getDataSource().getProfile())
.setApplicationDbName(applicationDbName)
.setNomeAzienda(nomeAzienda)
.setAzienda(azienda)
.setGestSetupDatiAzienda(gestSetupValues);
} else {
throw new Exception("Non è stato possibile leggere i dati dalla tabella azienda");
}
HashMap<String, String> gestSetupValues =
setupGest.getSetupSection(connection, "DATI_AZIENDA", "FATTURAZIONE_ELETTRONICA");
emsDBConst.getConsts(dbName)
.setApplicationDbName(applicationDbName)
.setNomeAzienda(nomeAzienda)
.setAzienda(azienda)
.setGestSetupDatiAzienda(gestSetupValues);
} else {
throw new Exception("Non è stato possibile leggere i dati dalla tabella azienda");
}
} catch (Exception ex) {
throw new Exception("[" + connection.getProfileName() + "] " + ex.getMessage(), ex.getCause());
ex.printStackTrace();
logger.error(String.format("Impossibile caricare alcune informazioni dal DB \"%s\". %s", advancedDataSource.getProfileName(), ex.getMessage()));
}
return null;
});
}
taskExecutorService.executeTasks(futureTasks);
}
}

View File

@@ -33,7 +33,7 @@ public class BooleanDeserializer extends JsonDeserializer<Boolean> {
if ("1".equals(text) || "true".equals(text)) {
return true;
}
if ("0".equals(text) || "false".equals(text) || text.isEmpty()) {
if ("0".equals(text) || "false".equals(text) || text.length() == 0) {
return Boolean.FALSE;
}

View File

@@ -1,6 +1,7 @@
package it.integry.ems.adapter;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import it.integry.ems_model.config.EmsRestConstants;
@@ -8,6 +9,7 @@ import it.integry.ems_model.utility.UtilityString;
import java.io.IOException;
import java.time.LocalDate;
import java.util.Date;
public class JsonLocalDateAdapterDeserializer extends JsonDeserializer<LocalDate> {
@@ -19,7 +21,7 @@ public class JsonLocalDateAdapterDeserializer extends JsonDeserializer<LocalDate
return null;
if (jp.getText().equalsIgnoreCase("null") || jp.getText().equalsIgnoreCase("1900-01-01"))
return EmsRestConstants.LOCAL_DATE_NULL;
return null;
return UtilityString.parseLocalDate(jp.getText());

View File

@@ -3,10 +3,10 @@ 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.LocalDate;
import java.time.LocalDateTime;
public class JsonLocalDateTimeAdapterDeserializer extends JsonDeserializer<LocalDateTime> {
@@ -19,7 +19,7 @@ public class JsonLocalDateTimeAdapterDeserializer extends JsonDeserializer<Local
return null;
if (jp.getText().equalsIgnoreCase("null") || jp.getText().equalsIgnoreCase("1900-01-01"))
return EmsRestConstants.LOCAL_DATE_TIME_NULL;
return null;
return UtilityString.parseLocalDateTime(jp.getText());

View File

@@ -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());
}
}

View File

@@ -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());
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.ems.configuration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
public class ApplicationContextProvider implements ApplicationContextAware {
private static ApplicationContext context;
public static ApplicationContext getApplicationContext() {
return context;
}
@Override
public void setApplicationContext(ApplicationContext ctx) {
context = ctx;
}
}

View File

@@ -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;
}
}
}

View File

@@ -1,34 +0,0 @@
package it.integry.ems.configuration;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Configuration
public class ExecutorServiceConfig {
private final int corePoolSize = Runtime.getRuntime().availableProcessors();
private final int maxPoolSize = (int) (corePoolSize * 1.5f);
private final int queueSize = 1_000_000;
@Bean
public ExecutorService taskExecutor() {
return new ThreadPoolExecutor(
corePoolSize,
maxPoolSize,
5,
TimeUnit.SECONDS,
new LinkedBlockingQueue<>(queueSize),
new ThreadFactoryBuilder()
.setNameFormat("ims-thread-%d")
.build()
);
}
}

View File

@@ -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;
}
}

View File

@@ -1,9 +1,9 @@
package it.integry.ems.controller;
import com.annimon.stream.Stream;
import com.fasterxml.jackson.databind.JsonNode;
import it.integry.common.var.CommonConstants;
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.download.DownloadFileHandlerService;
import it.integry.ems.download.dto.DownloadFileDto;
@@ -49,8 +49,6 @@ import org.quartz.*;
import org.quartz.impl.matchers.GroupMatcher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.http.ContentDisposition;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap;
@@ -70,14 +68,14 @@ import java.math.BigDecimal;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.Date;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@RestController
@Scope("request")
public class EmsController {
private final Logger logger = LogManager.getLogger();
@@ -223,11 +221,11 @@ public class EmsController {
} else {
byte[] stream = Base64Utility.decodeBase64Zipped(encodedFile);
if (stream != null) {
printerService.print(printerName, new ByteArrayInputStream(stream), mimeType, 1);
printerService.print(printerName, new ByteArrayInputStream(stream), mimeType);
response = new ServiceRestResponse(EsitoType.OK);
} 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 +296,11 @@ public class EmsController {
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);
} catch (Exception 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;
}
@@ -339,13 +337,20 @@ public class EmsController {
} catch (Exception 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);
} finally {
try {
multiDBTransactionManager.closeAll();
} catch (Exception e) {
logger.error(request.getRequestURI(), e);
response = new ServiceRestResponse(EsitoType.KO, e, multiDBTransactionManager.getPrimaryDatasource().getProfile(), entity);
}
if (entity.getOperation() == OperationType.SELECT_OBJECT) {
return obj;
} else {
return response;
if (entity.getOperation() == OperationType.SELECT_OBJECT) {
return obj;
} else {
return response;
}
}
}
@@ -386,7 +391,7 @@ public class EmsController {
} catch (Exception 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) {
@@ -412,7 +417,7 @@ public class EmsController {
String sql = procedure;
JsonNode parametersList = json.has("parameters") ? json.path("parameters") : null;
if (parametersList != null && parametersList.isEmpty()) {
if (parametersList != null && parametersList.size() == 0) {
parametersList = null;
}
@@ -483,7 +488,7 @@ public class EmsController {
} catch (Exception 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;
@@ -519,14 +524,10 @@ public class EmsController {
map.put(columnNameAltered, ((java.sql.Date) rs.getObject(columnName)).getTime() / 1000);
} else if (date2ts && metadata.getColumnType(i) == Types.TIMESTAMP) {
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) {
map.put(columnNameAltered, ((java.sql.Date) rs.getObject(columnName)).toLocalDate().format(DateTimeFormatter.ISO_DATE));
} else if (date2iso && metadata.getColumnType(i) == Types.TIMESTAMP) {
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 {
map.put(columnNameAltered, rs.getObject(columnName));
}
@@ -544,29 +545,20 @@ public class EmsController {
}
@RequestMapping(value = EmsRestConstants.PATH_EXPORT, method = RequestMethod.POST)
public @ResponseBody ServiceRestResponse export(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
@RequestParam(value = EmsRestConstants.TYPE) String typeExport,
@RequestParam(value = EmsRestConstants.FORMAT) String formatExport,
@RequestParam(required = false, defaultValue = "false") Boolean binaryDownload,
@RequestParam(required = false, defaultValue = "true") boolean headless,
@RequestBody(required = false) JsonNode body) throws Exception {
public @ResponseBody ServiceRestResponse export(
HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
@RequestParam(value = EmsRestConstants.TYPE) String typeExport,
@RequestParam(value = EmsRestConstants.FORMAT) String formatExport,
@RequestParam(required = false, defaultValue = "false") Boolean binaryDownload,
@RequestParam(required = false, defaultValue = "true") boolean headless,
@RequestBody(required = false) JsonNode body) throws Exception {
EntityExportResponse<?> entityExportResponse = emsServices.export(multiDBTransactionManager, requestDataDTO, 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);
EntityExportResponse<?> entityExportResponse = emsServices.export(typeExport, formatExport, body, headless);
ServiceRestResponse sr = ServiceRestResponse.createPositiveResponse();
if (entityExportResponse != null) {
if (binaryDownload) {
List<DownloadFileDto> downloadableFileList = new ArrayList<>();
for (EntityExportedFile exportedFile : (List<EntityExportedFile>) entityExportResponse.getResponse()) {
@@ -608,34 +600,59 @@ public class EmsController {
@RequestParam(required = false, defaultValue = "true") boolean headless,
@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();
ServiceRestResponse response;
if (entities != null && !entities.isEmpty() && entities.stream().anyMatch(x -> x instanceof EntityBase)) {
List<MessageDTO> errorMessages = entities.stream()
if (entities != null && entities.size() > 0 && Stream.of(entities).anyMatch(x -> x instanceof EntityBase)) {
List<MessageDTO> errorMessages = Stream.of(entities)
.filter(x -> x.getException() != null)
.map(x -> MessageDTO.error(x.getException().getMessage()))
.collect(Collectors.toList());
.toList();
List<AnomalieDTO> anomalie = importResponse.getAnomalie();
List<MessageDTO> messages = Stream.of(importResponse.getAnomalie())
.filter(x -> x.getTipo() != null)
.map(x -> {
switch (x.getTipo()) {
case ERROR:
return MessageDTO.error(x.getMessage());
case WARNING:
default:
return MessageDTO.warning(x.getMessage());
}
})
.toList();
if (!errorMessages.isEmpty() || (anomalie != null && !anomalie.isEmpty())) {
errorMessages.addAll(messages);
if (errorMessages.size() > 0) {
response = ServiceRestResponse.createNegativeResponse();
} else {
response = ServiceRestResponse.createPositiveResponse();
}
response.setMessages(errorMessages, importResponse.getAnomalie());
response.setEntityList(entities.stream().filter(x -> x.getException() == null).collect(Collectors.toList()));
response.setMessages(errorMessages);
response.setEntityList(Stream.of(entities).filter(x -> x.getException() == null).toList());
} else {
if (importResponse.getAnomalie() != null) {
if (!importResponse.getAnomalie().isEmpty()) {
response = ServiceRestResponse.createNegativeResponse()
.setMessagesFromAnomalie(importResponse.getAnomalie());
List<MessageDTO> messages = Stream.of(importResponse.getAnomalie())
.map(x -> {
switch (x.getTipo()) {
case ERROR:
return MessageDTO.error(x.getMessage());
case WARNING:
default:
return MessageDTO.warning(x.getMessage());
}
})
.toList();
response = ServiceRestResponse.createNegativeResponse();
response.setMessages(messages);
} else response = ServiceRestResponse.createPositiveResponse();
} else throw new Exception("Non ci sono dati da importare");
@@ -687,7 +704,7 @@ public class EmsController {
} catch (Exception e) {
e.printStackTrace();
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);
if (forceTransaction) {
break;
@@ -700,6 +717,16 @@ public class EmsController {
logger.error(request.getRequestURI(), e);
ServiceRestResponse response = new ServiceRestResponse(EsitoType.KO, configuration, e);
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;
@@ -727,64 +754,38 @@ public class EmsController {
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_FILE_ATTACHMENT + "/{idAttach}/{filename}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<byte[]> downloadStbFileAttachment(
@RequestParam(CommonConstants.PROFILE_DB) String config,
@PathVariable String idAttach,
@PathVariable String filename,
@RequestParam(name = "contentDisposition", defaultValue = "attachment") String contentDispositionType,
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(multiDBTransactionManager, idAttach, requestThumbnail);
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(idAttach, requestThumbnail);
if (attachmentDTO != null) {
return ResponseEntity.ok()
.contentType(MediaType.parseMediaType(attachmentDTO.getMimeType()))
.contentLength(attachmentDTO.getFileSize())
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
.builder(contentDispositionType)
.filename(attachmentDTO.getFileName())
.build()
.toString())
.header("Content-Disposition", "attachment; filename=\"" + attachmentDTO.getFileName() + "\"")
.body(attachmentDTO.getFileContent());
}
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)
public ResponseEntity<byte[]> downloadStbFileAttachmentPath(
@RequestParam(CommonConstants.PROFILE_DB) String config,
@RequestParam String idAttach,
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(multiDBTransactionManager, idAttach, requestThumbnail);
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(idAttach, requestThumbnail);
if (attachmentDTO != null) {
return ResponseEntity.ok()
.contentType(MediaType.parseMediaType(attachmentDTO.getMimeType()))
.contentLength(attachmentDTO.getFileSize())
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
.attachment()
.filename(attachmentDTO.getFileName())
.build()
.toString())
.header("Content-Disposition", "attachment; filename=\"" + attachmentDTO.getFileName() + "\"")
.body(attachmentDTO.getFileContent());
}
@@ -793,8 +794,9 @@ public class EmsController {
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_EMAIL_CONTENT, method = RequestMethod.GET)
public ResponseEntity<byte[]> downloadStbEmailContent(@RequestParam(CommonConstants.PROFILE_DB) String config,
@RequestParam Integer idEmail) throws Exception {
public byte[] downloadStbEmailContent(HttpServletRequest request, HttpServletResponse response,
@RequestParam(CommonConstants.PROFILE_DB) String config,
@RequestParam Integer idEmail) throws Exception {
StbEmailContent stbEmailContent = new StbEmailContent();
stbEmailContent.setIdEmail(idEmail);
stbEmailContent.setOperation(OperationType.SELECT_OBJECT);
@@ -802,7 +804,11 @@ public class EmsController {
stbEmailContent = entityProcessor.processEntity(stbEmailContent, multiDBTransactionManager);
if (stbEmailContent != null) {
byte[] byteArr;
response.setContentType("application/octet-stream");
response.setStatus(HttpServletResponse.SC_OK);
response.addHeader("Content-Disposition", "attachment; filename=\"email.eml\"");
byte[] byteArr = null;
String pattern = "[^\\x00-\\x7F]";
Pattern pat = Pattern.compile(pattern);
@@ -814,30 +820,24 @@ public class EmsController {
byteArr = Base64.decodeBase64(stbEmailContent.getEmailContent());
}
return ResponseEntity.ok()
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.contentLength(byteArr != null ? byteArr.length : 0)
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
.builder("attachment")
.filename("email.eml")
.build()
.toString())
.body(byteArr);
response.setContentLength(byteArr != null ? byteArr.length : 0);
return byteArr;
}
return ResponseEntity.notFound().build();
response.sendError(404, "Allegato non trovato");
return null;
}
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_PDF, method = RequestMethod.GET)
public ResponseEntity<byte[]> downloadDtbDocPdf(
@RequestParam(CommonConstants.PROFILE_DB) String config,
@RequestParam(name = "contentDisposition", defaultValue = "attachment") String contentDispositionType,
@RequestParam String dataDoc,
@RequestParam String serDoc,
@RequestParam Integer numDoc,
@RequestParam String codAnag,
@RequestParam String codDtip,
@RequestParam Integer versione) throws Exception {
public byte[] downloadDtbDocPdf(HttpServletResponse response,
@RequestParam(CommonConstants.PROFILE_DB) String config,
@RequestParam String dataDoc,
@RequestParam String serDoc,
@RequestParam Integer numDoc,
@RequestParam String codAnag,
@RequestParam String codDtip,
@RequestParam Integer versione) throws Exception {
DtbDocPdf dtbDocPdf = new DtbDocPdf();
dtbDocPdf.setDataDoc(UtilityDate.RecognizeDate(dataDoc));
@@ -851,7 +851,9 @@ public class EmsController {
dtbDocPdf = entityProcessor.processEntity(dtbDocPdf, multiDBTransactionManager);
if (dtbDocPdf != null) {
MediaType mimeType = mimeTypesHandler.getContentType(dtbDocPdf.getFilename());
response.setContentType("application/octet-stream");
response.setStatus(HttpServletResponse.SC_OK);
response.addHeader("Content-Disposition", "attachment; filename=\"" + dtbDocPdf.getFilename() + "\"");
byte[] byteArr = null;
@@ -869,28 +871,21 @@ public class EmsController {
byteArr = dtbDocPdf.getFilecontentByteArr(false);
}
return ResponseEntity.ok()
.contentType(mimeType)
.contentLength(byteArr != null ? byteArr.length : 0)
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
.builder(contentDispositionType)
.filename(dtbDocPdf.getFilename())
.build()
.toString())
.body(byteArr);
response.setContentLength(byteArr != null ? byteArr.length : 0);
return byteArr;
}
return ResponseEntity.notFound().build();
response.sendError(404, "Allegato non trovato");
return null;
}
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_ORD_PDF, method = RequestMethod.GET)
public ResponseEntity<byte[]> downloadDtbOrdPdf(
@RequestParam(CommonConstants.PROFILE_DB) String config,
@RequestParam String gestione,
@RequestParam String dataOrd,
@RequestParam Integer numOrd,
@RequestParam Integer versione) throws Exception {
public byte[] downloadDtbOrdPdf(HttpServletRequest request, HttpServletResponse response,
@RequestParam(CommonConstants.PROFILE_DB) String config,
@RequestParam String gestione,
@RequestParam String dataOrd,
@RequestParam Integer numOrd,
@RequestParam Integer versione) throws Exception {
DtbOrdPdf dtbOrdPdf = new DtbOrdPdf();
dtbOrdPdf.setGestione(gestione);
dtbOrdPdf.setDataOrd(UtilityDate.RecognizeDate(dataOrd));
@@ -901,27 +896,25 @@ public class EmsController {
dtbOrdPdf = entityProcessor.processEntity(dtbOrdPdf, multiDBTransactionManager);
if (dtbOrdPdf != null) {
byte[] byteArr = dtbOrdPdf.getFilecontentByteArr(true);
response.setContentType("application/octet-stream");
response.setStatus(HttpServletResponse.SC_OK);
response.addHeader("Content-Disposition", "attachment; filename=\"" + dtbOrdPdf.getFilename() + "\"");
return ResponseEntity.ok()
.contentType(MediaType.APPLICATION_PDF)
.contentLength(byteArr != null ? byteArr.length : 0)
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
.builder("attachment")
.filename(ContentDisposition.attachment().filename(dtbOrdPdf.getFilename()).build().toString())
.build()
.toString())
.body(byteArr);
byte[] byteArr = dtbOrdPdf.getFilecontentByteArr(true);
response.setContentLength(byteArr != null ? byteArr.length : 0);
return byteArr;
}
return ResponseEntity.notFound().build();
response.sendError(404, "Allegato non trovato");
return null;
}
@RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.POST)
public ServiceRestResponse uploadStbFileAttachment(@RequestParam(CommonConstants.PROFILE_DB) String config,
public ServiceRestResponse uploadStbFileAttachment(HttpServletRequest request, HttpServletResponse response,
@RequestParam(CommonConstants.PROFILE_DB) String config,
@RequestParam(required = false) String idAttach,
@RequestParam(required = false) String descrizione,
@RequestParam(required = false) StbFilesAttached.TypeAttach typeAttach,
@RequestParam(required = false) String typeAttach,
@RequestPart() MultipartFile[] files
) {
try {
@@ -931,7 +924,7 @@ public class EmsController {
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].getBytes(),
descrizione,
@@ -941,7 +934,11 @@ public class EmsController {
stbFilesAttached.setOnlyPkMaster(false);
return ServiceRestResponse.createEntityPositiveResponse(stbFilesAttached);
ServiceRestResponse serviceRestResponse = ServiceRestResponse.createPositiveResponse();
serviceRestResponse.setEntity(stbFilesAttached);
return serviceRestResponse;
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new ServiceRestResponse(EsitoType.KO, config, e);
@@ -1077,59 +1074,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)
public @ResponseBody
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)
@@ -1175,10 +1123,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)
public @ResponseBody
ServiceRestResponse exportServerInfoISCC(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
emsServices.checkServerVariables(multiDBTransactionManager);
emsServices.checkServerVariables();
return ServiceRestResponse.createPositiveResponse();
}
@@ -1190,7 +1150,7 @@ public class EmsController {
return ServiceRestResponse.createPositiveResponse(mapping);
} catch (Exception 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 +1162,7 @@ public class EmsController {
return ServiceRestResponse.createPositiveResponse(historyProfileDb);
} catch (Exception 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 +1179,7 @@ public class EmsController {
return ServiceRestResponse.createPositiveResponse(entityFields);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryConnection().getProfileName(), e);
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryDatasource().getProfile(), e);
}
}

View File

@@ -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;
}
}

View File

@@ -1,60 +0,0 @@
package it.integry.ems.controller;
import it.integry.ems.response.ServiceRestResponse;
import it.integry.ems.service.EntityProcessor;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.entity.WtbJrept;
import it.integry.ems_model.types.OperationType;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRSaver;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@RestController
@Scope("request")
@RequestMapping("report-management")
public class ReportManagementController {
@Autowired
private MultiDBTransactionManager multiDBTransactionManager;
@Autowired
private EntityProcessor entityProcessor;
@RequestMapping(value = "/compile/{reportId}", method = RequestMethod.GET)
public @ResponseBody ServiceRestResponse compile(@PathVariable("reportId") long reportId) throws Exception {
WtbJrept wtbJrept = new WtbJrept()
.setId(reportId);
wtbJrept.setOperation(OperationType.SELECT_OBJECT);
wtbJrept = entityProcessor.processEntity(wtbJrept, multiDBTransactionManager);
byte[] jrxml = Base64.decodeBase64(wtbJrept.getB64Jrxml());
ByteArrayInputStream bais = new ByteArrayInputStream(jrxml);
final JasperReport compiledReport = JasperCompileManager.compileReport(bais);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JRSaver.saveObject(compiledReport, baos);
wtbJrept.setCompiledJasper(ArrayUtils.toObject(baos.toByteArray()));
wtbJrept.setOperation(OperationType.UPDATE);
entityProcessor.processEntity(wtbJrept, multiDBTransactionManager);
return ServiceRestResponse.createPositiveResponse();
}
}

View File

@@ -1,172 +1,134 @@
package it.integry.ems.datasource;
import it.integry.ems.settings.Model.AvailableConnectionModel;
import it.integry.ems.settings.Model.SettingsModel;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems_model.config.EmsRestConstants;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityHashMap;
import it.integry.ems_model.utility.UtilityString;
import org.apache.commons.dbcp2.BasicDataSource;
import java.sql.SQLException;
import java.util.HashMap;
public class DataSource extends BasicDataSource {
private final int POOL_SIZE;
private AvailableConnectionModel connectionModel;
/**
* Instanzia un nuovo 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.
*/
@Deprecated
public DataSource() {
super();
POOL_SIZE = 5;
}
@Deprecated
public DataSource(int poolSize) {
super();
POOL_SIZE = poolSize;
}
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.
*
* @return una connessione dal pool
* @throws SQLException se si verifica un errore di accesso al database
*/
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());
// Prova a ottenere una connessione per verificare la configurazione e ottenere il sessionID
if (connectionModel.getConnectionType() == EmsRestConstants.DB_TYPE.MSSQL) {
HashMap<String, Object> resultSessionData = UtilityDB.executeSimpleQueryOnlyFirstRow(connection, "select CAST(@@spid AS BIGINT) AS session_id," +
" user_name() AS [user_name]," +
" suser_name() AS [suser_name]," +
" current_user AS [current_user]," +
" system_user AS [system_user]," +
" session_user AS [session_user]," +
" user AS [user]");
connection.setSessionId(UtilityHashMap.getValueIfExists(resultSessionData, "session_id"));
}
connection.setProfileName(connectionModel.getProfileName())
.setInternalDb(connectionModel.getInternalDb());
return connection;
}
public synchronized void initialize(String profileDB) throws Exception {
initialize(profileDB, null);
}
public synchronized void initialize(String profileDB, String customAppName) throws Exception {
AvailableConnectionModel connectionsModel = SettingsModel.getInstance().findConnectionModel(profileDB);
initialize(connectionsModel, customAppName);
}
public synchronized void initialize(AvailableConnectionModel connectionModel) throws Exception {
initialize(connectionModel, null);
}
public synchronized void initialize(AvailableConnectionModel connectionModel, String customAppName) throws Exception {
if (connectionModel == null) {
throw new Exception("Configurazione DB non trovata");
}
this.connectionModel = connectionModel;
this.setDriverClassName(connectionModel.getDriverClassName());
this.setUrl(connectionModel.getDbConnectionString(UtilityString.isNull(customAppName, "EMS Connection")));
this.setUsername(connectionModel.getUsername());
this.setPassword(connectionModel.getPasswordDecrypted());
this.setDefaultCatalog(connectionModel.getDbName());
this.setDefaultTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
this.setDefaultAutoCommit(false);
// ===== OTTIMIZZAZIONI CRITICHE =====
// Pool sizing ottimizzato per READ_UNCOMMITTED (meno locking = più connessioni possibili)
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
// Timeout ottimizzati per performance massime
// this.setMaxWaitMillis(-1L); // Infinito (DEFAULT)
// Validazione veloce ed efficiente
this.setValidationQuery("SELECT 1");
this.setValidationQueryTimeout(30); // Ridotto a 1 secondo
this.setTestWhileIdle(true); // Testa connessioni idle
// Eviction ottimizzata per READ_UNCOMMITTED
// this.setTimeBetweenEvictionRunsMillis(1 * 1000); // Ogni 30 secondi
// this.setMinEvictableIdleTimeMillis(1 * 60 * 1000); // 3 minuti (ridotto da 5)
// this.setNumTestsPerEvictionRun(5); // Testa più connessioni per volta
// Connection leak protection
this.setRemoveAbandonedOnBorrow(true);
this.setRemoveAbandonedOnMaintenance(true);
this.setRemoveAbandonedTimeout(3 * 60 * 10); // 3 minuti
this.setLogAbandoned(true); // Disabilita in produzione per performance
// Performance boosts massimi
// this.setPoolPreparedStatements(true);
// this.setMaxOpenPreparedStatements(200);
// 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);
// }
}
package it.integry.ems.datasource;
import it.integry.ems.settings.Model.AvailableConnectionsModel;
import it.integry.ems.settings.Model.SettingsModel;
import it.integry.ems_model.config.EmsRestConstants;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityHashMap;
import it.integry.ems_model.utility.UtilityString;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import javax.annotation.PreDestroy;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
@Service
@Scope(value = "request")
public class DataSource {
private AvailableConnectionsModel connectionModel;
private String profile;
private Short sessionID;
private Connection connection = null;
public String getDbName() {
return connectionModel.getDbName();
}
public String getProfile() {
return profile;
}
public EmsRestConstants.DB_TYPE getTypeDB() {
return connectionModel.getConnectionType();
}
public int getSessionID() {
return sessionID;
}
public synchronized Connection getConnection() throws IOException, SQLException {
if (connection == null || connection.isClosed())
init();
return connection;
}
public boolean isClosed() throws SQLException {
return !(connection != null && !connection.isClosed());
}
private void init() throws SQLException, IOException {
connection = DriverManager.getConnection(connectionModel.getDbConnectionString(), connectionModel.getUsername(), connectionModel.getPasswordDecrypted());
connection.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
connection.setAutoCommit(false);
if (connectionModel.getConnectionType() == EmsRestConstants.DB_TYPE.MSSQL) {
try (final PreparedStatement setNocountOn = connection.prepareStatement("SET NOCOUNT ON")) {
boolean resultNoCount = setNocountOn.execute();
}
HashMap<String, Object> resultSessionData = UtilityDB.executeSimpleQueryOnlyFirstRow(connection, "select @@spid AS session_id," +
" user_name() AS [user_name]," +
" suser_name() AS [suser_name]," +
" current_user AS [current_user]," +
" system_user AS [system_user]," +
" session_user AS [session_user]," +
" user AS [user]");
this.sessionID = UtilityHashMap.getValueIfExists(resultSessionData, "session_id");
}
}
@PreDestroy
private void destroy() throws SQLException {
forceClose();
}
public synchronized void initialize(String profileDB, String connectionName, boolean autoOpenConnection) throws Exception {
if (UtilityString.isNullOrEmpty(profileDB)) {
throw new Exception("Profile DB non valorizzato - controllare la chiamata del servizio");
}
this.profile = profileDB;
this.sessionID = -1;
AvailableConnectionsModel connectionModel = null;
List<AvailableConnectionsModel> availableConnectionsModels = SettingsModel.getInstance().getAvailableConnections();
if (!UtilityString.isNullOrEmpty(profileDB)) {
for (AvailableConnectionsModel connectionsModel : availableConnectionsModels) {
if (connectionsModel.getProfileName().equalsIgnoreCase(profileDB)) {
connectionModel = connectionsModel;
}
}
}
if (connectionModel == null) {
throw new Exception(String.format("Configurazione DB non trovata o dati mancanti (%s)", profileDB));
}
this.connectionModel = connectionModel;
if (autoOpenConnection) {
init();
}
}
public synchronized void initialize(String profileDB, boolean autoOpenConnection) throws Exception {
initialize(profileDB, "EMS Connection", autoOpenConnection);
}
public synchronized void initialize(String profileDB) throws Exception {
initialize(profileDB, "EMS Connection", true);
}
public void forceClose() throws SQLException {
if (connection != null) {
synchronized (connection) {
connection.close();
}
}
}
}

View File

@@ -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;
}
}

View File

@@ -1,143 +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(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));
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -2,23 +2,60 @@ package it.integry.ems.devices;
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.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.config.EmsRestConstants;
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")
@RequestMapping("device")
public class DevicesController {
@Deprecated
@RequestMapping(value = "register", method = RequestMethod.POST)
public @ResponseBody ServiceRestResponse register(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
@RequestBody Object registerDeviceRequestDTO) throws Exception {
private final Logger logger = LogManager.getLogger();
//TODO: To be removed
//Mantenuto solo per lasciare compatibilità con le vecchie versioni del WMS
//Non serve più per >= v1.45.00
@Autowired
private MultiDBTransactionManager multiDBTransactionManager;
@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();
}

View File

@@ -1,38 +1,55 @@
package it.integry.ems.devices;
import com.annimon.stream.Stream;
import it.integry.common.var.CommonConstants;
import it.integry.common.var.EmsDBConst;
import it.integry.ems.javabeans.RequestDataDTO;
import it.integry.security.service.DeviceService;
import it.integry.ems.properties.EmsProperties;
import it.integry.ems.settings.Model.AvailableConnectionsModel;
import it.integry.ems.settings.Model.SettingsModel;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.utility.UtilityHashMap;
import it.integry.ems_model.utility.UtilityString;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.xpath.operations.Mult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
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.HttpServletResponse;
import java.util.Optional;
@Component
@Scope("request")
public class DevicesRequestInterceptor implements HandlerInterceptor {
public class DevicesRequestInterceptor extends HandlerInterceptorAdapter {
private final Logger logger = LogManager.getLogger();
@Override
@Autowired
private SettingsModel settingsModel;
@Autowired
private DevicesService devicesService;
public boolean preHandle(
HttpServletRequest request,
HttpServletResponse response, Object handler) {
try {
DeviceService deviceService = ContextLoader.getCurrentWebApplicationContext().getBean(DeviceService.class);
RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
if (requestDataDTO.isValidProfileDB() && requestDataDTO.isValidDeviceId()) {
deviceService.updateUsage(requestDataDTO.getDeviceId());
devicesService.updateUsage(multiDBTransactionManager.getPrimaryConnection(), requestDataDTO.getDeviceId());
}
return true;
} catch (Exception ex) {
ex.printStackTrace();
logger.error(ex.getMessage(), ex);
return false;
}

View File

@@ -0,0 +1,71 @@
package it.integry.ems.devices;
import it.integry.ems.service.EntityProcessor;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems.user.UserSession;
import it.integry.ems_model.entity.StbDevices;
import it.integry.ems_model.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.sql.Connection;
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 = ContextLoader.getCurrentWebApplicationContext().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);
}
}

View File

@@ -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;
}
}

View File

@@ -2,16 +2,14 @@ package it.integry.ems.directory;
import com.fasterxml.jackson.databind.node.ArrayNode;
import it.integry.common.var.CommonConstants;
import it.integry.ems.datasource.DataSource;
import it.integry.ems.json.ResponseJSONObjectMapper;
import it.integry.ems.properties.EmsProperties;
import it.integry.ems.response.EsitoType;
import it.integry.ems.response.FileItem;
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.service.SetupGest;
import it.integry.ems_model.utility.UtilityHashMap;
import it.integry.ems_model.utility.UtilityString;
import it.integry.security.utility.RestUtil;
import org.apache.logging.log4j.LogManager;
@@ -31,18 +29,17 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Properties;
import java.util.TimerTask;
public class EmailWatcherListener extends TimerTask {
private final Logger logger = LogManager.getLogger();
private Logger logger = LogManager.getLogger();
private final EmailListenerInfo emailListenerInfo;
private final EmsProperties prop;
private final SetupGest setupGest;
private final ResponseJSONObjectMapper jsonObjectMapper;
private EmailListenerInfo emailListenerInfo;
private EmsProperties prop;
private SetupGest setupGest;
private ResponseJSONObjectMapper jsonObjectMapper;
public EmailWatcherListener(EmailListenerInfo emailListenerInfo, EmsProperties prop,
SetupGest setupGest, ResponseJSONObjectMapper jsonObjectMapper) {
@@ -55,44 +52,42 @@ public class EmailWatcherListener extends TimerTask {
@Override
public synchronized void run() {
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(emailListenerInfo.getDatabase())) {
Connection conn = multiDBTransactionManager.getPrimaryConnection();
try {
String flagAttivo = null, username = null, password = null,
imap = null, pop3 = null, pop3Port = null, imapPort = null;
DataSource ds = new DataSource();
ds.initialize(emailListenerInfo.getDatabase());
String[] params = emailListenerInfo.getSetupGestBranch().split("\\|");
if (params.length >= 2) {
final HashMap<String, String> setupData = setupGest.getSetupSection(conn, params[0], params[1]);
flagAttivo = UtilityHashMap.getValueIfExists(setupData, "ATTIVO");
username = UtilityHashMap.getValueIfExists(setupData, "USERNAME");
flagAttivo = setupGest.getSetup(ds.getConnection(), params[0], params[1], "ATTIVO");
username = setupGest.getSetup(ds.getConnection(), params[0], params[1], "USERNAME");
if (UtilityString.isNullOrEmpty(username))
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))
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))
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))
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))
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))
throw new Exception(params[0] + "/" + params[1] + "/IMAP_PORT non configurato correttamente");
}
ds.forceClose();
if (!UtilityString.isNullOrEmpty(flagAttivo) && "S".equals(flagAttivo)) {
Properties sysProperties = System.getProperties();
Session session = Session.getDefaultInstance(sysProperties);
@@ -164,7 +159,7 @@ public class EmailWatcherListener extends TimerTask {
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) == '{') {
ServiceRestResponse respWra = jsonObjectMapper.readValue(value, ServiceRestResponse.class);
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,
String emailDbg, String errorMessage) throws Exception {
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 = "";
PreparedStatement ps = mdb.prepareStatement("select nome_ditta from azienda");
ResultSet rs = ps.executeQuery();
if (rs.next()) {
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();
}
});
String nomeAzienda = "";
PreparedStatement ps = ds.getConnection().prepareStatement("select nome_ditta from azienda");
ResultSet rs = ps.executeQuery();
if (rs.next()) {
nomeAzienda = rs.getString("nome_ditta");
}
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();
}
});
}
}

View File

@@ -5,15 +5,12 @@ 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.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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.activation.MimetypesFileTypeMap;
import javax.servlet.http.HttpServletResponse;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -32,26 +29,26 @@ public class DownloadController {
private MimeTypesHandler mimetypesFileTypeMap;
@RequestMapping(value = "download/{uuid}/{fileName}", method = RequestMethod.GET)
public ResponseEntity<byte[]> download(@PathVariable String uuid,
@PathVariable String fileName) throws Exception {
public byte[] download(HttpServletResponse response,
@PathVariable String uuid,
@PathVariable String fileName) throws Exception {
byte[] fileContent = downloadFileHandlerService.getDownloadFileContent(uuid);
if (fileContent != null) {
String filename = downloadFileHandlerService.getDownloadFileName(uuid);
MediaType mediaType = mimetypesFileTypeMap.getContentType(fileName);
String mimeType = Files.probeContentType(Paths.get(fileName));
return ResponseEntity.ok()
.contentType(mediaType)
.contentLength(fileContent.length)
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
.builder("attachment")
.filename(filename)
.build()
.toString())
.body(fileContent);
response.setContentType(mimeType);
response.setStatus(HttpServletResponse.SC_OK);
response.addHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
response.setContentLength(fileContent.length);
return fileContent;
}
return ResponseEntity.notFound().build();
response.sendError(404, "File non trovato");
return null;
}
}

View File

@@ -1,5 +1,6 @@
package it.integry.ems.download;
import it.integry.annotations.PostContextConstruct;
import it.integry.ems.download.dto.CachedFileDto;
import it.integry.ems.download.dto.DownloadFileDto;
import it.integry.ems.looper.service.LooperService;
@@ -24,6 +25,13 @@ public class DownloadFileHandlerService {
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 {
return generateDownloadItem(file.getName(), FileUtils.readFileToByteArray(file), false);
}

View File

@@ -1,5 +1,6 @@
package it.integry.ems.dto.info;
package it.integry.ems.dto;
import java.util.List;
public class ApplicationInfoDTO {
private String name;
@@ -9,6 +10,7 @@ public class ApplicationInfoDTO {
private Short annoContab;
private String loadMenuPvm;
private List<String> salvataggiSoap;
private boolean delimitedIdentifier;
private boolean ansiPadding;
@@ -68,6 +70,15 @@ public class ApplicationInfoDTO {
return this;
}
public List<String> getSalvataggiSoap() {
return salvataggiSoap;
}
public ApplicationInfoDTO setSalvataggiSoap(List<String> salvataggiSoap) {
this.salvataggiSoap = salvataggiSoap;
return this;
}
public boolean isConcatNullYieldsNull() {
return concatNullYieldsNull;
}

View File

@@ -1,12 +1,14 @@
package it.integry.ems.dto;
import com.fasterxml.jackson.annotation.JsonValue;
import it.integry.ems.report.dto.JasperDTO;
import it.integry.ems_model.base.EntityBase;
import it.integry.ems_model.entity.DtbDocPdf;
import it.integry.ems_model.entity.MtbAartLink;
import it.integry.ems_model.entity.MtbUntMis;
import it.integry.ems_model.entity.StbActivityFile;
import it.integry.ems_model.entity._enum.IBaseEnum;
import java.util.HashMap;
import java.util.List;
public class CreateZipDTO {
@@ -16,8 +18,6 @@ public class CreateZipDTO {
private List<MtbAartLink> listMtbAartLink;
private List<DtbDocPdf> listDtbDocPdf;
private String fileName;
private SaveMode saveMode = SaveMode.STB_FILES_ATTACHED;
@@ -51,15 +51,6 @@ public class CreateZipDTO {
return this;
}
public List<DtbDocPdf> getListDtbDocPdf() {
return listDtbDocPdf;
}
public CreateZipDTO setListDtbDocPdf(List<DtbDocPdf> listDtbDocPdf) {
this.listDtbDocPdf = listDtbDocPdf;
return this;
}
public String getFileName() {
return fileName;
}

View File

@@ -1,4 +1,4 @@
package it.integry.ems.dto.info;
package it.integry.ems.dto;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package it.integry.ems.dto.info;
package it.integry.ems.dto;
public class DatabaseInfoDTO {

View File

@@ -95,19 +95,13 @@ public class EntityHierarchy {
}
public static class Field implements Cloneable {
public static class Field {
private java.lang.reflect.Field field;
private PK primaryKey;
private Identity identity;
private SqlField sqlField;
private ImportFromParent importFromParent;
private Priority priority;
private ObjectStorage objectStorage;
private Blob blob;
private Clob clob;
private VarBinary varBinary;
private String fieldName;
public java.lang.reflect.Field getField() {
return field;
@@ -115,26 +109,13 @@ public class EntityHierarchy {
public Field setField(java.lang.reflect.Field field) {
this.field = field;
this.fieldName = field.getName();
return this;
}
public boolean isPrimaryKey() {
return primaryKey != null;
}
public boolean isSqlField() {
return sqlField != null;
}
public boolean isImportFromParent() {
return importFromParent != null;
}
public boolean isPriority() {
return priority != null;
}
public boolean isObjectStorage() {
return objectStorage != null;
}
@@ -151,19 +132,6 @@ public class EntityHierarchy {
return identity != null;
}
public boolean isVarBinary() {
return varBinary != null;
}
public PK getPrimaryKey() {
return primaryKey;
}
public Field setPrimaryKey(PK primaryKey) {
this.primaryKey = primaryKey;
return this;
}
public Identity getIdentity() {
return identity;
}
@@ -182,24 +150,6 @@ public class EntityHierarchy {
return this;
}
public ImportFromParent getImportFromParent() {
return importFromParent;
}
public Field setImportFromParent(ImportFromParent importFromParent) {
this.importFromParent = importFromParent;
return this;
}
public Priority getPriority() {
return priority;
}
public Field setPriority(Priority priority) {
this.priority = priority;
return this;
}
public ObjectStorage getObjectStorage() {
return objectStorage;
}
@@ -226,46 +176,5 @@ public class EntityHierarchy {
this.clob = clob;
return this;
}
public VarBinary getVarBinary() {
return varBinary;
}
public Field setVarBinary(VarBinary varBinary) {
this.varBinary = varBinary;
return this;
}
public String getFieldName() {
return fieldName;
}
@Override
public Field clone() {
try {
Field cloned = (Field) super.clone();
// java.lang.reflect.Field è final, quindi usiamo lo stesso riferimento
cloned.field = this.field;
// Tutte le altre proprietà sono @interface (annotazioni) quindi immutabili
cloned.primaryKey = this.primaryKey;
cloned.identity = this.identity;
cloned.sqlField = this.sqlField;
cloned.importFromParent = this.importFromParent;
cloned.priority = this.priority;
cloned.objectStorage = this.objectStorage;
cloned.blob = this.blob;
cloned.clob = this.clob;
cloned.varBinary = this.varBinary;
// String è immutabile
cloned.fieldName = this.fieldName;
return cloned;
} catch (CloneNotSupportedException e) {
throw new RuntimeException("Errore durante la clonazione del Field", e);
}
}
}
}

View File

@@ -1,6 +1,5 @@
package it.integry.ems.dto;
import java.time.LocalDateTime;
import java.util.Date;
public class ExtendedStbActivity {
@@ -15,9 +14,11 @@ public class ExtendedStbActivity {
private String userCreator;
private String note;
private String activityDescription;
private Date dataInsAct;
private int priorita;
private LocalDateTime alarmTime;
private LocalDateTime oraInsAct;
private Date alarmDate;
private Date alarmTime;
private Date oraInsAct;
private String activityTypeId;
private String parentActivityId;
private StbActivityEmailObject emailObject;
@@ -115,6 +116,15 @@ public class ExtendedStbActivity {
return this;
}
public Date getDataInsAct() {
return dataInsAct;
}
public ExtendedStbActivity setDataInsAct(Date dataInsAct) {
this.dataInsAct = dataInsAct;
return this;
}
public int getPriorita() {
return priorita;
}
@@ -124,20 +134,29 @@ public class ExtendedStbActivity {
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;
}
public ExtendedStbActivity setAlarmTime(LocalDateTime alarmTime) {
public ExtendedStbActivity setAlarmTime(Date alarmTime) {
this.alarmTime = alarmTime;
return this;
}
public LocalDateTime getOraInsAct() {
public Date getOraInsAct() {
return oraInsAct;
}
public ExtendedStbActivity setOraInsAct(LocalDateTime oraInsAct) {
public ExtendedStbActivity setOraInsAct(Date oraInsAct) {
this.oraInsAct = oraInsAct;
return this;
}

View File

@@ -1,60 +0,0 @@
package it.integry.ems.dto;
public class Quartet<A, B, C, D> {
private final A first;
private final B second;
private final C third;
private final D fourth;
public Quartet(A first, B second, C third, D fourth) {
this.first = first;
this.second = second;
this.third = third;
this.fourth = fourth;
}
public A getFirst() {
return first;
}
public B getSecond() {
return second;
}
public C getThird() {
return third;
}
public D getFourth() {
return fourth;
}
public A getValue0() {
return first;
}
public B getValue1() {
return second;
}
public C getValue2() {
return third;
}
public D getValue3() {
return fourth;
}
@Override
public String toString() {
return "Quartet{" +
"first=" + first +
", second=" + second +
", third=" + third +
", fourth=" + fourth +
'}';
}
}

Some files were not shown because too many files have changed in this diff Show More