void DbObject::VersionChangedHandler(const ConfigObject::Ptr& object) { DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object); if (dbobj) { dbobj->SendConfigUpdate(); dbobj->SendStatusUpdate(); } }
void DbConnection::UpdateAllObjects(void) { DynamicType::Ptr type; BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) { BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) { DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object); if (dbobj) { if (!GetObjectActive(dbobj)) ActivateObject(dbobj); dbobj->SendConfigUpdate(); dbobj->SendStatusUpdate(); } } }
void DbConnection::UpdateObject(const ConfigObject::Ptr& object) { if (!GetConnected()) return; DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object); if (dbobj) { bool active = object->IsActive(); if (active) { ActivateObject(dbobj); dbobj->SendConfigUpdate(); dbobj->SendStatusUpdate(); } else DeactivateObject(dbobj); } }
void DbConnection::UpdateObject(const ConfigObject::Ptr& object) { if (!GetConnected()) return; DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object); if (dbobj) { bool dbActive = GetObjectActive(dbobj); bool active = object->IsActive(); if (active && !dbActive) { ActivateObject(dbobj); dbobj->SendConfigUpdate(); dbobj->SendStatusUpdate(); } else if (!active) { /* Deactivate the deleted object no matter * which state it had in the database. */ DeactivateObject(dbobj); } } }