← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11820: improve loading speed for view sent SMS page

 

------------------------------------------------------------
revno: 11820
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-08-28 11:31:21 +0700
message:
  improve loading speed for view sent SMS page
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.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-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java	2013-08-28 04:31:21 +0000
@@ -123,7 +123,7 @@
         throws Exception
     {
         List<OutboundSms> tempListOutboundSMS = outboundSmsService.getAllOutboundSms();
-        
+
         listOutboundSMS = new ArrayList<OutboundSms>();
 
         if ( filterStatusType != null && filterStatusType == 0 )
@@ -156,24 +156,24 @@
 
         recipientNames = new ArrayList<String>();
         recipientNames.add( "" );
+        String tempString;
         for ( OutboundSms outboundSms : listOutboundSMS )
         {
-            String tempString = "";
+            tempString = "";
             for ( String phoneNumber : outboundSms.getRecipients() )
             {
-                if ( userService.getUsersByPhoneNumber( phoneNumber ) == null
-                    || userService.getUsersByPhoneNumber( phoneNumber ).size() == 0 )
+                Collection<User> users = userService.getUsersByPhoneNumber( phoneNumber );
+                if ( users == null || users.size() == 0 )
                 {
                     tempString += "[unknown]";
                 }
-                else if ( userService.getUsersByPhoneNumber( phoneNumber ) != null
-                    && userService.getUsersByPhoneNumber( phoneNumber ).size() > 0 )
+                else if ( users != null && users.size() > 0 )
                 {
 
-                    Iterator<User> users = userService.getUsersByPhoneNumber( phoneNumber ).iterator();
-                    while ( users.hasNext() )
+                    Iterator<User> usersIterator = users.iterator();
+                    while ( usersIterator.hasNext() )
                     {
-                        User user = users.next();
+                        User user = usersIterator.next();
                         tempString += "[" + user.getUsername() + "]";
                     }
                 }