mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 08:04:14 +02:00
ido: replace hardcoded objecttype_id with enum
This commit is contained in:
parent
2b0fd9e34b
commit
d4015fe218
@ -27,9 +27,9 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_DBTYPE(CheckCommand, "command", 12, "object_id", CommandDbObject);
|
REGISTER_DBTYPE(CheckCommand, "command", DbObjectTypeCommand, "object_id", CommandDbObject);
|
||||||
REGISTER_DBTYPE(EventCommand, "command", 12, "object_id", CommandDbObject);
|
REGISTER_DBTYPE(EventCommand, "command", DbObjectTypeCommand, "object_id", CommandDbObject);
|
||||||
REGISTER_DBTYPE(NotificationCommand, "command", 12, "object_id", CommandDbObject);
|
REGISTER_DBTYPE(NotificationCommand, "command", DbObjectTypeCommand, "object_id", CommandDbObject);
|
||||||
|
|
||||||
CommandDbObject::CommandDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
CommandDbObject::CommandDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||||
: DbObject(type, name1, name2)
|
: DbObject(type, name1, name2)
|
||||||
|
@ -34,6 +34,22 @@ enum DbObjectUpdateType
|
|||||||
DbObjectRemoved
|
DbObjectRemoved
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum DbObjectType
|
||||||
|
{
|
||||||
|
DbObjectTypeHost = 1,
|
||||||
|
DbObjectTypeService = 2,
|
||||||
|
DbObjectTypeHostGroup = 3,
|
||||||
|
DbObjectTypeServiceGroup = 4,
|
||||||
|
DbObjectTypeHostEscalation = 5,
|
||||||
|
DbObjectTypeServiceEscalation = 6,
|
||||||
|
DbObjectTypeHostDependency = 7,
|
||||||
|
DbObjectTypeServiceDependency = 8,
|
||||||
|
DbObjectTypeTimePeriod = 9,
|
||||||
|
DbObjectTypeContact = 10,
|
||||||
|
DbObjectTypeContactGroup = 11,
|
||||||
|
DbObjectTypeCommand = 12,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A database object.
|
* A database object.
|
||||||
*
|
*
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_DBTYPE(Host, "host", 1, "host_object_id", HostDbObject);
|
REGISTER_DBTYPE(Host, "host", DbObjectTypeHost, "host_object_id", HostDbObject);
|
||||||
|
|
||||||
HostDbObject::HostDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
HostDbObject::HostDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||||
: DbObject(type, name1, name2)
|
: DbObject(type, name1, name2)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_DBTYPE(HostGroup, "hostgroup", 3, "hostgroup_object_id", HostGroupDbObject);
|
REGISTER_DBTYPE(HostGroup, "hostgroup", DbObjectTypeHostGroup, "hostgroup_object_id", HostGroupDbObject);
|
||||||
INITIALIZE_ONCE(HostGroupDbObject, &HostGroupDbObject::StaticInitialize);
|
INITIALIZE_ONCE(HostGroupDbObject, &HostGroupDbObject::StaticInitialize);
|
||||||
|
|
||||||
HostGroupDbObject::HostGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
HostGroupDbObject::HostGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_DBTYPE(Service, "service", 2, "service_object_id", ServiceDbObject);
|
REGISTER_DBTYPE(Service, "service", DbObjectTypeService, "service_object_id", ServiceDbObject);
|
||||||
|
|
||||||
ServiceDbObject::ServiceDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
ServiceDbObject::ServiceDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||||
: DbObject(type, name1, name2)
|
: DbObject(type, name1, name2)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_DBTYPE(ServiceGroup, "servicegroup", 4, "servicegroup_object_id", ServiceGroupDbObject);
|
REGISTER_DBTYPE(ServiceGroup, "servicegroup", DbObjectTypeServiceGroup, "servicegroup_object_id", ServiceGroupDbObject);
|
||||||
|
|
||||||
ServiceGroupDbObject::ServiceGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
ServiceGroupDbObject::ServiceGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||||
: DbObject(type, name1, name2)
|
: DbObject(type, name1, name2)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_DBTYPE(TimePeriod, "timeperiod", 9, "timeperiod_object_id", TimePeriodDbObject);
|
REGISTER_DBTYPE(TimePeriod, "timeperiod", DbObjectTypeTimePeriod, "timeperiod_object_id", TimePeriodDbObject);
|
||||||
|
|
||||||
TimePeriodDbObject::TimePeriodDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
TimePeriodDbObject::TimePeriodDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||||
: DbObject(type, name1, name2)
|
: DbObject(type, name1, name2)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_DBTYPE(User, "contact", 10, "contact_object_id", UserDbObject);
|
REGISTER_DBTYPE(User, "contact", DbObjectTypeContact, "contact_object_id", UserDbObject);
|
||||||
|
|
||||||
UserDbObject::UserDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
UserDbObject::UserDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||||
: DbObject(type, name1, name2)
|
: DbObject(type, name1, name2)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_DBTYPE(UserGroup, "contactgroup", 11, "contactgroup_object_id", UserGroupDbObject);
|
REGISTER_DBTYPE(UserGroup, "contactgroup", DbObjectTypeContactGroup, "contactgroup_object_id", UserGroupDbObject);
|
||||||
|
|
||||||
UserGroupDbObject::UserGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
UserGroupDbObject::UserGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||||
: DbObject(type, name1, name2)
|
: DbObject(type, name1, name2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user