Adding class meta-data attributes.
[PyCIM.git] / schemata / CIM14 / IEC61968 / Customers / CustomerAgreement.py
blobc06d841a806d3dab88aaabaacf19bbe8e05bc3d4
1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14.IEC61968.Common.Agreement import Agreement
19 class CustomerAgreement(Agreement):
20 """Agreement between the Customer and the ServiceSupplier to pay for service at a specific ServiceLocation. It records certain billing information about the type of service provided at the ServiceLocation and is used during charge creation to determine the type of service.
21 """
23 def __init__(self, loadMgmt='', budgetBill='', billingCycle='', DemandResponseProgram=None, ServiceSupplier=None, PricingStructures=None, ServiceLocations=None, ServiceCategory=None, MeterReadings=None, CustomerAccount=None, AuxiliaryAgreements=None, EndDeviceControls=None, Customer=None, ServiceDeliveryPoints=None, Equipments=None, *args, **kw_args):
24 """Initialises a new 'CustomerAgreement' instance.
26 @param loadMgmt: Load management code.
27 @param budgetBill: Budget bill code.
28 @param billingCycle: Cycle day on which the associated customer account will normally be billed, used to determine when to produce the billing.
29 @param DemandResponseProgram: Demand response program for this customer agreement.
30 @param ServiceSupplier: Service supplier for this customer agreement.
31 @param PricingStructures: All pricing structures applicable to this customer agreement.
32 @param ServiceLocations: All service locations regulated by this customer agreement.
33 @param ServiceCategory:
34 @param MeterReadings: (could be deprecated in the future) All meter readings for this customer agreement.
35 @param CustomerAccount: Customer account owning this agreement.
36 @param AuxiliaryAgreements: All (non-service related) auxiliary agreements that refer to this customer agreement.
37 @param EndDeviceControls: Could be deprecated in the future.
38 @param Customer: Customer for this agreement.
39 @param ServiceDeliveryPoints: All service delivery points regulated by this customer agreement.
40 @param Equipments:
41 """
42 #: Load management code.
43 self.loadMgmt = loadMgmt
45 #: Budget bill code.
46 self.budgetBill = budgetBill
48 #: Cycle day on which the associated customer account will normally be billed, used to determine when to produce the billing.
49 self.billingCycle = billingCycle
51 self._DemandResponseProgram = None
52 self.DemandResponseProgram = DemandResponseProgram
54 self._ServiceSupplier = None
55 self.ServiceSupplier = ServiceSupplier
57 self._PricingStructures = []
58 self.PricingStructures = [] if PricingStructures is None else PricingStructures
60 self._ServiceLocations = []
61 self.ServiceLocations = [] if ServiceLocations is None else ServiceLocations
63 self._ServiceCategory = None
64 self.ServiceCategory = ServiceCategory
66 self._MeterReadings = []
67 self.MeterReadings = [] if MeterReadings is None else MeterReadings
69 self._CustomerAccount = None
70 self.CustomerAccount = CustomerAccount
72 self._AuxiliaryAgreements = []
73 self.AuxiliaryAgreements = [] if AuxiliaryAgreements is None else AuxiliaryAgreements
75 self._EndDeviceControls = []
76 self.EndDeviceControls = [] if EndDeviceControls is None else EndDeviceControls
78 self._Customer = None
79 self.Customer = Customer
81 self._ServiceDeliveryPoints = []
82 self.ServiceDeliveryPoints = [] if ServiceDeliveryPoints is None else ServiceDeliveryPoints
84 self._Equipments = []
85 self.Equipments = [] if Equipments is None else Equipments
87 super(CustomerAgreement, self).__init__(*args, **kw_args)
89 _attrs = ["loadMgmt", "budgetBill", "billingCycle"]
90 _attr_types = {"loadMgmt": str, "budgetBill": str, "billingCycle": str}
91 _defaults = {"loadMgmt": '', "budgetBill": '', "billingCycle": ''}
92 _enums = {}
93 _refs = ["DemandResponseProgram", "ServiceSupplier", "PricingStructures", "ServiceLocations", "ServiceCategory", "MeterReadings", "CustomerAccount", "AuxiliaryAgreements", "EndDeviceControls", "Customer", "ServiceDeliveryPoints", "Equipments"]
94 _many_refs = ["PricingStructures", "ServiceLocations", "MeterReadings", "AuxiliaryAgreements", "EndDeviceControls", "ServiceDeliveryPoints", "Equipments"]
96 def getDemandResponseProgram(self):
97 """Demand response program for this customer agreement.
98 """
99 return self._DemandResponseProgram
101 def setDemandResponseProgram(self, value):
102 if self._DemandResponseProgram is not None:
103 filtered = [x for x in self.DemandResponseProgram.CustomerAgreements if x != self]
104 self._DemandResponseProgram._CustomerAgreements = filtered
106 self._DemandResponseProgram = value
107 if self._DemandResponseProgram is not None:
108 self._DemandResponseProgram._CustomerAgreements.append(self)
110 DemandResponseProgram = property(getDemandResponseProgram, setDemandResponseProgram)
112 def getServiceSupplier(self):
113 """Service supplier for this customer agreement.
115 return self._ServiceSupplier
117 def setServiceSupplier(self, value):
118 if self._ServiceSupplier is not None:
119 filtered = [x for x in self.ServiceSupplier.CustomerAgreements if x != self]
120 self._ServiceSupplier._CustomerAgreements = filtered
122 self._ServiceSupplier = value
123 if self._ServiceSupplier is not None:
124 self._ServiceSupplier._CustomerAgreements.append(self)
126 ServiceSupplier = property(getServiceSupplier, setServiceSupplier)
128 def getPricingStructures(self):
129 """All pricing structures applicable to this customer agreement.
131 return self._PricingStructures
133 def setPricingStructures(self, value):
134 for p in self._PricingStructures:
135 filtered = [q for q in p.CustomerAgreements if q != self]
136 self._PricingStructures._CustomerAgreements = filtered
137 for r in value:
138 if self not in r._CustomerAgreements:
139 r._CustomerAgreements.append(self)
140 self._PricingStructures = value
142 PricingStructures = property(getPricingStructures, setPricingStructures)
144 def addPricingStructures(self, *PricingStructures):
145 for obj in PricingStructures:
146 if self not in obj._CustomerAgreements:
147 obj._CustomerAgreements.append(self)
148 self._PricingStructures.append(obj)
150 def removePricingStructures(self, *PricingStructures):
151 for obj in PricingStructures:
152 if self in obj._CustomerAgreements:
153 obj._CustomerAgreements.remove(self)
154 self._PricingStructures.remove(obj)
156 def getServiceLocations(self):
157 """All service locations regulated by this customer agreement.
159 return self._ServiceLocations
161 def setServiceLocations(self, value):
162 for p in self._ServiceLocations:
163 filtered = [q for q in p.CustomerAgreements if q != self]
164 self._ServiceLocations._CustomerAgreements = filtered
165 for r in value:
166 if self not in r._CustomerAgreements:
167 r._CustomerAgreements.append(self)
168 self._ServiceLocations = value
170 ServiceLocations = property(getServiceLocations, setServiceLocations)
172 def addServiceLocations(self, *ServiceLocations):
173 for obj in ServiceLocations:
174 if self not in obj._CustomerAgreements:
175 obj._CustomerAgreements.append(self)
176 self._ServiceLocations.append(obj)
178 def removeServiceLocations(self, *ServiceLocations):
179 for obj in ServiceLocations:
180 if self in obj._CustomerAgreements:
181 obj._CustomerAgreements.remove(self)
182 self._ServiceLocations.remove(obj)
184 def getServiceCategory(self):
186 return self._ServiceCategory
188 def setServiceCategory(self, value):
189 if self._ServiceCategory is not None:
190 filtered = [x for x in self.ServiceCategory.CustomerAgreements if x != self]
191 self._ServiceCategory._CustomerAgreements = filtered
193 self._ServiceCategory = value
194 if self._ServiceCategory is not None:
195 self._ServiceCategory._CustomerAgreements.append(self)
197 ServiceCategory = property(getServiceCategory, setServiceCategory)
199 def getMeterReadings(self):
200 """(could be deprecated in the future) All meter readings for this customer agreement.
202 return self._MeterReadings
204 def setMeterReadings(self, value):
205 for x in self._MeterReadings:
206 x._CustomerAgreement = None
207 for y in value:
208 y._CustomerAgreement = self
209 self._MeterReadings = value
211 MeterReadings = property(getMeterReadings, setMeterReadings)
213 def addMeterReadings(self, *MeterReadings):
214 for obj in MeterReadings:
215 obj._CustomerAgreement = self
216 self._MeterReadings.append(obj)
218 def removeMeterReadings(self, *MeterReadings):
219 for obj in MeterReadings:
220 obj._CustomerAgreement = None
221 self._MeterReadings.remove(obj)
223 def getCustomerAccount(self):
224 """Customer account owning this agreement.
226 return self._CustomerAccount
228 def setCustomerAccount(self, value):
229 if self._CustomerAccount is not None:
230 filtered = [x for x in self.CustomerAccount.CustomerAgreements if x != self]
231 self._CustomerAccount._CustomerAgreements = filtered
233 self._CustomerAccount = value
234 if self._CustomerAccount is not None:
235 self._CustomerAccount._CustomerAgreements.append(self)
237 CustomerAccount = property(getCustomerAccount, setCustomerAccount)
239 def getAuxiliaryAgreements(self):
240 """All (non-service related) auxiliary agreements that refer to this customer agreement.
242 return self._AuxiliaryAgreements
244 def setAuxiliaryAgreements(self, value):
245 for x in self._AuxiliaryAgreements:
246 x._CustomerAgreement = None
247 for y in value:
248 y._CustomerAgreement = self
249 self._AuxiliaryAgreements = value
251 AuxiliaryAgreements = property(getAuxiliaryAgreements, setAuxiliaryAgreements)
253 def addAuxiliaryAgreements(self, *AuxiliaryAgreements):
254 for obj in AuxiliaryAgreements:
255 obj._CustomerAgreement = self
256 self._AuxiliaryAgreements.append(obj)
258 def removeAuxiliaryAgreements(self, *AuxiliaryAgreements):
259 for obj in AuxiliaryAgreements:
260 obj._CustomerAgreement = None
261 self._AuxiliaryAgreements.remove(obj)
263 def getEndDeviceControls(self):
264 """Could be deprecated in the future.
266 return self._EndDeviceControls
268 def setEndDeviceControls(self, value):
269 for x in self._EndDeviceControls:
270 x._CustomerAgreement = None
271 for y in value:
272 y._CustomerAgreement = self
273 self._EndDeviceControls = value
275 EndDeviceControls = property(getEndDeviceControls, setEndDeviceControls)
277 def addEndDeviceControls(self, *EndDeviceControls):
278 for obj in EndDeviceControls:
279 obj._CustomerAgreement = self
280 self._EndDeviceControls.append(obj)
282 def removeEndDeviceControls(self, *EndDeviceControls):
283 for obj in EndDeviceControls:
284 obj._CustomerAgreement = None
285 self._EndDeviceControls.remove(obj)
287 def getCustomer(self):
288 """Customer for this agreement.
290 return self._Customer
292 def setCustomer(self, value):
293 if self._Customer is not None:
294 filtered = [x for x in self.Customer.CustomerAgreements if x != self]
295 self._Customer._CustomerAgreements = filtered
297 self._Customer = value
298 if self._Customer is not None:
299 self._Customer._CustomerAgreements.append(self)
301 Customer = property(getCustomer, setCustomer)
303 def getServiceDeliveryPoints(self):
304 """All service delivery points regulated by this customer agreement.
306 return self._ServiceDeliveryPoints
308 def setServiceDeliveryPoints(self, value):
309 for x in self._ServiceDeliveryPoints:
310 x._CustomerAgreement = None
311 for y in value:
312 y._CustomerAgreement = self
313 self._ServiceDeliveryPoints = value
315 ServiceDeliveryPoints = property(getServiceDeliveryPoints, setServiceDeliveryPoints)
317 def addServiceDeliveryPoints(self, *ServiceDeliveryPoints):
318 for obj in ServiceDeliveryPoints:
319 obj._CustomerAgreement = self
320 self._ServiceDeliveryPoints.append(obj)
322 def removeServiceDeliveryPoints(self, *ServiceDeliveryPoints):
323 for obj in ServiceDeliveryPoints:
324 obj._CustomerAgreement = None
325 self._ServiceDeliveryPoints.remove(obj)
327 def getEquipments(self):
329 return self._Equipments
331 def setEquipments(self, value):
332 for p in self._Equipments:
333 filtered = [q for q in p.CustomerAgreements if q != self]
334 self._Equipments._CustomerAgreements = filtered
335 for r in value:
336 if self not in r._CustomerAgreements:
337 r._CustomerAgreements.append(self)
338 self._Equipments = value
340 Equipments = property(getEquipments, setEquipments)
342 def addEquipments(self, *Equipments):
343 for obj in Equipments:
344 if self not in obj._CustomerAgreements:
345 obj._CustomerAgreements.append(self)
346 self._Equipments.append(obj)
348 def removeEquipments(self, *Equipments):
349 for obj in Equipments:
350 if self in obj._CustomerAgreements:
351 obj._CustomerAgreements.remove(self)
352 self._Equipments.remove(obj)