dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10568
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2899: Changed Grid value type from String to Object, allows for more flexibility. Changed ReportTable s...
------------------------------------------------------------
revno: 2899
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-02-23 15:27:49 +0100
message:
Changed Grid value type from String to Object, allows for more flexibility. Changed ReportTable so that nothing is displayed instead of 0 when there is no data.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Grid.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/orgunitdistribution/impl/DefaultOrgUnitDistributionService.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
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/GenericBatchHandler.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CsvUtils.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridTest.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/encoding/velocity/EncoderVelocityContext.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridCsvResult.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridJrxmlResult.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm
--
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/common/Grid.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Grid.java 2011-02-18 19:27:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Grid.java 2011-02-23 14:27:49 +0000
@@ -107,32 +107,32 @@
*
* @param value the value to add.
*/
- Grid addValue( String value );
+ Grid addValue( Object value );
/**
* Returns the row with the given index.
*
* @param rowIndex the index of the row.
*/
- List<String> getRow( int rowIndex );
+ List<Object> getRow( int rowIndex );
/**
* Returns all rows.
*/
- List<List<String>> getRows();
+ List<List<Object>> getRows();
/**
* Returns all visible rows, ie. rows with a corresponding header that is
* not hidden.
*/
- List<List<String>> getVisibleRows();
+ List<List<Object>> getVisibleRows();
/**
* Returns the column with the given index.
*
* @param columnIndex the index of the column.
*/
- List<String> getColumn( int columnIndex );
+ List<Object> getColumn( int columnIndex );
/**
* Return the value at the given row index and the given column index.
@@ -142,7 +142,7 @@
* @return the column value.
* @throws IllegalArgumentException if the grid does not contain the requested row / column.
*/
- String getValue( int rowIndex, int columnIndex );
+ Object getValue( int rowIndex, int columnIndex );
/**
* Adds a new column at the end of the grid.
@@ -151,7 +151,7 @@
* @throws IllegalStateException if the columnValues has different length
* than the rows in grid, or if the grid rows are not of the same length.
*/
- Grid addColumn( List<String> columnValues );
+ Grid addColumn( List<Object> columnValues );
/**
* Removes the header and column at the given index.
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2011-02-22 23:05:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2011-02-23 14:27:49 +0000
@@ -87,6 +87,7 @@
executeSql( "DROP TABLE reporttable_displaycolumns" );
executeSql( "DROP TABLE reportreporttables" );
executeSql( "ALTER TABLE dataelementcategoryoption drop column categoryid" );
+ executeSql( "ALTER TABLE reporttable DROP column dimension_type" );
executeSql( "ALTER TABLE reporttable DROP column dimensiontype" );
executeSql( "ALTER TABLE categoryoptioncombo DROP COLUMN displayorder" );
executeSql( "ALTER TABLE dataelementcategoryoption DROP COLUMN shortname" );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/orgunitdistribution/impl/DefaultOrgUnitDistributionService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/orgunitdistribution/impl/DefaultOrgUnitDistributionService.java 2011-01-26 10:01:53 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/orgunitdistribution/impl/DefaultOrgUnitDistributionService.java 2011-02-23 14:27:49 +0000
@@ -98,7 +98,7 @@
for ( int i = 1; i < grid.getWidth(); i++ ) // Skip name column
{
- categoryValues.put( grid.getHeaders().get( i ).getName(), Double.valueOf( grid.getRow( 0 ).get( i ) ) );
+ categoryValues.put( grid.getHeaders().get( i ).getName(), Double.valueOf( String.valueOf( grid.getRow( 0 ).get( i ) ) ) );
}
String title = groupSet.getName() + TITLE_SEP + organisationUnit.getName();
@@ -145,7 +145,7 @@
{
Collection<OrganisationUnit> result = CollectionUtils.intersection( subTree, group.getMembers() );
- grid.addValue( result != null ? String.valueOf( result.size() ) : String.valueOf( 0 ) );
+ grid.addValue( result != null ? result.size() : 0 );
}
}
=== 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 2011-02-22 23:05:45 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2011-02-23 14:27:49 +0000
@@ -84,7 +84,6 @@
{
private static final Log log = LogFactory.getLog( DefaultReportTableService.class );
- private static final String NULL_REPLACEMENT = "0.0";
private static final String MODE_REPORT = "report";
private static final String MODE_REPORT_TABLE = "table";
@@ -237,7 +236,7 @@
batchHandler.setTableName( reportTable.getTableName() );
batchHandler.init();
- for ( List<String> row : grid.getRows() )
+ for ( List<Object> row : grid.getRows() )
{
batchHandler.addObject( row );
}
@@ -506,7 +505,7 @@
for ( IdentifiableObject object : row ) // TODO change order and get one loop?
{
- grid.addValue( String.valueOf( object.getId() ) ); // Index columns
+ grid.addValue( object.getId() ); // Index columns
}
for ( IdentifiableObject object : row )
@@ -516,21 +515,21 @@
grid.addValue( reportTable.getReportingMonthName() );
grid.addValue( reportTable.getOrganisationUnitName() );
- grid.addValue( isCurrentParent( row ) ? String.valueOf( 1 ) : String.valueOf( 0 ) );
+ grid.addValue( isCurrentParent( row ) ? 1 : 0 );
for ( List<IdentifiableObject> column : reportTable.getColumns() )
{
- grid.addValue( toString( map.get( getIdentifier( row, column ) ) ) ); // Values
+ grid.addValue( map.get( getIdentifier( row, column ) ) ); // Values
}
if ( reportTable.doTotal() )
{
for ( DataElementCategoryOption categoryOption : reportTable.getCategoryCombo().getCategoryOptions() )
{
- grid.addValue( toString( map.get( getIdentifier( row, DataElementCategoryOption.class, categoryOption.getId() ) ) ) );
+ grid.addValue( map.get( getIdentifier( row, DataElementCategoryOption.class, categoryOption.getId() ) ) );
}
- grid.addValue( toString( map.get( getIdentifier( row ) ) ) ); // Only category option combo is crosstab when total, row identifier will return total
+ grid.addValue( map.get( getIdentifier( row ) ) ); // Only category option combo is crosstab when total, row identifier will return total
}
}
@@ -569,14 +568,4 @@
return false;
}
-
- /**
- * Converts the given Double to String or replaces with default value if null.
- *
- * @param value the Double.
- */
- private String toString( Double value )
- {
- return value != null ? String.valueOf( value ) : NULL_REPLACEMENT;
- }
}
=== 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 2011-02-18 19:27:56 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java 2011-02-23 14:27:49 +0000
@@ -340,15 +340,15 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 13.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 16.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 8 ) );
}
@Test
@@ -362,17 +362,17 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 8 ) );
-
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 8 ) );
-
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 2 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 2 ).get( 8 ) );
-
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 3 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 3 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 8 ) );
+
+ assertEquals( 13.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 8 ) );
+
+ assertEquals( 15.0, grid.getRow( 2 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 2 ).get( 8 ) );
+
+ assertEquals( 17.0, grid.getRow( 3 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 3 ).get( 8 ) );
}
@Test
@@ -386,15 +386,15 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 17.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 8 ) );
}
@Test
@@ -408,15 +408,15 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 13.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 16.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 8 ) );
}
@Test
@@ -430,17 +430,17 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 8 ) );
-
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 8 ) );
-
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 2 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 2 ).get( 8 ) );
-
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 3 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 3 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 8 ) );
+
+ assertEquals( 13.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 8 ) );
+
+ assertEquals( 15.0, grid.getRow( 2 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 2 ).get( 8 ) );
+
+ assertEquals( 17.0, grid.getRow( 3 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 3 ).get( 8 ) );
}
@Test
@@ -454,15 +454,15 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 17.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 8 ) );
}
@Test
@@ -476,15 +476,15 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 13.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 16.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 8 ) );
}
@Test
@@ -498,17 +498,17 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 8 ) );
-
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 8 ) );
-
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 2 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 2 ).get( 8 ) );
-
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 3 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 3 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 8 ) );
+
+ assertEquals( 13.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 8 ) );
+
+ assertEquals( 15.0, grid.getRow( 2 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 2 ).get( 8 ) );
+
+ assertEquals( 17.0, grid.getRow( 3 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 3 ).get( 8 ) );
}
@Test
@@ -522,15 +522,15 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 17.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 8 ) );
}
@Test
@@ -557,23 +557,23 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 9 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 10 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 11 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 12 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 13.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 13.0, grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 9 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 10 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 11 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 12 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 8 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 1 ).get( 9 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 1 ).get( 10 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 11 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 12 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 16.0, grid.getRow( 1 ).get( 9 ) );
+ assertEquals( 16.0, grid.getRow( 1 ).get( 10 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 11 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 12 ) );
}
@Test
@@ -600,25 +600,25 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 9 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 10 ) );
-
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 8 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 9 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 10 ) );
-
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 2 ).get( 7 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 2 ).get( 8 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 2 ).get( 9 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 2 ).get( 10 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 9 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 10 ) );
+
+ assertEquals( 13.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 9 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 10 ) );
+
+ assertEquals( 15.0, grid.getRow( 2 ).get( 7 ) );
+ assertEquals( 15.0, grid.getRow( 2 ).get( 8 ) );
+ assertEquals( 16.0, grid.getRow( 2 ).get( 9 ) );
+ assertEquals( 16.0, grid.getRow( 2 ).get( 10 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 3 ).get( 7 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 3 ).get( 8 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 3 ).get( 9 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 3 ).get( 10 ) );
+ assertEquals( 17.0, grid.getRow( 3 ).get( 7 ) );
+ assertEquals( 17.0, grid.getRow( 3 ).get( 8 ) );
+ assertEquals( 18.0, grid.getRow( 3 ).get( 9 ) );
+ assertEquals( 18.0, grid.getRow( 3 ).get( 10 ) );
}
@Test
@@ -645,23 +645,23 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 9 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 10 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 0 ).get( 11 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 0 ).get( 12 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 9 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 10 ) );
+ assertEquals( 16.0, grid.getRow( 0 ).get( 11 ) );
+ assertEquals( 16.0, grid.getRow( 0 ).get( 12 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 8 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 1 ).get( 9 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 1 ).get( 10 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 11 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 12 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 17.0, grid.getRow( 1 ).get( 9 ) );
+ assertEquals( 17.0, grid.getRow( 1 ).get( 10 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 11 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 12 ) );
}
@Test
@@ -688,53 +688,53 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 9 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 10 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 11 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 12 ) );
- assertEquals( String.valueOf( 22.0 ), grid.getRow( 0 ).get( 13 ) );
-
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 9 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 10 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 11 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 12 ) );
- assertEquals( String.valueOf( 24.0 ), grid.getRow( 1 ).get( 13 ) );
-
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 2 ).get( 9 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 2 ).get( 10 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 2 ).get( 11 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 2 ).get( 12 ) );
- assertEquals( String.valueOf( 26.0 ), grid.getRow( 2 ).get( 13 ) );
-
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 3 ).get( 9 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 3 ).get( 10 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 3 ).get( 11 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 3 ).get( 12 ) );
- assertEquals( String.valueOf( 28.0 ), grid.getRow( 3 ).get( 13 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 9 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 10 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 11 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 12 ) );
+ assertEquals( 22.0, grid.getRow( 0 ).get( 13 ) );
+
+ assertEquals( 12.0, grid.getRow( 1 ).get( 9 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 10 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 11 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 12 ) );
+ assertEquals( 24.0, grid.getRow( 1 ).get( 13 ) );
+
+ assertEquals( 13.0, grid.getRow( 2 ).get( 9 ) );
+ assertEquals( 13.0, grid.getRow( 2 ).get( 10 ) );
+ assertEquals( 13.0, grid.getRow( 2 ).get( 11 ) );
+ assertEquals( 13.0, grid.getRow( 2 ).get( 12 ) );
+ assertEquals( 26.0, grid.getRow( 2 ).get( 13 ) );
+
+ assertEquals( 14.0, grid.getRow( 3 ).get( 9 ) );
+ assertEquals( 14.0, grid.getRow( 3 ).get( 10 ) );
+ assertEquals( 14.0, grid.getRow( 3 ).get( 11 ) );
+ assertEquals( 14.0, grid.getRow( 3 ).get( 12 ) );
+ assertEquals( 28.0, grid.getRow( 3 ).get( 13 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 4 ).get( 9 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 4 ).get( 10 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 4 ).get( 11 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 4 ).get( 12 ) );
- assertEquals( String.valueOf( 30.0 ), grid.getRow( 4 ).get( 13 ) );
-
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 5 ).get( 9 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 5 ).get( 10 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 5 ).get( 11 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 5 ).get( 12 ) );
- assertEquals( String.valueOf( 32.0 ), grid.getRow( 5 ).get( 13 ) );
-
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 6 ).get( 9 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 6 ).get( 10 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 6 ).get( 11 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 6 ).get( 12 ) );
- assertEquals( String.valueOf( 34.0 ), grid.getRow( 6 ).get( 13 ) );
-
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 7 ).get( 9 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 7 ).get( 10 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 7 ).get( 11 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 7 ).get( 12 ) );
- assertEquals( String.valueOf( 36.0 ), grid.getRow( 7 ).get( 13 ) );
+ assertEquals( 15.0, grid.getRow( 4 ).get( 9 ) );
+ assertEquals( 15.0, grid.getRow( 4 ).get( 10 ) );
+ assertEquals( 15.0, grid.getRow( 4 ).get( 11 ) );
+ assertEquals( 15.0, grid.getRow( 4 ).get( 12 ) );
+ assertEquals( 30.0, grid.getRow( 4 ).get( 13 ) );
+
+ assertEquals( 16.0, grid.getRow( 5 ).get( 9 ) );
+ assertEquals( 16.0, grid.getRow( 5 ).get( 10 ) );
+ assertEquals( 16.0, grid.getRow( 5 ).get( 11 ) );
+ assertEquals( 16.0, grid.getRow( 5 ).get( 12 ) );
+ assertEquals( 32.0, grid.getRow( 5 ).get( 13 ) );
+
+ assertEquals( 17.0, grid.getRow( 6 ).get( 9 ) );
+ assertEquals( 17.0, grid.getRow( 6 ).get( 10 ) );
+ assertEquals( 17.0, grid.getRow( 6 ).get( 11 ) );
+ assertEquals( 17.0, grid.getRow( 6 ).get( 12 ) );
+ assertEquals( 34.0, grid.getRow( 6 ).get( 13 ) );
+
+ assertEquals( 18.0, grid.getRow( 7 ).get( 9 ) );
+ assertEquals( 18.0, grid.getRow( 7 ).get( 10 ) );
+ assertEquals( 18.0, grid.getRow( 7 ).get( 11 ) );
+ assertEquals( 18.0, grid.getRow( 7 ).get( 12 ) );
+ assertEquals( 36.0, grid.getRow( 7 ).get( 13 ) );
}
@Test
@@ -748,31 +748,31 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 9 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 0 ).get( 10 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 11 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 12 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 13 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 0 ).get( 14 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 15 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 16 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 13.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 9 ) );
+ assertEquals( 13.0, grid.getRow( 0 ).get( 10 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 11 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 12 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 13 ) );
+ assertEquals( 13.0, grid.getRow( 0 ).get( 14 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 15 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 16 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 8 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 9 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 10 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 1 ).get( 11 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 12 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 13 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 14 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 1 ).get( 15 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 16 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 16.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 9 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 10 ) );
+ assertEquals( 16.0, grid.getRow( 1 ).get( 11 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 12 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 13 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 14 ) );
+ assertEquals( 16.0, grid.getRow( 1 ).get( 15 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 16 ) );
}
@Test
@@ -786,41 +786,41 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 8 ) );
-
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 8 ) );
-
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 2 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 2 ).get( 8 ) );
-
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 3 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 3 ).get( 8 ) );
-
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 4 ).get( 7 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 4 ).get( 8 ) );
-
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 5 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 5 ).get( 8 ) );
-
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 6 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 6 ).get( 8 ) );
-
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 7 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 7 ).get( 8 ) );
-
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 8 ).get( 7 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 8 ).get( 8 ) );
-
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 9 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 9 ).get( 8 ) );
-
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 10 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 10 ).get( 8 ) );
-
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 11 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 11 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 8 ) );
+
+ assertEquals( 13.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 8 ) );
+
+ assertEquals( 15.0, grid.getRow( 2 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 2 ).get( 8 ) );
+
+ assertEquals( 17.0, grid.getRow( 3 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 3 ).get( 8 ) );
+
+ assertEquals( 11.0, grid.getRow( 4 ).get( 7 ) );
+ assertEquals( 12.0, grid.getRow( 4 ).get( 8 ) );
+
+ assertEquals( 13.0, grid.getRow( 5 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 5 ).get( 8 ) );
+
+ assertEquals( 15.0, grid.getRow( 6 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 6 ).get( 8 ) );
+
+ assertEquals( 17.0, grid.getRow( 7 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 7 ).get( 8 ) );
+
+ assertEquals( 11.0, grid.getRow( 8 ).get( 7 ) );
+ assertEquals( 12.0, grid.getRow( 8 ).get( 8 ) );
+
+ assertEquals( 13.0, grid.getRow( 9 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 9 ).get( 8 ) );
+
+ assertEquals( 15.0, grid.getRow( 10 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 10 ).get( 8 ) );
+
+ assertEquals( 17.0, grid.getRow( 11 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 11 ).get( 8 ) );
}
@Test
@@ -834,31 +834,31 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 9 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 10 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 11 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 0 ).get( 12 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 13 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 14 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 15 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 0 ).get( 16 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 9 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 10 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 11 ) );
+ assertEquals( 16.0, grid.getRow( 0 ).get( 12 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 13 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 14 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 15 ) );
+ assertEquals( 16.0, grid.getRow( 0 ).get( 16 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 5 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 6 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 8 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 9 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 10 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 1 ).get( 11 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 12 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 13 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 14 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 1 ).get( 15 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 1 ).get( 16 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 5 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 6 ) );
+ assertEquals( 17.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 9 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 10 ) );
+ assertEquals( 17.0, grid.getRow( 1 ).get( 11 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 12 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 13 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 14 ) );
+ assertEquals( 17.0, grid.getRow( 1 ).get( 15 ) );
+ assertEquals( 18.0, grid.getRow( 1 ).get( 16 ) );
}
@Test
@@ -872,14 +872,14 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 3 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 4 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 0 ).get( 5 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 0 ).get( 6 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 9 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 0 ).get( 10 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 3 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 4 ) );
+ assertEquals( 13.0, grid.getRow( 0 ).get( 5 ) );
+ assertEquals( 14.0, grid.getRow( 0 ).get( 6 ) );
+ assertEquals( 15.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 9 ) );
+ assertEquals( 18.0, grid.getRow( 0 ).get( 10 ) );
}
@Test
@@ -893,14 +893,14 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 9 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 1 ).get( 9 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 2 ).get( 9 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 3 ).get( 9 ) );
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 4 ).get( 9 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 5 ).get( 9 ) );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 6 ).get( 9 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 7 ).get( 9 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 9 ) );
+ assertEquals( 12.0, grid.getRow( 1 ).get( 9 ) );
+ assertEquals( 13.0, grid.getRow( 2 ).get( 9 ) );
+ assertEquals( 14.0, grid.getRow( 3 ).get( 9 ) );
+ assertEquals( 15.0, grid.getRow( 4 ).get( 9 ) );
+ assertEquals( 16.0, grid.getRow( 5 ).get( 9 ) );
+ assertEquals( 17.0, grid.getRow( 6 ).get( 9 ) );
+ assertEquals( 18.0, grid.getRow( 7 ).get( 9 ) );
}
@Test
@@ -917,11 +917,11 @@
assertEquals( 2, grid.getHeight() );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 0 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 12.0, grid.getRow( 0 ).get( 8 ) );
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 1 ).get( 8 ) );
+ assertEquals( 13.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 1 ).get( 8 ) );
}
@Test
@@ -936,16 +936,16 @@
Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, 0, 0 );
- assertEquals( String.valueOf( 17.0 ), grid.getRow( 0 ).get( 7 ) );
- assertEquals( String.valueOf( 18.0 ), grid.getRow( 0 ).get( 8 ) );
-
- assertEquals( String.valueOf( 15.0 ), grid.getRow( 1 ).get( 7 ) );
- assertEquals( String.valueOf( 16.0 ), grid.getRow( 1 ).get( 8 ) );
-
- assertEquals( String.valueOf( 13.0 ), grid.getRow( 2 ).get( 7 ) );
- assertEquals( String.valueOf( 14.0 ), grid.getRow( 2 ).get( 8 ) );
+ assertEquals( 17.0, grid.getRow( 0 ).get( 7 ) );
+ assertEquals( 18.0, grid.getRow( 0 ).get( 8 ) );
+
+ assertEquals( 15.0, grid.getRow( 1 ).get( 7 ) );
+ assertEquals( 16.0, grid.getRow( 1 ).get( 8 ) );
+
+ assertEquals( 13.0, grid.getRow( 2 ).get( 7 ) );
+ assertEquals( 14.0, grid.getRow( 2 ).get( 8 ) );
- assertEquals( String.valueOf( 11.0 ), grid.getRow( 3 ).get( 7 ) );
- assertEquals( String.valueOf( 12.0 ), grid.getRow( 3 ).get( 8 ) );
+ assertEquals( 11.0, grid.getRow( 3 ).get( 7 ) );
+ assertEquals( 12.0, grid.getRow( 3 ).get( 8 ) );
}
}
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/GenericBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/GenericBatchHandler.java 2010-11-23 16:12:57 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/GenericBatchHandler.java 2011-02-23 14:27:49 +0000
@@ -81,9 +81,9 @@
@SuppressWarnings( "unchecked" )
protected void setValues( Object object )
{
- List<String> values = (List<String>) object;
+ List<Object> values = (List<Object>) object;
- for ( String value : values )
+ for ( Object value : values )
{
statementBuilder.setValue( value );
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java 2011-02-22 18:28:46 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java 2011-02-23 14:27:49 +0000
@@ -28,7 +28,6 @@
*/
import static org.hisp.dhis.system.util.MathUtils.getRounded;
-import static org.hisp.dhis.system.util.MathUtils.isNumeric;
import java.util.ArrayList;
import java.util.Collections;
@@ -73,7 +72,7 @@
* A two dimensional List which simulates a grid where the first list
* represents rows and the second represents columns.
*/
- private List<List<String>> grid;
+ private List<List<Object>> grid;
/**
* Indicating the current row in the grid for writing data.
@@ -91,7 +90,7 @@
public ListGrid()
{
headers = new ArrayList<GridHeader>();
- grid = new ArrayList<List<String>>();
+ grid = new ArrayList<List<Object>>();
}
// ---------------------------------------------------------------------
@@ -182,41 +181,41 @@
public Grid addRow()
{
- grid.add( new ArrayList<String>() );
+ grid.add( new ArrayList<Object>() );
currentRowWriteIndex++;
return this;
}
- public Grid addValue( String value )
+ public Grid addValue( Object value )
{
grid.get( currentRowWriteIndex ).add( value );
return this;
}
- public List<String> getRow( int rowIndex )
+ public List<Object> getRow( int rowIndex )
{
return grid.get( rowIndex );
}
- public List<List<String>> getRows()
+ public List<List<Object>> getRows()
{
return grid;
}
- public List<List<String>> getVisibleRows()
+ public List<List<Object>> getVisibleRows()
{
verifyGridState();
- List<List<String>> tempGrid = new ArrayList<List<String>>();
+ List<List<Object>> tempGrid = new ArrayList<List<Object>>();
if ( headers != null && headers.size() > 0 )
{
- for ( List<String> row : grid )
+ for ( List<Object> row : grid )
{
- List<String> tempRow = new ArrayList<String>();
+ List<Object> tempRow = new ArrayList<Object>();
for ( int i = 0; i < row.size(); i++ )
{
@@ -233,11 +232,11 @@
return tempGrid;
}
- public List<String> getColumn( int columnIndex )
+ public List<Object> getColumn( int columnIndex )
{
- List<String> column = new ArrayList<String>();
+ List<Object> column = new ArrayList<Object>();
- for ( List<String> row : grid )
+ for ( List<Object> row : grid )
{
column.add( row.get( columnIndex ) );
}
@@ -245,7 +244,7 @@
return column;
}
- public String getValue( int rowIndex, int columnIndex )
+ public Object getValue( int rowIndex, int columnIndex )
{
if ( grid.size() < rowIndex || grid.get( rowIndex ) == null || grid.get( rowIndex ).size() < columnIndex )
{
@@ -255,7 +254,7 @@
return grid.get( rowIndex ).get( columnIndex );
}
- public Grid addColumn( List<String> columnValues )
+ public Grid addColumn( List<Object> columnValues )
{
verifyGridState();
@@ -284,7 +283,7 @@
headers.remove( columnIndex );
}
- for ( List<String> row : grid )
+ for ( List<Object> row : grid )
{
row.remove( columnIndex );
}
@@ -334,21 +333,21 @@
SimpleRegression regression = new SimpleRegression();
- List<String> column = getColumn( columnIndex );
+ List<Object> column = getColumn( columnIndex );
int index = 0;
- for ( String value : column )
+ for ( Object value : column )
{
index++;
- if ( Double.parseDouble( value ) != 0.0 ) // 0 omitted from regression
+ if ( Double.parseDouble( String.valueOf( value ) ) != 0.0 ) // 0 omitted from regression
{
- regression.addData( index, Double.parseDouble( value ) );
+ regression.addData( index, Double.parseDouble( String.valueOf( value ) ) );
}
}
- List<String> regressionColumn = new ArrayList<String>();
+ List<Object> regressionColumn = new ArrayList<Object>();
index = 0;
@@ -358,7 +357,7 @@
if ( !Double.isNaN( predicted ) ) // Enough values must exist for regression
{
- regressionColumn.add( String.valueOf( getRounded( predicted, 1 ) ) );
+ regressionColumn.add( getRounded( predicted, 1 ) );
}
else
{
@@ -412,7 +411,7 @@
{
Integer rowLength = null;
- for ( List<String> row : grid )
+ for ( List<Object> row : grid )
{
if ( rowLength != null && rowLength != row.size() )
{
@@ -450,7 +449,7 @@
buffer.append( headerNames ).append( "\n" );
}
- for ( List<String> row : grid )
+ for ( List<Object> row : grid )
{
buffer.append( row ).append( "\n" );
}
@@ -463,7 +462,7 @@
// -------------------------------------------------------------------------
public static class GridRowComparator
- implements Comparator<List<String>>
+ implements Comparator<List<Object>>
{
private int columnIndex;
private int order;
@@ -475,13 +474,15 @@
}
@Override
- public int compare( List<String> list1, List<String> list2 )
+ @SuppressWarnings("unchecked")
+ public int compare( List<Object> list1, List<Object> list2 )
{
if ( order == 0 || list1 == null || list2 == null )
{
return 0;
}
+ /*
if ( isNumeric( list1.get( columnIndex ) ) && isNumeric( list2.get( columnIndex ) ) )
{
final Double value1 = Double.valueOf( list1.get( columnIndex ) );
@@ -491,7 +492,17 @@
}
final String value1 = list1.get( columnIndex );
- final String value2 = list2.get( columnIndex );
+ final String value2 = list2.get( columnIndex );
+ */
+
+ if ( list1.get( columnIndex ) == null || !( list1.get( columnIndex ) instanceof Comparable<?> ) ||
+ list2.get( columnIndex ) == null || !( list2.get( columnIndex ) instanceof Comparable<?> ) )
+ {
+ return 0;
+ }
+
+ final Comparable<Object> value1 = (Comparable<Object>) list1.get( columnIndex );
+ final Comparable<Object> value2 = (Comparable<Object>) list2.get( columnIndex );
return order > 0 ? value2.compareTo( value1 ) : value1.compareTo( value2 );
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CsvUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CsvUtils.java 2010-12-25 16:43:02 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CsvUtils.java 2011-02-23 14:27:49 +0000
@@ -74,6 +74,18 @@
return value;
}
+
+ /**
+ * Encodes the given value to a CSV acceptable value. Returns the empty string
+ * if argument is null.
+ *
+ * @param value the value.
+ * @return the CSV encoded value.
+ */
+ public static String csvEncode( Object value )
+ {
+ return value != null ? csvEncode( String.valueOf( value ) ) : EMPTY;
+ }
/**
* Appends a separator to the value and returns the value as a byte array.
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java 2010-12-29 10:06:33 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java 2011-02-23 14:27:49 +0000
@@ -61,6 +61,8 @@
*/
public class PDFUtils
{
+ private static final String EMPTY = "";
+
/**
* Creates a document.
*
@@ -221,6 +223,13 @@
return getCell( text, 1, getFont( 9 ), ALIGN_LEFT );
}
+ public static PdfPCell getTextCell( Object object )
+ {
+ String text = object != null ? String.valueOf( object ) : EMPTY;
+
+ return getCell( text, 1, getFont( 9 ), ALIGN_LEFT );
+ }
+
public static PdfPCell getItalicCell( String text )
{
return getCell( text, 1, getItalicFont( 9 ), ALIGN_LEFT );
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridTest.java 2011-02-19 00:09:05 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridTest.java 2011-02-23 14:27:49 +0000
@@ -28,11 +28,10 @@
*/
import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.assertFalse;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -42,8 +41,6 @@
import org.junit.Before;
import org.junit.Test;
-import org.hisp.dhis.system.grid.ListGrid;
-
/**
* @author Lars Helge Overland
* @version $Id$
@@ -70,24 +67,24 @@
grid.addHeader( headerC );
grid.addRow();
- grid.addValue( "11" );
- grid.addValue( "12" );
- grid.addValue( "13" );
-
- grid.addRow();
- grid.addValue( "21" );
- grid.addValue( "22" );
- grid.addValue( "23" );
-
- grid.addRow();
- grid.addValue( "31" );
- grid.addValue( "32" );
- grid.addValue( "33" );
-
- grid.addRow();
- grid.addValue( "41" );
- grid.addValue( "42" );
- grid.addValue( "43" );
+ grid.addValue( 11 );
+ grid.addValue( 12 );
+ grid.addValue( 13 );
+
+ grid.addRow();
+ grid.addValue( 21 );
+ grid.addValue( 22 );
+ grid.addValue( 23 );
+
+ grid.addRow();
+ grid.addValue( 31 );
+ grid.addValue( 32 );
+ grid.addValue( 33 );
+
+ grid.addRow();
+ grid.addValue( 41 );
+ grid.addValue( 42 );
+ grid.addValue( 43 );
}
@Test
@@ -105,19 +102,19 @@
@Test
public void testGetRow()
{
- List<String> rowA = grid.getRow( 0 );
+ List<Object> rowA = grid.getRow( 0 );
assertTrue( rowA.size() == 3 );
- assertTrue( rowA.contains( "11" ) );
- assertTrue( rowA.contains( "12" ) );
- assertTrue( rowA.contains( "13" ) );
+ assertTrue( rowA.contains( 11 ) );
+ assertTrue( rowA.contains( 12 ) );
+ assertTrue( rowA.contains( 13 ) );
- List<String> rowB = grid.getRow( 1 );
+ List<Object> rowB = grid.getRow( 1 );
assertTrue( rowB.size() == 3 );
- assertTrue( rowB.contains( "21" ) );
- assertTrue( rowB.contains( "22" ) );
- assertTrue( rowB.contains( "23" ) );
+ assertTrue( rowB.contains( 21 ) );
+ assertTrue( rowB.contains( 22 ) );
+ assertTrue( rowB.contains( 23 ) );
}
@Test
@@ -154,49 +151,49 @@
@Test
public void testGetColumn()
{
- List<String> column1 = grid.getColumn( 1 );
+ List<Object> column1 = grid.getColumn( 1 );
assertEquals( 4, column1.size() );
- assertTrue( column1.contains( "12" ) );
- assertTrue( column1.contains( "22" ) );
- assertTrue( column1.contains( "32" ) );
- assertTrue( column1.contains( "42" ) );
+ assertTrue( column1.contains( 12 ) );
+ assertTrue( column1.contains( 22 ) );
+ assertTrue( column1.contains( 32 ) );
+ assertTrue( column1.contains( 42 ) );
- List<String> column2 = grid.getColumn( 2 );
+ List<Object> column2 = grid.getColumn( 2 );
assertEquals( 4, column2.size() );
- assertTrue( column2.contains( "13" ) );
- assertTrue( column2.contains( "23" ) );
- assertTrue( column2.contains( "33" ) );
- assertTrue( column2.contains( "43" ) );
+ assertTrue( column2.contains( 13 ) );
+ assertTrue( column2.contains( 23 ) );
+ assertTrue( column2.contains( 33 ) );
+ assertTrue( column2.contains( 43 ) );
}
@Test
public void testAddColumn()
{
- List<String> columnValues = new ArrayList<String>();
- columnValues.add( "14" );
- columnValues.add( "24" );
- columnValues.add( "34" );
- columnValues.add( "44" );
+ List<Object> columnValues = new ArrayList<Object>();
+ columnValues.add( 14 );
+ columnValues.add( 24 );
+ columnValues.add( 34 );
+ columnValues.add( 44 );
grid.addColumn( columnValues );
- List<String> column3 = grid.getColumn( 3 );
+ List<Object> column3 = grid.getColumn( 3 );
assertEquals( 4, column3.size() );
- assertTrue( column3.contains( "14" ) );
- assertTrue( column3.contains( "24" ) );
- assertTrue( column3.contains( "34" ) );
- assertTrue( column3.contains( "44" ) );
+ assertTrue( column3.contains( 14 ) );
+ assertTrue( column3.contains( 24 ) );
+ assertTrue( column3.contains( 34 ) );
+ assertTrue( column3.contains( 44 ) );
- List<String> row2 = grid.getRow( 1 );
+ List<Object> row2 = grid.getRow( 1 );
assertEquals( 4, row2.size() );
- assertTrue( row2.contains( "21" ) );
- assertTrue( row2.contains( "22" ) );
- assertTrue( row2.contains( "23" ) );
- assertTrue( row2.contains( "24" ) );
+ assertTrue( row2.contains( 21 ) );
+ assertTrue( row2.contains( 22 ) );
+ assertTrue( row2.contains( 23 ) );
+ assertTrue( row2.contains( 24 ) );
}
@Test
@@ -228,11 +225,11 @@
assertEquals( 2, grid.getRows().size() );
- List<String> rowA = grid.getRow( 0 );
- assertTrue( rowA.contains( "11" ) );
+ List<Object> rowA = grid.getRow( 0 );
+ assertTrue( rowA.contains( 11 ) );
- List<String> rowB = grid.getRow( 1 );
- assertTrue( rowB.contains( "21" ) );
+ List<Object> rowB = grid.getRow( 1 );
+ assertTrue( rowB.contains( 21 ) );
grid.limitGrid( 0 );
@@ -244,17 +241,20 @@
{
Grid grid = new ListGrid();
- grid.addRow().addValue( "1" ).addValue( "a" );
- grid.addRow().addValue( "2" ).addValue( "b" );
- grid.addRow().addValue( "3" ).addValue( "c" );
+ grid.addRow().addValue( 1 ).addValue( "a" );
+ grid.addRow().addValue( 2 ).addValue( "b" );
+ grid.addRow().addValue( 3 ).addValue( "c" );
grid.sortGrid( 2, 1 );
- List<String> row1 = grid.getRow( 0 );
+ List<Object> row1 = grid.getRow( 0 );
assertTrue( row1.contains( "c" ) );
- List<String> row2 = grid.getRow( 1 );
- assertTrue( row2.contains( "b" ) );
+ List<Object> row2 = grid.getRow( 1 );
+ assertTrue( row2.contains( "b" ) );
+
+ List<Object> row3 = grid.getRow( 2 );
+ assertTrue( row3.contains( "a" ) );
}
@Test
@@ -262,64 +262,88 @@
{
Grid grid = new ListGrid();
- grid.addRow().addValue( "3" ).addValue( "a" );
- grid.addRow().addValue( "2" ).addValue( "b" );
- grid.addRow().addValue( "1" ).addValue( "c" );
+ grid.addRow().addValue( 3 ).addValue( "a" );
+ grid.addRow().addValue( 2 ).addValue( "b" );
+ grid.addRow().addValue( 1 ).addValue( "c" );
grid.sortGrid( 1, -1 );
- List<String> row1 = grid.getRow( 0 );
- assertTrue( row1.contains( "1" ) );
+ List<Object> row1 = grid.getRow( 0 );
+ assertTrue( row1.contains( 1 ) );
- List<String> row2 = grid.getRow( 1 );
- assertTrue( row2.contains( "2" ) );
+ List<Object> row2 = grid.getRow( 1 );
+ assertTrue( row2.contains( 2 ) );
+
+ List<Object> row3 = grid.getRow( 2 );
+ assertTrue( row3.contains( 3 ) );
}
-
+
@Test
public void testSortC()
{
Grid grid = new ListGrid();
-
- grid.addRow().addValue( "a" ).addValue( "a" ).addValue( "5.2" );
- grid.addRow().addValue( "b" ).addValue( "b" ).addValue( "0.0" );
- grid.addRow().addValue( "c" ).addValue( "c" ).addValue( "108.1" );
- grid.addRow().addValue( "d" ).addValue( "d" ).addValue( "45.0" );
- grid.addRow().addValue( "e" ).addValue( "e" ).addValue( "4043.9" );
- grid.addRow().addValue( "f" ).addValue( "f" ).addValue( "0.1" );
+
+ grid.addRow().addValue( 1 ).addValue( "c" );
+ grid.addRow().addValue( 3 ).addValue( "a" );
+ grid.addRow().addValue( 2 ).addValue( "b" );
+
+ grid.sortGrid( 1, 1 );
+
+ List<Object> row1 = grid.getRow( 0 );
+ assertTrue( row1.contains( 3 ) );
+
+ List<Object> row2 = grid.getRow( 1 );
+ assertTrue( row2.contains( 2 ) );
+
+ List<Object> row3 = grid.getRow( 2 );
+ assertTrue( row3.contains( 1 ) );
+ }
+
+ @Test
+ public void testSortD()
+ {
+ Grid grid = new ListGrid();
+
+ grid.addRow().addValue( "a" ).addValue( "a" ).addValue( 5.2 );
+ grid.addRow().addValue( "b" ).addValue( "b" ).addValue( 0.0 );
+ grid.addRow().addValue( "c" ).addValue( "c" ).addValue( 108.1 );
+ grid.addRow().addValue( "d" ).addValue( "d" ).addValue( 45.0 );
+ grid.addRow().addValue( "e" ).addValue( "e" ).addValue( 4043.9 );
+ grid.addRow().addValue( "f" ).addValue( "f" ).addValue( 0.1 );
grid = grid.sortGrid( 3, 1 );
- List<String> row1 = grid.getRow( 0 );
- assertTrue( row1.contains( "4043.9" ) );
+ List<Object> row1 = grid.getRow( 0 );
+ assertTrue( row1.contains( 4043.9 ) );
- List<String> row2 = grid.getRow( 1 );
- assertTrue( row2.contains( "108.1" ) );
+ List<Object> row2 = grid.getRow( 1 );
+ assertTrue( row2.contains( 108.1 ) );
- List<String> row3 = grid.getRow( 2 );
- assertTrue( row3.contains( "45.0" ) );
-
- List<String> row4 = grid.getRow( 3 );
- assertTrue( row4.contains( "5.2" ) );
-
- List<String> row5 = grid.getRow( 4 );
- assertTrue( row5.contains( "0.1" ) );
-
- List<String> row6 = grid.getRow( 5 );
- assertTrue( row6.contains( "0.0" ) );
+ List<Object> row3 = grid.getRow( 2 );
+ assertTrue( row3.contains( 45.0 ) );
+
+ List<Object> row4 = grid.getRow( 3 );
+ assertTrue( row4.contains( 5.2 ) );
+
+ List<Object> row5 = grid.getRow( 4 );
+ assertTrue( row5.contains( 0.1 ) );
+
+ List<Object> row6 = grid.getRow( 5 );
+ assertTrue( row6.contains( 0.0 ) );
}
@Test
public void testGridRowComparator()
{
- List<List<String>> lists = new ArrayList<List<String>>();
- List<String> l1 = Arrays.asList( "b", "b", "50" );
- List<String> l2 = Arrays.asList( "c", "c", "400" );
- List<String> l3 = Arrays.asList( "a", "a", "6" );
+ List<List<Object>> lists = new ArrayList<List<Object>>();
+ List<Object> l1 = getList( "b", "b", 50 );
+ List<Object> l2 = getList( "c", "c", 400 );
+ List<Object> l3 = getList( "a", "a", 6 );
lists.add( l1 );
lists.add( l2 );
lists.add( l3 );
- Comparator<List<String>> comparator = new ListGrid.GridRowComparator( 2, -1 );
+ Comparator<List<Object>> comparator = new ListGrid.GridRowComparator( 2, -1 );
Collections.sort( lists, comparator );
assertEquals( l3, lists.get( 0 ) );
@@ -333,48 +357,60 @@
grid = new ListGrid();
grid.addRow();
- grid.addValue( "10.0" );
- grid.addRow();
- grid.addValue( "50.0" );
- grid.addRow();
- grid.addValue( "20.0" );
- grid.addRow();
- grid.addValue( "60.0" );
+ grid.addValue( 10.0 );
+ grid.addRow();
+ grid.addValue( 50.0 );
+ grid.addRow();
+ grid.addValue( 20.0 );
+ grid.addRow();
+ grid.addValue( 60.0 );
grid.addRegressionColumn( 0 );
- List<String> column = grid.getColumn( 1 );
+ List<Object> column = grid.getColumn( 1 );
assertTrue( column.size() == 4 );
- assertTrue( column.contains( "5.0" ) );
- assertTrue( column.contains( "17.0" ) );
- assertTrue( column.contains( "29.0" ) );
- assertTrue( column.contains( "41.0" ) );
+ assertTrue( column.contains( 5.0 ) );
+ assertTrue( column.contains( 17.0 ) );
+ assertTrue( column.contains( 29.0 ) );
+ assertTrue( column.contains( 41.0 ) );
}
@Test
public void testJRDataSource() throws Exception
{
assertTrue( grid.next() );
- assertEquals( "11", (String)grid.getFieldValue( new MockJRField( "colA" ) ) );
- assertEquals( "12", (String)grid.getFieldValue( new MockJRField( "colB" ) ) );
- assertEquals( "13", (String)grid.getFieldValue( new MockJRField( "colC" ) ) );
-
- assertTrue( grid.next() );
- assertEquals( "21", (String)grid.getFieldValue( new MockJRField( "colA" ) ) );
- assertEquals( "22", (String)grid.getFieldValue( new MockJRField( "colB" ) ) );
- assertEquals( "23", (String)grid.getFieldValue( new MockJRField( "colC" ) ) );
-
- assertTrue( grid.next() );
- assertEquals( "31", (String)grid.getFieldValue( new MockJRField( "colA" ) ) );
- assertEquals( "32", (String)grid.getFieldValue( new MockJRField( "colB" ) ) );
- assertEquals( "33", (String)grid.getFieldValue( new MockJRField( "colC" ) ) );
-
- assertTrue( grid.next() );
- assertEquals( "41", (String)grid.getFieldValue( new MockJRField( "colA" ) ) );
- assertEquals( "42", (String)grid.getFieldValue( new MockJRField( "colB" ) ) );
- assertEquals( "43", (String)grid.getFieldValue( new MockJRField( "colC" ) ) );
+ assertEquals( 11, grid.getFieldValue( new MockJRField( "colA" ) ) );
+ assertEquals( 12, grid.getFieldValue( new MockJRField( "colB" ) ) );
+ assertEquals( 13, grid.getFieldValue( new MockJRField( "colC" ) ) );
+
+ assertTrue( grid.next() );
+ assertEquals( 21, grid.getFieldValue( new MockJRField( "colA" ) ) );
+ assertEquals( 22, grid.getFieldValue( new MockJRField( "colB" ) ) );
+ assertEquals( 23, grid.getFieldValue( new MockJRField( "colC" ) ) );
+
+ assertTrue( grid.next() );
+ assertEquals( 31, grid.getFieldValue( new MockJRField( "colA" ) ) );
+ assertEquals( 32, grid.getFieldValue( new MockJRField( "colB" ) ) );
+ assertEquals( 33, grid.getFieldValue( new MockJRField( "colC" ) ) );
+
+ assertTrue( grid.next() );
+ assertEquals( 41, grid.getFieldValue( new MockJRField( "colA" ) ) );
+ assertEquals( 42, grid.getFieldValue( new MockJRField( "colB" ) ) );
+ assertEquals( 43, grid.getFieldValue( new MockJRField( "colC" ) ) );
assertFalse( grid.next() );
}
+
+ private static List<Object> getList( Object... items )
+ {
+ List<Object> list = new ArrayList<Object>();
+
+ for ( Object item : items )
+ {
+ list.add( item );
+ }
+
+ return list;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/encoding/velocity/EncoderVelocityContext.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/encoding/velocity/EncoderVelocityContext.java 2010-11-25 14:51:44 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/encoding/velocity/EncoderVelocityContext.java 2011-02-23 14:27:49 +0000
@@ -70,6 +70,11 @@
public static class Encoder
{
+ public String htmlEncode( Object object )
+ {
+ return object != null ? StringEscapeUtils.escapeHtml( String.valueOf( object ) ) : null;
+ }
+
public String htmlEncode( String object )
{
return StringEscapeUtils.escapeHtml( object );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridCsvResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridCsvResult.java 2011-01-17 16:17:06 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridCsvResult.java 2011-02-23 14:27:49 +0000
@@ -110,9 +110,9 @@
out.write( NEWLINE );
- for ( List<String> row : grid.getRows() )
+ for ( List<Object> row : grid.getRows() )
{
- Iterator<String> columns = row.iterator();
+ Iterator<Object> columns = row.iterator();
while ( columns.hasNext() )
{
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridJrxmlResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridJrxmlResult.java 2011-01-17 11:14:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridJrxmlResult.java 2011-02-23 14:27:49 +0000
@@ -98,13 +98,13 @@
// Write jrxml based on Velocity template
// ---------------------------------------------------------------------
- VelocityEngine velocity = new VelocityEngine();
+ final VelocityEngine velocity = new VelocityEngine();
velocity.setProperty( Velocity.RESOURCE_LOADER, RESOURCE_LOADER_NAME );
velocity.setProperty( RESOURCE_LOADER_NAME + ".resource.loader.class", ClasspathResourceLoader.class.getName() );
velocity.init();
- VelocityContext context = new VelocityContext();
+ final VelocityContext context = new VelocityContext();
context.put( KEY_GRID, grid );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java 2011-01-26 07:55:56 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java 2011-02-23 14:27:49 +0000
@@ -115,9 +115,9 @@
table.addCell( getEmptyCell( grid.getVisibleWidth(), 10 ) );
- for ( List<String> row : grid.getVisibleRows() )
+ for ( List<Object> row : grid.getVisibleRows() )
{
- for ( String col : row )
+ for ( Object col : row )
{
table.addCell( getTextCell( col ) );
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java 2011-02-11 08:32:38 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java 2011-02-23 14:27:49 +0000
@@ -27,8 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.MathUtils.isNumeric;
-
import java.io.OutputStream;
import java.util.List;
@@ -60,6 +58,7 @@
{
private static final String DEFAULT_SHEET_NAME = "Sheet 1";
private static final String DEFAULT_FILENAME = "Grid.xls";
+ private static final String EMPTY = "";
private static final WritableCellFormat FORMAT_TTTLE = new WritableCellFormat( new WritableFont(
WritableFont.TAHOMA, 13, WritableFont.NO_BOLD, false ) );
@@ -134,19 +133,21 @@
rowNumber++;
- for ( List<String> row : grid.getVisibleRows() )
+ for ( List<Object> row : grid.getVisibleRows() )
{
columnIndex = 0;
- for ( String column : row )
+ for ( Object column : row )
{
- if ( isNumeric( column ) )
+ if ( column != null && column instanceof Number )
{
- sheet.addCell( new Number( columnIndex++, rowNumber, Double.valueOf( column ), FORMAT_TEXT ) );
+ sheet.addCell( new Number( columnIndex++, rowNumber, Double.valueOf( String.valueOf( column ) ), FORMAT_TEXT ) );
}
else
{
- sheet.addCell( new Label( columnIndex++, rowNumber, column, FORMAT_TEXT ) );
+ String content = column != null ? String.valueOf( column ) : EMPTY;
+
+ sheet.addCell( new Label( columnIndex++, rowNumber, content, FORMAT_TEXT ) );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java 2011-01-26 10:01:53 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java 2011-02-23 14:27:49 +0000
@@ -211,11 +211,11 @@
{
grid.addRow();
grid.addValue( result.getName() );
- grid.addValue( String.valueOf( result.getRegistrations() ) );
- grid.addValue( String.valueOf( result.getSources() ) );
- grid.addValue( String.valueOf( result.getPercentage() ) );
- grid.addValue( String.valueOf( result.getRegistrationsOnTime() ) );
- grid.addValue( String.valueOf( result.getPercentageOnTime() ) );
+ grid.addValue( result.getRegistrations() );
+ grid.addValue( result.getSources() );
+ grid.addValue( result.getPercentage() );
+ grid.addValue( result.getRegistrationsOnTime() );
+ grid.addValue( result.getPercentageOnTime() );
}
return grid;
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm 2011-02-18 21:50:37 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm 2011-02-23 14:27:49 +0000
@@ -28,7 +28,7 @@
<td onclick="showTableDetails( $table.id )">$encoder.htmlEncode( $table.name )</td>
<td style="text-align:right">
<a href="getReportParams.action?id=$table.id&mode=table" title="$i18n.getString( "create" )"><img src="../images/start_process.png" alt="$i18n.getString( "create" )"></a>
- <a href="displayAddTableForm.action?id=$table.id&mode=$table.mode&dimension=$table.isDimensional()" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
+ <a href="displayAddTableForm.action?id=${table.id}&dimension=${table.isDimensional()}" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
<a href="javascript:addReportTableToDashboard( '$table.id' )" title="$i18n.getString( 'add_to_dashboard' )"><img src="../images/add_to_dashboard.png" alt="$i18n.getString( 'add_to_dashboard' )"></a>
#if( $auth.hasAccess( "dhis-web-reporting", "removeTable" ) )
<a href="javascript:removeTable( $table.id, '$encoder.jsEncode( $table.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>