dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09886
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2678: Minor fix
------------------------------------------------------------
revno: 2678
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-01-20 20:55:28 +0100
message:
Minor fix
modified:
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.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-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java 2011-01-11 13:11:31 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java 2011-01-20 19:55:28 +0000
@@ -107,8 +107,7 @@
final Set<DataElementOperand> operandsWithDataInPage = new HashSet<DataElementOperand>();
- crossTabStore.dropCrossTabTable( key );
-
+ crossTabStore.dropCrossTabTable( key );
crossTabStore.createCrossTabTable( operandPage, key );
log.debug( "Created crosstab table for key: " + key );
@@ -136,8 +135,7 @@
if ( value != null && value.length() > MAX_LENGTH )
{
- log.warn( "Value ignored, too long: '" + value + "'" );
-
+ log.warn( "Value ignored, too long: '" + value + "'" );
value = null;
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java 2011-01-10 10:27:03 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java 2011-01-20 19:55:28 +0000
@@ -69,4 +69,16 @@
return page;
}
+
+ /**
+ * Returns the number of pages in the list.
+ */
+ public int pageSize()
+ {
+ int c = size();
+ int r = c / pageSize;
+ int m = c % pageSize;
+
+ return m == 0 ? r : ( r + 1 );
+ }
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java 2011-01-10 10:27:03 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java 2011-01-20 19:55:28 +0000
@@ -72,4 +72,20 @@
assertNull( page );
}
+
+ @Test
+ public void testPageSize()
+ {
+ PaginatedList<String> list = new PaginatedList<String>( Arrays.asList( "A", "B", "C" ), 2 );
+
+ assertEquals( 2, list.pageSize() );
+
+ list = new PaginatedList<String>( Arrays.asList( "A", "B", "C", "D" ), 2 );
+
+ assertEquals( 2, list.pageSize() );
+
+ list = new PaginatedList<String>( Arrays.asList( "A", "B", "C", "D", "E" ), 2 );
+
+ assertEquals( 3, list.pageSize() );
+ }
}