+ } else {
+ /* object exists, update its attributes if version was changed */
+ if (params->Get("version") > object->GetVersion()) {
+ Log(LogInformation, "ApiListener")
+ << "Processing config update for object '" << object->GetName()
+ << "': Object version '" << object->GetVersion()
+ << "' is older than the received version '" << params->Get("version") << "'.";
+
+ Dictionary::Ptr modified_attributes = params->Get("modified_attributes");
+
+ if (modified_attributes) {
+ ObjectLock olock(modified_attributes);
+ BOOST_FOREACH(const Dictionary::Pair& kv, modified_attributes) {
+ int fid = object->GetReflectionType()->GetFieldId(kv.first);
+ static_cast<Object::Ptr>(object)->SetField(fid, kv.second, false, origin);
+ }
+ }
+ } else {
+ Log(LogWarning, "ApiListener")
+ << "Skipping config update for object '" << object->GetName()
+ << "': Object version '" << object->GetVersion()
+ << "' is more recent than the received version '" << params->Get("version") << "'.";
+ return Empty;
+ }