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
.IEC61968
.Common
.Location
import Location
19 class SDPLocation(Location
):
20 """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.
23 def __init__(self
, remark
='', siteAccessProblem
='', occupancyDate
='', accessMethod
='', ServiceDeliveryPoints
=None, *args
, **kw_args
):
24 """Initialises a new 'SDPLocation' instance.
26 @param remark: Remarks about this location.
27 @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.
28 @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'.
29 @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.
30 @param ServiceDeliveryPoints: All service delivery points at this location.
32 #: Remarks about this location.
35 #: 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.
36 self
.siteAccessProblem
= siteAccessProblem
38 #: Date when certificate of occupancy was provided for this location, 0 if valid certificate of occupancy does not exist for (inherited) 'Location.corporateCode'.
39 self
.occupancyDate
= occupancyDate
41 #: 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.
42 self
.accessMethod
= accessMethod
44 self
._ServiceDeliveryPoints
= []
45 self
.ServiceDeliveryPoints
= [] if ServiceDeliveryPoints
is None else ServiceDeliveryPoints
47 super(SDPLocation
, self
).__init
__(*args
, **kw_args
)
49 _attrs
= ["remark", "siteAccessProblem", "occupancyDate", "accessMethod"]
50 _attr_types
= {"remark": str, "siteAccessProblem": str, "occupancyDate": str, "accessMethod": str}
51 _defaults
= {"remark": '', "siteAccessProblem": '', "occupancyDate": '', "accessMethod": ''}
53 _refs
= ["ServiceDeliveryPoints"]
54 _many_refs
= ["ServiceDeliveryPoints"]
56 def getServiceDeliveryPoints(self
):
57 """All service delivery points at this location.
59 return self
._ServiceDeliveryPoints
61 def setServiceDeliveryPoints(self
, value
):
62 for p
in self
._ServiceDeliveryPoints
:
63 filtered
= [q
for q
in p
.SDPLocations
if q
!= self
]
64 self
._ServiceDeliveryPoints
._SDPLocations
= filtered
66 if self
not in r
._SDPLocations
:
67 r
._SDPLocations
.append(self
)
68 self
._ServiceDeliveryPoints
= value
70 ServiceDeliveryPoints
= property(getServiceDeliveryPoints
, setServiceDeliveryPoints
)
72 def addServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
73 for obj
in ServiceDeliveryPoints
:
74 if self
not in obj
._SDPLocations
:
75 obj
._SDPLocations
.append(self
)
76 self
._ServiceDeliveryPoints
.append(obj
)
78 def removeServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
79 for obj
in ServiceDeliveryPoints
:
80 if self
in obj
._SDPLocations
:
81 obj
._SDPLocations
.remove(self
)
82 self
._ServiceDeliveryPoints
.remove(obj
)