You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2016/07/01 15:09:12 UTC

[5/8] usergrid git commit: Add edge read repair on entity updates.

Add edge read repair on entity updates.


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

Branch: refs/heads/usergrid-1268-akka-211
Commit: a6c307b282bbec2399f6dbf5220bb284184eddc3
Parents: f4ae0cb
Author: Michael Russo <mr...@apigee.com>
Authored: Wed Jun 29 15:50:49 2016 -0700
Committer: Michael Russo <mr...@apigee.com>
Committed: Wed Jun 29 15:50:49 2016 -0700

----------------------------------------------------------------------
 .../usergrid/services/AbstractCollectionService.java   | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/a6c307b2/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java b/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
index 14b1df1..1ed7255 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
@@ -277,6 +277,12 @@ public class AbstractCollectionService extends AbstractService {
 
         if ( item != null ) {
             validateEntityType( item, id );
+
+            if( context.getOwner().getType().equals(TYPE_APPLICATION)) {
+                // this will repair any missing edges
+                em.addToCollection(context.getOwner(), context.getCollectionName(), item);
+            }
+
             updateEntity( context, item, context.getPayload() );
             item = importEntity( context, item );
         }
@@ -312,7 +318,14 @@ public class AbstractCollectionService extends AbstractService {
         else {
             entity = importEntity( context, entity );
             checkPermissionsForEntity( context, entity );
+
+            if( context.getOwner().getType().equals(TYPE_APPLICATION)) {
+                // this will repair any missing edges
+                em.addToCollection(context.getOwner(), context.getCollectionName(), entity);
+            }
+
             updateEntity( context, entity );
+
         }
 
         return new ServiceResults( this, context, Type.COLLECTION, Results.fromEntity( entity ), null, null );