Package ZenEvents :: Module EventDetail
[hide private]
[frames] | no frames]

Source Code for Module ZenEvents.EventDetail

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 as published by 
 8  # the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  from ZEvent import ZEvent 
15  from Products.ZenModel.ZenModelItem import ZenModelItem 
16  from Acquisition import Implicit 
17   
18  from AccessControl import Permissions as permissions 
19  from Globals import InitializeClass 
20  from AccessControl import ClassSecurityInfo 
21   
22 -class EventDetail(ZEvent, ZenModelItem, Implicit):
23 security = ClassSecurityInfo() 24 security.setDefaultAccess("allow") 25 26 factory_type_information = ( 27 { 28 'id' : 'EventDetail', 29 'meta_type' : 'EventDetail', 30 'description' : """Detail view of netcool event""", 31 'icon' : 'EventDetail_icon.gif', 32 'product' : 'ZenEvents', 33 'factory' : '', 34 'immediate_view' : 'viewEventFields', 35 'actions' : 36 ( 37 { 'id' : 'fields' 38 , 'name' : 'Fields' 39 , 'action' : 'viewEventFields' 40 , 'permissions' : ( 41 permissions.view, ) 42 }, 43 { 'id' : 'details' 44 , 'name' : 'Details' 45 , 'action' : 'viewEventDetail' 46 , 'permissions' : ( 47 permissions.view, ) 48 }, 49 { 'id' : 'log' 50 , 'name' : 'Log' 51 , 'action' : 'viewEventLog' 52 , 'permissions' : ( 53 permissions.view, ) 54 }, 55 ) 56 }, 57 ) 58
59 - def __init__(self, manager, fields, data, details=None, logs=None):
60 ZEvent.__init__(self, manager, fields, data) 61 self._details = details 62 self._logs = logs
63
64 - def getEventDetails(self):
65 """return array of detail tuples (field,value)""" 66 return self._details
67 68
69 - def getEventLogs(self):
70 """return an array of log tuples (user,date,text)""" 71 return self._logs
72 73 74 InitializeClass(EventDetail) 75
76 -class EventData:
77 security = ClassSecurityInfo() 78 security.setDefaultAccess("allow")
79 - def __init__(self, field, value):
80 self.field = field 81 self.value = value
82 InitializeClass(EventData) 83 84
85 -class EventLog:
86 security = ClassSecurityInfo() 87 security.setDefaultAccess("allow")
88 - def __init__(self, user, date, text):
89 self.user = user 90 self.date = date 91 self.text = text
92 InitializeClass(EventLog) 93