1
2
3
4
5
6
7
8
9
10
11
12
13
14 from Globals import InitializeClass
15 from AccessControl import ClassSecurityInfo
16
17 from ManagedEntity import ManagedEntity
18
19 from Products.ZenRelations.RelSchema import *
20
22 """
23 MEProduct is a ManagedEntity that needs to track is manufacturer.
24 For instance software and hardware.
25 """
26
27 _relations = ManagedEntity._relations + (
28 ("productClass", ToOne(ToMany, "Products.ZenModel.ProductClass", "instances")),
29 )
30
31 security = ClassSecurityInfo()
32
33
34 security.declareProtected('View', 'getProductName')
36 productClass = self.productClass()
37 if productClass:
38 return productClass.name and productClass.name or productClass.id
39 return ''
40 getModelName = getProductName
41
42
43 security.declareProtected('View', 'getManufacturer')
45 if self.productClass():
46 return self.productClass().manufacturer()
47
48
49 security.declareProtected('View', 'getManufacturerName')
54
55
56 security.declareProtected('View', 'getManufacturerLink')
58 if self.productClass():
59 return self.productClass().manufacturer.getPrimaryLink()
60 return ""
61
62
64 """Get the product class of this software.
65 """
66 pclass = self.productClass()
67 if pclass: return pclass.getProductKey()
68 return ""
69
70
73
74
76 """Return list of tuples with product context for this product.
77 """
78 prod = self.productClass()
79 if prod:
80 prodcontext = self.primaryAq()
81 return prodcontext.zenPropertyItems()
82 return []
83
84 InitializeClass(MEProduct)
85