usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [29/51] [abbrv] git commit: Initialized connection to null. Added if else statements checking the possible instance types of the iterator.
Date Thu, 16 Jan 2014 17:30:25 GMT
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/two-dot-o
Commit: 89b9f502a14db98dfa32e890a46ac700ab272c6b
Parents: 2dde4ea
Author: GERey <greyes@apigee.com>
Authored: Wed Jan 15 14:55:47 2014 -0800
Committer: GERey <greyes@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 );
         }


Mime
View raw message