Search in sources :

Example 6 with Notification

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);
    }
}
Also used : Notification(org.opensmartgridplatform.adapter.ws.schema.core.notification.Notification) WebServiceSecurityException(org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException)

Aggregations

Notification (org.opensmartgridplatform.adapter.ws.schema.core.notification.Notification)6 WebServiceSecurityException (org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException)2 CompletionException (java.util.concurrent.CompletionException)1