Fix su aggiornamento valori StbExchangeConfig
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:
@@ -48,7 +48,7 @@ public class ExchangeSystemManagerService {
|
|||||||
@PostContextConstruct(priority = 20)
|
@PostContextConstruct(priority = 20)
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
|
||||||
if(!settingsModel.isPrimaryInstance() || UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer())
|
if (!settingsModel.isPrimaryInstance() || UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (AdvancedDataSource db : multiDBTransactionManager.getActiveConnections()) {
|
for (AdvancedDataSource db : multiDBTransactionManager.getActiveConnections()) {
|
||||||
@@ -91,9 +91,6 @@ public class ExchangeSystemManagerService {
|
|||||||
private void executeExchange(StbExchangeConfig stbExchangeConfig) {
|
private void executeExchange(StbExchangeConfig stbExchangeConfig) {
|
||||||
logger.info("Avvio EXCHANGE [" + stbExchangeConfig.getDescription() + "]");
|
logger.info("Avvio EXCHANGE [" + stbExchangeConfig.getDescription() + "]");
|
||||||
|
|
||||||
stbExchangeConfig = (StbExchangeConfig) stbExchangeConfig.clone();
|
|
||||||
stbExchangeConfig.setSchedulationCron(null); //Blanco il campo schedulazione per evitare che venga salvato nel DB
|
|
||||||
|
|
||||||
StbExchangeConfigDetail executingStbExchangeConfigDetail = null;
|
StbExchangeConfigDetail executingStbExchangeConfigDetail = null;
|
||||||
|
|
||||||
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(stbExchangeConfig.getInternalProfileDb())) {
|
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(stbExchangeConfig.getInternalProfileDb())) {
|
||||||
@@ -109,10 +106,7 @@ public class ExchangeSystemManagerService {
|
|||||||
RequestDataDTO requestDataDTO = new RequestDataDTO();
|
RequestDataDTO requestDataDTO = new RequestDataDTO();
|
||||||
requestDataDTO.setUsername("EXCHANGE");
|
requestDataDTO.setUsername("EXCHANGE");
|
||||||
|
|
||||||
stbExchangeConfig.setLastExecution(LocalDateTime.now())
|
saveStartTime(internalDb, stbExchangeConfig, LocalDateTime.now());
|
||||||
.setOperation(OperationType.UPDATE);
|
|
||||||
stbExchangeConfig.manageWithParentConnection(internalDb.getPrimaryConnection());
|
|
||||||
internalDb.commitAll();
|
|
||||||
|
|
||||||
for (StbExchangeConfigDetail stbExchangeConfigDetail : stbExchangeConfigs) {
|
for (StbExchangeConfigDetail stbExchangeConfigDetail : stbExchangeConfigs) {
|
||||||
executingStbExchangeConfigDetail = stbExchangeConfigDetail;
|
executingStbExchangeConfigDetail = stbExchangeConfigDetail;
|
||||||
@@ -212,9 +206,7 @@ public class ExchangeSystemManagerService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stbExchangeConfig.setLastExecutionErrorMessage(EmsRestConstants.NULL)
|
saveEndTime(internalDb, stbExchangeConfig);
|
||||||
.setOperation(OperationType.UPDATE);
|
|
||||||
stbExchangeConfig.manageWithParentConnection(internalDb.getPrimaryConnection());
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Errore", e);
|
logger.error("Errore", e);
|
||||||
@@ -231,7 +223,32 @@ public class ExchangeSystemManagerService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveStartTime(MultiDBTransactionManager internalDb, @NotNull StbExchangeConfig stbExchangeConfig, @NotNull LocalDateTime startTime) throws Exception {
|
||||||
|
StbExchangeConfig stbExchangeConfigClone = new StbExchangeConfig()
|
||||||
|
.setId(stbExchangeConfig.getId());
|
||||||
|
|
||||||
|
stbExchangeConfigClone.setLastExecution(LocalDateTime.now())
|
||||||
|
.setOperation(OperationType.UPDATE);
|
||||||
|
|
||||||
|
stbExchangeConfigClone.manageWithParentConnection(internalDb.getPrimaryConnection());
|
||||||
|
internalDb.commitAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveEndTime(MultiDBTransactionManager internalDb, @NotNull StbExchangeConfig stbExchangeConfig) throws Exception {
|
||||||
|
StbExchangeConfig stbExchangeConfigClone = new StbExchangeConfig()
|
||||||
|
.setId(stbExchangeConfig.getId());
|
||||||
|
|
||||||
|
stbExchangeConfigClone.setLastExecutionErrorMessage(EmsRestConstants.NULL)
|
||||||
|
.setOperation(OperationType.UPDATE);
|
||||||
|
|
||||||
|
stbExchangeConfigClone.manageWithParentConnection(internalDb.getPrimaryConnection());
|
||||||
|
internalDb.commitAll();
|
||||||
|
}
|
||||||
|
|
||||||
private void saveErrorLog(MultiDBTransactionManager internalDb, @NotNull StbExchangeConfig stbExchangeConfig, @Nullable StbExchangeConfigDetail stbExchangeConfigDetail, @NotNull Exception exceptionToLog) {
|
private void saveErrorLog(MultiDBTransactionManager internalDb, @NotNull StbExchangeConfig stbExchangeConfig, @Nullable StbExchangeConfigDetail stbExchangeConfigDetail, @NotNull Exception exceptionToLog) {
|
||||||
|
StbExchangeConfig stbExchangeConfigClone = new StbExchangeConfig()
|
||||||
|
.setId(stbExchangeConfig.getId());
|
||||||
|
|
||||||
String logMessage = "";
|
String logMessage = "";
|
||||||
|
|
||||||
if (stbExchangeConfigDetail != null) {
|
if (stbExchangeConfigDetail != null) {
|
||||||
@@ -240,10 +257,10 @@ public class ExchangeSystemManagerService {
|
|||||||
|
|
||||||
logMessage += UtilityException.convertExceptionToHumanReadableText(exceptionToLog);
|
logMessage += UtilityException.convertExceptionToHumanReadableText(exceptionToLog);
|
||||||
|
|
||||||
stbExchangeConfig.setLastExecutionErrorMessage(logMessage)
|
stbExchangeConfigClone.setLastExecutionErrorMessage(logMessage)
|
||||||
.setOperation(OperationType.UPDATE);
|
.setOperation(OperationType.UPDATE);
|
||||||
try {
|
try {
|
||||||
stbExchangeConfig.manageWithParentConnection(internalDb.getPrimaryConnection());
|
stbExchangeConfigClone.manageWithParentConnection(internalDb.getPrimaryConnection());
|
||||||
internalDb.commitAll();
|
internalDb.commitAll();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Errore durante l'aggiornamento dello stato dell'exchange", e);
|
logger.error("Errore durante l'aggiornamento dello stato dell'exchange", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user