use of com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO in project otter by alibaba.
the class IbatisAlarmRuleDAO method findById.
public AlarmRuleDO findById(Long alarmRuleId) {
Assert.assertNotNull(alarmRuleId);
AlarmRuleDO alarmRuleDo = (AlarmRuleDO) getSqlMapClientTemplate().queryForObject("findByRuleId", alarmRuleId);
return alarmRuleDo;
}
use of com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO in project otter by alibaba.
the class IbatisAlarmRuleDAO method listByPipelineId.
public List<AlarmRuleDO> listByPipelineId(Long pipelineId, AlarmRuleStatus status) {
List<AlarmRuleDO> alarmRuleDos = listByPipelineId(pipelineId);
List<AlarmRuleDO> result = new ArrayList<AlarmRuleDO>();
for (AlarmRuleDO alarmRuleDo : alarmRuleDos) {
if (alarmRuleDo.getStatus().equals(status)) {
result.add(alarmRuleDo);
}
}
return result;
}
use of com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO in project otter by alibaba.
the class AlarmRuleServiceImpl method modify.
public void modify(AlarmRule alarmRule) {
AlarmRuleDO alarmRuleDo = modelToDo(alarmRule);
alarmRuleDao.update(alarmRuleDo);
}
use of com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO 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.AlarmRuleDO 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