UNOMI-99 Improve network unavailable and connection timeout handling - Fix send mail action to work even if we don't specify a notification type, id and frequency
Signed-off-by: Serge Huber <shu...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/b38d44c8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/b38d44c8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/b38d44c8 Branch: refs/heads/feature-UNOMI-5-KARAF4 Commit: b38d44c8d22f91e0956a4e3ff8b373d09ec519f4 Parents: 15ba3c9 Author: Serge Huber <shu...@apache.org> Authored: Fri Jun 16 14:56:19 2017 +0200 Committer: Serge Huber <shu...@apache.org> Committed: Fri Jun 16 14:56:19 2017 +0200 ---------------------------------------------------------------------- .../apache/unomi/plugins/mail/actions/SendMailAction.java | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b38d44c8/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java ---------------------------------------------------------------------- diff --git a/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java b/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java index fc8b85a..8810bbc 100644 --- a/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java +++ b/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java @@ -82,6 +82,16 @@ public class SendMailAction implements ActionExecutor { String subject = (String) action.getParameterValues().get("subject"); String template = (String) action.getParameterValues().get("template"); + if (notifType == null) { + notifType = "default"; + } + if (notifTypeId == null) { + notifTypeId = subject; + } + if (notifyOnce == null) { + notifyOnce = false; + } + Map profileNotif = (HashMap) event.getProfile().getSystemProperties().get("notificationAck"); if (profileNotif != null && profileNotif.get(notifType) != null && ((HashMap) profileNotif.get(notifType)).get(notifTypeId) != null) { Integer notifTypeAck = (Integer) ((HashMap) profileNotif.get(notifType) ).get(notifTypeId);