Cambiati alcuni datasource
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
18
.idea/copilotDiffState.xml
generated
18
.idea/copilotDiffState.xml
generated
File diff suppressed because one or more lines are too long
@@ -19,6 +19,15 @@ public class DataSource extends BasicDataSource {
|
||||
|
||||
private AvailableConnectionsModel 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(String)} per ottenere una connessione.
|
||||
*/
|
||||
@Deprecated
|
||||
public DataSource() {
|
||||
super();
|
||||
}
|
||||
|
||||
public EmsRestConstants.DB_TYPE getTypeDB() {
|
||||
return connectionModel.getConnectionType();
|
||||
@@ -31,6 +40,7 @@ public class DataSource extends BasicDataSource {
|
||||
* @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());
|
||||
|
||||
@@ -35,12 +35,12 @@ import java.util.TimerTask;
|
||||
|
||||
public class EmailWatcherListener extends TimerTask {
|
||||
|
||||
private Logger logger = LogManager.getLogger();
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
private EmailListenerInfo emailListenerInfo;
|
||||
private EmsProperties prop;
|
||||
private SetupGest setupGest;
|
||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||
private final EmailListenerInfo emailListenerInfo;
|
||||
private final EmsProperties prop;
|
||||
private final SetupGest setupGest;
|
||||
private final ResponseJSONObjectMapper jsonObjectMapper;
|
||||
|
||||
public EmailWatcherListener(EmailListenerInfo emailListenerInfo, EmsProperties prop,
|
||||
SetupGest setupGest, ResponseJSONObjectMapper jsonObjectMapper) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import it.integry.ems.Import.base.IEntityImporter;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems.Import.enums.EntityImportType;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.dto.*;
|
||||
import it.integry.ems.exception.MissingDataException;
|
||||
import it.integry.ems.export.base.EntityExportResponse;
|
||||
@@ -32,6 +31,7 @@ import it.integry.ems.service.dto.AttachmentDTO;
|
||||
import it.integry.ems.service.dto.EntityFieldDTO;
|
||||
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.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
@@ -130,6 +130,9 @@ public class EmsServices {
|
||||
@Autowired
|
||||
private SettingsController settingsController;
|
||||
|
||||
@Autowired
|
||||
private BasicConnectionPool basicConnectionPool;
|
||||
|
||||
public EntityImportResponse<List<EntityBase>> importEntity(String type, String format, ImportRequestDTO body, boolean headless) throws Exception {
|
||||
logger.debug("Starting import [Type: " + type + ", Format: " + format + "]");
|
||||
String gestName = "IMPORT_" + type;
|
||||
@@ -996,7 +999,6 @@ public class EmsServices {
|
||||
" FROM azienda";
|
||||
|
||||
|
||||
|
||||
for (Connection connection : mdb.getActiveConnections()) {
|
||||
HashMap<String, Object> resultDbInfo = UtilityDB.executeSimpleQueryOnlyFirstRow(connection, sql);
|
||||
|
||||
@@ -1021,13 +1023,10 @@ public class EmsServices {
|
||||
}
|
||||
|
||||
private void importClientieOrdiniQuore() throws Exception {
|
||||
DataSource ds = new DataSource();
|
||||
ds.initialize(settingsModel.getDefaultProfile());
|
||||
|
||||
Boolean enabled = Boolean.parseBoolean(setupGest.getSetup(ds.getConnection(),
|
||||
try (Connection connection = basicConnectionPool.getConnection(settingsModel.getDefaultProfile())) {
|
||||
boolean enabled = Boolean.parseBoolean(setupGest.getSetup(connection,
|
||||
"IMPORT_ORDINI WEB", "CONQUIST", "ENABLED"));
|
||||
String folder = setupGest.getSetup(ds.getConnection(), "IMPORT_ORDINI WEB", "CONQUIST", "FOLDER");
|
||||
ds.close();
|
||||
String folder = setupGest.getSetup(connection, "IMPORT_ORDINI WEB", "CONQUIST", "FOLDER");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(folder))
|
||||
throw new Exception("IMPORT_ORDINI WEB/CONQUIST/FOLDER non configurato correttamente");
|
||||
@@ -1122,6 +1121,7 @@ public class EmsServices {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private File[] getFileListQuore(String folder, final String fileNameFilter) {
|
||||
File directory = new File(folder + "/import");
|
||||
|
||||
@@ -8,7 +8,6 @@ import it.integry.ems.activity.dto.DescrizioneTipiAttivitaDTO;
|
||||
import it.integry.ems.activity.dto.ModellinoDTO;
|
||||
import it.integry.ems.activity.dto.SteUPEntryDTO;
|
||||
import it.integry.ems.activity.dto.SteUpScoreDTO;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.component.SQLServerDBSchemaManager;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTable;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableColumn;
|
||||
@@ -22,6 +21,7 @@ import it.integry.ems.service.MailService;
|
||||
import it.integry.ems.service.ReportProcessor;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.service.SystemService;
|
||||
@@ -84,7 +84,8 @@ public class SteUPService {
|
||||
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
@Autowired
|
||||
private BasicConnectionPool basicConnectionPool;
|
||||
|
||||
|
||||
private UserDTO authUser(String md5User) throws Exception {
|
||||
@@ -122,10 +123,10 @@ public class SteUPService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public HashMap<String, Object> login(String profileDb, String username, String password) throws Exception {
|
||||
return login(profileDb, UtilityHash.generateMd5(String.format("%s%s", username, password)));
|
||||
}
|
||||
|
||||
public HashMap<String, Object> login(String profileDb, String md5User) throws Exception {
|
||||
HashMap<String, Object> toReturn = new HashMap<>();
|
||||
|
||||
@@ -949,9 +950,7 @@ public class SteUPService {
|
||||
|
||||
public void uploadAttachmentTmp() throws Exception {
|
||||
|
||||
DataSource ds = new DataSource();
|
||||
String integry = "WINACT";
|
||||
ds.initialize(integry);
|
||||
try (Connection connection = basicConnectionPool.getConnection("WINACT")) {
|
||||
|
||||
String sql =
|
||||
"select a.activity_id, t.activity_id_new, f.file_name, f.last_upd " +
|
||||
@@ -963,18 +962,17 @@ public class SteUPService {
|
||||
"where parent_activity_id is null " +
|
||||
"and effective_date = '2021/12/03' ) and activity_id_new in ('C0000348319')";
|
||||
|
||||
List<HashMap<String, Object>> resDati = UtilityDB.executeSimpleQuery(ds.getConnection(), sql);
|
||||
List<HashMap<String, Object>> resDati = UtilityDB.executeSimpleQuery(connection, sql);
|
||||
|
||||
for (HashMap<String, Object> dati : resDati) {
|
||||
System.out.println(dati.get("activity_id_new") + " " + dati.get("file_name"));
|
||||
logger.debug(dati.get("activity_id_new") + " " + dati.get("file_name"));
|
||||
|
||||
sql =
|
||||
"SELECT content " +
|
||||
sql = "SELECT content " +
|
||||
" FROM stb_activity_file " +
|
||||
" WHERE id = " + UtilityDB.valueToString(dati.get("activity_id")) + " AND " +
|
||||
"file_name = " + UtilityDB.valueToString(dati.get("file_name"));
|
||||
|
||||
byte[] content = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(ds.getConnection(), sql);
|
||||
byte[] content = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
|
||||
StbActivityFile stbActivityFile =
|
||||
new StbActivityFile()
|
||||
@@ -1003,7 +1001,7 @@ public class SteUPService {
|
||||
}
|
||||
|
||||
multiDBTransactionManager.commitAll();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -200,8 +200,6 @@ public class DocumentiConsortileService {
|
||||
|
||||
// Connessione al database dell'azienda agricola
|
||||
if (j == 0) {
|
||||
DataSource dsSync = new DataSource();
|
||||
dsSync.initialize(profileDB);
|
||||
multiDBTransactionManagerAzAgr.setPrimaryDs(profileDB);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user