------------------------------------------------------------
revno: 5108
committer: Bob Jolliffe [email protected]
branch nick: dhis2
timestamp: Thu 2011-11-03 16:01:58 +0000
message:
  Mapping uids to internal identifiers
modified:
  
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.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/common/AbstractIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java	2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java	2011-11-03 16:01:58 +0000
@@ -194,6 +194,26 @@
     }
 
     /**
+     * Get a map of uids to internal identifiers
+     *
+     * @param objects the IdentifiableObjects to put in the map
+     * @return the map
+     */
+    public static Map<String, Integer> getUIDMap( Collection<? extends AbstractIdentifiableObject> objects )
+    {
+        Map<String, Integer> map = new HashMap<String, Integer>();
+        for ( IdentifiableObject object : objects )
+        {
+            String uid = object.getUid();
+            int internalId = object.getId();
+
+            map.put( uid, internalId );
+        }
+
+        return map;
+    }
+
+    /**
      * Get a map of codes to internal identifiers
      *
      * @param objects the NameableObjects to put in the map
@@ -221,6 +241,6 @@
             }
         }
         return map;
-    }
+    }    
 
 }

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to