AlertSenderInfo info = notificationMgr.getAlertInfoForSender(senderName);
if (info==null) {
throw new StuffNotFoundException("Alert sender with name [" + senderName + "]");
}
AlertSender sender = new AlertSender(senderName);
sender.setDescription(info.getDescription());
ConfigurationDefinition definition = notificationMgr.getConfigurationDefinitionForSender(senderName);
for (PropertyDefinition pd : definition.getPropertyDefinitions().values()) {
if (pd instanceof PropertyDefinitionSimple) {
PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd;
sender.getConfigDefinition().put(pds.getName(),pds.getType().name());
}
else {
log.warn("Property " + pd.getName() + " for sender " + senderName + " is not of a supported type");
}
}
UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/alert/sender/{name}");
URI uri = uriBuilder.build(sender.getSenderName());
Link self = new Link("self",uri.toString());
sender.setLink(self);
Response.ResponseBuilder builder = Response.ok(sender);
return builder.build();