Update README.rst
[PyCIM.git] / CIM14 / IEC61968 / Customers / CustomerAgreement.py
blobfddfca6a9b7ed389476e5f85e2ef74bc96617447
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 CIM14.IEC61968.Common.Agreement import Agreement
23 class CustomerAgreement(Agreement):
24 """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.
25 """
27 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):
28 """Initialises a new 'CustomerAgreement' instance.
30 @param loadMgmt: Load management code.
31 @param budgetBill: Budget bill code.
32 @param billingCycle: Cycle day on which the associated customer account will normally be billed, used to determine when to produce the billing.
33 @param DemandResponseProgram: Demand response program for this customer agreement.
34 @param ServiceSupplier: Service supplier for this customer agreement.
35 @param PricingStructures: All pricing structures applicable to this customer agreement.
36 @param ServiceLocations: All service locations regulated by this customer agreement.
37 @param ServiceCategory:
38 @param MeterReadings: (could be deprecated in the future) All meter readings for this customer agreement.
39 @param CustomerAccount: Customer account owning this agreement.
40 @param AuxiliaryAgreements: All (non-service related) auxiliary agreements that refer to this customer agreement.
41 @param EndDeviceControls: Could be deprecated in the future.
42 @param Customer: Customer for this agreement.
43 @param ServiceDeliveryPoints: All service delivery points regulated by this customer agreement.
44 @param Equipments:
45 """
46 #: Load management code.
47 self.loadMgmt = loadMgmt
49 #: Budget bill code.
50 self.budgetBill = budgetBill
52 #: Cycle day on which the associated customer account will normally be billed, used to determine when to produce the billing.
53 self.billingCycle = billingCycle
55 self._DemandResponseProgram = None
56 self.DemandResponseProgram = DemandResponseProgram
58 self._ServiceSupplier = None
59 self.ServiceSupplier = ServiceSupplier
61 self._PricingStructures = []
62 self.PricingStructures = [] if PricingStructures is None else PricingStructures
64 self._ServiceLocations = []
65 self.ServiceLocations = [] if ServiceLocations is None else ServiceLocations
67 self._ServiceCategory = None
68 self.ServiceCategory = ServiceCategory
70 self._MeterReadings = []
71 self.MeterReadings = [] if MeterReadings is None else MeterReadings
73 self._CustomerAccount = None
74 self.CustomerAccount = CustomerAccount
76 self._AuxiliaryAgreements = []
77 self.AuxiliaryAgreements = [] if AuxiliaryAgreements is None else AuxiliaryAgreements
79 self._EndDeviceControls = []
80 self.EndDeviceControls = [] if EndDeviceControls is None else EndDeviceControls
82 self._Customer = None
83 self.Customer = Customer
85 self._ServiceDeliveryPoints = []
86 self.ServiceDeliveryPoints = [] if ServiceDeliveryPoints is None else ServiceDeliveryPoints
88 self._Equipments = []
89 self.Equipments = [] if Equipments is None else Equipments
91 super(CustomerAgreement, self).__init__(*args, **kw_args)
93 _attrs = ["loadMgmt", "budgetBill", "billingCycle"]
94 _attr_types = {"loadMgmt": str, "budgetBill": str, "billingCycle": str}
95 _defaults = {"loadMgmt": '', "budgetBill": '', "billingCycle": ''}
96 _enums = {}
97 _refs = ["DemandResponseProgram", "ServiceSupplier", "PricingStructures", "ServiceLocations", "ServiceCategory", "MeterReadings", "CustomerAccount", "AuxiliaryAgreements", "EndDeviceControls", "Customer", "ServiceDeliveryPoints", "Equipments"]
98 _many_refs = ["PricingStructures", "ServiceLocations", "MeterReadings", "AuxiliaryAgreements", "EndDeviceControls", "ServiceDeliveryPoints", "Equipments"]
100 def getDemandResponseProgram(self):
101 """Demand response program for this customer agreement.
103 return self._DemandResponseProgram
105 def setDemandResponseProgram(self, value):
106 if self._DemandResponseProgram is not None:
107 filtered = [x for x in self.DemandResponseProgram.CustomerAgreements if x != self]
108 self._DemandResponseProgram._CustomerAgreements = filtered
110 self._DemandResponseProgram = value
111 if self._DemandResponseProgram is not None:
112 if self not in self._DemandResponseProgram._CustomerAgreements:
113 self._DemandResponseProgram._CustomerAgreements.append(self)
115 DemandResponseProgram = property(getDemandResponseProgram, setDemandResponseProgram)
117 def getServiceSupplier(self):
118 """Service supplier for this customer agreement.
120 return self._ServiceSupplier
122 def setServiceSupplier(self, value):
123 if self._ServiceSupplier is not None:
124 filtered = [x for x in self.ServiceSupplier.CustomerAgreements if x != self]
125 self._ServiceSupplier._CustomerAgreements = filtered
127 self._ServiceSupplier = value
128 if self._ServiceSupplier is not None:
129 if self not in self._ServiceSupplier._CustomerAgreements:
130 self._ServiceSupplier._CustomerAgreements.append(self)
132 ServiceSupplier = property(getServiceSupplier, setServiceSupplier)
134 def getPricingStructures(self):
135 """All pricing structures applicable to this customer agreement.
137 return self._PricingStructures
139 def setPricingStructures(self, value):
140 for p in self._PricingStructures:
141 filtered = [q for q in p.CustomerAgreements if q != self]
142 self._PricingStructures._CustomerAgreements = filtered
143 for r in value:
144 if self not in r._CustomerAgreements:
145 r._CustomerAgreements.append(self)
146 self._PricingStructures = value
148 PricingStructures = property(getPricingStructures, setPricingStructures)
150 def addPricingStructures(self, *PricingStructures):
151 for obj in PricingStructures:
152 if self not in obj._CustomerAgreements:
153 obj._CustomerAgreements.append(self)
154 self._PricingStructures.append(obj)
156 def removePricingStructures(self, *PricingStructures):
157 for obj in PricingStructures:
158 if self in obj._CustomerAgreements:
159 obj._CustomerAgreements.remove(self)
160 self._PricingStructures.remove(obj)
162 def getServiceLocations(self):
163 """All service locations regulated by this customer agreement.
165 return self._ServiceLocations
167 def setServiceLocations(self, value):
168 for p in self._ServiceLocations:
169 filtered = [q for q in p.CustomerAgreements if q != self]
170 self._ServiceLocations._CustomerAgreements = filtered
171 for r in value:
172 if self not in r._CustomerAgreements:
173 r._CustomerAgreements.append(self)
174 self._ServiceLocations = value
176 ServiceLocations = property(getServiceLocations, setServiceLocations)
178 def addServiceLocations(self, *ServiceLocations):
179 for obj in ServiceLocations:
180 if self not in obj._CustomerAgreements:
181 obj._CustomerAgreements.append(self)
182 self._ServiceLocations.append(obj)
184 def removeServiceLocations(self, *ServiceLocations):
185 for obj in ServiceLocations:
186 if self in obj._CustomerAgreements:
187 obj._CustomerAgreements.remove(self)
188 self._ServiceLocations.remove(obj)
190 def getServiceCategory(self):
192 return self._ServiceCategory
194 def setServiceCategory(self, value):
195 if self._ServiceCategory is not None:
196 filtered = [x for x in self.ServiceCategory.CustomerAgreements if x != self]
197 self._ServiceCategory._CustomerAgreements = filtered
199 self._ServiceCategory = value
200 if self._ServiceCategory is not None:
201 if self not in self._ServiceCategory._CustomerAgreements:
202 self._ServiceCategory._CustomerAgreements.append(self)
204 ServiceCategory = property(getServiceCategory, setServiceCategory)
206 def getMeterReadings(self):
207 """(could be deprecated in the future) All meter readings for this customer agreement.
209 return self._MeterReadings
211 def setMeterReadings(self, value):
212 for x in self._MeterReadings:
213 x.CustomerAgreement = None
214 for y in value:
215 y._CustomerAgreement = self
216 self._MeterReadings = value
218 MeterReadings = property(getMeterReadings, setMeterReadings)
220 def addMeterReadings(self, *MeterReadings):
221 for obj in MeterReadings:
222 obj.CustomerAgreement = self
224 def removeMeterReadings(self, *MeterReadings):
225 for obj in MeterReadings:
226 obj.CustomerAgreement = None
228 def getCustomerAccount(self):
229 """Customer account owning this agreement.
231 return self._CustomerAccount
233 def setCustomerAccount(self, value):
234 if self._CustomerAccount is not None:
235 filtered = [x for x in self.CustomerAccount.CustomerAgreements if x != self]
236 self._CustomerAccount._CustomerAgreements = filtered
238 self._CustomerAccount = value
239 if self._CustomerAccount is not None:
240 if self not in self._CustomerAccount._CustomerAgreements:
241 self._CustomerAccount._CustomerAgreements.append(self)
243 CustomerAccount = property(getCustomerAccount, setCustomerAccount)
245 def getAuxiliaryAgreements(self):
246 """All (non-service related) auxiliary agreements that refer to this customer agreement.
248 return self._AuxiliaryAgreements
250 def setAuxiliaryAgreements(self, value):
251 for x in self._AuxiliaryAgreements:
252 x.CustomerAgreement = None
253 for y in value:
254 y._CustomerAgreement = self
255 self._AuxiliaryAgreements = value
257 AuxiliaryAgreements = property(getAuxiliaryAgreements, setAuxiliaryAgreements)
259 def addAuxiliaryAgreements(self, *AuxiliaryAgreements):
260 for obj in AuxiliaryAgreements:
261 obj.CustomerAgreement = self
263 def removeAuxiliaryAgreements(self, *AuxiliaryAgreements):
264 for obj in AuxiliaryAgreements:
265 obj.CustomerAgreement = None
267 def getEndDeviceControls(self):
268 """Could be deprecated in the future.
270 return self._EndDeviceControls
272 def setEndDeviceControls(self, value):
273 for x in self._EndDeviceControls:
274 x.CustomerAgreement = None
275 for y in value:
276 y._CustomerAgreement = self
277 self._EndDeviceControls = value
279 EndDeviceControls = property(getEndDeviceControls, setEndDeviceControls)
281 def addEndDeviceControls(self, *EndDeviceControls):
282 for obj in EndDeviceControls:
283 obj.CustomerAgreement = self
285 def removeEndDeviceControls(self, *EndDeviceControls):
286 for obj in EndDeviceControls:
287 obj.CustomerAgreement = None
289 def getCustomer(self):
290 """Customer for this agreement.
292 return self._Customer
294 def setCustomer(self, value):
295 if self._Customer is not None:
296 filtered = [x for x in self.Customer.CustomerAgreements if x != self]
297 self._Customer._CustomerAgreements = filtered
299 self._Customer = value
300 if self._Customer is not None:
301 if self not in self._Customer._CustomerAgreements:
302 self._Customer._CustomerAgreements.append(self)
304 Customer = property(getCustomer, setCustomer)
306 def getServiceDeliveryPoints(self):
307 """All service delivery points regulated by this customer agreement.
309 return self._ServiceDeliveryPoints
311 def setServiceDeliveryPoints(self, value):
312 for x in self._ServiceDeliveryPoints:
313 x.CustomerAgreement = None
314 for y in value:
315 y._CustomerAgreement = self
316 self._ServiceDeliveryPoints = value
318 ServiceDeliveryPoints = property(getServiceDeliveryPoints, setServiceDeliveryPoints)
320 def addServiceDeliveryPoints(self, *ServiceDeliveryPoints):
321 for obj in ServiceDeliveryPoints:
322 obj.CustomerAgreement = self
324 def removeServiceDeliveryPoints(self, *ServiceDeliveryPoints):
325 for obj in ServiceDeliveryPoints:
326 obj.CustomerAgreement = None
328 def getEquipments(self):
330 return self._Equipments
332 def setEquipments(self, value):
333 for p in self._Equipments:
334 filtered = [q for q in p.CustomerAgreements if q != self]
335 self._Equipments._CustomerAgreements = filtered
336 for r in value:
337 if self not in r._CustomerAgreements:
338 r._CustomerAgreements.append(self)
339 self._Equipments = value
341 Equipments = property(getEquipments, setEquipments)
343 def addEquipments(self, *Equipments):
344 for obj in Equipments:
345 if self not in obj._CustomerAgreements:
346 obj._CustomerAgreements.append(self)
347 self._Equipments.append(obj)
349 def removeEquipments(self, *Equipments):
350 for obj in Equipments:
351 if self in obj._CustomerAgreements:
352 obj._CustomerAgreements.remove(self)
353 self._Equipments.remove(obj)