parent
f4b8b369a8
commit
e5f3a063fb
|
@ -25,9 +25,8 @@
|
|||
|
||||
namespace Monitoring\Backend\Ido\Query;
|
||||
|
||||
|
||||
/**
|
||||
* NotificationQuery
|
||||
* Notification query
|
||||
*/
|
||||
class NotificationQuery extends AbstractQuery
|
||||
{
|
||||
|
@ -38,20 +37,20 @@ class NotificationQuery extends AbstractQuery
|
|||
*/
|
||||
protected $columnMap = array(
|
||||
'notification' => array(
|
||||
'notification_type' => 'n.notification_type',
|
||||
'notification_reason' => 'n.notification_reason',
|
||||
'notification_start_time' => 'n.start_time',
|
||||
'notification_information' => 'n.output'
|
||||
'notification_type' => 'n.notification_type',
|
||||
'notification_reason' => 'n.notification_reason',
|
||||
'notification_start_time' => 'n.start_time',
|
||||
'notification_information' => 'n.output'
|
||||
),
|
||||
'objects' => array(
|
||||
'host_name' => 'o.name1',
|
||||
'service_description' => 'o.name2'
|
||||
'host_name' => 'o.name1',
|
||||
'service_description' => 'o.name2'
|
||||
),
|
||||
'contact' => array(
|
||||
'notification_contact' => 'c_o.name1'
|
||||
'notification_contact' => 'c_o.name1'
|
||||
),
|
||||
'command' => array(
|
||||
'notification_command' => 'cmd_o.name1'
|
||||
'notification_command' => 'cmd_o.name1'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -60,9 +59,12 @@ class NotificationQuery extends AbstractQuery
|
|||
*/
|
||||
protected function joinBaseTables()
|
||||
{
|
||||
$this->baseQuery = $this->db->select()->from(array(
|
||||
'n' => $this->prefix . 'notifications'
|
||||
));
|
||||
$this->baseQuery = $this->db->select()->from(
|
||||
array(
|
||||
'n' => $this->prefix . 'notifications'
|
||||
),
|
||||
array()
|
||||
);
|
||||
$this->joinedVirtualTables = array('notification' => true);
|
||||
}
|
||||
|
||||
|
@ -71,11 +73,12 @@ class NotificationQuery extends AbstractQuery
|
|||
*/
|
||||
protected function joinObjects()
|
||||
{
|
||||
$this->baseQuery->joinInner(
|
||||
$this->baseQuery->join(
|
||||
array(
|
||||
'o' => $this->prefix . 'objects'
|
||||
),
|
||||
'n.object_id = o.object_id AND o.is_active = 1 AND o.objecttype_id IN (1, 2)'
|
||||
'n.object_id = o.object_id AND o.is_active = 1 AND o.objecttype_id IN (1, 2)',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -84,17 +87,19 @@ class NotificationQuery extends AbstractQuery
|
|||
*/
|
||||
protected function joinContact()
|
||||
{
|
||||
$this->baseQuery->joinInner(
|
||||
$this->baseQuery->join(
|
||||
array(
|
||||
'c' => $this->prefix . 'contactnotifications'
|
||||
),
|
||||
'n.notification_id = c.notification_id'
|
||||
'n.notification_id = c.notification_id',
|
||||
array()
|
||||
);
|
||||
$this->baseQuery->joinInner(
|
||||
$this->baseQuery->join(
|
||||
array(
|
||||
'c_o' => $this->prefix . 'objects'
|
||||
),
|
||||
'c.contact_object_id = c_o.object_id'
|
||||
'c.contact_object_id = c_o.object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -103,23 +108,26 @@ class NotificationQuery extends AbstractQuery
|
|||
*/
|
||||
protected function joinCommand()
|
||||
{
|
||||
$this->baseQuery->joinInner(
|
||||
$this->baseQuery->join(
|
||||
array(
|
||||
'cmd_c' => $this->prefix . 'contactnotifications'
|
||||
),
|
||||
'n.notification_id = cmd_c.notification_id'
|
||||
'n.notification_id = cmd_c.notification_id',
|
||||
array()
|
||||
);
|
||||
$this->baseQuery->joinInner(
|
||||
$this->baseQuery->join(
|
||||
array(
|
||||
'cmd_m' => $this->prefix . 'contactnotificationmethods'
|
||||
),
|
||||
'cmd_c.notification_id = cmd_m.contactnotification_id'
|
||||
'cmd_c.notification_id = cmd_m.contactnotification_id',
|
||||
array()
|
||||
);
|
||||
$this->baseQuery->joinInner(
|
||||
$this->baseQuery->join(
|
||||
array(
|
||||
'cmd_o' => $this->prefix . 'objects'
|
||||
),
|
||||
'cmd_m.command_object_id = cmd_o.object_id'
|
||||
'cmd_m.command_object_id = cmd_o.object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue