← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22089: Maintenance, impl support for analytics tables clear and expired user account invitations clear.

 

------------------------------------------------------------
revno: 22089
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-01 12:16:58 +0100
message:
  Maintenance, impl support for analytics tables clear and expired user account invitations clear.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/pom.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.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-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/pom.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/pom.xml	2016-01-15 00:52:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/pom.xml	2016-03-01 11:16:58 +0000
@@ -55,6 +55,10 @@
     </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-analytics</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-administration</artifactId>
     </dependency>
 	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java	2016-03-01 11:16:58 +0000
@@ -1,5 +1,7 @@
 package org.hisp.dhis.dataadmin.action.maintenance;
 
+import java.util.List;
+
 /*
  * Copyright (c) 2004-2016, University of Oslo
  * All rights reserved.
@@ -28,8 +30,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.annotation.Resource;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.analytics.AnalyticsTableService;
@@ -54,20 +54,8 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    @Resource( name = "org.hisp.dhis.analytics.AnalyticsTableService" )
-    private AnalyticsTableService analyticsTableService;
-
-    @Resource( name = "org.hisp.dhis.analytics.CompletenessTableService" )
-    private AnalyticsTableService completenessTableService;
-
-    @Resource( name = "org.hisp.dhis.analytics.CompletenessTargetTableService" )
-    private AnalyticsTableService completenessTargetTableService;
-
-    @Resource( name = "org.hisp.dhis.analytics.OrgUnitTargetTableService" )
-    private AnalyticsTableService orgUnitTargetTableService;
-
-    @Resource( name = "org.hisp.dhis.analytics.EventAnalyticsTableService" )
-    private AnalyticsTableService eventAnalyticsTableService;
+    @Autowired
+    private List<AnalyticsTableService> analyticsTableService;
 
     private MaintenanceService maintenanceService;
 
@@ -170,14 +158,16 @@
     {
         String username = currentUserService.getCurrentUsername();
 
-        if ( clearAnalytics )
+        if ( clearAnalytics && analyticsTableService != null )
         {
             resourceTableService.dropAllSqlViews();
-            analyticsTableService.dropTables();
-            completenessTableService.dropTables();
-            completenessTargetTableService.dropTables();
-            orgUnitTargetTableService.dropTables();
-            eventAnalyticsTableService.dropTables();
+            
+            for ( AnalyticsTableService service : analyticsTableService )
+            {
+                service.dropTables();
+                
+                log.debug( "Cleared analytics tables: " + service.getClass().getSimpleName() );
+            }
 
             log.info( "'" + username + "': Cleared analytics tables" );
         }