public static <T extends NamedConfigurationType> T getTransportConfiguration(String transportName, String baseTransportName, Function<NotificationConfigurationType, List<T>> getter, RepositoryService cacheRepositoryService, OperationResult result) { SystemConfigurationType systemConfiguration = NotificationFunctionsImpl.getSystemConfiguration(cacheRepositoryService, result); if (systemConfiguration == null || systemConfiguration.getNotificationConfiguration() == null) { return null; } String transportConfigName = transportName.length() > baseTransportName.length() ? transportName.substring(baseTransportName.length() + 1) : null; // after e.g. "sms:" or "file:" for (T namedConfiguration: getter.apply(systemConfiguration.getNotificationConfiguration())) { if ((transportConfigName == null && namedConfiguration.getName() == null) || (transportConfigName != null && transportConfigName.equals(namedConfiguration.getName()))) { return namedConfiguration; } } return null; }
if (systemConfigurationType.getNotificationConfiguration() == null) { LOGGER.trace("No notification configuration in repository, finished event processing."); return; NotificationConfigurationType notificationConfigurationType = systemConfigurationType.getNotificationConfiguration(); processNotifications(notificationConfigurationType, event, task, result);
private void assertJaxb(SystemConfigurationType config, boolean isObject) throws SchemaException { assertEquals("Wrong name", PrismTestUtil.createPolyStringType("sysconfig"), config.getName()); List<NotificationMessageAttachmentType> attachments = config .getNotificationConfiguration() .getHandler().get(0) .getSimpleUserNotifier().get(0) .getAttachment(); assertEquals("Wrong # of attachments", 4, attachments.size()); assertAttachmentContent(attachments.get(0), "untyped"); assertAttachmentContent(attachments.get(1), "ABC"); assertAttachmentContent(attachments.get(2), "DEF".getBytes()); assertAttachmentContent(attachments.get(3), new BigInteger("1234567890123456789012345678901234567890")); }
if (systemConfiguration == null || systemConfiguration.getNotificationConfiguration() == null) { String msg = "No notifications are configured. Custom notification to " + message.getTo() + " will not be sent."; LOGGER.warn(msg) ; CustomTransportConfigurationType configuration = systemConfiguration.getNotificationConfiguration().getCustomTransport().stream() .filter(transportConfigurationType -> java.util.Objects.equals(configName, transportConfigurationType.getName())) .findFirst().orElse(null);
@Test public void test000Sanity() throws Exception { final String TEST_NAME = "test000Sanity"; displayTestTitle(TEST_NAME); AccountActivationNotifierType accountActivationNotifier = null; SystemConfigurationType systemConfig = getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value()).asObjectable(); IntegrationTestTools.displayXml("system config", systemConfig.asPrismObject()); for (EventHandlerType handler: systemConfig.getNotificationConfiguration().getHandler()) { display("Handler: ", handler); List<AccountActivationNotifierType> accountActivationNotifiers = handler.getAccountActivationNotifier(); if (!accountActivationNotifiers.isEmpty()) { accountActivationNotifier = accountActivationNotifiers.get(0); } } display("Account activation notifier", accountActivationNotifier); assertNotNull("No accountActivationNotifier", accountActivationNotifier); }
if (systemConfiguration == null || systemConfiguration.getNotificationConfiguration() == null || systemConfiguration.getNotificationConfiguration().getMail() == null) { String msg = "No notifications are configured. Mail notification to " + mailMessage.getTo() + " will not be sent."; LOGGER.warn(msg) ; MailConfigurationType mailConfigurationType = systemConfiguration.getNotificationConfiguration().getMail();
if (systemConfiguration == null || systemConfiguration.getNotificationConfiguration() == null) { String msg = "No notifications are configured. SMS notification to " + message.getTo() + " will not be sent."; LOGGER.warn(msg) ; for (SmsConfigurationType smsConfigurationType: systemConfiguration.getNotificationConfiguration().getSms()) { if (StringUtils.isEmpty(smsConfigName) && smsConfigurationType.getName() == null || StringUtils.isNotEmpty(smsConfigName) && smsConfigName.equals(smsConfigurationType.getName())) {
CryptoUtil.checkEncrypted(jack); CryptoUtil.checkEncrypted(config); MailConfigurationType mail = config.asObjectable().getNotificationConfiguration().getMail(); SmsConfigurationType sms1 = config.asObjectable().getNotificationConfiguration().getSms().get(0); SmsConfigurationType sms2 = config.asObjectable().getNotificationConfiguration().getSms().get(1); String compromisedKeyName = getKeyName( jack.asObjectable().getCredentials().getPassword().getValue(),