Fixing website and API documentation links
[PyCIM.git] / CIM15 / IEC61968 / Common / Organisation.py
blob6ffd5a6150cd3ce3f1b4af72e2af209fe980fdaf
1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 # IN THE SOFTWARE.
21 from CIM15.IEC61970.Core.IdentifiedObject import IdentifiedObject
23 class Organisation(IdentifiedObject):
24 """Organisation that might have roles as utility, contractor, supplier, manufacturer, customer, etc.Organisation that might have roles as utility, contractor, supplier, manufacturer, customer, etc.
25 """
27 def __init__(self, phone2=None, phone1=None, streetAddress=None, postalAddress=None, electronicAddress=None, BusinessRoles=None, *args, **kw_args):
28 """Initialises a new 'Organisation' instance.
30 @param phone2: Additional phone number.
31 @param phone1: Phone number.
32 @param streetAddress: Street address.
33 @param postalAddress: Postal address, potentially different than 'streetAddress' (e.g., another city).
34 @param electronicAddress: Electronic address.
35 @param BusinessRoles:
36 """
37 self.phone2 = phone2
39 self.phone1 = phone1
41 self.streetAddress = streetAddress
43 self.postalAddress = postalAddress
45 self.electronicAddress = electronicAddress
47 self._BusinessRoles = []
48 self.BusinessRoles = [] if BusinessRoles is None else BusinessRoles
50 super(Organisation, self).__init__(*args, **kw_args)
52 _attrs = []
53 _attr_types = {}
54 _defaults = {}
55 _enums = {}
56 _refs = ["phone2", "phone1", "streetAddress", "postalAddress", "electronicAddress", "BusinessRoles"]
57 _many_refs = ["BusinessRoles"]
59 # Additional phone number.
60 phone2 = None
62 # Phone number.
63 phone1 = None
65 # Street address.
66 streetAddress = None
68 # Postal address, potentially different than 'streetAddress' (e.g., another city).
69 postalAddress = None
71 # Electronic address.
72 electronicAddress = None
74 def getBusinessRoles(self):
76 return self._BusinessRoles
78 def setBusinessRoles(self, value):
79 for p in self._BusinessRoles:
80 filtered = [q for q in p.Organisations if q != self]
81 self._BusinessRoles._Organisations = filtered
82 for r in value:
83 if self not in r._Organisations:
84 r._Organisations.append(self)
85 self._BusinessRoles = value
87 BusinessRoles = property(getBusinessRoles, setBusinessRoles)
89 def addBusinessRoles(self, *BusinessRoles):
90 for obj in BusinessRoles:
91 if self not in obj._Organisations:
92 obj._Organisations.append(self)
93 self._BusinessRoles.append(obj)
95 def removeBusinessRoles(self, *BusinessRoles):
96 for obj in BusinessRoles:
97 if self in obj._Organisations:
98 obj._Organisations.remove(self)
99 self._BusinessRoles.remove(obj)