← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 453: Minor code fixes in indian dashboard.

 

------------------------------------------------------------
revno: 453
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-07-13 14:30:40 +0200
message:
  Minor code fixes in indian dashboard.
modified:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/aa/action/GenerateAnnualAnalysisDataAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetDataElementsGroupAndDataSetAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/GenerateCommentsResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/GenerateGroupWiseDataStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/orgunitgroupsetwise/action/GenerateDataStatusOrgnisationunitGroupSetWiseResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/sa/action/GenerateSurveyAnalysisDataAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DBConnection.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/aa/action/GenerateAnnualAnalysisDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/aa/action/GenerateAnnualAnalysisDataAction.java	2009-07-10 06:54:07 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/aa/action/GenerateAnnualAnalysisDataAction.java	2009-07-13 12:30:40 +0000
@@ -346,7 +346,7 @@
         while ( iterator1.hasNext() )
         {
             List<Double> dataValues = new ArrayList<Double>();
-            int tempYear = Integer.parseInt( (String) iterator1.next() );
+            int tempYear = Integer.parseInt( iterator1.next() );
             series1[count1] = "" + tempYear;
             series2[count1] = " ";
             yseriesList.add( "" + tempYear );
@@ -355,7 +355,7 @@
             count2 = 0;
             while ( iterator2.hasNext() )
             {
-                int tempMonth = Integer.parseInt( (String) iterator2.next() );
+                int tempMonth = Integer.parseInt( iterator2.next() );
                 p = dashBoardService.getPeriodByMonth( tempMonth, tempYear, monthlyPeriodType );
                 if ( p == null )
                 {
@@ -382,8 +382,7 @@
                         Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
                         while ( optionComboIterator.hasNext() )
                         {
-                            DataElementCategoryOptionCombo decoc = (DataElementCategoryOptionCombo) optionComboIterator
-                                .next();
+                            DataElementCategoryOptionCombo decoc = optionComboIterator.next();
 
                             aggDataValue = aggregationService.getAggregatedDataValue( selectedDataElement, decoc, p
                                 .getStartDate(), p.getEndDate(), selectedOrgUnit );
@@ -458,7 +457,7 @@
         Iterator<PeriodType> iter = periodTypes.iterator();
         while ( iter.hasNext() )
         {
-            PeriodType tempPeriodType = (PeriodType) iter.next();
+            PeriodType tempPeriodType = iter.next();
             if ( tempPeriodType.getName().trim().equalsIgnoreCase( periodTypeName ) )
             {
                 periodType = tempPeriodType;

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetDataElementsGroupAndDataSetAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetDataElementsGroupAndDataSetAction.java	2009-07-10 06:54:07 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetDataElementsGroupAndDataSetAction.java	2009-07-13 12:30:40 +0000
@@ -98,7 +98,6 @@
 
     public List<DataElementGroup> getApplicableDataElementGroups( Integer dataSetId )
     {
-
         List<DataElementGroup> applicableDataElementGroups = new ArrayList<DataElementGroup>();
 
         if ( id == null || id == ALL )
@@ -120,7 +119,7 @@
 
             while ( degIterator.hasNext() )
             {
-                DataElementGroup deg = (DataElementGroup) degIterator.next();
+                DataElementGroup deg = degIterator.next();
 
                 List<DataElement> checkDataElement = new ArrayList<DataElement>( deg.getMembers() );
 

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/GenerateCommentsResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/GenerateCommentsResultAction.java	2009-07-10 06:54:07 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/GenerateCommentsResultAction.java	2009-07-13 12:30:40 +0000
@@ -34,10 +34,10 @@
 public class GenerateCommentsResultAction
     implements Action
 {
-
     // ---------------------------------------------------------------
     // Dependencies
     // ---------------------------------------------------------------
+    
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -312,7 +312,7 @@
                 while ( orgUnitIterator.hasNext() )
                 {
                     OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer
-                        .parseInt( (String) orgUnitIterator.next() ) );
+                        .parseInt( orgUnitIterator.next() ) );
                     orgUnitList.add( o );
                     List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( o.getChildren() );
                     Collections.sort( organisationUnits, new OrganisationUnitShortNameComparator() );
@@ -375,7 +375,7 @@
 
         while ( dataSetIterator.hasNext() )
         {
-            ds = dataSetService.getDataSet( Integer.parseInt( (String) dataSetIterator.next() ) );
+            ds = dataSetService.getDataSet( Integer.parseInt( dataSetIterator.next() ) );
             dataSetList.add( ds );
             dataElements = ds.getDataElements();
             deInfo = getDEInfo( dataElements );
@@ -389,12 +389,11 @@
             Iterator<OrganisationUnit> orgUnitListIterator = orgUnitList.iterator();
             OrganisationUnit o;
             Set<Source> dso = new HashSet<Source>();
-            Iterator periodIterator;
+            Iterator<Period> periodIterator;
 
             while ( orgUnitListIterator.hasNext() )
             {
-
-                o = (OrganisationUnit) orgUnitListIterator.next();
+                o = orgUnitListIterator.next();
                 orgUnitInfo = "" + o.getId();
 
                 if ( maxOULevel < organisationUnitService.getLevelOfOrganisationUnit( o ) )
@@ -407,12 +406,11 @@
                 periodIterator = periodList.iterator();
 
                 Period p;
-                Collection dataValueResult;
                 double dataStatusPercentatge;
 
                 while ( periodIterator.hasNext() )
                 {
-                    p = (Period) periodIterator.next();
+                    p = periodIterator.next();
                     periodInfo = "" + p.getId();
 
                     PreparedStatement ps1 = null;
@@ -441,8 +439,6 @@
                             OrganisationUnit ou = organisationUnitService.getOrganisationUnit( rs1.getInt( 1 ) );
                             DataElement de = dataElementService.getDataElement( rs1.getInt( 2 ) );
                             Period per = periodService.getPeriod( rs1.getInt( 3 ) );
-
-                            String tempStr = ou.getShortName() + " --- " + de.getName();
                         }
 
                         // results.add( new Integer( (int) dataStatusPercentatge
@@ -552,7 +548,7 @@
         OrganisationUnit child;
         while ( childIterator.hasNext() )
         {
-            child = (OrganisationUnit) childIterator.next();
+            child = childIterator.next();
             orgUnitTree.addAll( getChildOrgUnitTree( child ) );
         }
         return orgUnitTree;

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/GenerateGroupWiseDataStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/GenerateGroupWiseDataStatusResultAction.java	2009-07-10 06:54:07 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/action/GenerateGroupWiseDataStatusResultAction.java	2009-07-13 12:30:40 +0000
@@ -318,8 +318,6 @@
         }
         else if ( facilityLB.equals( "immChildren" ) )
         {
-            int number;
-
             selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
 
             number = selectedOrgUnit.getChildren().size();
@@ -330,7 +328,7 @@
             while ( orgUnitIterator.hasNext() )
             {
                 OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer
-                    .parseInt( (String) orgUnitIterator.next() ) );
+                    .parseInt( orgUnitIterator.next() ) );
                 orgUnitList.add( o );
                 List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( o.getChildren() );
                 Collections.sort( organisationUnits, new OrganisationUnitShortNameComparator() );
@@ -446,7 +444,7 @@
         while ( dataElementGroupIterator.hasNext() )
         {
             ds = dataSetService.getDataSet( Integer.valueOf( selectedDataSets.get( 0 ) ) );
-            deg = (DataElementGroup) dataElementGroupIterator.next();
+            deg = dataElementGroupIterator.next();
 
             dataElements = deg.getMembers();
             dataElements.retainAll( ds.getDataElements() );
@@ -465,15 +463,15 @@
                 endPeriod.getEndDate() );
             dataSetPeriods.put( ds, periodList );
 
-            Iterator orgUnitListIterator = orgUnitList.iterator();
+            Iterator<OrganisationUnit> orgUnitListIterator = orgUnitList.iterator();
             OrganisationUnit o;
             Set<Source> dso = new HashSet<Source>();
-            Iterator periodIterator;
+            Iterator<Period> periodIterator;
 
             while ( orgUnitListIterator.hasNext() )
             {
 
-                o = (OrganisationUnit) orgUnitListIterator.next();
+                o = orgUnitListIterator.next();
                 orgUnitInfo = "" + o.getId();
 
                 if ( maxOULevel < organisationUnitService.getLevelOfOrganisationUnit( o ) )
@@ -486,12 +484,12 @@
                 periodIterator = periodList.iterator();
 
                 Period p;
-                Collection dataValueResult;
+                
                 double dataStatusPercentatge;
 
                 while ( periodIterator.hasNext() )
                 {
-                    p = (Period) periodIterator.next();
+                    p = periodIterator.next();
                     periodInfo = "" + p.getId();
 
                     if ( dso == null )
@@ -749,11 +747,11 @@
 
         Collection<OrganisationUnit> children = orgUnit.getChildren();
 
-        Iterator childIterator = children.iterator();
+        Iterator<OrganisationUnit> childIterator = children.iterator();
         OrganisationUnit child;
         while ( childIterator.hasNext() )
         {
-            child = (OrganisationUnit) childIterator.next();
+            child = childIterator.next();
             orgUnitTree.addAll( getChildOrgUnitTree( child ) );
         }
         return orgUnitTree;
@@ -824,11 +822,11 @@
 
         List<DataElementGroup> applicableDataElementGroups = new ArrayList<DataElementGroup>();
 
-        Iterator degIterator = allDataElementGroups.iterator();
+        Iterator<DataElementGroup> degIterator = allDataElementGroups.iterator();
 
         while ( degIterator.hasNext() )
         {
-            DataElementGroup deg = (DataElementGroup) degIterator.next();
+            DataElementGroup deg = degIterator.next();
 
             List<DataElement> checkDataElement = new ArrayList<DataElement>( deg.getMembers() );
 

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/orgunitgroupsetwise/action/GenerateDataStatusOrgnisationunitGroupSetWiseResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/orgunitgroupsetwise/action/GenerateDataStatusOrgnisationunitGroupSetWiseResultAction.java	2009-07-10 06:54:07 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/orgunitgroupsetwise/action/GenerateDataStatusOrgnisationunitGroupSetWiseResultAction.java	2009-07-13 12:30:40 +0000
@@ -61,10 +61,10 @@
 public class GenerateDataStatusOrgnisationunitGroupSetWiseResultAction
     implements Action
 {
-
     // ---------------------------------------------------------------
     // Dependencies
     // ---------------------------------------------------------------
+    
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -349,7 +349,7 @@
         while ( orgUnitListCBIterator.hasNext() )
         {
             OrganisationUnitGroup og = organisationUnitGroupService.getOrganisationUnitGroup( Integer
-                .parseInt( (String) orgUnitListCBIterator.next() ) );
+                .parseInt( orgUnitListCBIterator.next() ) );
             orgUnitGroupList.add( og );
 
         }
@@ -373,7 +373,7 @@
             Iterator<OrganisationUnit> orgUnitsIterator = orgUnits.iterator();
             while ( orgUnitsIterator.hasNext() )
             {
-                OrganisationUnit o = (OrganisationUnit) orgUnitsIterator.next();
+                OrganisationUnit o = orgUnitsIterator.next();
                 orgUnitList.add( o );
             }
 
@@ -607,7 +607,7 @@
         OrganisationUnit child;
         while ( childIterator.hasNext() )
         {
-            child = (OrganisationUnit) childIterator.next();
+            child = childIterator.next();
             orgUnitTree.addAll( getChildOrgUnitTree( child ) );
         }
         return orgUnitTree;

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataAction.java	2009-07-10 06:54:07 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataAction.java	2009-07-13 12:30:40 +0000
@@ -474,10 +474,10 @@
 
         if ( riRadio.equals( "indicatorsRadio" ) )
         {
-            Iterator indicatorIterator = selectedIndicators.iterator();
+            Iterator<String> indicatorIterator = selectedIndicators.iterator();
             while ( indicatorIterator.hasNext() )
             {
-                int serviceID = Integer.parseInt( (String) indicatorIterator.next() );
+                int serviceID = Integer.parseInt( indicatorIterator.next() );
                 Indicator indicator = indicatorService.getIndicator( serviceID );
                 // selectedServiceList.add( indicator );
                 li1.add( indicator );
@@ -508,10 +508,10 @@
             }
             if ( deSelection.equalsIgnoreCase( "optioncombo" ) )
             {
-                Iterator deIterator = selectedDataElements.iterator();
+                Iterator<String> deIterator = selectedDataElements.iterator();
                 while ( deIterator.hasNext() )
                 {
-                    String serviceId = (String) deIterator.next();
+                    String serviceId = deIterator.next();
                     String partsOfServiceId[] = serviceId.split( ":" );
                     int dataElementId = Integer.parseInt( partsOfServiceId[0] );
                     DataElement dataElement = dataElementService.getDataElement( dataElementId );
@@ -527,10 +527,10 @@
             }
             else
             {
-                Iterator deIterator = selectedDataElements.iterator();
+                Iterator<String> deIterator = selectedDataElements.iterator();
                 while ( deIterator.hasNext() )
                 {
-                    int serviceID = Integer.parseInt( (String) deIterator.next() );
+                    int serviceID = Integer.parseInt( deIterator.next() );
                     DataElement dataElement = dataElementService.getDataElement( serviceID );
                     // selectedServiceList.add( dataElement );
                     li2.add( dataElement );
@@ -550,7 +550,7 @@
         /* Hack to Intialize Indicator Targets to Zeros */
         if ( riRadio.equals( "indicatorsRadio" ) )
         {
-            Iterator serviceIterator = selectedServiceList.iterator();
+            Iterator<Object> serviceIterator = selectedServiceList.iterator();
             while ( serviceIterator.hasNext() )
             {
                 Indicator indicator = (Indicator) serviceIterator.next();
@@ -564,12 +564,12 @@
         endPeriod = periodService.getPeriod( eDateLB );
 
         int monthlyPeriodTypeId = 0;
-        Collection periodTypes = periodService.getAllPeriodTypes();
+        Collection<PeriodType> periodTypes = periodService.getAllPeriodTypes();
         PeriodType monthlyPeriodType = null;
-        Iterator iter = periodTypes.iterator();
+        Iterator<PeriodType> iter = periodTypes.iterator();
         while ( iter.hasNext() )
         {
-            PeriodType periodType = (PeriodType) iter.next();
+            PeriodType periodType = iter.next();
             if ( periodType.getName().toLowerCase().trim().equals( "monthly" ) )
             {
                 monthlyPeriodType = periodType;
@@ -684,7 +684,7 @@
         series2 = new String[selectedServiceList.size()];
         categories1 = new String[selectedPeriodList.size()];
         categories2 = new String[selectedPeriodList.size()];
-        Iterator serviceListIterator = selectedServiceList.iterator();
+        Iterator<Object> serviceListIterator = selectedServiceList.iterator();
         while ( serviceListIterator.hasNext() )
         {
             List<String> numValues = new ArrayList<String>();
@@ -703,10 +703,10 @@
 
                 List<Period> tempPeriodList = new ArrayList<Period>( periodService.getIntersectingPeriods( startPeriod
                     .getStartDate(), endPeriod.getEndDate() ) );
-                Iterator tempPeriodListIterator = tempPeriodList.iterator();
+                Iterator<Period> tempPeriodListIterator = tempPeriodList.iterator();
                 while ( tempPeriodListIterator.hasNext() )
                 {
-                    Period tempPeriod = (Period) tempPeriodListIterator.next();
+                    Period tempPeriod = tempPeriodListIterator.next();
                     if ( ougSetCB == null )
                     {
                         // List<Target> tempTarget = new ArrayList<Target>(
@@ -779,7 +779,7 @@
                     yseriesList.add( dElement.getName() );
                 }
             }
-            Iterator periodListIterator = selectedPeriodList.iterator();
+            Iterator<Period> periodListIterator = selectedPeriodList.iterator();
             countForPeriodList = 0;
             while ( periodListIterator.hasNext() )
             {
@@ -812,7 +812,7 @@
                         Iterator<OrganisationUnit> orgUnitsIterator = orgUnits.iterator();
                         while ( orgUnitsIterator.hasNext() )
                         {
-                            OrganisationUnit ou = (OrganisationUnit) orgUnitsIterator.next();
+                            OrganisationUnit ou = orgUnitsIterator.next();
                             double tempd = aggregationService.getAggregatedIndicatorValue( ind, p.getStartDate(), p
                                 .getEndDate(), ou );
                             double tempnum = aggregationService.getAggregatedNumeratorValue( ind, p.getStartDate(), p
@@ -867,7 +867,7 @@
                                 Iterator<OrganisationUnit> orgUnitsIterator = orgUnits.iterator();
                                 while ( orgUnitsIterator.hasNext() )
                                 {
-                                    OrganisationUnit ou = (OrganisationUnit) orgUnitsIterator.next();
+                                    OrganisationUnit ou = orgUnitsIterator.next();
 
                                     double tempd = -1.0;
                                     DataValue dv1 = dataValueService.getDataValue( ou, dElement, p, decoc );
@@ -887,7 +887,7 @@
                                 Iterator<OrganisationUnit> orgUnitsIterator = orgUnits.iterator();
                                 while ( orgUnitsIterator.hasNext() )
                                 {
-                                    OrganisationUnit ou = (OrganisationUnit) orgUnitsIterator.next();
+                                    OrganisationUnit ou = orgUnitsIterator.next();
                                     double tempd = aggregationService.getAggregatedDataValue( dElement, decoc, p
                                         .getStartDate(), p.getEndDate(), ou );
                                     if ( tempd == -1 )
@@ -910,8 +910,7 @@
                         Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
                         while ( optionComboIterator.hasNext() )
                         {
-                            DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator
-                                .next();
+                            DataElementCategoryOptionCombo decoc1 = optionComboIterator.next();
 
                             if ( ougSetCB == null )
                             {
@@ -939,7 +938,7 @@
                                 Iterator<OrganisationUnit> orgUnitsIterator = orgUnits.iterator();
                                 while ( orgUnitsIterator.hasNext() )
                                 {
-                                    OrganisationUnit ou = (OrganisationUnit) orgUnitsIterator.next();
+                                    OrganisationUnit ou = orgUnitsIterator.next();
                                     double tempd = 0.0;
                                     if ( aggDataCB == null )
                                     {
@@ -1035,7 +1034,7 @@
                 // childOrgUnitList = new ArrayList<Object>(
                 // selectedOrgUnitGroup.getMembers() );
                 childOrgUnitList = new ArrayList<Object>();
-                Iterator orgUnitGroupIte = orgUnitListCB.iterator();
+                Iterator<String> orgUnitGroupIte = orgUnitListCB.iterator();
                 while ( orgUnitGroupIte.hasNext() )
                 {
                     OrganisationUnitGroup oug = organisationUnitGroupService.getOrganisationUnitGroup( Integer
@@ -1050,26 +1049,27 @@
         {
             if ( ougSetCB == null )
             {
-                Iterator orgUnitIterator = orgUnitListCB.iterator();
+                Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
                 while ( orgUnitIterator.hasNext() )
                 {
                     OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer
-                        .parseInt( (String) orgUnitIterator.next() ) );
+                        .parseInt( orgUnitIterator.next() ) );
                     childOrgUnitList.add( o );
                 }
             }
             else
             {
-                Iterator orgUnitGroupIte = orgUnitListCB.iterator();
+                Iterator<String> orgUnitGroupIte = orgUnitListCB.iterator();
                 while ( orgUnitGroupIte.hasNext() )
                 {
                     OrganisationUnitGroup oug = organisationUnitGroupService.getOrganisationUnitGroup( Integer
-                        .parseInt( (String) orgUnitGroupIte.next() ) );
+                        .parseInt( orgUnitGroupIte.next() ) );
                     childOrgUnitList.add( oug );
                 }
             }
         }
-        Iterator serviceListIterator = selectedServiceList.iterator();
+        
+        Iterator<Object> serviceListIterator = selectedServiceList.iterator();
         Double[][] serviceValues = new Double[selectedServiceList.size()][childOrgUnitList.size()];
 
         data2 = new Double[selectedServiceList.size()][childOrgUnitList.size()];
@@ -1096,10 +1096,10 @@
 
                 List<Period> tempPeriodList = new ArrayList<Period>( periodService.getIntersectingPeriods( startPeriod
                     .getStartDate(), endPeriod.getEndDate() ) );
-                Iterator tempPeriodListIterator = tempPeriodList.iterator();
+                Iterator<Period> tempPeriodListIterator = tempPeriodList.iterator();
                 while ( tempPeriodListIterator.hasNext() )
                 {
-                    Period tempPeriod = (Period) tempPeriodListIterator.next();
+                    Period tempPeriod = tempPeriodListIterator.next();
                     if ( ougSetCB == null )
                     {
                         if ( facilityLB.equals( "children" ) )
@@ -1217,7 +1217,7 @@
 
             double numVal = 0.0;
             double denVal = 0.0;
-            Iterator childOrgUnitListIterator = childOrgUnitList.iterator();
+            Iterator<Object> childOrgUnitListIterator = childOrgUnitList.iterator();
             countForChildOrgUnitList = 0;
             while ( childOrgUnitListIterator.hasNext() )
             {
@@ -1261,7 +1261,7 @@
                         Iterator<OrganisationUnit> orgUnitsIterator = orgUnits.iterator();
                         while ( orgUnitsIterator.hasNext() )
                         {
-                            OrganisationUnit ou = (OrganisationUnit) orgUnitsIterator.next();
+                            OrganisationUnit ou = orgUnitsIterator.next();
                             double tempd = aggregationService.getAggregatedIndicatorValue( ind, startPeriod
                                 .getStartDate(), endPeriod.getEndDate(), ou );
                             double tempnum = aggregationService.getAggregatedNumeratorValue( ind, startPeriod
@@ -1301,7 +1301,7 @@
                         {
                             if ( ougSetCB == null )
                             {
-                                noOfChildren = dashBoardService.getAllChildren( (OrganisationUnit) childOrgUnit )
+                                noOfChildren = dashBoardService.getAllChildren( childOrgUnit )
                                     .size();
                             }
                             else
@@ -1343,7 +1343,7 @@
                             Iterator<OrganisationUnit> orgUnitsIterator = orgUnits.iterator();
                             while ( orgUnitsIterator.hasNext() )
                             {
-                                OrganisationUnit ou = (OrganisationUnit) orgUnitsIterator.next();
+                                OrganisationUnit ou = orgUnitsIterator.next();
                                 double tempd = 0.0;
                                 if ( aggDataCB == null )
                                 {
@@ -1384,8 +1384,7 @@
                         Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
                         while ( optionComboIterator.hasNext() )
                         {
-                            DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator
-                                .next();
+                            DataElementCategoryOptionCombo decoc1 = optionComboIterator.next();
                             if ( ougSetCB == null || facilityLB.equals( "children" ) )
                             {
                                 if ( aggDataCB == null )
@@ -1415,7 +1414,7 @@
                                 Iterator<OrganisationUnit> orgUnitsIterator = orgUnits.iterator();
                                 while ( orgUnitsIterator.hasNext() )
                                 {
-                                    OrganisationUnit ou = (OrganisationUnit) orgUnitsIterator.next();
+                                    OrganisationUnit ou = orgUnitsIterator.next();
                                     double tempd = 0.0;
 
                                     if ( aggDataCB == null )
@@ -1558,7 +1557,7 @@
 
             String query = "SELECT target FROM indicator WHERE indicatorid = ?";
             pst = con.prepareStatement( query );
-            Iterator serviceIterator = selectedServiceList.iterator();
+            Iterator<Object> serviceIterator = selectedServiceList.iterator();
             while ( serviceIterator.hasNext() )
             {
                 Indicator indicator = (Indicator) serviceIterator.next();

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/sa/action/GenerateSurveyAnalysisDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/sa/action/GenerateSurveyAnalysisDataAction.java	2009-07-10 06:54:07 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/sa/action/GenerateSurveyAnalysisDataAction.java	2009-07-13 12:30:40 +0000
@@ -319,10 +319,10 @@
         {
             indicatorListSize = selectedIndicators.size();
             System.out.println( "First Indicator : " + selectedIndicators.get( 0 ) );
-            Iterator indicatorIterator = selectedIndicators.iterator();
+            Iterator<String> indicatorIterator = selectedIndicators.iterator();
             while ( indicatorIterator.hasNext() )
             {
-                int serviceID = Integer.parseInt( (String) indicatorIterator.next() );
+                int serviceID = Integer.parseInt( indicatorIterator.next() );
                 Indicator indicator = indicatorService.getIndicator( serviceID );
                 selectedServiceList.add( indicator );
                 chartTitle += indicator.getName() + ", ";
@@ -338,10 +338,10 @@
         }
         else
         {
-            Iterator deIterator = selectedDataElements.iterator();
+            Iterator<String> deIterator = selectedDataElements.iterator();
             while ( deIterator.hasNext() )
             {
-                int serviceID = Integer.parseInt( (String) deIterator.next() );
+                int serviceID = Integer.parseInt( deIterator.next() );
                 DataElement dataElement = dataElementService.getDataElement( serviceID );
                 selectedServiceList.add( dataElement );
                 chartTitle += dataElement.getShortName() + ", ";
@@ -429,15 +429,15 @@
         }
         else
         {
-            Iterator orgUnitIterator = orgUnitListCB.iterator();
+            Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
             while ( orgUnitIterator.hasNext() )
             {
                 OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer
-                    .parseInt( (String) orgUnitIterator.next() ) );
+                    .parseInt( orgUnitIterator.next() ) );
                 childOrgUnitList.add( o );
             }
         }
-        Iterator serviceListIterator = selectedServiceList.iterator();
+        Iterator<Object> serviceListIterator = selectedServiceList.iterator();
         Double[][] serviceValues = new Double[selectedServiceList.size()][childOrgUnitList.size()];
 
         data2 = new Double[selectedServiceList.size()][childOrgUnitList.size()];
@@ -467,11 +467,11 @@
                 yseriesList.add( dElement.getName() );
             }
 
-            Iterator childOrgUnitListIterator = childOrgUnitList.iterator();
+            Iterator<OrganisationUnit> childOrgUnitListIterator = childOrgUnitList.iterator();
             countForChildOrgUnitList = 0;
             while ( childOrgUnitListIterator.hasNext() )
             {
-                OrganisationUnit childOrgUnit = (OrganisationUnit) childOrgUnitListIterator.next();
+                OrganisationUnit childOrgUnit = childOrgUnitListIterator.next();
                 if ( riRadio.equals( "indicatorsRadio" ) )
                 {
                     serviceValues[countForServiceList][countForChildOrgUnitList] = aggregationService
@@ -490,8 +490,7 @@
                     Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
                     while ( optionComboIterator.hasNext() )
                     {
-                        DataElementCategoryOptionCombo decoc = (DataElementCategoryOptionCombo) optionComboIterator
-                            .next();
+                        DataElementCategoryOptionCombo decoc = optionComboIterator.next();
 
                         aggDataValue = aggregationService.getAggregatedDataValue( dElement, decoc, startPeriod
                             .getStartDate(), endPeriod.getEndDate(), childOrgUnit );

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java	2009-07-10 06:54:07 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java	2009-07-13 12:30:40 +0000
@@ -144,21 +144,21 @@
         selectedOrgUnitList = new ArrayList<OrganisationUnit>();
         if ( orgUnitListCB == null )
             System.out.println( "orgunit list is null" );
-        Iterator orgUnitIterator = orgUnitListCB.iterator();
+        Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
         while ( orgUnitIterator.hasNext() )
         {
             OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer
-                .parseInt( (String) orgUnitIterator.next() ) );
+                .parseInt( orgUnitIterator.next() ) );
             selectedOrgUnitList.add( o );
         }
 
         /* DataElement Info */
         selectedDataElementList = new ArrayList<DataElement>();
-        Iterator dataElementIterator = selectedDataElements.iterator();
+        Iterator<String> dataElementIterator = selectedDataElements.iterator();
         while ( dataElementIterator.hasNext() )
         {
             DataElement de = dataElementService
-                .getDataElement( Integer.parseInt( (String) dataElementIterator.next() ) );
+                .getDataElement( Integer.parseInt( dataElementIterator.next() ) );
             selectedDataElementList.add( de );
         }
 
@@ -169,17 +169,18 @@
         /* Result Calculation Part */
         double rowTotal = 0.0;
         dataValueResult = new HashMap<DataElement, List<Double>>();
-        dataElementIterator = selectedDataElementList.iterator();
-        while ( dataElementIterator.hasNext() )
+        Iterator<DataElement> selectedDataElementIterator = selectedDataElementList.iterator();
+        
+        while ( selectedDataElementIterator.hasNext() )
         {
-            DataElement de = (DataElement) dataElementIterator.next();
+            DataElement de = selectedDataElementIterator.next();
 
             List<Double> dataValue = new ArrayList<Double>();
-            orgUnitIterator = selectedOrgUnitList.iterator();
+            Iterator<OrganisationUnit> selectedOrgUnitIterator = selectedOrgUnitList.iterator();
             rowTotal = 0.0;
-            while ( orgUnitIterator.hasNext() )
+            while ( selectedOrgUnitIterator.hasNext() )
             {
-                OrganisationUnit ou = (OrganisationUnit) orgUnitIterator.next();
+                OrganisationUnit ou = selectedOrgUnitIterator.next();
                 //System.out.println( de.getAlternativeName() + " : " + startPeriod.getStartDate() + " : "
                     //+ endPeriod.getEndDate() + " : " + ou.getShortName() );
                 double aggDataValue = 0.0;
@@ -192,7 +193,7 @@
                 Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
                 while ( optionComboIterator.hasNext() )
                 {
-                    DataElementCategoryOptionCombo decoc = (DataElementCategoryOptionCombo) optionComboIterator.next();
+                    DataElementCategoryOptionCombo decoc = optionComboIterator.next();
 
                     aggDataValue = aggregationService.getAggregatedDataValue( de, decoc, startPeriod.getStartDate(),
                         endPeriod.getEndDate(), ou );

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DBConnection.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DBConnection.java	2009-07-08 09:58:18 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DBConnection.java	2009-07-13 12:30:40 +0000
@@ -151,7 +151,7 @@
             input = new BufferedReader( fr );
 
             String s = input.readLine();
-            while ( s instanceof String )
+            while ( s instanceof String ) //TODO wtf?
             {
                 if ( s.contains( "jdbc:mysql:" ) )
                 {

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java	2009-07-10 06:54:07 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java	2009-07-13 12:30:40 +0000
@@ -67,10 +67,10 @@
         PeriodType monthlyPeriodType = getPeriodTypeObject( "monthly" );
 
         List<Period> monthlyPeriodList = new ArrayList<Period>();
-        Iterator it = periodList.iterator();
+        Iterator<Period> it = periodList.iterator();
         while ( it.hasNext() )
         {
-            Period period = (Period) it.next();
+            Period period = it.next();
             if ( period.getPeriodType().getId() == monthlyPeriodType.getId() )
             {
                 monthlyPeriodList.add( period );
@@ -139,12 +139,12 @@
      */
     public PeriodType getPeriodTypeObject( String periodTypeName )
     {
-        Collection periodTypes = periodService.getAllPeriodTypes();
+        Collection<PeriodType> periodTypes = periodService.getAllPeriodTypes();
         PeriodType periodType = null;
-        Iterator iter = periodTypes.iterator();
+        Iterator<PeriodType> iter = periodTypes.iterator();
         while ( iter.hasNext() )
         {
-            PeriodType tempPeriodType = (PeriodType) iter.next();
+            PeriodType tempPeriodType = iter.next();
             if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
             {
                 periodType = tempPeriodType;
@@ -166,10 +166,10 @@
     {
         List<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>();
 
-        Iterator it = selecteOU.getChildren().iterator();
+        Iterator<OrganisationUnit> it = selecteOU.getChildren().iterator();
         while ( it.hasNext() )
         {
-            OrganisationUnit orgU = (OrganisationUnit) it.next();
+            OrganisationUnit orgU = it.next();
             ouList.add( orgU );
         }
         return ouList;



--
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.