Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -726,6 +726,7 @@ public class EmsController {
|
||||
|
||||
responseList.add(response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(request.getRequestURI(), e);
|
||||
response = new ServiceRestResponse(EsitoType.KO, e, multiDBTransactionManager.getPrimaryDatasource().getProfile(), entity);
|
||||
responseList.add(response);
|
||||
|
||||
@@ -58,6 +58,13 @@ public class MigrationService {
|
||||
|
||||
@PostContextConstruct
|
||||
public void init() {
|
||||
if (UtilityDebug.isDebugExecution())
|
||||
return;
|
||||
|
||||
startMigrationsGlobally(multiDBTransactionManager);
|
||||
}
|
||||
|
||||
public void startMigrationsGlobally(MultiDBTransactionManager multiDBTransactionManager) {
|
||||
Reflections reflections = new Reflections("it.integry.ems.migration.model");
|
||||
|
||||
allMigrationsList = new ArrayList<>(Stream.of(reflections.getSubTypesOf(MigrationModelInterface.class))
|
||||
@@ -128,6 +135,7 @@ public class MigrationService {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void executeMigration(Class<? extends MigrationModelInterface> migrationClass,
|
||||
AdvancedDataSource advancedDataSource,
|
||||
SettingsController settingsController,
|
||||
|
||||
@@ -19,6 +19,12 @@ public class MigrationSetupController {
|
||||
return ServiceRestResponse.createPositiveResponse(migrationSetupService.retrieveAll());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "executeAll", method = RequestMethod.GET)
|
||||
public @ResponseBody ServiceRestResponse executeAll() throws Exception {
|
||||
migrationSetupService.executeAll();
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "{migrationCode}/retry", method = RequestMethod.POST)
|
||||
public @ResponseBody ServiceRestResponse retryMigration(@PathVariable long migrationCode) throws Exception {
|
||||
migrationSetupService.retry(migrationCode);
|
||||
|
||||
@@ -124,4 +124,13 @@ public class MigrationSetupService {
|
||||
migrationService.updateLastMigrationIntoDB(advancedDataSource, migrationCode);
|
||||
migrationService.executeMigrationGroup(advancedDataSource);
|
||||
}
|
||||
|
||||
|
||||
public void executeAll() throws Exception {
|
||||
for (AvailableConnectionsModel availableConnectionsModel : settingsModel.getAvailableConnections()) {
|
||||
multiDBTransactionManager.addConnection(availableConnectionsModel);
|
||||
}
|
||||
|
||||
migrationService.startMigrationsGlobally(multiDBTransactionManager);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,10 @@ public class MultiDBTransactionManager implements AutoCloseable{
|
||||
this.dbPrimary = null;
|
||||
}
|
||||
|
||||
public void addConnection(AvailableConnectionsModel availableConnectionsModel) throws Exception {
|
||||
this.addConnection(availableConnectionsModel.getProfileName());
|
||||
}
|
||||
|
||||
public void addConnection(String profileName) throws Exception {
|
||||
DataSource ds = new DataSource();
|
||||
ds.initialize(profileName);
|
||||
|
||||
@@ -36,6 +36,7 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler({Exception.class})
|
||||
public @ResponseBody
|
||||
ServiceRestResponse handleException(HttpServletRequest request, HttpServletResponse response, Exception ex) {
|
||||
ex.printStackTrace();
|
||||
logger.error(request.getRequestURI(), ex);
|
||||
return ServiceRestResponse.createNegativeResponse(ex);
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ public class EntityPropertyHolder {
|
||||
if (!UtilityString.isNullOrEmpty(whereUniqueStr))
|
||||
whereStr += "OR (" + whereUniqueStr + ")";
|
||||
|
||||
if(whereStr.equalsIgnoreCase("()"))
|
||||
if (whereStr.equalsIgnoreCase("()"))
|
||||
whereStr = "(1 = 1)";
|
||||
|
||||
return whereStr;
|
||||
@@ -501,15 +501,15 @@ public class EntityPropertyHolder {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (childEntity.equals(entity)) {
|
||||
//ignoro le entity autoreferenziate
|
||||
continue;
|
||||
}
|
||||
EntityHierarchyDTO dto = new EntityHierarchyDTO();
|
||||
dto.setClazz(childEntity);
|
||||
dto.setEntityName(childEntity.getSimpleName());
|
||||
dto.setTableName(childEntity.getAnnotation(Table.class).value());
|
||||
dto.setChildren(getEntityChildren(childEntity));
|
||||
|
||||
if (!childEntity.equals(entity))
|
||||
//Prendo i fields solo delle entity non autoreferenziate
|
||||
dto.setChildren(getEntityChildren(childEntity));
|
||||
|
||||
dto.setField(field);
|
||||
children.add(dto);
|
||||
}
|
||||
|
||||
@@ -693,8 +693,7 @@ public class WMSGenericService {
|
||||
" LEFT OUTER JOIN mtb_sfam on mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp AND mtb_aart.cod_msgr = mtb_sfam.cod_msgr and \n" +
|
||||
" mtb_aart.cod_msfa = mtb_sfam.cod_msfa \n" +
|
||||
"WHERE flag_evaso = 'I' \n" +
|
||||
" AND qta_da_evadere > 0 \n" +
|
||||
" AND (mtb_aart.flag_qta_cnf_fissa = 'S' OR (mtb_aart.flag_qta_cnf_fissa <> 'S' AND num_cnf_da_evadere > 0))\n" +
|
||||
" AND ((mtb_aart.flag_qta_cnf_fissa = 'S' AND qta_da_evadere > 0) OR (mtb_aart.flag_qta_cnf_fissa = 'N' AND (num_cnf_da_evadere > 0 OR qta_da_evadere > 0)))\n" +
|
||||
" AND (" +
|
||||
UtilityQuery.concatFieldListInWhereCond(whereCondOrders) + ")" +
|
||||
"GROUP BY sit_ord.cod_jcom, sit_ord.cod_mart, sit_ord.cod_col, sit_ord.cod_Tagl, sit_ord.cod_alis, sit_ord.cod_art_for,\n" +
|
||||
|
||||
Reference in New Issue
Block a user