]> granicus.if.org Git - icinga2/commitdiff
ido: replace hardcoded objecttype_id with enum
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 2 Aug 2013 15:12:07 +0000 (17:12 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 2 Aug 2013 15:12:07 +0000 (17:12 +0200)
lib/ido/commanddbobject.cpp
lib/ido/dbobject.h
lib/ido/hostdbobject.cpp
lib/ido/hostgroupdbobject.cpp
lib/ido/servicedbobject.cpp
lib/ido/servicegroupdbobject.cpp
lib/ido/timeperioddbobject.cpp
lib/ido/userdbobject.cpp
lib/ido/usergroupdbobject.cpp

index 9c742aa4114261fcf03cee5d85da21382d4bcaf2..5e58ed8a783017da7fe8267da03a1821602b9540 100644 (file)
@@ -27,9 +27,9 @@
 
 using namespace icinga;
 
-REGISTER_DBTYPE(CheckCommand, "command", 12, "object_id", CommandDbObject);
-REGISTER_DBTYPE(EventCommand, "command", 12, "object_id", CommandDbObject);
-REGISTER_DBTYPE(NotificationCommand, "command", 12, "object_id", CommandDbObject);
+REGISTER_DBTYPE(CheckCommand, "command", DbObjectTypeCommand, "object_id", CommandDbObject);
+REGISTER_DBTYPE(EventCommand, "command", DbObjectTypeCommand, "object_id", CommandDbObject);
+REGISTER_DBTYPE(NotificationCommand, "command", DbObjectTypeCommand, "object_id", CommandDbObject);
 
 CommandDbObject::CommandDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
        : DbObject(type, name1, name2)
index 446b98e7a7342f2abfe22aa8fdabaa04d0b78cb5..5e4d90867fb73368512cca4660ce09766a5b4d36 100644 (file)
@@ -34,6 +34,22 @@ enum DbObjectUpdateType
        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.
  *
index f2d5bea6b9b6a6068e8dbff3f6635fdf9f7d7ff7..a6b6c22696d9ec53c1576589e85322d42dfa12f0 100644 (file)
@@ -31,7 +31,7 @@
 
 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)
        : DbObject(type, name1, name2)
index a90079850b7146a5501b5b6947e7ac0381630243..fb871f516e3a0d3330c84ab5c35e43d8819e143a 100644 (file)
@@ -28,7 +28,7 @@
 
 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);
 
 HostGroupDbObject::HostGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
index c342e6c4a28c65e1e8d290d2b478bb27fc9364f8..2037c1ef0bfae54dcbf67825df855680ed7a5409 100644 (file)
@@ -29,7 +29,7 @@
 
 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)
        : DbObject(type, name1, name2)
index 85a3ef69b7a6827f962600defd047d878373dc72..6437dc90b1d4580d7d80ed356449ad23393ac3a6 100644 (file)
@@ -26,7 +26,7 @@
 
 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)
        : DbObject(type, name1, name2)
index 7c27a30aebd6e4c1baa4a51718d77ab3213554f0..4b791f5588c9ce4ba68937bbf26ada4182afad5e 100644 (file)
@@ -26,7 +26,7 @@
 
 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)
        : DbObject(type, name1, name2)
index bd158d707b9646ba6b4c0a222256daca80cb3307..e5130f1a624e3ef1785fcf41d41d23c563e39507 100644 (file)
@@ -26,7 +26,7 @@
 
 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)
        : DbObject(type, name1, name2)
index a043eafe14d5fb3919ed1b984beaeb1cf45db206..3d45d2e6d3f6798246da3803894b36abc7092d6d 100644 (file)
@@ -26,7 +26,7 @@
 
 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)
        : DbObject(type, name1, name2)