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/USERGRID-872 Commit: 208be5719e8b54721bde5215a8488636d3a8411f Parents: 5727925 Author: Michael Russo <michaelaru...@gmail.com> Authored: Tue Dec 22 22:07:47 2015 -0800 Committer: Michael Russo <michaelaru...@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