1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "base/configobject.hpp"
4 #include "base/utility.hpp"
5 #impl_include "icinga/service.hpp"
14 * The type of a service comment.
23 CommentAcknowledgement = 4
26 class CommentNameComposer : public NameComposer
29 virtual String MakeName(const String& shortName, const Object::Ptr& context) const;
30 virtual Dictionary::Ptr ParseName(const String& name) const;
34 class Comment : ConfigObject < CommentNameComposer
39 [config, protected, required, navigation(host)] name(Host) host_name {
41 return Host::GetByName(GetHostName());
44 [config, protected, navigation(service)] String service_name {
46 if (!oldValue.IsEmpty()) {
47 Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);
48 DependencyGraph::RemoveDependency(this, service.get());
51 if (!newValue.IsEmpty()) {
52 Service::Ptr service = Service::GetByNamePair(GetHostName(), newValue);
53 DependencyGraph::AddDependency(this, service.get());
57 if (GetServiceName().IsEmpty())
60 Host::Ptr host = Host::GetByName(GetHostName());
61 return host->GetServiceByShortName(GetServiceName());
65 [config] Timestamp entry_time {
66 default {{{ return Utility::GetTime(); }}}
68 [config, enum] CommentType entry_type {
69 default {{{ return CommentUser; }}}
71 [config, required] String author;
72 [config, required] String text;
73 [config] bool persistent;
74 [config] Timestamp expire_time;
75 [state] int legacy_id;