Update README.rst
[PyCIM.git] / CIM14 / IEC61968 / PaymentMetering / PointOfSale.py
blob09d4f692796eb4b005af38cac89843fb6e3e3c11
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.IEC61970.Core.IdentifiedObject import IdentifiedObject
23 class PointOfSale(IdentifiedObject):
24 """Logical point where transactions take place with operational interaction between Cashier and the payment system; in certain cases PointOfSale interacts directly with the end customer, in which case Cashier might not be a real person: for example a self-service kiosk or over the internet.
25 """
27 def __init__(self, location='', Vendor=None, CashierShifts=None, *args, **kw_args):
28 """Initialises a new 'PointOfSale' instance.
30 @param location: Local description for where this point of sale is physically located.
31 @param Vendor: Vendor that controls this PointOfSale.
32 @param CashierShifts: All shifts this point of sale operated in.
33 """
34 #: Local description for where this point of sale is physically located.
35 self.location = location
37 self._Vendor = None
38 self.Vendor = Vendor
40 self._CashierShifts = []
41 self.CashierShifts = [] if CashierShifts is None else CashierShifts
43 super(PointOfSale, self).__init__(*args, **kw_args)
45 _attrs = ["location"]
46 _attr_types = {"location": str}
47 _defaults = {"location": ''}
48 _enums = {}
49 _refs = ["Vendor", "CashierShifts"]
50 _many_refs = ["CashierShifts"]
52 def getVendor(self):
53 """Vendor that controls this PointOfSale.
54 """
55 return self._Vendor
57 def setVendor(self, value):
58 if self._Vendor is not None:
59 filtered = [x for x in self.Vendor.PointOfSales if x != self]
60 self._Vendor._PointOfSales = filtered
62 self._Vendor = value
63 if self._Vendor is not None:
64 if self not in self._Vendor._PointOfSales:
65 self._Vendor._PointOfSales.append(self)
67 Vendor = property(getVendor, setVendor)
69 def getCashierShifts(self):
70 """All shifts this point of sale operated in.
71 """
72 return self._CashierShifts
74 def setCashierShifts(self, value):
75 for x in self._CashierShifts:
76 x.PointOfSale = None
77 for y in value:
78 y._PointOfSale = self
79 self._CashierShifts = value
81 CashierShifts = property(getCashierShifts, setCashierShifts)
83 def addCashierShifts(self, *CashierShifts):
84 for obj in CashierShifts:
85 obj.PointOfSale = self
87 def removeCashierShifts(self, *CashierShifts):
88 for obj in CashierShifts:
89 obj.PointOfSale = None