usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject git commit: change path query so it can serialize
Date Wed, 10 Sep 2014 20:29:38 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o 4971ee8a5 -> f0eda9f65


change path query so it can serialize


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

Branch: refs/heads/two-dot-o
Commit: f0eda9f65f4799863890a29000bb24f25d62a0c6
Parents: 4971ee8
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Wed Sep 10 14:29:26 2014 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Wed Sep 10 14:29:26 2014 -0600

----------------------------------------------------------------------
 .../apache/usergrid/persistence/PathQuery.java  | 22 ++++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f0eda9f6/stack/core/src/main/java/org/apache/usergrid/persistence/PathQuery.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/PathQuery.java b/stack/core/src/main/java/org/apache/usergrid/persistence/PathQuery.java
index 6721fa6..6d252fd 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/PathQuery.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/PathQuery.java
@@ -19,6 +19,8 @@ package org.apache.usergrid.persistence;
 
 import org.apache.usergrid.persistence.index.query.Query;
 import java.util.Iterator;
+import java.util.UUID;
+
 import org.apache.usergrid.persistence.index.query.Query.Level;
 
 
@@ -26,7 +28,8 @@ public class PathQuery<E> {
 
     private PathQuery source;
     private Query query;
-    private EntityRef head;
+    private UUID uuid;
+    private String type;
 
 
     public PathQuery() {
@@ -39,7 +42,8 @@ public class PathQuery<E> {
      * @param head the top-level entity
      */
     public PathQuery( EntityRef head ) {
-        this.head = head;
+        this.uuid = head.getUuid();
+        this.type = head.getType();
         this.query = null;
     }
 
@@ -54,7 +58,8 @@ public class PathQuery<E> {
         if ( query.getCollection() == null && query.getConnectionType() == null )
{
             throw new IllegalArgumentException( "Query must have a collection or connectionType
value" );
         }
-        this.head = head;
+        this.uuid = head.getUuid();
+        this.type = head.getType();
         this.query = query;
     }
 
@@ -81,7 +86,7 @@ public class PathQuery<E> {
 
     public Iterator<E> iterator( EntityManager em ) {
         try {
-            if ( head != null ) {
+            if ( uuid != null && type != null ) {
                 return new PagingResultsIterator( getHeadResults( em ), query.getResultsLevel()
);
             }
             else {
@@ -95,7 +100,7 @@ public class PathQuery<E> {
 
 
     protected Results getHeadResults( EntityManager em ) throws Exception {
-        EntityRef ref = new SimpleEntityRef( head );
+        EntityRef ref = new SimpleEntityRef(type,uuid);
         return ( query.getCollection() != null ) ? 
                em.searchCollection( ref, query.getCollection(), query ) :
                em.searchConnectedEntities( ref, query );
@@ -103,7 +108,7 @@ public class PathQuery<E> {
 
 
     protected Iterator refIterator( EntityManager em ) throws Exception {
-        if ( head != null ) {
+        if ( type != null  && uuid != null) {
             return new PagingResultsIterator( getHeadResults( em ), Level.REFS );
         }
         else {
@@ -122,10 +127,9 @@ public class PathQuery<E> {
     }
 
 
-    public EntityRef getHead() {
-        return head;
-    }
+    public String getType(){return type;}
 
+    public UUID getUuid(){return uuid;}
 
     public Query getQuery() {
         return query;


Mime
View raw message