usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [07/12] incubator-usergrid git commit: [USERGRID-396] Added ability to short circuit if not unique id's are found.
Date Mon, 16 Mar 2015 23:35:50 GMT
[USERGRID-396] Added ability to short circuit if not unique id's are found.


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

Branch: refs/heads/USERGRID-466
Commit: a6929ab249e88d85c6025660f44392ed2b9c93a7
Parents: c872b69
Author: GERey <greyes@apigee.com>
Authored: Thu Mar 12 12:07:46 2015 -0700
Committer: GERey <greyes@apigee.com>
Committed: Thu Mar 12 12:07:46 2015 -0700

----------------------------------------------------------------------
 .../impl/EntityCollectionManagerImpl.java           | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6929ab2/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
index d95183d..7db34aa 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
@@ -287,6 +287,12 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
         } );
     }
 
+
+    /**
+     * Retrieves all entities that correspond to each field given in the Collection.
+     * @param fields
+     * @return
+     */
     @Override
     public Observable<FieldSet> getAllEntities(final Collection<Field> fields)
{
         return rx.Observable.just(fields).map( new Func1<Collection<Field>, FieldSet>()
{
@@ -296,8 +302,14 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
 
                     final UUID startTime = UUIDGenerator.newTimeUUID();
 
+                    //Get back set of unique values that correspond to collection of fields
                     UniqueValueSet set = uniqueValueSerializationStrategy.load( collectionScope,
fields );
 
+                    //Short circut if we don't have any uniqueValues from the given fields.
+                    if(!set.iterator().hasNext()){
+                        return new FieldSetImpl( 0 );
+                    }
+
 
                     //loop through each field, and construct an entity load
                     List<Id> entityIds = new ArrayList<>(fields.size());
@@ -311,6 +323,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
                         uniqueValues.add(value);
                     }
 
+                    //Load a entity for each entityId we retrieved.
                     final EntitySet entitySet = entitySerializationStrategy.load(collectionScope,
entityIds, startTime);
 
                     //now loop through and ensure the entities are there.
@@ -334,7 +347,8 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
 
                     }
 
-                    //fire and forget, we don't care.  We'll repair it again if we have to
+                    //TODO: explore making this an Async process
+                    //We'll repair it again if we have to
                     deleteBatch.execute();
 
                     return response;


Mime
View raw message