dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41690
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21260: DataApprovalController: change SimpleEntry to SetMap
------------------------------------------------------------
revno: 21260
committer: jimgrace@xxxxxxxxx
branch nick: dhis2
timestamp: Tue 2015-12-01 20:20:01 -0500
message:
DataApprovalController: change SimpleEntry to SetMap
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java 2015-12-01 18:08:11 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java 2015-12-02 01:20:01 +0000
@@ -29,6 +29,7 @@
*/
import org.hisp.dhis.common.IdentifiableObjectManager;
+import org.hisp.dhis.common.SetMap;
import org.hisp.dhis.dataapproval.DataApproval;
import org.hisp.dhis.dataapproval.DataApprovalLevel;
import org.hisp.dhis.dataapproval.DataApprovalLevelService;
@@ -79,8 +80,6 @@
import java.util.Set;
import static com.google.common.collect.Lists.newArrayList;
-import static java.util.AbstractMap.SimpleEntry;
-
/**
* This controller uses both /dataApprovals and /dataAcceptances.
@@ -266,18 +265,21 @@
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ou );
- Set<SimpleEntry<DataApprovalWorkflow, DataElementCategoryCombo>> pairs = new HashSet<>();
+ SetMap<DataApprovalWorkflow, DataElementCategoryCombo> workflowCategoryComboMap = new SetMap<>();
for ( DataSet dataSet : dataSets )
{
- pairs.add( new SimpleEntry<>( dataSet.getWorkflow(), dataSet.getCategoryCombo() ) );
+ workflowCategoryComboMap.putValue( dataSet.getWorkflow(), dataSet.getCategoryCombo() );
}
List<DataApprovalStatus> statusList = new ArrayList<>();
- for ( SimpleEntry<DataApprovalWorkflow, DataElementCategoryCombo> pair : pairs )
+ for ( DataApprovalWorkflow workflow : workflowCategoryComboMap.keySet() )
{
- statusList.addAll( dataApprovalService.getUserDataApprovalsAndPermissions( pair.getKey(), period, orgUnit, pair.getValue() ) );
+ for ( DataElementCategoryCombo attributeCombo : workflowCategoryComboMap.get( workflow ) )
+ {
+ statusList.addAll( dataApprovalService.getUserDataApprovalsAndPermissions( workflow, period, orgUnit, attributeCombo ) );
+ }
}
List<Map<String, Object>> list = new ArrayList<>();