dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21681
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10330: Ensuring sort order in _categoryoptioncomboname resource table
------------------------------------------------------------
revno: 10330
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-19 20:15:12 +0100
message:
Ensuring sort order in _categoryoptioncomboname resource table
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.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/dataelement/DataElementCategoryCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2013-03-01 10:18:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2013-03-19 19:15:12 +0000
@@ -165,8 +165,7 @@
CombinationGenerator<DataElementCategoryOption> generator =
new CombinationGenerator<DataElementCategoryOption>( getCategoryOptionsAsArray() );
- sortLoop:
- while ( generator.hasNext() )
+ sortLoop: while ( generator.hasNext() )
{
List<DataElementCategoryOption> categoryOptions = generator.getNext();
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2013-03-05 21:37:21 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2013-03-19 19:15:12 +0000
@@ -45,6 +45,7 @@
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategory;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -231,18 +232,21 @@
{
resourceTableStore.createDataElementCategoryOptionComboName();
- Collection<DataElementCategoryOptionCombo> combos = categoryService.getAllDataElementCategoryOptionCombos();
+ Collection<DataElementCategoryCombo> combos = categoryService.getAllDataElementCategoryCombos();
List<Object[]> batchArgs = new ArrayList<Object[]>();
- for ( DataElementCategoryOptionCombo combo : combos )
+ for ( DataElementCategoryCombo combo : combos )
{
- List<Object> values = new ArrayList<Object>();
-
- values.add( combo.getId() );
- values.add( combo.getName() );
-
- batchArgs.add( values.toArray() );
+ for ( DataElementCategoryOptionCombo coc : combo.getSortedOptionCombos() )
+ {
+ List<Object> values = new ArrayList<Object>();
+
+ values.add( coc.getId() );
+ values.add( coc.getName() );
+
+ batchArgs.add( values.toArray() );
+ }
}
resourceTableStore.batchUpdate( 2, TABLE_NAME_CATEGORY_OPTION_COMBO_NAME, batchArgs );