Fixes wiring and updates code to be compatible with 2.0-dev

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

Branch: refs/heads/USERGRID-593
Commit: 83174e8bf6675476e21a8d9e47ae0eadff6cb7a3
Parents: ec3a710
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Apr 24 10:28:45 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Apr 24 10:28:45 2015 -0600

----------------------------------------------------------------------
 .../corepersistence/CpEntityManagerFactory.java |  13 ++-
 .../corepersistence/CpRelationManager.java      |  34 ++++--
 .../command/read/entity/EntityLoadCommand.java  | 113 +++++--------------
 .../read/graph/AbstractReadGraphCommand.java    |   2 +-
 .../migration/AppInfoMigrationPlugin.java       |   6 +-
 .../results/CollectionGraphQueryExecutor.java   |   6 +-
 .../rx/impl/AllApplicationsObservableImpl.java  |   7 +-
 .../corepersistence/util/CpNamingUtils.java     |  32 +++---
 .../org/apache/usergrid/persistence/Query.java  |   5 +-
 .../serialization/impl/EdgesObservableImpl.java |   6 +-
 .../usergrid/persistence/index/IndexFig.java    |   2 -
 11 files changed, 99 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 6ba71e2..f06cf40 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -50,6 +50,7 @@ import 
org.apache.usergrid.persistence.cassandra.CassandraService;
 import org.apache.usergrid.persistence.cassandra.CounterUtils;
 import org.apache.usergrid.persistence.cassandra.Setup;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
+import 
org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
 import 
org.apache.usergrid.persistence.collection.serialization.impl.migration.EntityIdScope;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import 
org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
@@ -61,6 +62,7 @@ import 
org.apache.usergrid.persistence.exceptions.ApplicationAlreadyExistsExcept
 import 
org.apache.usergrid.persistence.exceptions.DuplicateUniquePropertyExistsException;
 import org.apache.usergrid.persistence.graph.Edge;
 import org.apache.usergrid.persistence.graph.GraphManager;
+import org.apache.usergrid.persistence.graph.GraphManagerFactory;
 import org.apache.usergrid.persistence.graph.SearchByEdgeType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
 import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
@@ -116,6 +118,8 @@ public class CpEntityManagerFactory implements 
EntityManagerFactory, Application
     private final ApplicationIdCache applicationIdCache;
 
     private ManagerCache managerCache;
+    private final EntityCollectionManagerFactory 
entityCollectionManagerFactory;
+    private final GraphManagerFactory graphManagerFactory;
 
     private CassandraService cassandraService;
     private CounterUtils counterUtils;
@@ -125,7 +129,7 @@ public class CpEntityManagerFactory implements 
EntityManagerFactory, Application
     private final AsyncIndexService indexService;
 
     public CpEntityManagerFactory( final CassandraService cassandraService, 
final CounterUtils counterUtils,
-                                   final Injector injector) {
+                                   final Injector injector ) {
 
         this.cassandraService = cassandraService;
         this.counterUtils = counterUtils;
@@ -137,6 +141,9 @@ public class CpEntityManagerFactory implements 
EntityManagerFactory, Application
         this.indexService = injector.getInstance( AsyncIndexService.class );
         this.applicationIdCache = 
injector.getInstance(ApplicationIdCacheFactory.class).getInstance(
             getManagementEntityManager() );
+        this.entityCollectionManagerFactory = injector.getInstance( 
EntityCollectionManagerFactory.class );
+        this.graphManagerFactory = injector.getInstance( 
GraphManagerFactory.class );
+
 
     }
 
@@ -192,8 +199,8 @@ public class CpEntityManagerFactory implements 
EntityManagerFactory, Application
 
 
     private EntityManager _getEntityManager( UUID applicationId ) {
-        EntityManager em = new CpEntityManager(cassandraService, counterUtils, 
indexService, managerCache, metricsFactory, applicationId,
-            entityCollectionManagerFactory, graphManagerFactory );
+        EntityManager em = new CpEntityManager(cassandraService, counterUtils, 
indexService, managerCache, metricsFactory,
+            entityCollectionManagerFactory, graphManagerFactory,  
applicationId );
         return em;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
index 8e2fdd7..86ba300 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
@@ -31,7 +31,9 @@ import org.slf4j.LoggerFactory;
 import org.springframework.util.Assert;
 
 import org.apache.usergrid.corepersistence.index.AsyncIndexService;
+import 
org.apache.usergrid.corepersistence.results.CollectionGraphQueryExecutor;
 import 
org.apache.usergrid.corepersistence.results.CollectionResultsLoaderFactoryImpl;
+import 
org.apache.usergrid.corepersistence.results.ConnectionGraphQueryExecutor;
 import 
org.apache.usergrid.corepersistence.results.ConnectionResultsLoaderFactoryImpl;
 import org.apache.usergrid.corepersistence.results.ElasticSearchQueryExecutor;
 import org.apache.usergrid.corepersistence.results.QueryExecutor;
@@ -51,7 +53,6 @@ import org.apache.usergrid.persistence.Schema;
 import org.apache.usergrid.persistence.SimpleEntityRef;
 import org.apache.usergrid.persistence.SimpleRoleRef;
 import org.apache.usergrid.persistence.cassandra.ConnectionRefImpl;
-import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import 
org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -635,19 +636,28 @@ public class CpRelationManager implements RelationManager 
{
         }
 
 
-        final SearchEdge searchEdge = createCollectionSearchEdge( 
cpHeadEntity.getId(), collName );
 
-        final ApplicationEntityIndex ei = managerCache.getEntityIndex( 
applicationScope );
+        query.setEntityType( collection.getType() );
+        query = adjustQuery( query );
 
-        final SearchTypes types = SearchTypes.fromTypes( collection.getType() 
);
 
-        logger.debug( "Searching scope {}", searchEdge );
+        if ( query.isGraphSearch() ) {
+            QueryExecutor executor =
+                new CollectionGraphQueryExecutor( 
entityCollectionManagerFactory, graphManagerFactory, applicationScope,
+                    headEntity, query.getOffsetCursor(), collName, 
query.getLimit() );
 
-        query.setEntityType( collection.getType() );
-        query = adjustQuery( query );
+            return executor.next();
+        }
 
 
 
+        final SearchEdge searchEdge = createCollectionSearchEdge( 
cpHeadEntity.getId(), collName );
+
+        final ApplicationEntityIndex ei = managerCache.getEntityIndex( 
applicationScope );
+
+        final SearchTypes types = SearchTypes.fromTypes( collection.getType() 
);
+
+        logger.debug( "Searching scope {}", searchEdge );
 
         final CollectionResultsLoaderFactoryImpl resultsLoaderFactory =
             new CollectionResultsLoaderFactoryImpl( managerCache );
@@ -909,6 +919,16 @@ public class CpRelationManager implements RelationManager {
 
         query = adjustQuery( query );
 
+
+
+        if ( query.isGraphSearch() ) {
+            QueryExecutor executor =
+                new ConnectionGraphQueryExecutor( 
entityCollectionManagerFactory, graphManagerFactory, applicationScope,
+                    headEntity, query.getOffsetCursor(), connection, 
query.getLimit() );
+
+            return executor.next();
+        }
+
         final ConnectionResultsLoaderFactoryImpl resultsLoaderFactory =
             new ConnectionResultsLoaderFactoryImpl( managerCache, headEntity, 
connection );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/entity/EntityLoadCommand.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/entity/EntityLoadCommand.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/entity/EntityLoadCommand.java
index f4de9e0..08193ef 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/entity/EntityLoadCommand.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/entity/EntityLoadCommand.java
@@ -21,7 +21,6 @@ package 
org.apache.usergrid.corepersistence.command.read.entity;
 
 
 import java.io.Serializable;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.usergrid.corepersistence.command.read.AbstractCommand;
@@ -29,7 +28,6 @@ import 
org.apache.usergrid.corepersistence.command.read.CollectCommand;
 import org.apache.usergrid.corepersistence.util.CpEntityMapUtils;
 import org.apache.usergrid.persistence.EntityFactory;
 import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import 
org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
 import org.apache.usergrid.persistence.collection.EntitySet;
@@ -39,10 +37,6 @@ import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import rx.Observable;
-import rx.functions.Func1;
-import rx.observables.GroupedObservable;
-
-import static 
org.apache.usergrid.corepersistence.util.CpNamingUtils.getCollectionScopeNameFromEntityType;
 
 
 /**
@@ -73,7 +67,7 @@ public class EntityLoadCommand extends 
AbstractCommand<Results, Serializable> im
 
 
     @Override
-    public Observable<Results> call( final Observable<? extends Id> observable 
) {
+    public Observable<Results> call( final Observable<Id> observable ) {
 
 
         /**
@@ -81,90 +75,39 @@ public class EntityLoadCommand extends 
AbstractCommand<Results, Serializable> im
          * objects
          */
 
+        final EntityCollectionManager entityCollectionManager =
+            entityCollectionManagerFactory.createCollectionManager( 
applicationScope );
+
+        final Observable<EntitySet> entitySetObservable = observable.buffer( 
resultSize ).flatMap(
+            bufferedIds -> Observable.just( bufferedIds ).flatMap( ids -> 
entityCollectionManager.load( ids ) ) );
+
+
+        return entitySetObservable
+
+            .flatMap( entitySet -> {
+
+                //get our entites and filter missing ones, then collect them 
into a results object
+                final Observable<MvccEntity> mvccEntityObservable = 
Observable.from( entitySet.getEntities() );
+
+                //convert them to our old entity model, then filter nulls, 
meaning they weren't found
+                return mvccEntityObservable.map( mvccEntity -> mapEntity( 
mvccEntity ) ).filter(
+                    entity -> entity == null )
+
+                    //convert them to a list, then map them into results
+                    .toList().map( entities -> {
+                        final Results results = Results.fromEntities( entities 
);
+                        results.setCursor( generateCursor() );
 
-        return observable.buffer( resultSize ).flatMap( new Func1<List<? 
extends Id>, Observable<Results>>() {
-            @Override
-            public Observable<Results> call( final List<? extends Id> ids ) {
-
-                return Observable.from( ids )
-                    //group them by type so we can load them, in 2.0 dev this 
step will be removed
-                    .groupBy( new Func1<Id, String>() {
-                        @Override
-                        public String call( final Id id ) {
-                            return id.getType();
-                        }
-                    } )
-
-                        //take all our groups and load them as id sets
-
-                    .flatMap( new Func1<GroupedObservable<String, Id>, 
Observable<EntitySet>>() {
-                        @Override
-                        public Observable<EntitySet> call(
-                            final GroupedObservable<String, Id> 
stringIdGroupedObservable ) {
-
-
-                            final String entityType = 
stringIdGroupedObservable.getKey();
-
-                            final CollectionScope collectionScope =
-                                getCollectionScopeNameFromEntityType( 
applicationScope.getApplication(), entityType );
-
-
-                            return stringIdGroupedObservable.toList()
-                                                            .flatMap( new 
Func1<List<Id>, Observable<EntitySet>>() {
-                                                                @Override
-                                                                public 
Observable<EntitySet> call(
-                                                                    final 
List<Id> ids ) {
-
-                                                                    final 
EntityCollectionManager ecm =
-                                                                        
entityCollectionManagerFactory
-                                                                            
.createCollectionManager( collectionScope );
-                                                                    return 
ecm.load( ids );
-                                                                }
-                                                            } );
-                        }
-                    } )
-                        //emit our groups of entities as a stream of entities
-                    .flatMap( new Func1<EntitySet, 
Observable<org.apache.usergrid.persistence.Entity>>() {
-                        @Override
-                        public 
Observable<org.apache.usergrid.persistence.Entity> call( final EntitySet 
entitySet ) {
-                            //emit our entities, and filter out deleted entites
-                            return Observable.from( entitySet.getEntities() 
).map(
-                                new Func1<MvccEntity, 
org.apache.usergrid.persistence.Entity>() {
-
-                                    @Override
-                                    public 
org.apache.usergrid.persistence.Entity call( final MvccEntity mvccEntity ) {
-                                        return mapEntity( mvccEntity );
-                                    }
-                                } )
-                                //filter null entities
-                                .filter( new 
Func1<org.apache.usergrid.persistence.Entity, Boolean>() {
-                                    @Override
-                                    public Boolean call( final 
org.apache.usergrid.persistence.Entity entity ) {
-                                        return entity == null;
-                                    }
-                                } );
-                        }
-                    } )
-
-                        //convert them to a list, then map them into results
-                    .toList().map( new 
Func1<List<org.apache.usergrid.persistence.Entity>, Results>() {
-                        @Override
-                        public Results call( final 
List<org.apache.usergrid.persistence.Entity> entities ) {
-                            final Results results = Results.fromEntities( 
entities );
-                            results.setCursor( generateCursor() );
-
-                            return results;
-                        }
+                        return results;
                     } );
-            }
-        } );
+            } );
     }
 
+                /**
+                 * Map a new cp entity to an old entity.  May be null if not 
present
+                 */
 
 
-    /**
-     * Map a new cp entity to an old entity.  May be null if not present
-     */
     private org.apache.usergrid.persistence.Entity mapEntity( final MvccEntity 
mvccEntity ) {
         if ( !mvccEntity.getEntity().isPresent() ) {
             return null;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/graph/AbstractReadGraphCommand.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/graph/AbstractReadGraphCommand.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/graph/AbstractReadGraphCommand.java
index 141fb06..95b6c6b 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/graph/AbstractReadGraphCommand.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/command/read/graph/AbstractReadGraphCommand.java
@@ -56,7 +56,7 @@ public abstract class AbstractReadGraphCommand extends 
AbstractCommand<Id, Edge>
 
 
     @Override
-    public Observable<Id> call( final Observable<? extends Id> observable ) {
+    public Observable<Id> call( final Observable<Id> observable ) {
 
         //get the graph manager
         final GraphManager graphManager = 
graphManagerFactory.createEdgeManager( applicationScope );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
index 129f2f9..30955af 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
@@ -18,6 +18,7 @@
  */
 package org.apache.usergrid.corepersistence.migration;
 
+import com.google.common.base.Optional;
 import com.google.inject.Inject;
 import org.apache.usergrid.corepersistence.util.CpEntityMapUtils;
 import org.apache.usergrid.corepersistence.util.CpNamingUtils;
@@ -261,7 +262,7 @@ public class AppInfoMigrationPlugin implements 
MigrationPlugin {
         Id rootAppId = systemAppScope.getApplication();
 
         final SimpleSearchByEdgeType simpleSearchByEdgeType =  new 
SimpleSearchByEdgeType(
-            rootAppId, edgeType, Long.MAX_VALUE, 
SearchByEdgeType.Order.DESCENDING, null);
+            rootAppId, edgeType, Long.MAX_VALUE, 
SearchByEdgeType.Order.DESCENDING, Optional.absent());
 
         Observable<org.apache.usergrid.persistence.model.entity.Entity> 
entityObs =
             gm.loadEdgesFromSource( simpleSearchByEdgeType )
@@ -284,7 +285,8 @@ public class AppInfoMigrationPlugin implements 
MigrationPlugin {
 
 
         final SimpleSearchByEdgeType simpleSearchByEdgeType =  new 
SimpleSearchByEdgeType(
-            
CpNamingUtils.generateApplicationId(CpNamingUtils.MANAGEMENT_APPLICATION_ID), 
edgeType, Long.MAX_VALUE, SearchByEdgeType.Order.DESCENDING, null);
+            
CpNamingUtils.generateApplicationId(CpNamingUtils.MANAGEMENT_APPLICATION_ID), 
edgeType, Long.MAX_VALUE, SearchByEdgeType.Order.DESCENDING,
+            Optional.absent());
         edgesObservable = edgesObservable !=null ? edgesObservable : 
gm.loadEdgesFromSource( simpleSearchByEdgeType );
         return edgesObservable;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionGraphQueryExecutor.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionGraphQueryExecutor.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionGraphQueryExecutor.java
index 651c27e..515fc2b 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionGraphQueryExecutor.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionGraphQueryExecutor.java
@@ -42,13 +42,13 @@ public class CollectionGraphQueryExecutor extends 
AbstractGraphQueryExecutor {
     public CollectionGraphQueryExecutor( final EntityCollectionManagerFactory 
entityCollectionManagerFactory,
                                          final GraphManagerFactory 
graphManagerFactory,
                                          final ApplicationScope 
applicationScope, final EntityRef source,
-                                         final String cursor, final String 
connectionName, final int limit ) {
+                                         final String cursor, final String 
collectionName, final int limit ) {
 
         super( entityCollectionManagerFactory, applicationScope, source, 
cursor, limit );
         this.graphManagerFactory = graphManagerFactory;
 
-        Preconditions.checkNotNull( connectionName, "connectionName is 
required on the query" );
-        this.collectionName = connectionName;
+        Preconditions.checkNotNull( collectionName, "collectionName is 
required on the query" );
+        this.collectionName = collectionName;
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/core/src/main/java/org/apache/usergrid/corepersistence/rx/impl/AllApplicationsObservableImpl.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/rx/impl/AllApplicationsObservableImpl.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/rx/impl/AllApplicationsObservableImpl.java
index 5e2f6b6..fbabbee 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/rx/impl/AllApplicationsObservableImpl.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/rx/impl/AllApplicationsObservableImpl.java
@@ -40,6 +40,7 @@ import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.utils.UUIDUtils;
 
+import com.google.common.base.Optional;
 import com.google.inject.Inject;
 
 import rx.Observable;
@@ -91,8 +92,8 @@ public class AllApplicationsObservableImpl implements 
AllApplicationsObservable
 
         //we have app infos.  For each of these app infos, we have to load the 
application itself
         Observable<ApplicationScope> appIds = gm.loadEdgesFromSource(
-                new SimpleSearchByEdgeType( rootAppId, edgeType, 
Long.MAX_VALUE, SearchByEdgeType.Order.DESCENDING,
-                        null ) ).flatMap( new Func1<Edge, 
Observable<ApplicationScope>>() {
+            new SimpleSearchByEdgeType( rootAppId, edgeType, Long.MAX_VALUE, 
SearchByEdgeType.Order.DESCENDING,
+                Optional.absent() ) ).flatMap( new Func1<Edge, 
Observable<ApplicationScope>>() {
             @Override
             public Observable<ApplicationScope> call( final Edge edge ) {
 
@@ -118,7 +119,7 @@ public class AllApplicationsObservableImpl implements 
AllApplicationsObservable
                         @Override
                         public ApplicationScope call( final Entity entity ) {
                             final UUID uuid = UUIDUtils.tryExtractUUID(
-                                entity.getField( 
Schema.PROPERTY_APPLICATION_ID ).getValue().toString());
+                                entity.getField( 
Schema.PROPERTY_APPLICATION_ID ).getValue().toString() );
                             return getApplicationScope( uuid );
                         }
                     } );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
index 364b071..5472071 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
@@ -21,7 +21,6 @@ package org.apache.usergrid.corepersistence.util;
 
 import java.util.UUID;
 
-import org.apache.usergrid.persistence.EntityRef;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
 import org.apache.usergrid.persistence.entities.Application;
@@ -73,7 +72,6 @@ public class CpNamingUtils {
     public static String TYPES_BY_UUID_MAP = "zzz_typesbyuuid_zzz";
 
 
-
     /**
      * Generate a standard edge name for our graph using the connection name. 
To be used only for searching.  DO NOT use
      * for creation.  Use the createConnectionEdge instead.
@@ -99,7 +97,8 @@ public class CpNamingUtils {
      * Get the index scope for the edge from the source
      */
     public static IndexEdge generateScopeFromSource( final Edge edge ) {
-        return new IndexEdgeImpl( edge.getSourceNode(), edge.getType(), 
SearchEdge.NodeType.SOURCE, edge.getTimestamp() );
+        return new IndexEdgeImpl( edge.getSourceNode(), edge.getType(), 
SearchEdge.NodeType.SOURCE,
+            edge.getTimestamp() );
     }
 
 
@@ -107,7 +106,8 @@ public class CpNamingUtils {
      * Get the index scope for the edge from the source
      */
     public static IndexEdge generateScopeToTarget( final Edge edge ) {
-        return new IndexEdgeImpl( edge.getTargetNode(), edge.getType(), 
SearchEdge.NodeType.TARGET, edge.getTimestamp() );
+        return new IndexEdgeImpl( edge.getTargetNode(), edge.getType(), 
SearchEdge.NodeType.TARGET,
+            edge.getTimestamp() );
     }
 
 
@@ -120,13 +120,7 @@ public class CpNamingUtils {
 
 
     /**
-     *
      * TODO move sourceId to ApplicationScope
-     *
-     * @param sourceId
-     * @param collectionName
-     * @param entityId
-     * @return
      */
     public static Edge createCollectionEdge( final Id sourceId, final String 
collectionName, final Id entityId ) {
         final String edgeType = CpNamingUtils.getEdgeTypeFromCollectionName( 
collectionName );
@@ -205,7 +199,7 @@ public class CpNamingUtils {
     public static ApplicationScope getApplicationScope( UUID applicationId ) {
 
         // We can always generate a scope, it doesn't matter if  the 
application exists yet or not.
-        return  new ApplicationScopeImpl( generateApplicationId( applicationId 
) );
+        return new ApplicationScopeImpl( generateApplicationId( applicationId 
) );
     }
 
 
@@ -221,14 +215,12 @@ public class CpNamingUtils {
 
     /**
      * Generate an application scope for the management application
-     * @return
      */
-    public static Id getManagementApplicationId(){
-        return  generateApplicationId( MANAGEMENT_APPLICATION_ID );
+    public static Id getManagementApplicationId() {
+        return generateApplicationId( MANAGEMENT_APPLICATION_ID );
     }
 
 
-
     /**
      * Get the map scope for the applicationId to store entity uuid to type 
mapping
      */
@@ -268,13 +260,19 @@ public class CpNamingUtils {
     }
 
 
-    private static String getCollectionScopeNameFromCollectionName( String 
name ) {
+    /**
+     * Only use when searching graph.  When searching ES use the 
<see>createCollectionSearchEdge</see>
+     */
+    public static String getCollectionScopeNameFromCollectionName( String name 
) {
         String csn = EDGE_COLL_SUFFIX + name;
         return csn.toLowerCase();
     }
 
 
-    private static String getConnectionScopeName( String connectionType ) {
+    /**
+     * Only use when searching graph.  When searching ES use the 
<see>createConnectionSearchByEdge</see>
+     */
+    public static String getConnectionScopeName( String connectionType ) {
         String csn = EDGE_CONN_SUFFIX + connectionType;
         return csn.toLowerCase();
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/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 1c28e6a..930b98e 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
@@ -500,6 +500,9 @@ public class Query {
     }
 
     public String getOffsetCursor() {
+
+        //TODO refactor cursor logic for encapsulation at level using it
+
         String cursor = "";
         if(offset.isPresent()){
             ByteBuffer buffer = INTEGER_SERIALIZER.toByteBuffer(offset.get());
@@ -871,7 +874,7 @@ public class Query {
      * Return true if no query is present and we should perform a graph search
      * @return
      */
-    public boolean graphSearch(){
+    public boolean isGraphSearch(){
         return ql == null;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgesObservableImpl.java
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgesObservableImpl.java
 
b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgesObservableImpl.java
index ca9fb03..df9e094 100644
--- 
a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgesObservableImpl.java
+++ 
b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgesObservableImpl.java
@@ -65,7 +65,7 @@ public class EdgesObservableImpl implements EdgesObservable {
 
                 return gm.loadEdgesFromSource(
                     new SimpleSearchByEdgeType( sourceNode, edgeType, 
Long.MAX_VALUE, SearchByEdgeType.Order.DESCENDING,
-                        null ) );
+                        Optional.<Edge>absent() ) );
         } );
     }
 
@@ -86,7 +86,7 @@ public class EdgesObservableImpl implements EdgesObservable {
 
                 return gm.loadEdgesFromSource(
                     new SimpleSearchByEdgeType( sourceNode, edgeType, 
startTimestamp.or( Long.MIN_VALUE ), SearchByEdgeType.Order.ASCENDING,
-                        null ) );
+                        Optional.<Edge>absent() ) );
         } );
     }
 
@@ -123,7 +123,7 @@ public class EdgesObservableImpl implements EdgesObservable 
{
 
             return gm.loadEdgesToTarget(
                 new SimpleSearchByEdgeType( targetNode, edgeType, 
Long.MAX_VALUE, SearchByEdgeType.Order.DESCENDING,
-                    null ) );
+                    Optional.<Edge>absent() ) );
         } );
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/83174e8b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
 
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
index 7f2ff09..1ee3580 100644
--- 
a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
+++ 
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
@@ -89,8 +89,6 @@ public interface IndexFig extends GuicyFig {
     String ELASTICSEARCH_CLIENT_TYPE = "elasticsearch.client.type";
 
 
-    String QUERY_LIMIT_DEFAULT = "index.query.limit.default";
-
 
     @Default( "127.0.0.1" )
     @Key( ELASTICSEARCH_HOSTS )

Reply via email to