Implementing RDF/XML serialisation using meta-data attributes.
[PyCIM.git] / schemata / CIM14 / IEC61968 / PaymentMetering / Cashier.py
blobb091056bd61ddc18b7e09ea18b729eacb212cb20
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
64 self._CashierShifts.append(obj)
66 def removeCashierShifts(self, *CashierShifts):
67 for obj in CashierShifts:
68 obj._Cashier = None
69 self._CashierShifts.remove(obj)
71 # Electronic address.
72 electronicAddress = None
74 def getVendor(self):
75 """Vendor that manages this Cachier.
76 """
77 return self._Vendor
79 def setVendor(self, value):
80 if self._Vendor is not None:
81 filtered = [x for x in self.Vendor.Cashiers if x != self]
82 self._Vendor._Cashiers = filtered
84 self._Vendor = value
85 if self._Vendor is not None:
86 self._Vendor._Cashiers.append(self)
88 Vendor = property(getVendor, setVendor)