Search in sources :

Example 1 with DataElementCategoryComboSizeComparator

use of org.hisp.dhis.dataelement.comparator.DataElementCategoryComboSizeComparator in project dhis2-core by dhis2.

the class LoadFormAction method getDataElementCategoryCombos.

private List<DataElementCategoryCombo> getDataElementCategoryCombos(List<DataElement> dataElements, DataSet dataSet) {
    Set<DataElementCategoryCombo> categoryCombos = new HashSet<>();
    for (DataElement dataElement : dataElements) {
        categoryCombos.add(dataElement.getCategoryCombo(dataSet));
    }
    List<DataElementCategoryCombo> listCategoryCombos = new ArrayList<>(categoryCombos);
    Collections.sort(listCategoryCombos, new DataElementCategoryComboSizeComparator());
    return listCategoryCombos;
}
Also used : DataElement(org.hisp.dhis.dataelement.DataElement) DataElementCategoryCombo(org.hisp.dhis.dataelement.DataElementCategoryCombo) ArrayList(java.util.ArrayList) DataElementCategoryComboSizeComparator(org.hisp.dhis.dataelement.comparator.DataElementCategoryComboSizeComparator) HashSet(java.util.HashSet)

Aggregations

ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 DataElement (org.hisp.dhis.dataelement.DataElement)1 DataElementCategoryCombo (org.hisp.dhis.dataelement.DataElementCategoryCombo)1 DataElementCategoryComboSizeComparator (org.hisp.dhis.dataelement.comparator.DataElementCategoryComboSizeComparator)1