1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "icinga/customvarobject.hpp"
4 #include "icinga/checkable.hpp"
5 #impl_include "icinga/service.hpp"
13 class DependencyNameComposer : public NameComposer
16 virtual String MakeName(const String& shortName, const Object::Ptr& context) const;
17 virtual Dictionary::Ptr ParseName(const String& name) const;
21 class Dependency : CustomVarObject < DependencyNameComposer
26 [config, required, navigation(child_host)] name(Host) child_host_name {
28 return Host::GetByName(GetChildHostName());
32 [config, navigation(child_service)] String child_service_name {
34 if (!oldValue.IsEmpty()) {
35 Service::Ptr service = Service::GetByNamePair(GetParentHostName(), oldValue);
36 DependencyGraph::RemoveDependency(this, service.get());
39 if (!newValue.IsEmpty()) {
40 Service::Ptr service = Service::GetByNamePair(GetParentHostName(), newValue);
41 DependencyGraph::AddDependency(this, service.get());
45 if (GetChildServiceName().IsEmpty())
48 Host::Ptr host = Host::GetByName(GetChildHostName());
49 return host->GetServiceByShortName(GetChildServiceName());
53 [config, required, navigation(parent_host)] name(Host) parent_host_name {
55 return Host::GetByName(GetParentHostName());
59 [config, navigation(parent_service)] String parent_service_name {
61 if (!oldValue.IsEmpty()) {
62 Service::Ptr service = Service::GetByNamePair(GetParentHostName(), oldValue);
63 DependencyGraph::RemoveDependency(this, service.get());
66 if (!newValue.IsEmpty()) {
67 Service::Ptr service = Service::GetByNamePair(GetParentHostName(), newValue);
68 DependencyGraph::AddDependency(this, service.get());
72 if (GetParentServiceName().IsEmpty())
75 Host::Ptr host = Host::GetByName(GetParentHostName());
76 return host->GetServiceByShortName(GetParentServiceName());
80 [config, navigation] name(TimePeriod) period (PeriodRaw) {
82 return TimePeriod::GetByName(GetPeriodRaw());
86 [config] array(Value) states;
87 [no_user_view, no_user_modify] int state_filter_real (StateFilter);
89 [config] bool ignore_soft_states {
90 default {{{ return true; }}}
93 [config] bool disable_checks;
94 [config] bool disable_notifications {
95 default {{{ return true; }}}