usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject incubator-usergrid git commit: clear cursor
Date Tue, 21 Apr 2015 21:25:17 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-dev 1fc18b56f -> 1674dc07c


clear cursor


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

Branch: refs/heads/two-dot-o-dev
Commit: 1674dc07c9293cacfadfef81dd110fd8fdc2b5f8
Parents: 1fc18b5
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Tue Apr 21 15:25:04 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Tue Apr 21 15:25:04 2015 -0600

----------------------------------------------------------------------
 .../results/ElasticSearchQueryExecutor.java       |  2 ++
 .../org/apache/usergrid/persistence/Query.java    | 18 ++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1674dc07/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
index 98a8dac..895b457 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
@@ -160,6 +160,8 @@ public class ElasticSearchQueryExecutor implements QueryExecutor {
         //set offset into query
         if(results.getOffset().isPresent()) {
             query.setOffset(results.getOffset().get());
+        }else{
+            query.clearOffset();
         }
         return results;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1674dc07/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java b/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
index 4273334..e5fbac9 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
@@ -57,8 +57,6 @@ public class Query {
     private static final Logger logger = LoggerFactory.getLogger( Query.class );
     private static final IntegerSerializer INTEGER_SERIALIZER = IntegerSerializer.get();
 
-
-
     public enum Level {
         IDS, REFS, CORE_PROPERTIES, ALL_PROPERTIES, LINKED_PROPERTIES
     }
@@ -324,7 +322,7 @@ public class Query {
 
     public static Query fromUUID( UUID uuid ) {
         Query q = new Query();
-        q.addIdentifier( Identifier.fromUUID( uuid ) );
+        q.addIdentifier( Identifier.fromUUID(uuid) );
         return q;
     }
 
@@ -529,14 +527,18 @@ public class Query {
 
     public void setOffsetFromCursor(String cursor) {
         if(cursor == null || cursor.length() == 0){
-            return;
+            clearOffset();
+        }else {
+            byte[] bytes = Base64.decodeBase64(cursor);
+            ByteBuffer buffer = ByteBuffer.wrap(bytes);
+            Integer number  = INTEGER_SERIALIZER.fromByteBuffer(buffer);
+            setOffset(number);
         }
-        byte[] bytes = Base64.decodeBase64(cursor);
-        ByteBuffer buffer = ByteBuffer.wrap(bytes);
-        Integer number = INTEGER_SERIALIZER.fromByteBuffer(buffer);
-        setOffset(number);
     }
 
+    public void clearOffset() {
+        this.offset = Optional.absent();
+    }
 
     public void setOffset( int offset ) {
         this.offset = Optional.of(offset);


Mime
View raw message