You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/01/30 02:21:00 UTC

[20/50] [abbrv] git commit: Initialized connection to null. Added if else statements checking the possible instance types of the iterator.

Initialized connection to null.
Added if else statements checking the possible instance types of the 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/89b9f502
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/89b9f502
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/89b9f502

Branch: refs/heads/USERGRID-2771-graph-edges
Commit: 89b9f502a14db98dfa32e890a46ac700ab272c6b
Parents: 2dde4ea
Author: GERey <gr...@apigee.com>
Authored: Wed Jan 15 14:55:47 2014 -0800
Committer: GERey <gr...@apigee.com>
Committed: Wed Jan 15 14:55:47 2014 -0800

----------------------------------------------------------------------
 .../cassandra/RelationManagerImpl.java            | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/89b9f502/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
index da11ddd..d2d6c15 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
@@ -1088,10 +1088,24 @@ public class RelationManagerImpl implements RelationManager {
         PagingResultsIterator itr =
                 new PagingResultsIterator( getConnectedEntities(headEntity, null, null, Level.REFS) );
 
-        ConnectionRefImpl connection;
+        ConnectionRefImpl connection = null;
 
         while ( itr.hasNext() ) {
-            connection = new ConnectionRefImpl( new SimpleEntityRef((EntityRef)itr.next()));
+            Object itrObj = itr.next();
+            if ( itrObj instanceof ConnectionRefImpl ) {
+                connection = (ConnectionRefImpl) itrObj;
+            }
+            else if ( itrObj instanceof SimpleEntityRef ) {
+                connection = new ConnectionRefImpl( (SimpleEntityRef) itrObj );
+            }
+            else {
+                if ( itrObj instanceof EntityRef ) {
+                    connection = new ConnectionRefImpl( new SimpleEntityRef((EntityRef) itr.next()));
+                }
+                else if ( itrObj instanceof UUID ) {
+                    connection = new ConnectionRefImpl( new SimpleEntityRef((UUID)itr.next()));
+                }
+            }
 
             batchUpdateEntityConnection( batch, true, connection, timestampUuid );
         }