1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "icinga/customvarobject.hpp"
4 #impl_include "icinga/service.hpp"
12 class ScheduledDowntimeNameComposer : public NameComposer
15 virtual String MakeName(const String& shortName, const Object::Ptr& context) const;
16 virtual Dictionary::Ptr ParseName(const String& name) const;
20 class ScheduledDowntime : CustomVarObject < ScheduledDowntimeNameComposer
22 // Scheduled Downtimes have a dependency on Downtimes. This is to make sure ScheduledDowntimes are activated after
23 // the Downtimes (and other checkables)
24 activation_priority 20;
29 [config, protected, required, navigation(host)] name(Host) host_name {
31 return Host::GetByName(GetHostName());
34 [config, protected, navigation(service)] String service_name {
36 if (!oldValue.IsEmpty()) {
37 Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);
38 DependencyGraph::RemoveDependency(this, service.get());
41 if (!newValue.IsEmpty()) {
42 Service::Ptr service = Service::GetByNamePair(GetHostName(), newValue);
43 DependencyGraph::AddDependency(this, service.get());
47 if (GetServiceName().IsEmpty())
50 Host::Ptr host = Host::GetByName(GetHostName());
51 return host->GetServiceByShortName(GetServiceName());
55 [config, required] String author;
56 [config, required] String comment;
58 [config] double duration;
60 default {{{ return true; }}}
63 [config] Value child_options {
64 default {{{ return "DowntimeNoChildren"; }}}
67 [config, required] Dictionary::Ptr ranges;
70 validator ScheduledDowntime {