You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by md...@apache.org on 2015/12/23 21:58:27 UTC

[1/2] usergrid git commit: Fix issue where user scoped notification requests were not finding devices to send notifications to.

Repository: usergrid
Updated Branches:
  refs/heads/release fdc0d8081 -> 208be5719


Fix issue where user scoped notification requests were not finding devices to send notifications to.


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

Branch: refs/heads/release
Commit: 57279250e473b60e6324327ce8d67c976aadef41
Parents: fdc0d80
Author: Michael Russo <mi...@gmail.com>
Authored: Tue Dec 22 22:02:41 2015 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Tue Dec 22 22:02:41 2015 -0800

----------------------------------------------------------------------
 .../usergrid/persistence/entities/Notification.java       | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/57279250/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java b/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
index 362201a..096706b 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
@@ -304,7 +304,15 @@ public class Notification extends TypedEntity {
                 String collection = pathToken.getCollection();
                 Query query = new Query();
                 if (pathToken.getIdentifier()!=null) {
-                    query.addIdentifier(pathToken.getIdentifier());
+
+                    // users collection is special case and uses "username" instaed of "name"
+                    // build a query using QL with "username" as Identifier.Type.USERNAME doesn't exist
+                    if (collection.equals("users") && pathToken.getIdentifier().getType() == Identifier.Type.NAME){
+                        query.setQl("select * where username ='"+pathToken.getIdentifier().getName()+"'");
+                    }else{
+                        query.addIdentifier(pathToken.getIdentifier());
+                    }
+
                 }
                 query.setLimit(100);
                 query.setCollection(collection);


[2/2] usergrid git commit: Allow notification entities to be deleted if they are not in a state that represents "in progress".

Posted by md...@apache.org.
Allow notification entities to be deleted if they are not in a state that represents "in progress".


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

Branch: refs/heads/release
Commit: 208be5719e8b54721bde5215a8488636d3a8411f
Parents: 5727925
Author: Michael Russo <mi...@gmail.com>
Authored: Tue Dec 22 22:07:47 2015 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Tue Dec 22 22:07:47 2015 -0800

----------------------------------------------------------------------
 .../usergrid/services/notifications/NotificationsService.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/208be571/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
index 2a72a01..202971d 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
@@ -231,7 +231,9 @@ public class NotificationsService extends AbstractCollectionService {
     @Override
     protected boolean isDeleteAllowed(ServiceContext context, Entity entity) {
         Notification notification = (Notification) entity;
-        return (notification.getStarted() == null);
+        Notification.State state = notification.getState();
+        return !(state.equals(Notification.State.CREATED) || state.equals(Notification.State.STARTED) ||
+            state.equals(Notification.State.SCHEDULED));
     }
 
     // validate payloads