usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [02/10] git commit: implemented using iterator
Date Thu, 27 Feb 2014 23:25:58 GMT
implemented using iterator


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/8f71e788
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/8f71e788
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/8f71e788

Branch: refs/heads/master
Commit: 8f71e788f496e87d72792af0dc3cbf0b822a7428
Parents: e5a4321
Author: Shawn Feldman <shawn.feldman@gmail.com>
Authored: Wed Feb 26 14:37:18 2014 -0700
Committer: Shawn Feldman <shawn.feldman@gmail.com>
Committed: Wed Feb 26 14:37:18 2014 -0700

----------------------------------------------------------------------
 .../users/activities/ActivitiesService.java     | 23 ++++++++++----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8f71e788/stack/services/src/main/java/org/apache/usergrid/services/users/activities/ActivitiesService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/users/activities/ActivitiesService.java
b/stack/services/src/main/java/org/apache/usergrid/services/users/activities/ActivitiesService.java
index b076e4d..520bb6e 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/users/activities/ActivitiesService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/users/activities/ActivitiesService.java
@@ -16,16 +16,11 @@
 package org.apache.usergrid.services.users.activities;
 
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
+import org.apache.usergrid.persistence.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.usergrid.persistence.Entity;
-import org.apache.usergrid.persistence.EntityRef;
-import org.apache.usergrid.persistence.Results;
 import org.apache.usergrid.persistence.entities.Activity;
 import org.apache.usergrid.persistence.entities.Activity.ActivityObject;
 import org.apache.usergrid.persistence.entities.User;
@@ -133,10 +128,16 @@ public class ActivitiesService extends GenericCollectionService {
             return;
         }
         em.addToCollection( user, "feed", activity );
-        Results r = em.getConnectingEntities( user.getUuid(), "following", User.ENTITY_TYPE,
Results.Level.REFS, 1000 ); //allow 1000 connections
-        List<EntityRef> refs = r.getRefs();
-        if ( refs != null ) {
-            em.addToCollections( refs, "feed", activity );
+        Results results =  em.getConnectingEntities(user.getUuid(), "following", User.ENTITY_TYPE,
Results.Level.REFS);
+        PagingResultsIterator itr = new PagingResultsIterator(results);
+
+        ConnectedEntityRef c;
+        List<EntityRef> refs = new ArrayList<EntityRef>();
+
+        while ( itr.hasNext() ) {
+            c = (ConnectedEntityRef) itr.next();
+            refs.add(c);
         }
+        em.addToCollections( refs, "feed", activity );
     }
 }


Mime
View raw message