@Override public Set<String> getRecipientsId(MessageEntity message) { if (MessageChannel.HTTP.equals(message.getChannel())) { return Collections.singleton(message.getRecipient().getUrl()); } return getRecipientsId(null, message); }
@Override public Set<String> getRecipientsId(MessageEntity message) { if (MessageChannel.HTTP.equals(message.getChannel())) { return Collections.singleton(message.getRecipient().getUrl()); } return getRecipientsId(null, message); }
@Override public Set<String> getRecipientsId(Api api, MessageEntity message) { if (message != null && MessageChannel.HTTP.equals(message.getChannel())) { return Collections.singleton(message.getRecipient().getUrl());
private void assertRecipientsNotEmpty(MessageEntity messageEntity) { if ( messageEntity == null || messageEntity.getRecipient() == null || messageEntity.getChannel() == null || messageEntity.getRecipient().getRoleScope() == null || messageEntity.getRecipient().getRoleValues() == null || messageEntity.getRecipient().getRoleValues().isEmpty()) { throw new MessageRecipientFormatException(); } }
@Override public Set<String> getRecipientsId(Api api, MessageEntity message) { if (message != null && MessageChannel.HTTP.equals(message.getChannel())) { return Collections.singleton(message.getRecipient().getUrl());
private void assertRecipientsNotEmpty(MessageEntity messageEntity) { if ( messageEntity == null || messageEntity.getRecipient() == null || messageEntity.getChannel() == null || messageEntity.getRecipient().getRoleScope() == null || messageEntity.getRecipient().getRoleValues() == null || messageEntity.getRecipient().getRoleValues().isEmpty()) { throw new MessageRecipientFormatException(); } }
private int send(Api api, MessageEntity message, Set<String> recipientsId) { switch (message.getChannel()) { case MAIL: Set<String> mails = getRecipientsEmails(recipientsId); if (!mails.isEmpty()) { emailService.sendAsyncEmailNotification(new EmailNotificationBuilder() .to(defaultFrom) .bcc(mails.toArray(new String[0])) .subject(message.getTitle()) .template(EmailNotificationBuilder.EmailTemplate.GENERIC_MESSAGE) .params(Collections.singletonMap("message", message.getText())) .build()); } return mails.size(); case PORTAL: Hook hook = api==null ? PortalHook.MESSAGE : ApiHook.MESSAGE; portalNotificationService.create(hook, new ArrayList<>(recipientsId), getPortalParams(api, message)); return recipientsId.size(); case HTTP: webNotifierService.request( HttpMethod.POST, recipientsId.iterator().next(), message.getParams(), getPostMessage(api, message), message.isUseSystemProxy()); return 1; default: return 0; } }
private int send(Api api, MessageEntity message, Set<String> recipientsId) { switch (message.getChannel()) { case MAIL: Set<String> mails = getRecipientsEmails(recipientsId); if (!mails.isEmpty()) { emailService.sendAsyncEmailNotification(new EmailNotificationBuilder() .to(defaultFrom) .bcc(mails.toArray(new String[0])) .subject(message.getTitle()) .template(EmailNotificationBuilder.EmailTemplate.GENERIC_MESSAGE) .params(Collections.singletonMap("message", message.getText())) .build()); } return mails.size(); case PORTAL: Hook hook = api==null ? PortalHook.MESSAGE : ApiHook.MESSAGE; portalNotificationService.create(hook, new ArrayList<>(recipientsId), getPortalParams(api, message)); return recipientsId.size(); case HTTP: webNotifierService.request( HttpMethod.POST, recipientsId.iterator().next(), message.getParams(), getPostMessage(api, message), message.isUseSystemProxy()); return 1; default: return 0; } }