From 5c2bcc16203aeec921d284f61739a953d2bd1918 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Thu, 15 Feb 2024 17:24:35 +0100 Subject: [PATCH] [New] Added NotificationResource --- .../main/java/li/strolch/rest/StrolchRestfulClasses.java | 1 + .../li/strolch/rest/endpoint/NotificationResource.java | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web-rest/src/main/java/li/strolch/rest/StrolchRestfulClasses.java b/web-rest/src/main/java/li/strolch/rest/StrolchRestfulClasses.java index b6552b0a3..97c837a22 100644 --- a/web-rest/src/main/java/li/strolch/rest/StrolchRestfulClasses.java +++ b/web-rest/src/main/java/li/strolch/rest/StrolchRestfulClasses.java @@ -46,6 +46,7 @@ public class StrolchRestfulClasses { restfulClasses.add(LanguagesResource.class); restfulClasses.add(OperationsLogResource.class); restfulClasses.add(AgentResource.class); + restfulClasses.add(NotificationResource.class); // privilege restfulClasses.add(PrivilegeUsersResource.class); diff --git a/web-rest/src/main/java/li/strolch/rest/endpoint/NotificationResource.java b/web-rest/src/main/java/li/strolch/rest/endpoint/NotificationResource.java index 5b7b8f777..6a3775811 100644 --- a/web-rest/src/main/java/li/strolch/rest/endpoint/NotificationResource.java +++ b/web-rest/src/main/java/li/strolch/rest/endpoint/NotificationResource.java @@ -46,6 +46,7 @@ import static java.util.Optional.ofNullable; import static li.strolch.model.StrolchModelConstants.*; import static li.strolch.privilege.base.PrivilegeConstants.REALM; import static li.strolch.rest.StrolchRestfulConstants.*; +import static li.strolch.runtime.StrolchConstants.DEFAULT_REALM; import static li.strolch.runtime.StrolchConstants.StrolchPrivilegeConstants.PRIVILEGE_GET_NOTIFICATIONS; import static li.strolch.utils.helper.ExceptionHelper.getCallerMethod; import static li.strolch.utils.helper.ExceptionHelper.getCallerMethodNoClass; @@ -61,7 +62,7 @@ public class NotificationResource { private StrolchTransaction openTx(Certificate certificate) { String realm = certificate.getRealm(); if (StringHelper.isEmpty(realm)) - realm = REALM; + realm = DEFAULT_REALM; return RestfulStrolchComponent.getInstance().openTx(certificate, realm, getCallerMethod()); } @@ -100,8 +101,10 @@ public class NotificationResource { notificationJ.addProperty(PARAM_TITLE, textBag.getString(PARAM_TITLE)); notificationJ.addProperty(PARAM_TEXT, textBag.getString(PARAM_TEXT)); - notificationJ.addProperty(PARAM_VISIBLE_FROM, ISO8601.toString(textBag.getDate(PARAM_VISIBLE_FROM))); - notificationJ.addProperty(PARAM_VISIBLE_TO, ISO8601.toString(textBag.getDate(PARAM_VISIBLE_TO))); + notificationJ.addProperty(PARAM_VISIBLE_FROM, + ISO8601.toString(notification.getDate(BAG_VISIBILITY, PARAM_VISIBLE_FROM))); + notificationJ.addProperty(PARAM_VISIBLE_TO, + ISO8601.toString(notification.getDate(BAG_VISIBILITY, PARAM_VISIBLE_TO))); return notificationJ; };