use of com.evolveum.midpoint.studio.impl.ShowExceptionNotificationAction in project midpoint-studio by Evolveum.
the class TestConnectionAction method testConnection.
private void testConnection(Project project, Environment environment) {
try {
MidPointClient client = new MidPointClient(project, environment);
TestConnectionResult result = client.testConnection();
String status = result.success() ? "was successful" : "failed";
NotificationType type = result.success() ? NotificationType.INFORMATION : NotificationType.ERROR;
String versionInfo = "";
if (result.success()) {
versionInfo = " Version: " + result.version() + ", build: " + result.revision() + ".";
}
NotificationAction action = null;
if (result.exception() != null) {
action = new ShowExceptionNotificationAction("Connection test exception for '" + environment.getName() + "'", result.exception(), TestConnectionAction.class, environment);
}
MidPointUtils.publishNotification(project, NOTIFICATION_KEY, "Test connection", "Connection test for '" + environment.getName() + "' " + status + "." + versionInfo, type, action);
} catch (Exception ex) {
MidPointUtils.publishExceptionNotification(project, environment, TestConnectionAction.class, NOTIFICATION_KEY, "Connection test for '" + environment.getName() + "' failed with exception", ex);
}
}
Aggregations