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)
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.
*
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)
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)
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)
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)
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)
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)
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)