protected List<String> getRecipientsAddresses(Event event, GeneralNotifierType generalNotifierType, ExpressionVariables variables,
UserType defaultRecipient, String transportName, Transport transport, Task task, OperationResult result) {
List<String> addresses = new ArrayList<>();
if (!generalNotifierType.getRecipientExpression().isEmpty()) {
for (ExpressionType expressionType : generalNotifierType.getRecipientExpression()) {
List<String> r = evaluateExpressionChecked(expressionType, variables, "notification recipient", task, result);
if (r != null) {
addresses.addAll(r);
}
}
if (addresses.isEmpty()) {
getLogger().info("Notification for " + event + " will not be sent, because there are no known recipients.");
}
} else if (defaultRecipient == null) {
getLogger().info("Unknown default recipient, notification will not be sent.");
} else {
String address = transport.getDefaultRecipientAddress(defaultRecipient);
if (StringUtils.isEmpty(address)) {
getLogger().info("Notification to " + defaultRecipient.getName() + " will not be sent, because the user has no address (mail, phone number, etc) for transport '" + transportName + "' set.");
} else {
addresses.add(address);
}
}
return addresses;
}