← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22260: minor simplifaction in Preheat

 

------------------------------------------------------------
revno: 22260
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2016-03-12 16:00:34 +0700
message:
  minor simplifaction in Preheat
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/Preheat.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatIdentifier.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/preheat/Preheat.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/Preheat.java	2016-03-12 08:52:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/Preheat.java	2016-03-12 09:00:34 +0000
@@ -168,8 +168,7 @@
                 User user = (User) object;
 
                 Map<String, IdentifiableObject> identifierMap = map.get( PreheatIdentifier.UID ).get( UserCredentials.class );
-                String key = PreheatIdentifier.UID.getIdentifier( user );
-                identifierMap.put( key, user.getUserCredentials() );
+                identifierMap.put( user.getUid(), user.getUserCredentials() );
             }
 
             Map<String, IdentifiableObject> identifierMap = map.get( PreheatIdentifier.UID ).get( klass );
@@ -192,8 +191,7 @@
                 User user = (User) object;
 
                 Map<String, IdentifiableObject> identifierMap = map.get( PreheatIdentifier.CODE ).get( UserCredentials.class );
-                String key = PreheatIdentifier.CODE.getIdentifier( user );
-                identifierMap.put( key, user.getUserCredentials() );
+                identifierMap.put( user.getCode(), user.getUserCredentials() );
             }
 
             Map<String, IdentifiableObject> identifierMap = map.get( PreheatIdentifier.CODE ).get( klass );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatIdentifier.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatIdentifier.java	2016-03-12 08:52:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatIdentifier.java	2016-03-12 09:00:34 +0000
@@ -30,7 +30,6 @@
 
 import com.google.common.collect.Lists;
 import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.user.UserCredentials;
 import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
@@ -56,16 +55,9 @@
      */
     AUTO;
 
-    @SuppressWarnings( { "incomplete-switch", "unchecked" } )
+    @SuppressWarnings( "incomplete-switch" )
     public <T extends IdentifiableObject> String getIdentifier( T object )
     {
-        object = UserCredentials.class.isInstance( object ) ? (T) ((UserCredentials) object).getUserInfo() : object;
-
-        if ( object == null )
-        {
-            return null;
-        }
-
         switch ( this )
         {
             case UID: