← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18366: Impl support for maintenance operation for dropping all SQL views

 

------------------------------------------------------------
revno: 18366
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-02-20 15:53:31 +0100
message:
  Impl support for maintenance operation for dropping all SQL views
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java
  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/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/maintenanceForm.vm


--
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-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java	2015-02-20 14:46:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java	2015-02-20 14:53:31 +0000
@@ -109,6 +109,13 @@
         maintenanceService.deleteZeroDataValues();
     }
 
+    @RequestMapping( value = "/dropSqlViews", method = { RequestMethod.PUT, RequestMethod.POST } )
+    @PreAuthorize( "hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')" )
+    public void dropSqlViews()
+    {
+        sqlViewService.dropAllSqlViews();
+    }
+    
     @RequestMapping( value = "/createSqlViews", method = { RequestMethod.PUT, RequestMethod.POST } )
     @PreAuthorize( "hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')" )
     public void createSqlViews()

=== 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	2015-02-20 14:46:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java	2015-02-20 14:53:31 +0000
@@ -38,7 +38,6 @@
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.datamart.DataMartManager;
 import org.hisp.dhis.maintenance.MaintenanceService;
-import org.hisp.dhis.resourcetable.ResourceTableService;
 import org.hisp.dhis.sqlview.SqlViewService;
 import org.hisp.dhis.user.CurrentUserService;
 
@@ -72,13 +71,6 @@
     @Resource(name="org.hisp.dhis.analytics.EventAnalyticsTableService")
     private AnalyticsTableService eventAnalyticsTableService;
     
-    private ResourceTableService resourceTableService;
-    
-    public void setResourceTableService( ResourceTableService resourceTableService )
-    {
-        this.resourceTableService = resourceTableService;
-    }
-
     private MaintenanceService maintenanceService;
 
     public void setMaintenanceService( MaintenanceService maintenanceService )
@@ -181,13 +173,20 @@
         this.removeExpiredInvitations = removeExpiredInvitations;
     }
 
+    private boolean dropSqlViews;
+
+    public void setDropSqlViews( boolean dropSqlViews )
+    {
+        this.dropSqlViews = dropSqlViews;
+    }
+
     private boolean createSqlViews;
     
     public void setCreateSqlViews( boolean createSqlViews )
     {
         this.createSqlViews = createSqlViews;
     }
-
+    
     private boolean updateCategoryOptionCombos;
 
     public void setUpdateCategoryOptionCombos( boolean updateCategoryOptionCombos )
@@ -270,6 +269,13 @@
             
             log.info( "'" + username + "': Removed expired invitations" );
         }
+
+        if ( dropSqlViews )
+        {
+            sqlViewService.dropAllSqlViews();
+            
+            log.info( "'" + username + "': Dropped SQL views" );
+        }
         
         if ( createSqlViews )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2015-02-13 15:23:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2015-02-20 14:53:31 +0000
@@ -8,7 +8,6 @@
   <bean id="org.hisp.dhis.dataadmin.action.maintenance.PerformMaintenanceAction"
     class="org.hisp.dhis.dataadmin.action.maintenance.PerformMaintenanceAction"
     scope="prototype">
-    <property name="resourceTableService" ref="org.hisp.dhis.resourcetable.ResourceTableService" />
     <property name="maintenanceService" ref="org.hisp.dhis.maintenance.MaintenanceService" />
     <property name="completenessService" ref="compulsoryDataCompletenessService" />
     <property name="aggregatedDataValueService" ref="org.hisp.dhis.aggregation.AggregatedDataValueService" />

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2015-02-17 13:27:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2015-02-20 14:53:31 +0000
@@ -138,6 +138,7 @@
 select_the_data_element_to_keep=Select the data element to keep
 eliminate=Eliminate
 move_all=Move All
+drop_sql_views=Drop SQL views
 move_selected=Move Selected
 duplicate_data_elimination=Duplicate Data Elimination
 select_different_org_units=Please select two different organisation units

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js	2015-02-13 15:23:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js	2015-02-20 14:53:31 +0000
@@ -8,11 +8,12 @@
     var dataSetCompleteness = $( "#dataSetCompleteness" ).is( ":checked" );
     var prunePeriods = $( "#prunePeriods" ).is( ":checked" );
     var removeExpiredInvitations = $( "#removeExpiredInvitations" ).is( ":checked" );
+    var dropSqlViews = $( "#dropSqlViews" ).is( ":checked" );
     var createSqlViews = $( "#createSqlViews" ).is( ":checked" );
     var updateCategoryOptionCombos = $( "#updateCategoryOptionCombos" ).is( ":checked" );
     
     if ( clearAnalytics || clearDataMart || dataMartIndex || zeroValues || dataSetCompleteness || 
-    	prunePeriods || removeExpiredInvitations || createSqlViews || updateCategoryOptionCombos )
+    	prunePeriods || removeExpiredInvitations || dropSqlViews || createSqlViews || updateCategoryOptionCombos )
     {
         setHeaderWaitMessage( i18n_performing_maintenance );
         
@@ -23,6 +24,7 @@
             "&dataSetCompleteness=" + dataSetCompleteness +
             "&prunePeriods=" + prunePeriods +
             "&removeExpiredInvitations=" + removeExpiredInvitations +
+            "&dropSqlViews=" + dropSqlViews +
             "&createSqlViews=" + createSqlViews +
             "&updateCategoryOptionCombos=" + updateCategoryOptionCombos;
         

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/maintenanceForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/maintenanceForm.vm	2015-02-13 15:23:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/maintenanceForm.vm	2015-02-20 14:53:31 +0000
@@ -42,6 +42,11 @@
 </p>
 
 <p>
+	<input type="checkbox" id="dropSqlViews"/>
+	<label for="dropSqlViews">$i18n.getString( "drop_sql_views" )</label>
+</p>
+
+<p>
 	<input type="checkbox" id="createSqlViews"/>
 	<label for="createSqlViews">$i18n.getString( "create_sql_views" )</label>
 </p>