Package ZenModel :: Module GraphGroup
[hide private]
[frames] | no frames]

Source Code for Module ZenModel.GraphGroup

  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  __doc__="""GraphGroup 
 15   
 16  GraphGroup contains the settings, graphDefinitions and collections 
 17  that form part of an UberReport. 
 18  """ 
 19   
 20   
 21  from AccessControl import Permissions 
 22  from Globals import InitializeClass 
 23  from AccessControl import ClassSecurityInfo 
 24  from Products.ZenRelations.RelSchema import * 
 25  from ZenModelRM import ZenModelRM 
 26   
 27   
28 -def manage_addGraphGroup(context, id, REQUEST = None):
29 ''' This is here so than zope will let us copy/paste/rename 30 ''' 31 gg = GraphGroup(id) 32 context._setObject(gg.id, gg) 33 if REQUEST: 34 return context.callZenScreen(REQUEST)
35 36
37 -class GraphGroup(ZenModelRM):
38 ''' 39 ''' 40 41 meta_type = 'GraphGroup' 42 43 sequence = 0 44 collectionId = '' 45 graphDefId = '' 46 combineDevices = False 47 48 _properties = ( 49 {'id':'sequence', 'type':'long', 'mode':'w'}, 50 {'id':'collectionId', 'type':'string', 'mode':'w'}, 51 {'id':'graphDefId', 'type':'string', 'mode':'w'}, 52 {'id':'combineDevices', 'type':'boolean', 'mode':'w'}, 53 ) 54 55 _relations = ( 56 ('report', 57 ToOne(ToManyCont, 'Products.ZenModel.MultiGraphReport', 58 'graphGroups')), 59 ) 60 61 factory_type_information = ( 62 { 63 'immediate_view' : 'editGraphGroup', 64 'actions' : 65 ( 66 { 'id' : 'edit' 67 , 'name' : 'Graph Group' 68 , 'action' : 'editGraphGroup' 69 , 'permissions' : ( Permissions.view, ) 70 }, 71 ) 72 }, 73 ) 74 75 security = ClassSecurityInfo() 76
77 - def __init__(self, newId, collectionId='', graphDefId='', sequence=0, 78 title=None, buildRelations=True):
83 84
85 - def getCollection(self):
86 ''' Return the referenced collection or None if it doesn't exist 87 ''' 88 return getattr(self.report.collections, self.collectionId, None)
89 90
91 - def getGraphDef(self):
92 ''' Return the referenced graphDef or None if it doesn't exist 93 ''' 94 return getattr(self.report().graphDefs, self.graphDefId, None)
95 96
97 - def getCollectionUrl(self):
98 ''' 99 ''' 100 collection = self.getCollection() 101 url = None 102 if collection: 103 url = collection.getPrimaryUrlPath() 104 return url
105 106
107 - def getGraphDefUrl(self):
108 ''' 109 ''' 110 graphDef = self.getGraphDef() 111 url = None 112 if graphDef: 113 url = graphDef.getPrimaryUrlPath() 114 return url
115 116 117 # def zmanage_editProperties(self, REQUEST): 118 # ''' Save then redirect back to the report 119 # ''' 120 # self.manage_changeProperties(**REQUEST.form) 121 # index_object = getattr(self, 'index_object', lambda self: None) 122 # index_object() 123 # REQUEST['RESPONSE'].redirect(self.report().getPrimaryUrlPath()) 124 125 126 InitializeClass(GraphGroup) 127