← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 2494
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-01-08 17:27:43 +0100
message:
  Minor fix
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java
  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/crosstab/jdbc/CrossTabStore.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.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/period/Period.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java	2010-12-20 12:52:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java	2011-01-08 16:27:43 +0000
@@ -179,9 +179,11 @@
      *
      * @return the period string
      */
-    public String getIsoDate() {
+    public String getIsoDate() 
+    {
         return periodType.getIsoDate(this);
     }
+    
     /**
      * Copies the transient properties (name) from the argument Period
      * to this Period.
@@ -206,7 +208,17 @@
     {
         return periodType.getName() + SEPARATOR + getMediumDateString( startDate ) + SEPARATOR + getMediumDateString( endDate );
     }
-    
+
+    /**
+     * Returns the frequency order of the period type of the period.
+     * 
+     * @return the frequency order.
+     */
+    public int frequencyOrder()
+    {
+        return periodType != null ? periodType.getFrequencyOrder() : TwoYearlyPeriodType.FREQUENCY_ORDER;
+    }
+
     /**
      * Formats a Date to the format YYYY-MM-DD.
      * 
@@ -243,7 +255,7 @@
             throw new RuntimeException( "Failed to parse medium date", ex );
         }
     }
-
+    
     // -------------------------------------------------------------------------
     // hashCode, equals and toString
     // -------------------------------------------------------------------------

=== 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	2010-06-26 19:48:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/CrossTabService.java	2011-01-08 16:27:43 +0000
@@ -60,9 +60,9 @@
     /**
      * Trims the crosstab table.
      * 
-     * @param emptyOperands the DataElementOperands without data.
+     * @param operands the DataElementOperands with data.
      */
-    void trimCrossTabTable( Collection<DataElementOperand> emptyOperands, String key );
+    void trimCrossTabTable( Collection<DataElementOperand> operands, String key );
 
     /**
      * Provides a Map with information about the crosstab table where the key is

=== 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	2010-12-05 19:34:52 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java	2011-01-08 16:27:43 +0000
@@ -170,7 +170,6 @@
         }
 
         return null;
-
     }
 
     public void dropCrossTabTable( String key )

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java	2010-06-26 19:48:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java	2011-01-08 16:27:43 +0000
@@ -80,7 +80,7 @@
      * Creates a trimmed crosstab table based on the regular crosstab table.
      * Trimming implies removing columns without data.
      * 
-     * @param operands the DataElementOperands.
+     * @param operands the DataElementOperands with data.
      */
     void createTrimmedCrossTabTable( Collection<DataElementOperand> operands, String key );
     

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java	2010-12-02 21:24:43 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java	2011-01-08 16:27:43 +0000
@@ -117,8 +117,6 @@
                     
                     final Map<DataElementOperand, Double> valueMap = dataElementAggregator.getAggregatedValues( currentOperandIndexMap, period, unit, level, hierarchy, key );
                     
-                    final PeriodType periodType = period.getPeriodType();
-                    
                     for ( Entry<DataElementOperand, Double> entry : valueMap.entrySet() )
                     {
                         value.clear();
@@ -126,7 +124,7 @@
                         value.setDataElementId( entry.getKey().getDataElementId() );
                         value.setCategoryOptionComboId( entry.getKey().getOptionComboId() );
                         value.setPeriodId( period.getId() );
-                        value.setPeriodTypeId( periodType.getId() );
+                        value.setPeriodTypeId( period.getPeriodType().getId() );
                         value.setOrganisationUnitId( unit.getId() );
                         value.setLevel( level );
                         value.setValue( getRounded( entry.getValue(), DECIMALS ) );

=== 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	2010-12-06 09:27:07 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2011-01-08 16:27:43 +0000
@@ -290,17 +290,17 @@
 
         Collection<Integer> intersectingPeriodIds = ConversionUtils.getIdentifiers( Period.class, periodService.getIntersectionPeriods( periods ) );
         
-        final Collection<DataElementOperand> emptyOperands = crossTabService.populateCrossTabTable(
+        final Collection<DataElementOperand> operandsWithData = crossTabService.populateCrossTabTable(
             allOperands, intersectingPeriodIds, childrenIds, key );
         
         log.info( "Populated crosstab table: " + TimeUtils.getHMS() );
 
-        if ( emptyOperands == null )
+        if ( operandsWithData == null )
         {
            return 0;
         }
         
-        crossTabService.trimCrossTabTable( emptyOperands, key );
+        crossTabService.trimCrossTabTable( operandsWithData, key );
 
         log.info( "Trimmed crosstab table: " + TimeUtils.getHMS() );