From bc5ceeb64d6b895206eafbca854162cc5f02c303 Mon Sep 17 00:00:00 2001 From: vmazurashu Date: Tue, 25 Sep 2018 17:48:12 +0300 Subject: [PATCH] #1891: fix version inconsistency which caused runtime error --- .../libreplan/web/StartupApplicationListener.java | 6 ++---- .../web/common/ConfigurationController.java | 8 ++++---- .../libreplan/web/common/GatheredUsageStats.java | 14 ++++++++++++++ .../tabs/MultipleTabsPlannerController.java | 5 ++--- pom.xml | 2 +- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/StartupApplicationListener.java b/libreplan-webapp/src/main/java/org/libreplan/web/StartupApplicationListener.java index f4f87f82c..56fe11c3e 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/StartupApplicationListener.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/StartupApplicationListener.java @@ -57,10 +57,8 @@ public class StartupApplicationListener implements ApplicationListener { if (SecurityUtils.isGatheredStatsAlreadySent) { return; } - if (configurationDAO.getConfigurationWithReadOnlyTransaction() == null || configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowToGatherUsageStatsEnabled()) { - GatheredUsageStats gatheredUsageStats = new GatheredUsageStats(); - - gatheredUsageStats.setupNotAutowiredClasses(userDAO, orderModel, workReportModel, workerModel, machineModel, + if (configurationDAO.getConfigurationWithReadOnlyTransaction() == null || configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowedToGatherUsageStatsEnabled()) { + GatheredUsageStats gatheredUsageStats = new GatheredUsageStats(userDAO, orderModel, workReportModel, workerModel, machineModel, expenseSheetModel, materialsModel, assignedQualityFormsModel); gatheredUsageStats.sendGatheredUsageStatsToServer(); diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java index a7a0d7a8d..ec80a2248 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java @@ -27,6 +27,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.cxf.jaxrs.client.WebClient; import org.libreplan.business.calendars.entities.BaseCalendar; import org.libreplan.business.common.daos.IConfigurationDAO; +import org.libreplan.business.common.entities.*; import org.libreplan.business.common.exceptions.ValidationException; import org.libreplan.business.costcategories.entities.TypeOfWorkHours; import org.libreplan.business.users.entities.UserRole; @@ -253,10 +254,9 @@ public class ConfigurationController extends GenericForwardComposer { messages.showMessage(Level.INFO, _("Changes saved")); // Send data to server - if (!SecurityUtils.isGatheredStatsAlreadySent && - configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowedToGatherUsageStatsEnabled()) { - sendDataToServer(); - } + if (!SecurityUtils.isGatheredStatsAlreadySent && (configurationDAO.getConfigurationWithReadOnlyTransaction() == null || configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowedToGatherUsageStatsEnabled())) { + sendDataToServer(); + } if ( getSelectedConnector() != null && !configurationModel.scheduleOrUnscheduleJobs(getSelectedConnector())) { diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/GatheredUsageStats.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/GatheredUsageStats.java index 977d41085..4aac8c2ca 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/common/GatheredUsageStats.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/GatheredUsageStats.java @@ -155,6 +155,20 @@ public class GatheredUsageStats { initialize(); } + public GatheredUsageStats(IUserDAO userDAO, IOrderModel orderModel, IWorkReportModel workReportModel, IWorkerModel workerModel, + IMachineModel machineModel, IExpenseSheetModel expenseSheetModel, IMaterialsModel materialsModel, IAssignedTaskQualityFormsToOrderElementModel assignedTaskQualityFormsToOrderElementModel) { + this.userDAO = userDAO; + this.orderModel = orderModel; + this.workReportModel = workReportModel; + this.workerModel = workerModel; + this.machineModel = machineModel; + this.expenseSheetModel = expenseSheetModel; + this.materialsModel = materialsModel; + this.assignedTaskQualityFormsToOrderElementModel = assignedTaskQualityFormsToOrderElementModel; + + initialize(); + } + private String generateID() { String ip = null; String hostname = null; diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java index 353b76c65..9ad8b71ed 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java @@ -506,9 +506,8 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry } // Send data to server - if ( !SecurityUtils.isGatheredStatsAlreadySent && - configurationDAO.getConfiguration().isAllowedToGatherUsageStatsEnabled() ) { - + if (!SecurityUtils.isGatheredStatsAlreadySent + && (configurationDAO.getConfigurationWithReadOnlyTransaction() == null || configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowedToGatherUsageStatsEnabled())) { sendDataToServer(); } diff --git a/pom.xml b/pom.xml index 86e752b83..edef634b5 100644 --- a/pom.xml +++ b/pom.xml @@ -469,7 +469,7 @@ org.zkoss.common zweb - 5.0.11 + 8.0.1.1