void StatusDataWriter::DumpCustomAttributes(std::ostream& fp, const CustomVarObject::Ptr& object) { Dictionary::Ptr vars = object->GetVars(); if (!vars) return; bool is_json = false; ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { if (kv.first.IsEmpty()) continue; Value value; if (kv.second.IsObjectType<Array>() || kv.second.IsObjectType<Dictionary>()) { value = JsonEncode(kv.second); is_json = true; } else value = CompatUtility::EscapeString(kv.second); fp << "\t" "_" << kv.first << "\t" << value << "\n"; } if (is_json) fp << "\t" "_is_json" "\t" "1" "\n"; }
String CompatUtility::GetCustomAttributeConfig(const CustomVarObject::Ptr& object, const String& name) { Dictionary::Ptr vars = object->GetVars(); if (!vars) return Empty; return vars->Get(name); }
/* vars attr */ Dictionary::Ptr CompatUtility::GetCustomAttributeConfig(const CustomVarObject::Ptr& object) { Dictionary::Ptr vars = object->GetVars(); if (!vars) return Dictionary::Ptr(); return vars; }
void DbObject::VarsChangedHandler(const CustomVarObject::Ptr& object) { DbObject::Ptr dbobj = GetOrCreateByObject(object); Log(LogDebug, "DbObject") << "Vars changed for object '" << object->GetName() << "'"; if (!dbobj) return; dbobj->SendVarsStatusUpdate(); }