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 Seal(IdentifiedObject
):
20 """Physically controls access to AssetContainers.
23 def __init__(self
, kind
="other", condition
="open", sealNumber
='', appliedDateTime
='', AssetContainer
=None, *args
, **kw_args
):
24 """Initialises a new 'Seal' instance.
26 @param kind: Kind of seal. Values are: "other", "lead", "steel", "lock"
27 @param condition: Condition of seal. Values are: "open", "broken", "missing", "other", "locked"
28 @param sealNumber: (reserved word) Seal number.
29 @param appliedDateTime: Date and time this seal has been applied.
30 @param AssetContainer: Asset container to which this seal is applied.
32 #: Kind of seal. Values are: "other", "lead", "steel", "lock"
35 #: Condition of seal. Values are: "open", "broken", "missing", "other", "locked"
36 self
.condition
= condition
38 #: (reserved word) Seal number.
39 self
.sealNumber
= sealNumber
41 #: Date and time this seal has been applied.
42 self
.appliedDateTime
= appliedDateTime
44 self
._AssetContainer
= None
45 self
.AssetContainer
= AssetContainer
47 super(Seal
, self
).__init
__(*args
, **kw_args
)
49 _attrs
= ["kind", "condition", "sealNumber", "appliedDateTime"]
50 _attr_types
= {"kind": str, "condition": str, "sealNumber": str, "appliedDateTime": str}
51 _defaults
= {"kind": "other", "condition": "open", "sealNumber": '', "appliedDateTime": ''}
52 _enums
= {"kind": "SealKind", "condition": "SealConditionKind"}
53 _refs
= ["AssetContainer"]
56 def getAssetContainer(self
):
57 """Asset container to which this seal is applied.
59 return self
._AssetContainer
61 def setAssetContainer(self
, value
):
62 if self
._AssetContainer
is not None:
63 filtered
= [x
for x
in self
.AssetContainer
.Seals
if x
!= self
]
64 self
._AssetContainer
._Seals
= filtered
66 self
._AssetContainer
= value
67 if self
._AssetContainer
is not None:
68 self
._AssetContainer
._Seals
.append(self
)
70 AssetContainer
= property(getAssetContainer
, setAssetContainer
)