dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33823
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17324: Minor
------------------------------------------------------------
revno: 17324
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-10-31 11:49:17 -0400
message:
Minor
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.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-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java 2014-10-31 15:32:24 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java 2014-10-31 15:49:17 +0000
@@ -33,6 +33,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
@@ -58,6 +59,9 @@
import org.hisp.dhis.user.CurrentUserService;
import org.springframework.transaction.annotation.Transactional;
+import com.google.common.base.Function;
+import com.google.common.collect.Maps;
+
/**
* @author Jim Grace
@@ -438,6 +442,17 @@
// Supportive methods
// -------------------------------------------------------------------------
+ private Map<String, DataApproval> getIndexedMap( List<DataApproval> dataApprovalList )
+ {
+ return Maps.uniqueIndex( dataApprovalList, new Function<DataApproval, String>()
+ {
+ public String apply( DataApproval approval )
+ {
+ return approval != null ? approval.getOrganisationUnit().getId() + "-" + approval.getPeriod().getId() : null;
+ }
+ } );
+ }
+
private void tracePrint( String s ) // Temporary, for development
{
// System.out.println( s );