You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/09/02 00:51:39 UTC
[20/35] usergrid git commit: collection iterator
collection iterator
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/394958f7
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/394958f7
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/394958f7
Branch: refs/heads/master
Commit: 394958f7513d6e61879b9bb65dd3f598cf988ce5
Parents: 0e0f805
Author: Mike Dunker <md...@apigee.com>
Authored: Tue Aug 30 15:27:53 2016 -0700
Committer: Mike Dunker <md...@apigee.com>
Committed: Tue Aug 30 15:27:53 2016 -0700
----------------------------------------------------------------------
.../org/apache/usergrid/tools/CollectionIterator.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/394958f7/stack/tools/src/main/java/org/apache/usergrid/tools/CollectionIterator.java
----------------------------------------------------------------------
diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/CollectionIterator.java b/stack/tools/src/main/java/org/apache/usergrid/tools/CollectionIterator.java
index 16c208d..958f03d 100644
--- a/stack/tools/src/main/java/org/apache/usergrid/tools/CollectionIterator.java
+++ b/stack/tools/src/main/java/org/apache/usergrid/tools/CollectionIterator.java
@@ -27,6 +27,7 @@ import org.apache.usergrid.corepersistence.pipeline.read.ResultsPage;
import org.apache.usergrid.corepersistence.results.IdQueryExecutor;
import org.apache.usergrid.corepersistence.service.CollectionSearch;
import org.apache.usergrid.corepersistence.service.CollectionService;
+import org.apache.usergrid.corepersistence.util.CpNamingUtils;
import org.apache.usergrid.persistence.*;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
@@ -195,8 +196,12 @@ public class CollectionIterator extends ToolBase {
CollectionService collectionService = injector.getInstance(CollectionService.class);
String collectionName = InflectionUtils.pluralize(entityType);
+ String simpleEdgeType = CpNamingUtils.getEdgeTypeFromCollectionName(collectionName);
+ logger.info("simpleEdgeType: {}", simpleEdgeType);
ApplicationScope applicationScope = new ApplicationScopeImpl(new SimpleId(app, "application"));
+ Id applicationScopeId = applicationScope.getApplication();
+ logger.info("applicationScope.getApplication(): {}", applicationScopeId);
EdgeSerialization edgeSerialization = injector.getInstance(EdgeSerialization.class);
Query query = new Query();
@@ -251,9 +256,12 @@ public class CollectionIterator extends ToolBase {
logger.info("{} - {} - entity data NOT found, REMOVING", uuid, dateString);
try {
//em.removeItemFromCollection(headEntity, collectionName, entityRef );
- Edge edge = new SimpleEdge(applicationScope.getApplication(), entityType, entityRef.asId(), timestamp);
+ logger.info("entityRef.asId(): {}", entityRef.asId());
+ Edge edge = new SimpleEdge(applicationScopeId, simpleEdgeType, entityRef.asId(), timestamp);
MarkedEdge markedEdge = new SimpleMarkedEdge(edge, true);
- edgeSerialization.deleteEdge(applicationScope, markedEdge, uuid).execute();
+ MutationBatch batch = edgeSerialization.deleteEdge(applicationScope, markedEdge, UUIDUtils.newTimeUUID());
+ logger.info("BATCH: {}", batch);
+ batch.execute();
} catch (Exception e) {
logger.error("{} - exception while trying to remove orphaned connection, {}", uuid, e.getMessage());
}