← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2334: Adding name of organisation unit report parameter to report table. This means that for the typica...

 

------------------------------------------------------------
revno: 2334
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2010-12-10 20:33:05 +0100
message:
  Adding name of organisation unit report parameter to report table. This means that for the typical report where one needs the facility data in a table and the district total in chart, one report table will suffice as the total can be retrieved with sql sum function and the district name now can be retrieved from the report table
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/CreateReportTableStatement.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/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2010-10-29 12:39:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2010-12-10 19:33:05 +0000
@@ -74,6 +74,7 @@
     public static final String ORGANISATIONUNIT_NAME = "organisationunitname";
 
     public static final String REPORTING_MONTH_COLUMN_NAME = "reporting_month_name";
+    public static final String PARAM_ORGANISATIONUNIT_COLUMN_NAME = "param_organisationunit_name";
     
     public static final String SEPARATOR = "_";
     public static final String SPACE = " ";
@@ -290,9 +291,14 @@
     private transient I18nFormat i18nFormat;
     
     /**
-     * The name of the reporting month.
+     * The name of the reporting month based on the report param.
      */
     private String reportingMonthName;
+    
+    /**
+     * The name of the (parent) organisation unit based on the report param. 
+     */
+    private String organisationUnitName;
 
     /**
      * The category option combos derived from the dimension set.
@@ -1376,6 +1382,16 @@
         this.reportingMonthName = reportingMonthName;
     }
     
+    public String getOrganisationUnitName()
+    {
+        return organisationUnitName;
+    }
+
+    public void setOrganisationUnitName( String organisationUnitName )
+    {
+        this.organisationUnitName = organisationUnitName;
+    }
+
     public List<DimensionOption> getDimensionOptions()
     {
         return dimensionOptions;

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2010-11-29 17:23:10 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2010-12-10 19:33:05 +0000
@@ -183,6 +183,7 @@
             {
                 OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
                 reportTable.getRelativeUnits().addAll( new ArrayList<OrganisationUnit>( organisationUnit.getChildren() ) );
+                reportTable.setOrganisationUnitName( organisationUnit.getName() );
                 
                 log.info( "Parent organisation unit: " + organisationUnit.getName() );
             }
@@ -198,6 +199,7 @@
                 List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
                 organisationUnits.add( organisationUnit );
                 reportTable.getRelativeUnits().addAll( organisationUnits );
+                reportTable.setOrganisationUnitName( organisationUnit.getName() );
                 
                 log.info( "Organisation unit: " + organisationUnit.getName() );
             }
@@ -477,10 +479,16 @@
                         }
                         
                         // -----------------------------------------------------
-                        // Reporting month name
+                        // Param reporting month name
                         // -----------------------------------------------------
 
                         grid.addValue( reportTable.getReportingMonthName() );
+
+                        // -----------------------------------------------------
+                        // Param organisation unit name
+                        // -----------------------------------------------------
+
+                        grid.addValue( reportTable.getOrganisationUnitName() );
                         
                         // -----------------------------------------------------
                         // Values

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/CreateReportTableStatement.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/CreateReportTableStatement.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/CreateReportTableStatement.java	2010-12-10 19:33:05 +0000
@@ -82,12 +82,18 @@
         }
 
         // ---------------------------------------------------------------------
-        // Reporting month name
+        // Param reporting month name
         // ---------------------------------------------------------------------
 
         buffer.append( ReportTable.REPORTING_MONTH_COLUMN_NAME + SPACE + LONG_TEXT_COLUMN_TYPE + SEPARATOR );
 
         // ---------------------------------------------------------------------
+        // Param organisation unit name
+        // ---------------------------------------------------------------------
+
+        buffer.append( ReportTable.PARAM_ORGANISATIONUNIT_COLUMN_NAME + SPACE + LONG_TEXT_COLUMN_TYPE + SEPARATOR );
+        
+        // ---------------------------------------------------------------------
         // Crosstab
         // ---------------------------------------------------------------------