← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21034: Async tasks, using system.id from conf file to identify system in error notifications.

 

------------------------------------------------------------
revno: 21034
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-11-11 18:40:22 +0100
message:
  Async tasks, using system.id from conf file to identify system in error notifications.
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/scheduling/AnalyticsTableTask.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/scheduling/MonitoringTask.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java	2015-10-06 18:24:42 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java	2015-11-11 17:40:22 +0000
@@ -31,6 +31,8 @@
 import java.util.Date;
 
 import org.hisp.dhis.commons.util.DebugUtils;
+import org.hisp.dhis.external.conf.ConfigurationKey;
+import org.hisp.dhis.external.conf.DhisConfigurationProvider;
 import org.hisp.dhis.message.MessageService;
 import org.hisp.dhis.resourcetable.ResourceTableService;
 import org.hisp.dhis.scheduling.TaskId;
@@ -59,7 +61,10 @@
 
     @Autowired
     private SystemSettingManager systemSettingManager;
-    
+
+    @Autowired
+    private DhisConfigurationProvider config;
+
     private TaskId taskId;
 
     public void setTaskId( TaskId taskId )
@@ -87,14 +92,14 @@
         }
         catch ( RuntimeException ex )
         {
-            String appTitle = (String) systemSettingManager.getSystemSetting( Setting.APPLICATION_TITLE );
-            
+            String systemId = config.getProperty( ConfigurationKey.SYSTEM_ID );
+
             notifier.notify( taskId, NotificationLevel.ERROR, "Process failed: " + ex.getMessage(), true );
             
             messageService.sendSystemNotification( 
                 "Resource table process failed",
                 "Resource table process failed, please check the logs. Time: " + new DateTime().toString() + ". " +
-                "Application title: " + appTitle + " " +
+                "System: " + systemId + " " +
                 "Message: " + ex.getMessage() + " " +
                 "Cause: " + DebugUtils.getStackTrace( ex.getCause() ) );
             

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/scheduling/AnalyticsTableTask.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/scheduling/AnalyticsTableTask.java	2015-10-06 18:24:42 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/scheduling/AnalyticsTableTask.java	2015-11-11 17:40:22 +0000
@@ -35,11 +35,12 @@
 
 import javax.annotation.Resource;
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.analytics.AnalyticsTableService;
 import org.hisp.dhis.commons.util.DebugUtils;
+import org.hisp.dhis.external.conf.ConfigurationKey;
+import org.hisp.dhis.external.conf.DhisConfigurationProvider;
 import org.hisp.dhis.message.MessageService;
 import org.hisp.dhis.scheduling.TaskId;
 import org.hisp.dhis.security.NoSecurityContextRunnable;
@@ -82,6 +83,9 @@
 
     @Autowired
     private SystemSettingManager systemSettingManager;
+    
+    @Autowired
+    private DhisConfigurationProvider config;
 
     private Integer lastYears;
 
@@ -164,14 +168,14 @@
         }
         catch ( RuntimeException ex )
         {
-            String appTitle = StringUtils.trimToEmpty( (String) systemSettingManager.getSystemSetting( Setting.APPLICATION_TITLE ) );
+            String systemId = config.getProperty( ConfigurationKey.SYSTEM_ID );
 
             notifier.notify( taskId, ERROR, "Process failed: " + ex.getMessage(), true );
 
             messageService.sendSystemNotification(
                 "Analytics table process failed",
                 "Analytics table process failed, please check the logs. Time: " + new DateTime().toString() + ". " +
-                    "Application title: " + appTitle + " " +
+                    "System: " + systemId + " " +
                     "Message: " + ex.getMessage() + " " +
                     "Cause: " + DebugUtils.getStackTrace( ex.getCause() ) );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/scheduling/MonitoringTask.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/scheduling/MonitoringTask.java	2015-10-06 18:24:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/scheduling/MonitoringTask.java	2015-11-11 17:40:22 +0000
@@ -34,6 +34,8 @@
 import java.util.Date;
 
 import org.hisp.dhis.commons.util.DebugUtils;
+import org.hisp.dhis.external.conf.ConfigurationKey;
+import org.hisp.dhis.external.conf.DhisConfigurationProvider;
 import org.hisp.dhis.message.MessageService;
 import org.hisp.dhis.scheduling.TaskId;
 import org.hisp.dhis.setting.Setting;
@@ -62,6 +64,9 @@
     @Autowired
     private SystemSettingManager systemSettingManager;
 
+    @Autowired
+    private DhisConfigurationProvider config;
+
     private TaskId taskId;
 
     public void setTaskId( TaskId taskId )
@@ -88,11 +93,14 @@
         }
         catch ( RuntimeException ex )
         {
+            String systemId = config.getProperty( ConfigurationKey.SYSTEM_ID );
+
             notifier.notify( taskId, ERROR, "Process failed: " + ex.getMessage(), true );
             
             messageService.sendSystemNotification( 
                 "Monitoring process failed",
                 "Monitoring process failed, please check the logs. Time: " + new DateTime().toString() + ". " +
+                "System: " + systemId + " " +
                 "Message: " + ex.getMessage() + " " +
                 "Cause: " + DebugUtils.getStackTrace( ex.getCause() ) );