use of org.opensmartgridplatform.adapter.ws.schema.core.notification.Notification in project open-smart-grid-platform by OSGP.
the class CoreNotificationService method doSendNotification.
private void doSendNotification(final NotificationType notificationType, final String organisationIdentification, final String deviceIdentification, final String correlationUid, final String result, final String message) {
final Notification notification = new Notification();
// Required fields.
notification.setNotificationType(notificationType);
notification.setDeviceIdentification(deviceIdentification);
// Optional fields.
if (!StringUtils.isEmpty(correlationUid)) {
notification.setCorrelationUid(correlationUid);
}
if (!StringUtils.isEmpty(result)) {
notification.setResult(OsgpResultType.valueOf(result));
}
if (!StringUtils.isEmpty(message)) {
notification.setMessage(message);
}
// Try to send notification and catch security exceptions.
try {
this.sendNotificationServiceClient.sendNotification(organisationIdentification, notification);
} catch (final WebServiceSecurityException e) {
LOGGER.error("Unable to send notification", e);
}
}
Aggregations