Merge "Fix timestamps columns of updating notification"

This commit is contained in:
Jenkins 2016-03-24 07:24:32 +00:00 committed by Gerrit Code Review
commit 9ec362343d
5 changed files with 5 additions and 6 deletions

View File

@ -544,7 +544,7 @@ public class AlarmDefinitionSqlRepoImpl
SubAlarmDefinitionDb subAlarmDefinitionDb = session.get(SubAlarmDefinitionDb.class, subAlarmDefinitionId);
subAlarmDefinitionDb.setOperator(sa.getOperator().name());
subAlarmDefinitionDb.setThreshold(sa.getThreshold());
subAlarmDefinitionDb.setUpdatedAt(new DateTime());
subAlarmDefinitionDb.setUpdatedAt(this.getUTCNow());
session.saveOrUpdate(subAlarmDefinitionDb);
}
}

View File

@ -179,6 +179,7 @@ public class NotificationMethodSqlRepoImpl
db.setName(name);
db.setType(AlarmNotificationMethodType.valueOf(type.name()));
db.setAddress(address);
db.setUpdatedAt(this.getUTCNow());
session.save(db);
tx.commit();

View File

@ -171,7 +171,8 @@ public class NotificationMethodMySqlRepoImpl implements NotificationMethodRepo {
if (h
.update(
"update notification_method set name = ?, type = ?, address = ? where tenant_id = ? and id = ?",
"update notification_method set name = ?, type = ?, address = ?, updated_at = NOW() "
+ "where tenant_id = ? and id = ?",
name, type.name(), address, tenantId, notificationMethodId) == 0)
throw new EntityNotFoundException("No notification method exists for %s",
notificationMethodId);

View File

@ -169,12 +169,11 @@ class NotificationsRepository(mysql_repository.MySQLRepository,
set name = %s,
type = %s,
address = %s,
created_at = %s,
updated_at = %s
where tenant_id = %s and id = %s"""
parms = [name.encode('utf8'), type.encode('utf8'), address.encode(
'utf8'), now, now, tenant_id, id]
'utf8'), now, tenant_id, id]
cursor.execute(query, parms)

View File

@ -72,7 +72,6 @@ class NotificationsRepository(sql_repository.SQLRepository,
name=bindparam('b_name'),
type=bindparam('b_type'),
address=bindparam('b_address'),
created_at=bindparam('b_created_at'),
updated_at=bindparam('b_updated_at')))
self._select_nm_id_query = (select([nm])
@ -188,7 +187,6 @@ class NotificationsRepository(sql_repository.SQLRepository,
b_name=name.encode('utf8'),
b_type=notification_type.encode('utf8'),
b_address=address.encode('utf8'),
b_created_at=now,
b_updated_at=now)
if cursor.rowcount < 1: