use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.
the class AlertController method validateTimeAlert.
private TimeAlert validateTimeAlert(TimeAlertRequest json) throws ParseException {
TimeAlert alert = timeAlertRequestConverter.convert(json);
dateUtils.getCronExpression(alert.getCron());
return alert;
}
use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.
the class TimeAlertRequestConverter method convert.
@Override
public TimeAlert convert(TimeAlertRequest source) {
TimeAlert alarm = new TimeAlert();
alarm.setName(source.getAlertName());
alarm.setDescription(source.getDescription());
alarm.setCron(source.getCron());
alarm.setTimeZone(source.getTimeZone());
if (source.getScalingPolicy() != null) {
alarm.setScalingPolicy(scalingPolicyRequestConverter.convert(source.getScalingPolicy()));
}
return alarm;
}
use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.
the class TimeAlertResponseConverter method convert.
@Override
public TimeAlert convert(TimeAlertResponse source) {
TimeAlert alarm = new TimeAlert();
alarm.setName(source.getAlertName());
alarm.setDescription(source.getDescription());
alarm.setCron(source.getCron());
alarm.setTimeZone(source.getTimeZone());
if (source.getScalingPolicy() != null) {
alarm.setScalingPolicy(scalingPolicyRequestConverter.convert(source.getScalingPolicy()));
}
return alarm;
}
use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.
the class AlertService method updateTimeAlert.
public TimeAlert updateTimeAlert(Long clusterId, Long alertId, TimeAlert timeAlert) {
TimeAlert alert = timeAlertRepository.findByCluster(alertId, clusterId);
alert.setDescription(timeAlert.getDescription());
alert.setCron(timeAlert.getCron());
alert.setTimeZone(timeAlert.getTimeZone());
alert.setName(timeAlert.getName());
return timeAlertRepository.save(alert);
}
use of com.sequenceiq.periscope.domain.TimeAlert in project cloudbreak by hortonworks.
the class DateUtilsTest method createTimeAlert.
private TimeAlert createTimeAlert(String cron, String timeZone) {
TimeAlert testTime = new TimeAlert();
testTime.setName("testAlert");
testTime.setCron(cron);
testTime.setTimeZone(timeZone);
return testTime;
}
Aggregations