← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1124: Fixed Bugs in ReportModule

 

------------------------------------------------------------
revno: 1124
committer: Bharath Kumar <chbharathk@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-11-25 19:28:53 +0530
message:
  Fixed Bugs in ReportModule
modified:
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/chart/action/SaveChartAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/action/GenerateCustomDataSetReportAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/action/GenerateDefaultDataSetReportAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/dataaccess/Dhis20ReportDataAccess.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/tablecreator/action/SaveTableAction.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 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/chart/action/SaveChartAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/chart/action/SaveChartAction.java	2009-11-18 11:06:48 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/chart/action/SaveChartAction.java	2009-11-25 13:58:53 +0000
@@ -28,6 +28,7 @@
  */
 
 import static org.hisp.dhis.system.util.ConversionUtils.getIntegerCollection;
+import static org.hisp.dhis.system.util.ConversionUtils.getList;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -41,7 +42,6 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.reporttable.RelativePeriods;
-import org.hisp.dhis.system.util.CollectionConversionUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -271,6 +271,10 @@
     {
         Chart chart = new Chart();
 
+        List<Indicator> indicators = getList( indicatorService.getIndicators( getIntegerCollection( selectedIndicators ) ) );
+        List<Period> periods = getList( periodService.getPeriods( getIntegerCollection( selectedPeriods ) ) );        
+        List<OrganisationUnit> organisationUnits = getList( organisationUnitService.getOrganisationUnits( getIntegerCollection( selectedOrganisationUnits ) ) );
+/*
         List<Indicator> indicators = new CollectionConversionUtils<Indicator>().getList( 
             indicatorService.getIndicators( getIntegerCollection( selectedIndicators ) ) );
 
@@ -279,7 +283,7 @@
         
         List<OrganisationUnit> organisationUnits = new CollectionConversionUtils<OrganisationUnit>().getList( 
             organisationUnitService.getOrganisationUnits( getIntegerCollection( selectedOrganisationUnits ) ) );
-
+*/
         chart.setId( id != null ? id : 0 );
         chart.setTitle( title );
         chart.setType( type );

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/action/GenerateCustomDataSetReportAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/action/GenerateCustomDataSetReportAction.java	2009-11-23 12:41:03 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/action/GenerateCustomDataSetReportAction.java	2009-11-25 13:58:53 +0000
@@ -209,7 +209,7 @@
 
                     if ( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
                     {
-                        double aggregatedValue;
+                        Double aggregatedValue;
 
                         if ( organisationUnitGroupId.equals( "Selected_Only" ) )
                         {
@@ -220,8 +220,8 @@
                         {
                             aggregatedValue = dataMartStore.getAggregatedValue( dataElement, optionCombo, period,
                                 orgUnit );
-                            value = (aggregatedValue != DataMartStore.NO_VALUES_REGISTERED) ? NumberUtils
-                                .formatDataValue( aggregatedValue ) : "";
+                            //value = (aggregatedValue != null ) ? NumberUtils.formatDataValue( aggregatedValue ) : "";
+                            value = ( aggregatedValue != null ) ? NumberUtils.formatDataValue( aggregatedValue ) : "";
                         }
                         else
                         {

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/action/GenerateDefaultDataSetReportAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/action/GenerateDefaultDataSetReportAction.java	2009-11-23 12:41:03 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/action/GenerateDefaultDataSetReportAction.java	2009-11-25 13:58:53 +0000
@@ -340,7 +340,7 @@
 
                         if ( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
                         {
-                            double aggregatedValue;
+                            Double aggregatedValue;
 
                             if ( organisationUnitGroupId.equals( "Selected_Only" ) )
                             {
@@ -353,7 +353,7 @@
                                 aggregatedValue = dataMartStore.getAggregatedValue( dataElement, optionCombo, period,
                                     orgUnit );
 
-                                value = (aggregatedValue != DataMartStore.NO_VALUES_REGISTERED) ? NumberUtils
+                                value = (aggregatedValue != null) ? NumberUtils
                                     .formatDataValue( aggregatedValue ) : "";
                             }
                             else
@@ -454,7 +454,7 @@
                     if ( dataElementService.getDataElement( reportElement.getElementId() ).getType().equals(
                         DataElement.VALUE_TYPE_INT ) )
                     {
-                        double aggregatedValue;
+                        Double aggregatedValue;
 
                         if ( selectedUnitOnly != null )
                         {
@@ -470,8 +470,7 @@
                                 .getDataElement( reportElement.getElementId() ), dataElements.iterator().next()
                                 .getCategoryCombo().getOptionCombos().iterator().next(), period, orgUnit );
 
-                            value = (aggregatedValue != DataMartStore.NO_VALUES_REGISTERED) ? NumberUtils
-                                .formatDataValue( aggregatedValue ) : "";
+                            value = (aggregatedValue != null) ? NumberUtils.formatDataValue( aggregatedValue ) : "";
                         }
                     }
 

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/dataaccess/Dhis20ReportDataAccess.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/dataaccess/Dhis20ReportDataAccess.java	2009-11-18 11:06:48 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/dataset/dataaccess/Dhis20ReportDataAccess.java	2009-11-25 13:58:53 +0000
@@ -31,7 +31,6 @@
 import java.util.Collection;
 import java.util.Set;
 
-import org.apache.commons.collections.CollectionUtils;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementGroup;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -40,7 +39,8 @@
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.system.filter.AggregateableDataElementPredicate;
+import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
+import org.hisp.dhis.system.util.FilterUtils;
 
 /**
  * @author Lars Helge Overland
@@ -97,7 +97,7 @@
 
         Set<DataElement> dataElements = group.getMembers();
         
-        CollectionUtils.filter( dataElements, new AggregateableDataElementPredicate() );
+        FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
         
         return dataElements;
     }

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/tablecreator/action/SaveTableAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/tablecreator/action/SaveTableAction.java	2009-11-23 12:41:03 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/tablecreator/action/SaveTableAction.java	2009-11-25 13:58:53 +0000
@@ -28,13 +28,12 @@
  */
 
 import static org.hisp.dhis.system.util.ConversionUtils.getIntegerCollection;
+import static org.hisp.dhis.system.util.ConversionUtils.getList;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
@@ -51,7 +50,6 @@
 import org.hisp.dhis.reporttable.ReportParams;
 import org.hisp.dhis.reporttable.ReportTable;
 import org.hisp.dhis.reporttable.ReportTableService;
-import org.hisp.dhis.system.util.CollectionConversionUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -364,6 +362,7 @@
     private ReportTable getReportTable()
         throws Exception
     {
+    	/*
         List<DataElement> dataElements = new CollectionConversionUtils<DataElement>().getList( 
             dataElementService.getDataElements( getIntegerCollection( selectedDataElements ) ) );
         
@@ -384,6 +383,12 @@
         
         List<DataElementCategoryOptionCombo> categoryOptionCombos = ( categoryCombo != null ) ? 
             new ArrayList<DataElementCategoryOptionCombo>( categoryCombo.getOptionCombos() ) : new ArrayList<DataElementCategoryOptionCombo>();
+*/
+        List<DataElement> dataElements = getList( dataElementService.getDataElements( getIntegerCollection( selectedDataElements ) ) );        
+        List<Indicator> indicators = getList( indicatorService.getIndicators( getIntegerCollection( selectedIndicators ) ) );        
+        List<DataSet> dataSets = getList( dataSetService.getDataSets( getIntegerCollection( selectedDataSets ) ) );        
+        List<Period> periods = getList( periodService.getPeriods( getIntegerCollection( selectedPeriods ) ) );        
+        List<OrganisationUnit> units = getList( organisationUnitService.getOrganisationUnits( getIntegerCollection( selectedOrganisationUnits ) ) );
 
         DimensionSet dimensionSet = dimensionService.getDimensionSet( dimensionSetId );
             
@@ -414,8 +419,8 @@
         if ( tableId == null )
         {
         	reportTable = new ReportTable( tableName, mode, regression,
-                    dataElements, indicators, dataSets, periods, null, organisationUnits, null,
-                    dimensionSet, doIndicators, doCategoryOptionCombos, doPeriods, doOrganisationUnits, relatives, reportParams, 
+                    dataElements, indicators, dataSets, periods, null, units, null,
+                    dimensionSet, doIndicators, doPeriods, doOrganisationUnits, relatives, reportParams, 
                     null, null );
         }
         else
@@ -427,15 +432,14 @@
             reportTable.setDataElements( dataElements );
             reportTable.setIndicators( indicators );
             reportTable.setDataSets( dataSets );
-            reportTable.setCategoryOptionCombos( categoryOptionCombos );
             reportTable.setPeriods( periods );
-            reportTable.setUnits( organisationUnits );
+            reportTable.setUnits( units );
             reportTable.setDoIndicators( doIndicators );
-            reportTable.setDoCategoryOptionCombos( doCategoryOptionCombos );
             reportTable.setDoPeriods( doPeriods );
             reportTable.setDoUnits( doOrganisationUnits );
             reportTable.setRelatives( relatives );
             reportTable.setReportParams( reportParams );
+            reportTable.setDimensionSet( dimensionSet );
         }
         
         return reportTable;