dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20045
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9011: Switched to org unit uid in report table generation
------------------------------------------------------------
revno: 9011
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-11-13 19:52:00 +0100
message:
Switched to org unit uid in report table generation
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.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/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.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/ReportTableService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2012-09-24 06:10:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2012-11-13 18:52:00 +0000
@@ -109,18 +109,6 @@
* Instantiates and populates a Grid populated with data from the ReportTable
* with the given identifier.
*
- * @param id the ReportTable identifier.
- * @param format the I18nFormat.
- * @param reportingPeriod the reporting date.
- * @param organisationUnitId the organisation unit identifier.
- * @return a Grid.
- */
- Grid getReportTableGrid( int id, I18nFormat format, Date reportingPeriod, Integer organisationUnitId );
-
- /**
- * Instantiates and populates a Grid populated with data from the ReportTable
- * with the given identifier.
- *
* @param uid the ReportTable unique identifier.
* @param format the I18nFormat.
* @param reportingPeriod the reporting date.
@@ -129,6 +117,8 @@
*/
Grid getReportTableGrid( String uid, I18nFormat format, Date reportingPeriod, String organisationUnitUid );
+ Grid getReportTableGrid( int reportTableId, I18nFormat format, Date reportingPeriod, String organisationUnitUid );
+
/**
* Instantiates and populates a Grid populated with data from the given
* ReportTable.
=== 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 2012-11-07 13:38:42 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2012-11-13 18:52:00 +0000
@@ -124,37 +124,31 @@
// ReportTableService implementation
// -------------------------------------------------------------------------
+ @Override
public Grid getReportTableGrid( String uid, I18nFormat format, Date reportingPeriod, String organisationUnitUid )
{
ReportTable reportTable = getReportTable( uid );
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitUid );
-
- Integer organisationUnitId = organisationUnit != null ? organisationUnit.getId() : null;
-
- return getReportTableGrid( reportTable.getId(), format, reportingPeriod, organisationUnitId );
+ return getReportTableGrid( reportTable, format, reportingPeriod, organisationUnitUid, false );
}
- public Grid getReportTableGrid( int id, I18nFormat format, Date reportingPeriod, Integer organisationUnitId )
+ @Override
+ public Grid getReportTableGrid( int reportTableId, I18nFormat format, Date reportingPeriod, String organisationUnitUid )
{
- ReportTable reportTable = getReportTable( id );
-
- reportTable = initDynamicMetaObjects( reportTable, reportingPeriod, organisationUnitId, format );
-
- return getGrid( reportTable, false );
+ ReportTable reportTable = getReportTable( reportTableId );
+
+ return getReportTableGrid( reportTable, format, reportingPeriod, organisationUnitUid, false );
}
-
+
+ @Override
public Grid getReportTableGrid( ReportTable reportTable, I18nFormat format, Date reportingPeriod, String organisationUnitUid, boolean minimal )
{
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitUid );
-
- Integer organisationUnitId = organisationUnit != null ? organisationUnit.getId() : null;
-
- reportTable = initDynamicMetaObjects( reportTable, reportingPeriod, organisationUnitId, format );
+ reportTable = initDynamicMetaObjects( reportTable, reportingPeriod, organisationUnitUid, format );
return getGrid( reportTable, minimal );
}
+ @Override
public ReportTable getReportTable( String uid, String mode )
{
if ( mode.equals( MODE_REPORT_TABLE ) )
@@ -256,7 +250,7 @@
* @return a report table.
*/
private ReportTable initDynamicMetaObjects( ReportTable reportTable, Date reportingPeriod,
- Integer organisationUnitId, I18nFormat format )
+ String organisationUnitUid, I18nFormat format )
{
// ---------------------------------------------------------------------
// Reporting period report parameter / current reporting period
@@ -289,7 +283,7 @@
if ( reportTable.getReportParams() != null &&
reportTable.getReportParams().isParamGrandParentOrganisationUnit() )
{
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitUid );
organisationUnit.setCurrentParent( true );
reportTable.getRelativeUnits().addAll(
new ArrayList<OrganisationUnit>( organisationUnit.getGrandChildren() ) );
@@ -306,7 +300,7 @@
if ( reportTable.getReportParams() != null &&
reportTable.getReportParams().isParamParentOrganisationUnit() )
{
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitUid );
organisationUnit.setCurrentParent( true );
reportTable.getRelativeUnits().addAll( new ArrayList<OrganisationUnit>( organisationUnit.getChildren() ) );
reportTable.getRelativeUnits().add( organisationUnit );
@@ -322,7 +316,7 @@
if ( reportTable.getReportParams() != null &&
reportTable.getReportParams().isParamOrganisationUnit() )
{
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitUid );
reportTable.getRelativeUnits().add( organisationUnit );
reportTable.setParentOrganisationUnit( organisationUnit );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java 2012-08-31 14:38:21 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java 2012-11-13 18:52:00 +0000
@@ -399,7 +399,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, null, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, null, "0" );
assertEquals( 21.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 23.0, grid.getRow( 0 ).get( 9 ) );
@@ -423,7 +423,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 21.0, grid.getRow( 0 ).get( 13 ) );
assertEquals( 22.0, grid.getRow( 0 ).get( 14 ) );
@@ -449,7 +449,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 21.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 22.0, grid.getRow( 0 ).get( 9 ) );
@@ -473,7 +473,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 21.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 23.0, grid.getRow( 0 ).get( 9 ) );
@@ -497,7 +497,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 21.0, grid.getRow( 0 ).get( 13 ) );
assertEquals( 22.0, grid.getRow( 0 ).get( 14 ) );
@@ -523,7 +523,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 21.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 22.0, grid.getRow( 0 ).get( 9 ) );
@@ -560,7 +560,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 21.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 31.0, grid.getRow( 0 ).get( 9 ) );
@@ -606,7 +606,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 21.0, grid.getRow( 0 ).get( 13 ) );
assertEquals( 31.0, grid.getRow( 0 ).get( 14 ) );
@@ -642,7 +642,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, null, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, null, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 13.0, grid.getRow( 0 ).get( 9 ) );
@@ -664,7 +664,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 13 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 14 ) );
@@ -688,7 +688,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 9 ) );
@@ -710,7 +710,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 13.0, grid.getRow( 0 ).get( 9 ) );
@@ -732,7 +732,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 13 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 14 ) );
@@ -756,7 +756,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 9 ) );
@@ -778,7 +778,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 13.0, grid.getRow( 0 ).get( 9 ) );
@@ -800,7 +800,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 13 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 14 ) );
@@ -824,7 +824,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 9 ) );
@@ -859,7 +859,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 11.0, grid.getRow( 0 ).get( 9 ) );
@@ -902,7 +902,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 13 ) );
assertEquals( 11.0, grid.getRow( 0 ).get( 14 ) );
@@ -947,7 +947,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 11.0, grid.getRow( 0 ).get( 9 ) );
@@ -990,7 +990,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 18 ) );
assertEquals( 11.0, grid.getRow( 0 ).get( 19 ) );
@@ -1034,7 +1034,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 13.0, grid.getRow( 0 ).get( 9 ) );
@@ -1072,7 +1072,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 13 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 14 ) );
@@ -1120,7 +1120,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 9 ) );
@@ -1158,7 +1158,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 3 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 4 ) );
@@ -1179,7 +1179,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 18 ) );
assertEquals( 12.0, grid.getRow( 1 ).get( 18 ) );
@@ -1201,7 +1201,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 2, grid.getHeight() );
@@ -1222,7 +1222,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 17.0, grid.getRow( 0 ).get( 13 ) );
assertEquals( 18.0, grid.getRow( 0 ).get( 14 ) );
@@ -1248,7 +1248,7 @@
int id = reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, 0 );
+ Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
assertEquals( 12.0, grid.getRow( 0 ).get( 9 ) );