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
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
23 class Seal(IdentifiedObject
):
24 """Physically controls access to AssetContainers.
27 def __init__(self
, kind
="other", condition
="open", sealNumber
='', appliedDateTime
='', AssetContainer
=None, *args
, **kw_args
):
28 """Initialises a new 'Seal' instance.
30 @param kind: Kind of seal. Values are: "other", "lead", "steel", "lock"
31 @param condition: Condition of seal. Values are: "open", "broken", "missing", "other", "locked"
32 @param sealNumber: (reserved word) Seal number.
33 @param appliedDateTime: Date and time this seal has been applied.
34 @param AssetContainer: Asset container to which this seal is applied.
36 #: Kind of seal. Values are: "other", "lead", "steel", "lock"
39 #: Condition of seal. Values are: "open", "broken", "missing", "other", "locked"
40 self
.condition
= condition
42 #: (reserved word) Seal number.
43 self
.sealNumber
= sealNumber
45 #: Date and time this seal has been applied.
46 self
.appliedDateTime
= appliedDateTime
48 self
._AssetContainer
= None
49 self
.AssetContainer
= AssetContainer
51 super(Seal
, self
).__init
__(*args
, **kw_args
)
53 _attrs
= ["kind", "condition", "sealNumber", "appliedDateTime"]
54 _attr_types
= {"kind": str, "condition": str, "sealNumber": str, "appliedDateTime": str}
55 _defaults
= {"kind": "other", "condition": "open", "sealNumber": '', "appliedDateTime": ''}
56 _enums
= {"kind": "SealKind", "condition": "SealConditionKind"}
57 _refs
= ["AssetContainer"]
60 def getAssetContainer(self
):
61 """Asset container to which this seal is applied.
63 return self
._AssetContainer
65 def setAssetContainer(self
, value
):
66 if self
._AssetContainer
is not None:
67 filtered
= [x
for x
in self
.AssetContainer
.Seals
if x
!= self
]
68 self
._AssetContainer
._Seals
= filtered
70 self
._AssetContainer
= value
71 if self
._AssetContainer
is not None:
72 if self
not in self
._AssetContainer
._Seals
:
73 self
._AssetContainer
._Seals
.append(self
)
75 AssetContainer
= property(getAssetContainer
, setAssetContainer
)