Vario
Some checks are pending
IntegryManagementSystem_Multi/pipeline/head Build queued...

This commit is contained in:
2025-01-10 17:17:19 +01:00
parent f115394750
commit a66ae4d788
3 changed files with 34 additions and 8 deletions

View File

@@ -37,7 +37,8 @@ public class DynamicCacheService {
DATI_AZIENDA_KEY,
ENTITY_LOGGER_SETUP,
GRIGLIA_ACQUISTO_KEY,
ENTITY_SYNC_KEY
ENTITY_SYNC_KEY,
STB_GEST_SETUP_KEY
}
public void addItem(Keys key, int invalidateTimeInMins, RunnableWithReturn<Object> refreshAction) {
@@ -161,13 +162,9 @@ public class DynamicCacheService {
}
private void cacheQueryByDB(String dbName, String profileName, String query, Class<?> clazz, HashMap<String, List<?>> cacheObjectByDB) throws Exception {
MultiDBTransactionManager m = new MultiDBTransactionManager(profileName, false);
try {
try (MultiDBTransactionManager m = new MultiDBTransactionManager(profileName, false)){
List<?> objects = UtilityDB.executeSimpleQueryDTO(m.getPrimaryConnection(), query, clazz);
cacheObjectByDB.putIfAbsent(dbName.toLowerCase(), objects);
} finally {
m.closeAll();
}
}

View File

@@ -69,8 +69,7 @@ public class EntityLoggerNewService {
}
private void initSetup() {
List<String> dbNames = settingsModel.getAvailableConnections().stream()
.filter(AvailableConnectionsModel::getInternalDb)
List<String> dbNames = settingsModel.getAvailableConnections(true).stream()
.map(AvailableConnectionsModel::getDbName)
.distinct()
.collect(Collectors.toList());

View File

@@ -25,6 +25,22 @@ import java.util.Map;
@Service
public class SetupGest {
// @Autowired
// private DynamicCacheService dynamicCacheService;
//
// @Autowired
// private SettingsModel settingsModel;
//
// @PostContextConstruct(priority = 30)
// public void init() {
// List<String> dbNames = settingsModel.getAvailableConnections(true).stream()
// .map(AvailableConnectionsModel::getDbName)
// .distinct()
// .collect(Collectors.toList());
//
// dynamicCacheService.addQuery(DynamicCacheService.Keys.STB_GEST_SETUP_KEY, 1, "SELECT * FROM " + StbGestSetup.ENTITY, StbGestSetup.class, dbNames);
// }
public String getImportSetup(Connection conn, String type, String format, String key) throws Exception {
return getSetup(conn, type, format, key, "IMPORT");
}
@@ -87,6 +103,20 @@ public class SetupGest {
if (!precode.isEmpty()) {
gestName = precode + "_" + gestName;
}
// String finalGestName = gestName;
//
// final List<StbGestSetup> stbGestSetups = dynamicCacheService.getObject(DynamicCacheService.Keys.STB_GEST_SETUP_KEY, connection.getCatalog());
// final StbGestSetup stbGestSetup = stbGestSetups.parallelStream().filter(x -> x.getGestName().equalsIgnoreCase(finalGestName) &&
// x.getSection().equalsIgnoreCase(section) &&
// x.getKeySection().equalsIgnoreCase(keySection))
// .findFirst()
// .orElse(null);
//
// if(stbGestSetup == null || stbGestSetup.getValue() == null)
// return "";
//
// return stbGestSetup.getValue();
String query = "SELECT value FROM stb_gest_setup"
+ " WHERE gest_name = " + UtilityDB.valueToString(gestName)
+ " AND section = " + UtilityDB.valueToString(section)