← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9970: Minor

 

------------------------------------------------------------
revno: 9970
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-04-04 00:08:32 +0200
message:
  Minor
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/scheduling/TaskId.java
  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/scheduling/AnalyticsTableTask.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DataMartTask.java
  dhis-2/dhis-services/pom.xml
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/InMemoryNotifier.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.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-api/src/main/java/org/hisp/dhis/scheduling/TaskId.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/scheduling/TaskId.java	2012-04-12 20:05:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/scheduling/TaskId.java	2012-04-03 22:08:32 +0000
@@ -38,6 +38,10 @@
     
     private String id;
     
+    public TaskId()
+    {
+    }
+    
     public TaskId( TaskCategory category, User user )
     {
         this.id = category.toString() + SEPARATOR + user.getUserCredentials().getUsername();

=== 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	2013-03-04 14:44:15 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java	2012-04-03 22:08:32 +0000
@@ -32,7 +32,6 @@
 import org.hisp.dhis.scheduling.TaskId;
 import org.hisp.dhis.system.notification.NotificationLevel;
 import org.hisp.dhis.system.notification.Notifier;
-import org.hisp.dhis.user.User;
 import org.springframework.beans.factory.annotation.Autowired;
 
 /**
@@ -46,24 +45,12 @@
 
     @Autowired
     private Notifier notifier;
-    
-    // -------------------------------------------------------------------------
-    // Must be set externally
-    // -------------------------------------------------------------------------
-
-    private User user;
-
-    public void setUser( User user )
-    {
-        this.user = user;
-    }
-
-    // -------------------------------------------------------------------------
-    // Constructor
-    // -------------------------------------------------------------------------
-
-    public ResourceTableTask()
-    {
+
+    private TaskId taskId;
+
+    public void setTaskId( TaskId taskId )
+    {
+        this.taskId = taskId;
     }
 
     // -------------------------------------------------------------------------
@@ -73,8 +60,6 @@
     @Override
     public void run()
     {
-        TaskId taskId = new TaskId( TaskCategory.RESOURCETABLE_UPDATE, user );
-        
         notifier.notify( taskId, TaskCategory.RESOURCETABLE_UPDATE, "Generating resource tables" );
         
         resourceTableService.generateAll();

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java	2013-03-04 14:44:15 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java	2012-04-03 22:08:32 +0000
@@ -38,7 +38,6 @@
 import org.hisp.dhis.scheduling.TaskId;
 import org.hisp.dhis.system.notification.Notifier;
 import org.hisp.dhis.system.util.DebugUtils;
-import org.hisp.dhis.user.User;
 import org.springframework.beans.factory.annotation.Autowired;
 
 /**
@@ -66,23 +65,11 @@
         this.last3Years = last3Years;
     }
 
-    // -------------------------------------------------------------------------
-    // Must be set externally
-    // -------------------------------------------------------------------------
-
-    private User user;
-
-    public void setUser( User user )
+    private TaskId taskId;
+
+    public void setTaskId( TaskId taskId )
     {
-        this.user = user;
-    }
-
-    // -------------------------------------------------------------------------
-    // Constructor
-    // -------------------------------------------------------------------------
-
-    public AnalyticsTableTask()
-    { 
+        this.taskId = taskId;
     }
 
     // -------------------------------------------------------------------------
@@ -92,8 +79,6 @@
     @Override
     public void run()
     {
-        TaskId taskId = new TaskId( ANALYTICS_UPDATE, user );
-        
         notifier.clear( taskId, ANALYTICS_UPDATE );
         
         try

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DataMartTask.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DataMartTask.java	2013-03-04 14:44:15 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DataMartTask.java	2012-04-03 22:08:32 +0000
@@ -42,10 +42,8 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.scheduling.TaskId;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.system.util.ConversionUtils;
-import org.hisp.dhis.user.User;
 import org.springframework.beans.factory.annotation.Autowired;
 
 /**
@@ -89,25 +87,13 @@
         this.last6To12Months = last6To12Months;
     }
 
-    // -------------------------------------------------------------------------
-    // Must be set externally
-    // -------------------------------------------------------------------------
-
-    private User user;
-
-    public void setUser( User user )
-    {
-        this.user = user;
-    }
-
-    // -------------------------------------------------------------------------
-    // Constructors
-    // -------------------------------------------------------------------------
-
-    public DataMartTask()
-    {
-    }
-    
+    private TaskId taskId;
+
+    public void setTaskId( TaskId taskId )
+    {
+        this.taskId = taskId;
+    }
+
     // -------------------------------------------------------------------------
     // Runnable implementation
     // -------------------------------------------------------------------------
@@ -116,8 +102,6 @@
     @SuppressWarnings("unchecked")  
     public void run()
     {
-        TaskId taskId = new TaskId( TaskCategory.DATAMART, user );
-        
         Set<String> periodTypes = (Set<String>) systemSettingManager.getSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
         
         List<Period> periods = getPeriods( periodTypes );

=== modified file 'dhis-2/dhis-services/pom.xml'
--- dhis-2/dhis-services/pom.xml	2012-12-03 21:04:39 +0000
+++ dhis-2/dhis-services/pom.xml	2012-04-03 22:08:32 +0000
@@ -15,18 +15,18 @@
   
   <modules>
     <module>dhis-service-core</module>
+    <module>dhis-service-integration</module>
     <module>dhis-service-i18n</module>
     <module>dhis-service-administration</module>
     <module>dhis-service-datamart-default</module>
     <module>dhis-service-importexport</module>
-    <module>dhis-service-reporting</module>
     <module>dhis-service-mapgeneration</module>
     <module>dhis-service-aggregationengine-default</module>
     <module>dhis-service-analytics</module>
     <module>dhis-service-sms</module>
     <module>dhis-service-patient</module>
     <module>dhis-service-mobile</module>
-    <module>dhis-service-integration</module>
+    <module>dhis-service-reporting</module>
   </modules>
   
   <dependencies>

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/InMemoryNotifier.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/InMemoryNotifier.java	2013-03-03 21:10:52 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/InMemoryNotifier.java	2012-04-03 22:08:32 +0000
@@ -97,7 +97,7 @@
     {
         List<Notification> list = new ArrayList<Notification>();
         
-        if ( category != null )
+        if ( id != null && category != null )
         {
             for ( Notification notification : notifications.get( id ) )
             {
@@ -119,7 +119,7 @@
     @Override
     public Notifier clear( TaskId id, TaskCategory category )
     {
-        if ( category != null )
+        if ( id != null && category != null )
         {
             Iterator<Notification> iter = notifications.get( id ).iterator();
             

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java	2013-03-03 21:10:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java	2012-04-03 22:08:32 +0000
@@ -72,7 +72,7 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_DATA_MART_ADMIN')" )
     public void data( HttpServletResponse response )
     {
-        analyticsTableService.update( null );
+        analyticsTableService.update( false, null );
         
         ContextUtils.okResponse( response, "Initiated analytics table update" );
     }
@@ -81,7 +81,7 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_DATA_MART_ADMIN')" )
     public void completeness( HttpServletResponse response )
     {
-        completenessTableService.update( null );
+        completenessTableService.update( false, null );
         
         ContextUtils.okResponse( response, "Initiated completeness table update" );
     }
@@ -90,7 +90,7 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_DATA_MART_ADMIN')" )
     public void completenessTarget( HttpServletResponse response )
     {
-        completenessTargetTableService.update( null );
+        completenessTargetTableService.update( false, null );
         
         ContextUtils.okResponse( response, "Initiated completeness target table update" );
     }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java	2013-03-04 14:44:15 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java	2012-04-03 22:08:32 +0000
@@ -37,6 +37,8 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.scheduling.DataMartTask;
+import org.hisp.dhis.scheduling.TaskCategory;
+import org.hisp.dhis.scheduling.TaskId;
 import org.hisp.dhis.system.scheduling.Scheduler;
 import org.hisp.dhis.system.util.DateUtils;
 import org.hisp.dhis.user.CurrentUserService;
@@ -119,10 +121,12 @@
             periods.addAll( periodType.generatePeriods( start, end ) );
         }
 
+        TaskId taskId = new TaskId( TaskCategory.DATAMART, currentUserService.getCurrentUser() );
+        
         if ( periods.size() > 0 )
         {
             dataMartTask.setPeriods( periods );
-            dataMartTask.setUser( currentUserService.getCurrentUser() );
+            dataMartTask.setTaskId( taskId );
         
             scheduler.executeTask( dataMartTask );
         }