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
21 from CIM14
.IEC61968
.Common
.Location
import Location
23 class SDPLocation(Location
):
24 """Location of an individual service delivery point. For residential or most businesses, it is typically the location of a meter on the customer's premises. For transmission, it is the point(s) of interconnection on the transmission provider's transmission system where capacity and/or energy transmitted by the transmission provider is made available to the receiving party. The point(s) of delivery is specified in the Service Agreement.
27 def __init__(self
, remark
='', siteAccessProblem
='', occupancyDate
='', accessMethod
='', ServiceDeliveryPoints
=None, *args
, **kw_args
):
28 """Initialises a new 'SDPLocation' instance.
30 @param remark: Remarks about this location.
31 @param siteAccessProblem: Problems previously encountered when visiting or performing work at this service delivery point location. Examples include: bad dog, violent customer, verbally abusive occupant, obstructions, safety hazards, etc.
32 @param occupancyDate: Date when certificate of occupancy was provided for this location, 0 if valid certificate of occupancy does not exist for (inherited) 'Location.corporateCode'.
33 @param accessMethod: Method for the service person to access this service delivery point location. For example, a description of where to obtain a key if the facility is unmanned and secured.
34 @param ServiceDeliveryPoints: All service delivery points at this location.
36 #: Remarks about this location.
39 #: Problems previously encountered when visiting or performing work at this service delivery point location. Examples include: bad dog, violent customer, verbally abusive occupant, obstructions, safety hazards, etc.
40 self
.siteAccessProblem
= siteAccessProblem
42 #: Date when certificate of occupancy was provided for this location, 0 if valid certificate of occupancy does not exist for (inherited) 'Location.corporateCode'.
43 self
.occupancyDate
= occupancyDate
45 #: Method for the service person to access this service delivery point location. For example, a description of where to obtain a key if the facility is unmanned and secured.
46 self
.accessMethod
= accessMethod
48 self
._ServiceDeliveryPoints
= []
49 self
.ServiceDeliveryPoints
= [] if ServiceDeliveryPoints
is None else ServiceDeliveryPoints
51 super(SDPLocation
, self
).__init
__(*args
, **kw_args
)
53 _attrs
= ["remark", "siteAccessProblem", "occupancyDate", "accessMethod"]
54 _attr_types
= {"remark": str, "siteAccessProblem": str, "occupancyDate": str, "accessMethod": str}
55 _defaults
= {"remark": '', "siteAccessProblem": '', "occupancyDate": '', "accessMethod": ''}
57 _refs
= ["ServiceDeliveryPoints"]
58 _many_refs
= ["ServiceDeliveryPoints"]
60 def getServiceDeliveryPoints(self
):
61 """All service delivery points at this location.
63 return self
._ServiceDeliveryPoints
65 def setServiceDeliveryPoints(self
, value
):
66 for p
in self
._ServiceDeliveryPoints
:
67 filtered
= [q
for q
in p
.SDPLocations
if q
!= self
]
68 self
._ServiceDeliveryPoints
._SDPLocations
= filtered
70 if self
not in r
._SDPLocations
:
71 r
._SDPLocations
.append(self
)
72 self
._ServiceDeliveryPoints
= value
74 ServiceDeliveryPoints
= property(getServiceDeliveryPoints
, setServiceDeliveryPoints
)
76 def addServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
77 for obj
in ServiceDeliveryPoints
:
78 if self
not in obj
._SDPLocations
:
79 obj
._SDPLocations
.append(self
)
80 self
._ServiceDeliveryPoints
.append(obj
)
82 def removeServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
83 for obj
in ServiceDeliveryPoints
:
84 if self
in obj
._SDPLocations
:
85 obj
._SDPLocations
.remove(self
)
86 self
._ServiceDeliveryPoints
.remove(obj
)