← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9947: Resource tables, pushed some functionality down to service layer

 

------------------------------------------------------------
revno: 9947
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-03-01 18:59:05 +0100
message:
  Resource tables, pushed some functionality down to service layer
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.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/resourcetable/ResourceTableService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java	2012-12-27 18:15:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java	2013-03-01 17:59:05 +0000
@@ -36,6 +36,11 @@
     String ID = ResourceTableService.class.getName();
 
     /**
+     * Generates all resource tables.
+     */
+    void generateAll();
+    
+    /**
      * Generates a resource table containing the hierarchy graph for each
      * OrganisationUnit.
      */

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2012-12-27 18:15:23 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2013-03-01 17:59:05 +0000
@@ -65,6 +65,7 @@
 import org.hisp.dhis.resourcetable.statement.CreateDataElementGroupSetTableStatement;
 import org.hisp.dhis.resourcetable.statement.CreateIndicatorGroupSetTableStatement;
 import org.hisp.dhis.resourcetable.statement.CreateOrganisationUnitGroupSetTableStatement;
+import org.hisp.dhis.sqlview.SqlViewService;
 
 /**
  * @author Lars Helge Overland
@@ -125,6 +126,13 @@
         this.periodService = periodService;
     }
 
+    private SqlViewService sqlViewService;
+    
+    public void setSqlViewService( SqlViewService sqlViewService )
+    {
+        this.sqlViewService = sqlViewService;
+    }
+
     private BatchHandlerFactory batchHandlerFactory;
 
     public void setBatchHandlerFactory( BatchHandlerFactory batchHandlerFactory )
@@ -133,6 +141,26 @@
     }
 
     // -------------------------------------------------------------------------
+    // All
+    // -------------------------------------------------------------------------
+
+    public void generateAll()
+    {
+        sqlViewService.dropAllSqlViewTables();
+        
+        generateCategoryOptionComboNames();
+        generateCategoryTable();
+        generateDataElementGroupSetTable();
+        generateDataElementTable();
+        generateIndicatorGroupSetTable();
+        generateOrganisationUnitGroupSetTable();
+        generateOrganisationUnitStructures();
+        generatePeriodTable();
+        
+        sqlViewService.createAllViewTables();
+    }
+    
+    // -------------------------------------------------------------------------
     // OrganisationUnitStructure
     // -------------------------------------------------------------------------
 

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml	2012-12-14 13:46:47 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml	2013-03-01 17:59:05 +0000
@@ -16,6 +16,7 @@
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+    <property name="sqlViewService" ref="org.hisp.dhis.sqlview.SqlViewService" />
     <property name="batchHandlerFactory" ref="batchHandlerFactory" />
   </bean>
   
@@ -52,7 +53,7 @@
     <property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
   
-  <!-- Databrowser Grid -->
+  <!-- Data browser -->
 
   <bean id="org.hisp.dhis.databrowser.DataBrowserGridStore" class="org.hisp.dhis.databrowser.jdbc.JDBCDataBrowserStore">
     <property name="statementBuilder" ref="statementBuilder" />

=== 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-01-25 10:33:17 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java	2013-03-01 17:59:05 +0000
@@ -63,7 +63,7 @@
         
     @Autowired
     private SqlViewService sqlViewService;
-    
+
     @RequestMapping( value = "/analytics", method = RequestMethod.PUT )
     @PreAuthorize( "hasRole('ALL') or hasRole('F_DATA_MART_ADMIN')" )
     public void analytics( HttpServletResponse response )
@@ -95,18 +95,7 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')" )
     public void resourceTables( HttpServletResponse response )
     {
-        sqlViewService.dropAllSqlViewTables();
-        
-        resourceTableService.generateCategoryOptionComboNames();
-        resourceTableService.generateCategoryTable();
-        resourceTableService.generateDataElementGroupSetTable();
-        resourceTableService.generateDataElementTable();
-        resourceTableService.generateIndicatorGroupSetTable();
-        resourceTableService.generateOrganisationUnitGroupSetTable();
-        resourceTableService.generateOrganisationUnitStructures();
-        resourceTableService.generatePeriodTable();
-        
-        sqlViewService.createAllViewTables();
+        resourceTableService.generateAll();
         
         ContextUtils.okResponse( response, "All resource tables updated" );
     }