Search in sources :

Example 1 with AlarmAlreadyExceedThresholdException

use of io.imunity.furms.api.validation.exceptions.AlarmAlreadyExceedThresholdException in project furms by unity-idm.

the class AlarmFormView method saveAlarm.

private void saveAlarm() {
    AlarmFormModel alarmFormModel = binder.getBean();
    AlarmWithUserEmails alarm = AlarmFormModelMapper.map(projectId, alarmFormModel);
    try {
        if (alarmFormModel.id == null)
            alarmService.create(alarm);
        else
            alarmService.update(alarm);
        UI.getCurrent().navigate(AlarmsView.class);
    } catch (DuplicatedNameValidationError e) {
        showErrorNotification(getTranslation("name.duplicated.error.message"));
    } catch (EmailNotPresentException e) {
        showErrorNotification(getTranslation("alarm.wrong.user", e.email));
    } catch (AlarmAlreadyExceedThresholdException e) {
        showErrorNotification(getTranslation("alarm.wrong.threshold"));
    } catch (FiredAlarmThresholdReduceException e) {
        showErrorNotification(getTranslation("fired.alarm.wrong.threshold"));
    } catch (Exception e) {
        showErrorNotification(getTranslation("base.error.message"));
        throw e;
    }
}
Also used : DuplicatedNameValidationError(io.imunity.furms.api.validation.exceptions.DuplicatedNameValidationError) AlarmAlreadyExceedThresholdException(io.imunity.furms.api.validation.exceptions.AlarmAlreadyExceedThresholdException) AlarmWithUserEmails(io.imunity.furms.domain.alarms.AlarmWithUserEmails) EmailNotPresentException(io.imunity.furms.api.validation.exceptions.EmailNotPresentException) FiredAlarmThresholdReduceException(io.imunity.furms.api.validation.exceptions.FiredAlarmThresholdReduceException) EmailNotPresentException(io.imunity.furms.api.validation.exceptions.EmailNotPresentException) AlarmAlreadyExceedThresholdException(io.imunity.furms.api.validation.exceptions.AlarmAlreadyExceedThresholdException) FiredAlarmThresholdReduceException(io.imunity.furms.api.validation.exceptions.FiredAlarmThresholdReduceException)

Aggregations

AlarmAlreadyExceedThresholdException (io.imunity.furms.api.validation.exceptions.AlarmAlreadyExceedThresholdException)1 DuplicatedNameValidationError (io.imunity.furms.api.validation.exceptions.DuplicatedNameValidationError)1 EmailNotPresentException (io.imunity.furms.api.validation.exceptions.EmailNotPresentException)1 FiredAlarmThresholdReduceException (io.imunity.furms.api.validation.exceptions.FiredAlarmThresholdReduceException)1 AlarmWithUserEmails (io.imunity.furms.domain.alarms.AlarmWithUserEmails)1