Search in sources :

Example 1 with OnmsReductionKeyMemo

use of org.opennms.netmgt.model.OnmsReductionKeyMemo in project opennms by OpenNMS.

the class AlarmRepositoryHibernate method updateReductionKeyMemo.

/**
     * {@inheritDoc}
     */
@Override
@Transactional
public void updateReductionKeyMemo(Integer alarmId, String body, String user) {
    OnmsAlarm onmsAlarm = m_alarmDao.get(alarmId);
    if (onmsAlarm != null) {
        OnmsReductionKeyMemo memo = onmsAlarm.getReductionKeyMemo();
        if (memo == null) {
            memo = new OnmsReductionKeyMemo();
            memo.setCreated(new Date());
        }
        memo.setBody(body);
        memo.setAuthor(user);
        memo.setReductionKey(onmsAlarm.getReductionKey());
        memo.setUpdated(new Date());
        m_memoDao.saveOrUpdate(memo);
        onmsAlarm.setReductionKeyMemo(memo);
    }
}
Also used : OnmsAlarm(org.opennms.netmgt.model.OnmsAlarm) OnmsReductionKeyMemo(org.opennms.netmgt.model.OnmsReductionKeyMemo) Date(java.util.Date) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Date (java.util.Date)1 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)1 OnmsReductionKeyMemo (org.opennms.netmgt.model.OnmsReductionKeyMemo)1 Transactional (org.springframework.transaction.annotation.Transactional)1