You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/04/30 01:11:10 UTC
incubator-usergrid git commit: null safety
Repository: incubator-usergrid
Updated Branches:
refs/heads/two-dot-o-dev fd6305c18 -> 74359cf2c
null safety
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/74359cf2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/74359cf2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/74359cf2
Branch: refs/heads/two-dot-o-dev
Commit: 74359cf2cbb770bf183b56127260fde85154e3fe
Parents: fd6305c
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Apr 29 17:11:04 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Apr 29 17:11:04 2015 -0600
----------------------------------------------------------------------
.../corepersistence/CpRelationManager.java | 34 ++++++++++----------
.../graph/impl/SimpleSearchByEdge.java | 5 +--
2 files changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/74359cf2/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 3119934..1f502f7 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
@@ -171,7 +171,7 @@ public class CpRelationManager implements RelationManager {
public Set<String> getCollectionIndexes( String collectionName ) throws Exception {
GraphManager gm = managerCache.getGraphManager( applicationScope );
- String edgeTypePrefix = CpNamingUtils.getEdgeTypeFromCollectionName( collectionName );
+ String edgeTypePrefix = CpNamingUtils.getEdgeTypeFromCollectionName(collectionName);
logger.debug( "getCollectionIndexes(): Searching for edge type prefix {} to target {}:{}", new Object[] {
edgeTypePrefix, cpHeadEntity.getId().getType(), cpHeadEntity.getId().getUuid()
@@ -207,7 +207,7 @@ public class CpRelationManager implements RelationManager {
private Map<EntityRef, Set<String>> getContainers() {
- return getContainers( -1, null, null );
+ return getContainers(-1, null, null);
}
@@ -224,14 +224,14 @@ public class CpRelationManager implements RelationManager {
Observable<Edge> edges =
gm.getEdgeTypesToTarget( new SimpleSearchEdgeType( cpHeadEntity.getId(), edgeType, null ) )
- .flatMap( new Func1<String, Observable<Edge>>() {
+ .flatMap(new Func1<String, Observable<Edge>>() {
@Override
- public Observable<Edge> call( final String edgeType ) {
+ public Observable<Edge> call(final String edgeType) {
return gm.loadEdgesToTarget(
- new SimpleSearchByEdgeType( cpHeadEntity.getId(), edgeType, Long.MAX_VALUE,
- SearchByEdgeType.Order.DESCENDING, Optional.<Edge>absent() ) );
+ new SimpleSearchByEdgeType(cpHeadEntity.getId(), edgeType, Long.MAX_VALUE,
+ SearchByEdgeType.Order.DESCENDING, Optional.<Edge>absent()));
}
- } );
+ });
//if our limit is set, take them. Note this logic is still borked, we can't possibly fit everything in memmory
if ( limit > -1 ) {
@@ -259,7 +259,7 @@ public class CpRelationManager implements RelationManager {
Id entityId = new SimpleId( entity.getUuid(), entity.getType() );
- String edgeType = CpNamingUtils.getEdgeTypeFromConnectionType( connectionType );
+ String edgeType = CpNamingUtils.getEdgeTypeFromConnectionType(connectionType);
logger.debug( "isConnectionMember(): Checking for edge type {} from {}:{} to {}:{}", new Object[] {
edgeType, headEntity.getType(), headEntity.getUuid(), entity.getType(), entity.getUuid()
@@ -280,16 +280,16 @@ public class CpRelationManager implements RelationManager {
Id entityId = new SimpleId( entity.getUuid(), entity.getType() );
- String edgeType = CpNamingUtils.getEdgeTypeFromCollectionName( collName );
+ String edgeType = CpNamingUtils.getEdgeTypeFromCollectionName(collName);
logger.debug( "isCollectionMember(): Checking for edge type {} from {}:{} to {}:{}", new Object[] {
edgeType, headEntity.getType(), headEntity.getUuid(), entity.getType(), entity.getUuid()
} );
- GraphManager gm = managerCache.getGraphManager( applicationScope );
+ GraphManager gm = managerCache.getGraphManager(applicationScope);
Observable<Edge> edges = gm.loadEdgeVersions(
new SimpleSearchByEdge( new SimpleId( headEntity.getUuid(), headEntity.getType() ), edgeType, entityId,
- Long.MAX_VALUE, SearchByEdgeType.Order.DESCENDING, null ) );
+ Long.MAX_VALUE, SearchByEdgeType.Order.DESCENDING, Optional.<Edge>absent() ) );
return edges.toBlocking().firstOrDefault( null ) != null;
}
@@ -413,7 +413,7 @@ public class CpRelationManager implements RelationManager {
logger.debug( "Wrote edge {}", edge );
}
- indexService.queueNewEdge( applicationScope, memberEntity, edge );
+ indexService.queueNewEdge(applicationScope, memberEntity, edge);
if ( logger.isDebugEnabled() ) {
@@ -629,11 +629,11 @@ public class CpRelationManager implements RelationManager {
final ReadPipelineBuilder readPipelineBuilder =
- pipelineBuilderFactory.createReadPipelineBuilder( applicationScope );
+ pipelineBuilderFactory.createReadPipelineBuilder(applicationScope);
//set our fields applicable to both operations
- readPipelineBuilder.withCursor( query.getCursor() );
- readPipelineBuilder.withLimit( query.getLimit() );
+ readPipelineBuilder.withCursor(query.getCursor());
+ readPipelineBuilder.withLimit(query.getLimit());
//TODO, this should be removed when the CP relation manager is removed
readPipelineBuilder.setStartId( cpHeadEntity.getId() );
@@ -899,11 +899,11 @@ public class CpRelationManager implements RelationManager {
final ReadPipelineBuilder readPipelineBuilder =
- pipelineBuilderFactory.createReadPipelineBuilder( applicationScope );
+ pipelineBuilderFactory.createReadPipelineBuilder(applicationScope);
//set our fields applicable to both operations
readPipelineBuilder.withCursor( query.getCursor() );
- readPipelineBuilder.withLimit( query.getLimit() );
+ readPipelineBuilder.withLimit(query.getLimit());
//TODO, this should be removed when the CP relation manager is removed
readPipelineBuilder.setStartId( cpHeadEntity.getId() );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/74359cf2/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByEdge.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByEdge.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByEdge.java
index 99c0cdb..a28a0bb 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByEdge.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByEdge.java
@@ -57,9 +57,10 @@ public class SimpleSearchByEdge implements SearchByEdge {
ValidationUtils.verifyIdentity(sourceNode);
ValidationUtils.verifyIdentity(targetNode);
- ValidationUtils.verifyString( type, "type" );
- GraphValidation.validateTimestamp( maxTimestamp, "maxTimestamp" );
+ ValidationUtils.verifyString(type, "type");
+ GraphValidation.validateTimestamp(maxTimestamp, "maxTimestamp");
Preconditions.checkNotNull(order, "order must not be null");
+ Preconditions.checkNotNull(last, "last can never be null");
this.sourceNode = sourceNode;