use of com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleParameter in project otter by alibaba.
the class AlarmRuleServiceImpl method modelToDo.
private AlarmRuleDO modelToDo(AlarmRule alarmRule) {
AlarmRuleDO alarmRuleDo = new AlarmRuleDO();
alarmRuleDo.setId(alarmRule.getId());
alarmRuleDo.setMatchValue(alarmRule.getMatchValue());
alarmRuleDo.setMonitorName(alarmRule.getMonitorName());
alarmRuleDo.setReceiverKey(alarmRule.getReceiverKey());
alarmRuleDo.setPipelineId(alarmRule.getPipelineId());
alarmRuleDo.setStatus(alarmRule.getStatus());
alarmRuleDo.setDescription(alarmRule.getDescription());
alarmRuleDo.setGmtCreate(alarmRule.getGmtCreate());
alarmRuleDo.setGmtModified(alarmRule.getGmtModified());
AlarmRuleParameter alarmRuleParameter = new AlarmRuleParameter();
alarmRuleParameter.setIntervalTime(alarmRule.getIntervalTime());
if (alarmRule.getPauseTime() != null) {
SimpleDateFormat format = new SimpleDateFormat(TIMESTAMP_FORMAT);
alarmRuleParameter.setPauseTime(format.format(alarmRule.getPauseTime()));
}
alarmRuleParameter.setAutoRecovery(alarmRule.getAutoRecovery());
alarmRuleParameter.setRecoveryThresold(alarmRule.getRecoveryThresold());
alarmRuleDo.setAlarmRuleParameter(alarmRuleParameter);
return alarmRuleDo;
}
use of com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleParameter in project otter by alibaba.
the class AlarmRuleServiceImpl method switchAlarmRuleStatus.
private void switchAlarmRuleStatus(Long alarmRuleId, AlarmRuleStatus alarmRuleStatus, String pauseTime) {
AlarmRuleDO alarmRuleDo = alarmRuleDao.findById(alarmRuleId);
if (null == alarmRuleDo) {
String exceptionCause = "query alarmRule:" + alarmRuleId + " return null.";
logger.error("ERROR ## " + exceptionCause);
throw new ManagerException(exceptionCause);
}
alarmRuleDo.setStatus(alarmRuleStatus);
if (alarmRuleDo.getAlarmRuleParameter() != null) {
alarmRuleDo.getAlarmRuleParameter().setPauseTime(pauseTime);
} else if (StringUtils.isNotEmpty(pauseTime)) {
alarmRuleDo.setAlarmRuleParameter(new AlarmRuleParameter());
alarmRuleDo.getAlarmRuleParameter().setPauseTime(pauseTime);
}
alarmRuleDao.update(alarmRuleDo);
}
Aggregations