← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2504: Simplification in datamart

 

------------------------------------------------------------
revno: 2504
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-01-10 11:27:03 +0100
message:
  Simplification in datamart
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/CrossTabService.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java
  dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.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-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/CrossTabService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/CrossTabService.java	2011-01-10 10:06:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/CrossTabService.java	2011-01-10 10:27:03 +0000
@@ -41,17 +41,6 @@
     String ID = CrossTabService.class.getName();
 
     /**
-     * Creates, populates and trims the crosstab table.
-     * 
-     * @param operands the collection of DataElementOperands.
-     * @param periodIds the collection of Period identifiers.
-     * @param organisationUnitIds the collection of OrganisationUnit identifiers.
-     * @return the DataElementOperands where data exists.
-     */
-    Collection<DataElementOperand> populateAndTrimCrossTabTable( final Collection<DataElementOperand> operands,
-        final Collection<Integer> periodIds, final Collection<Integer> organisationUnitIds, String key );
-    
-    /**
      * Creates and populates the crosstab table.
      * 
      * @param operands the collection of DataElementOperands.

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java	2011-01-10 10:06:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java	2011-01-10 10:27:03 +0000
@@ -29,7 +29,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -86,16 +85,6 @@
     // CrossTabService implementation
     // -------------------------------------------------------------------------
 
-    public Collection<DataElementOperand> populateAndTrimCrossTabTable( final Collection<DataElementOperand> operands,
-        final Collection<Integer> periodIds, final Collection<Integer> organisationUnitIds, String key )
-    {
-        Collection<DataElementOperand> operandsWithData = populateCrossTabTable( operands, periodIds, organisationUnitIds, key );
-        
-        trimCrossTabTable( operandsWithData, key );
-        
-        return operandsWithData;
-    }
-    
     public Collection<DataElementOperand> populateCrossTabTable( final Collection<DataElementOperand> operands,
         final Collection<Integer> periodIds, final Collection<Integer> organisationUnitIds, String key )
     {
@@ -105,8 +94,6 @@
 
             final List<DataElementOperand> operandList = new ArrayList<DataElementOperand>( operands );
 
-            Collections.sort( operandList );
-
             crossTabStore.dropCrossTabTable( key );
 
             log.info( "Dropped crosstab table" );
@@ -166,6 +153,8 @@
 
             batchHandler.flush();
             
+            trimCrossTabTable( operandsWithData, key );
+            
             return operandsWithData;
         }
 

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2011-01-09 21:24:40 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2011-01-10 10:27:03 +0000
@@ -271,7 +271,7 @@
         Collection<Integer> childrenIds = organisationUnitService.getOrganisationUnitHierarchy().getChildren( organisationUnitIds );
         Collection<Integer> intersectingPeriodIds = ConversionUtils.getIdentifiers( Period.class, periodService.getIntersectionPeriods( periods ) );
         
-        Collection<DataElementOperand> operandsWithData = crossTabService.populateAndTrimCrossTabTable( allOperands, intersectingPeriodIds, childrenIds, key );
+        Collection<DataElementOperand> operandsWithData = crossTabService.populateCrossTabTable( allOperands, intersectingPeriodIds, childrenIds, key );
 
         log.info( "Populated crosstab table: " + TimeUtils.getHMS() );
 

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java	2011-01-09 17:14:33 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java	2011-01-10 10:27:03 +0000
@@ -52,7 +52,7 @@
      * given in the constructor. If there is no more pages, null is returned. The
      * returned page is not guaranteed to have the same size as the page size.
      */
-    public List<T> getPage()
+    public List<T> nextPage()
     {
         int size = size();
         

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java	2011-01-09 17:14:33 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java	2011-01-10 10:27:03 +0000
@@ -41,24 +41,24 @@
 public class PaginatedListTest
 {
     @Test
-    public void testGetPage()
+    public void testNextPage()
     {
         PaginatedList<String> list = new PaginatedList<String>( Arrays.asList( "A", "B", "C" ), 2 );
         
-        List<String> page = list.getPage();
+        List<String> page = list.nextPage();
         
         assertNotNull( page );
         assertEquals( 2, page.size() );
         assertTrue( page.contains( "A" ) );
         assertTrue( page.contains( "B" ) );
         
-        page = list.getPage();
+        page = list.nextPage();
         
         assertNotNull( page );
         assertEquals( 1, page.size() );
         assertTrue( page.contains( "C" ) );
         
-        page = list.getPage();
+        page = list.nextPage();
         
         assertNull( page );
     }
@@ -68,7 +68,7 @@
     {
         PaginatedList<String> list = new PaginatedList<String>( new ArrayList<String>(), 2 );
         
-        List<String> page = list.getPage();
+        List<String> page = list.nextPage();
         
         assertNull( page );
     }