You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/06/09 01:42:50 UTC

[2/2] incubator-usergrid git commit: Fixes incorrect timestamp on edge creation and node deletion.

Fixes incorrect timestamp on edge creation and node deletion.


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

Branch: refs/heads/USERGRID-688
Commit: 9337b37f687c7647fef2610edfce9512332c2759
Parents: f07ea32
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Jun 8 17:42:46 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Jun 8 17:42:46 2015 -0600

----------------------------------------------------------------------
 .../org/apache/usergrid/corepersistence/CpEntityManager.java    | 2 +-
 .../org/apache/usergrid/corepersistence/util/CpNamingUtils.java | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9337b37f/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 513f257..7cee908 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -690,7 +690,7 @@ public class CpEntityManager implements EntityManager {
         Id entityId = new SimpleId( entityRef.getUuid(), entityRef.getType() );
 
         //for devices we don't have time uuids
-        UUID timeUUID =  UUIDUtils.isTimeBased(entityRef.getUuid()) ? entityRef.getUuid() : UUIDUtils.newTimeUUID();
+        UUID timeUUID = UUIDUtils.newTimeUUID();
 
         //Step 1 & 2 of delete
         return ecm.mark( entityId ).mergeWith( gm.markNode( entityId, timeUUID.timestamp() ) );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9337b37f/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 fe8118a..f1b1700 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
@@ -168,14 +168,13 @@ public class CpNamingUtils {
     public static Edge createCollectionEdge( final Id sourceId, final String collectionName, final Id entityId ) {
         final String edgeType = CpNamingUtils.getEdgeTypeFromCollectionName( collectionName );
 
-        final UUID entityIdUUID = entityId.getUuid();
 
         //if they don't use a time based uuid (such as in devices) we need to create a timestamp from "now" since
         // this is when the entity
         //will be added to the collection
-        final UUID timeStampUuid = UUIDUtils.isTimeBased( entityIdUUID ) ? entityIdUUID : UUIDGenerator.newTimeUUID();
+        final UUID timeStampUuid =  UUIDGenerator.newTimeUUID();
 
-        long uuidTimestamp = UUIDUtils.getUUIDLong( timeStampUuid );
+        final long uuidTimestamp = UUIDUtils.getUUIDLong( timeStampUuid );
 
         // create graph edge connection from head entity to member entity
         return new SimpleEdge( sourceId, edgeType, entityId, uuidTimestamp );