aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource/NotificationResource.java
diff options
context:
space:
mode:
authorPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-05 12:03:08 +0100
committerPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-05 12:03:08 +0100
commita21f436a58133f7da0cae06366d729665f3b8f9c (patch)
tree72ff1743d96f79e4a9d85b0d48715e5f9aa67cf9 /src/org/traccar/api/resource/NotificationResource.java
parent960bf899414d89221e92138fdb98777c3f4f73ec (diff)
parent40607036c5aa6385a7ae3f3a283bf107238a5944 (diff)
downloadtrackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.gz
trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.bz2
trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/org/traccar/api/resource/NotificationResource.java')
-rw-r--r--src/org/traccar/api/resource/NotificationResource.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/org/traccar/api/resource/NotificationResource.java b/src/org/traccar/api/resource/NotificationResource.java
index 5bec7fd85..03f7e4ba0 100644
--- a/src/org/traccar/api/resource/NotificationResource.java
+++ b/src/org/traccar/api/resource/NotificationResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.traccar.api.resource;
import java.sql.SQLException;
import java.util.Collection;
+import javax.mail.MessagingException;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -29,7 +30,9 @@ import javax.ws.rs.core.Response;
import org.traccar.Context;
import org.traccar.api.BaseResource;
+import org.traccar.model.Event;
import org.traccar.model.Notification;
+import org.traccar.notification.NotificationMail;
@Path("users/notifications")
@Produces(MediaType.APPLICATION_JSON)
@@ -46,7 +49,7 @@ public class NotificationResource extends BaseResource {
userId = getUserId();
}
Context.getPermissionsManager().checkUser(getUserId(), userId);
- return Context.getNotificationManager().getUserNotifications(userId);
+ return Context.getNotificationManager().getAllUserNotifications(userId);
}
@POST
@@ -56,4 +59,12 @@ public class NotificationResource extends BaseResource {
Context.getNotificationManager().updateNotification(entity);
return Response.ok(entity).build();
}
+
+ @Path("test")
+ @POST
+ public Response testMail() throws MessagingException {
+ NotificationMail.sendMailSync(getUserId(), new Event("test", 0), null);
+ return Response.noContent().build();
+ }
+
}