Search in sources :

Example 1 with AlarmRuleDO

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;
}
Also used : AlarmRuleDO(com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO)

Example 2 with 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;
}
Also used : AlarmRuleDO(com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO) ArrayList(java.util.ArrayList)

Example 3 with AlarmRuleDO

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);
}
Also used : AlarmRuleDO(com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO)

Example 4 with 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;
}
Also used : AlarmRuleDO(com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO) AlarmRuleParameter(com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleParameter) SimpleDateFormat(java.text.SimpleDateFormat)

Example 5 with 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);
}
Also used : AlarmRuleDO(com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO) AlarmRuleParameter(com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleParameter) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException)

Aggregations

AlarmRuleDO (com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleDO)5 AlarmRuleParameter (com.alibaba.otter.manager.biz.config.alarm.dal.dataobject.AlarmRuleParameter)2 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1