| 348 | } |
| 349 | |
| 350 | String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) const |
| 351 | { |
| 352 | String hashData = DbObject::CalculateConfigHash(configFields); |
| 353 | |
| 354 | Host::Ptr host = static_pointer_cast<Host>(GetObject()); |
| 355 | |
| 356 | Array::Ptr groups = host->GetGroups(); |
| 357 | |
| 358 | if (groups) { |
| 359 | groups = groups->ShallowClone(); |
| 360 | ObjectLock oLock (groups); |
| 361 | std::sort(groups->Begin(), groups->End()); |
| 362 | hashData += DbObject::HashValue(groups); |
| 363 | } |
| 364 | |
| 365 | ArrayData parents; |
| 366 | |
| 367 | /* parents */ |
| 368 | for (const Checkable::Ptr& checkable : host->GetParents()) { |
| 369 | Host::Ptr parent = dynamic_pointer_cast<Host>(checkable); |
| 370 | |
| 371 | if (!parent) |
| 372 | continue; |
| 373 | |
| 374 | parents.push_back(parent->GetName()); |
| 375 | } |
| 376 | |
| 377 | std::sort(parents.begin(), parents.end()); |
| 378 | |
| 379 | hashData += DbObject::HashValue(new Array(std::move(parents))); |
| 380 | |
| 381 | ArrayData dependencies; |
| 382 | |
| 383 | /* dependencies */ |
| 384 | for (const Dependency::Ptr& dep : host->GetDependencies()) { |
| 385 | Checkable::Ptr parent = dep->GetParent(); |
| 386 | |
| 387 | if (!parent) |
| 388 | continue; |
| 389 | |
| 390 | dependencies.push_back(new Array({ |
| 391 | parent->GetName(), |
| 392 | dep->GetStateFilter(), |
| 393 | dep->GetPeriodRaw() |
| 394 | })); |
| 395 | } |
| 396 | |
| 397 | std::sort(dependencies.begin(), dependencies.end()); |
| 398 | |
| 399 | hashData += DbObject::HashValue(new Array(std::move(dependencies))); |
| 400 | |
| 401 | ArrayData users; |
| 402 | |
| 403 | for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(host)) { |
| 404 | users.push_back(user->GetName()); |
| 405 | } |
| 406 | |
| 407 | std::sort(users.begin(), users.end()); |
nothing calls this directly
no test coverage detected