Bumping version for release.
[PyCIM.git] / CIM14 / IEC61968 / PaymentMetering / Cashier.py
blob467942be8388036626e635d58540d7d1fe38b01a
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.IEC61970.Core.IdentifiedObject import IdentifiedObject
19 class Cashier(IdentifiedObject):
20 """The operator of the point of sale for the duration of CashierShift. Cashier is under the exclusive management control of Vendor.
21 """
23 def __init__(self, CashierShifts=None, electronicAddress=None, Vendor=None, *args, **kw_args):
24 """Initialises a new 'Cashier' instance.
26 @param CashierShifts: All shifts operated by this cashier.
27 @param electronicAddress: Electronic address.
28 @param Vendor: Vendor that manages this Cachier.
29 """
30 self._CashierShifts = []
31 self.CashierShifts = [] if CashierShifts is None else CashierShifts
33 self.electronicAddress = electronicAddress
35 self._Vendor = None
36 self.Vendor = Vendor
38 super(Cashier, self).__init__(*args, **kw_args)
40 _attrs = []
41 _attr_types = {}
42 _defaults = {}
43 _enums = {}
44 _refs = ["CashierShifts", "electronicAddress", "Vendor"]
45 _many_refs = ["CashierShifts"]
47 def getCashierShifts(self):
48 """All shifts operated by this cashier.
49 """
50 return self._CashierShifts
52 def setCashierShifts(self, value):
53 for x in self._CashierShifts:
54 x.Cashier = None
55 for y in value:
56 y._Cashier = self
57 self._CashierShifts = value
59 CashierShifts = property(getCashierShifts, setCashierShifts)
61 def addCashierShifts(self, *CashierShifts):
62 for obj in CashierShifts:
63 obj.Cashier = self
65 def removeCashierShifts(self, *CashierShifts):
66 for obj in CashierShifts:
67 obj.Cashier = None
69 # Electronic address.
70 electronicAddress = None
72 def getVendor(self):
73 """Vendor that manages this Cachier.
74 """
75 return self._Vendor
77 def setVendor(self, value):
78 if self._Vendor is not None:
79 filtered = [x for x in self.Vendor.Cashiers if x != self]
80 self._Vendor._Cashiers = filtered
82 self._Vendor = value
83 if self._Vendor is not None:
84 if self not in self._Vendor._Cashiers:
85 self._Vendor._Cashiers.append(self)
87 Vendor = property(getVendor, setVendor)