Adding CIM15 package.
[PyCIM.git] / CIM15 / IEC61968 / Assets / AssetContainer.py
blob7532ad7b8c608aff6b1f6b9ee7c81fe50d759358
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 CIM15.IEC61968.Assets.Asset import Asset
23 class AssetContainer(Asset):
24 """Asset that is aggregation of other assets such as conductors, transformers, switchgear, land, fences, buildings, equipment, vehicles, etc.Asset that is aggregation of other assets such as conductors, transformers, switchgear, land, fences, buildings, equipment, vehicles, etc.
25 """
27 def __init__(self, Seals=None, Assets=None, LandProperties=None, *args, **kw_args):
28 """Initialises a new 'AssetContainer' instance.
30 @param Seals: All seals applied to this asset container.
31 @param Assets:
32 @param LandProperties:
33 """
34 self._Seals = []
35 self.Seals = [] if Seals is None else Seals
37 self._Assets = []
38 self.Assets = [] if Assets is None else Assets
40 self._LandProperties = []
41 self.LandProperties = [] if LandProperties is None else LandProperties
43 super(AssetContainer, self).__init__(*args, **kw_args)
45 _attrs = []
46 _attr_types = {}
47 _defaults = {}
48 _enums = {}
49 _refs = ["Seals", "Assets", "LandProperties"]
50 _many_refs = ["Seals", "Assets", "LandProperties"]
52 def getSeals(self):
53 """All seals applied to this asset container.
54 """
55 return self._Seals
57 def setSeals(self, value):
58 for x in self._Seals:
59 x.AssetContainer = None
60 for y in value:
61 y._AssetContainer = self
62 self._Seals = value
64 Seals = property(getSeals, setSeals)
66 def addSeals(self, *Seals):
67 for obj in Seals:
68 obj.AssetContainer = self
70 def removeSeals(self, *Seals):
71 for obj in Seals:
72 obj.AssetContainer = None
74 def getAssets(self):
76 return self._Assets
78 def setAssets(self, value):
79 for x in self._Assets:
80 x.AssetContainer = None
81 for y in value:
82 y._AssetContainer = self
83 self._Assets = value
85 Assets = property(getAssets, setAssets)
87 def addAssets(self, *Assets):
88 for obj in Assets:
89 obj.AssetContainer = self
91 def removeAssets(self, *Assets):
92 for obj in Assets:
93 obj.AssetContainer = None
95 def getLandProperties(self):
97 return self._LandProperties
99 def setLandProperties(self, value):
100 for p in self._LandProperties:
101 filtered = [q for q in p.AssetContainers if q != self]
102 self._LandProperties._AssetContainers = filtered
103 for r in value:
104 if self not in r._AssetContainers:
105 r._AssetContainers.append(self)
106 self._LandProperties = value
108 LandProperties = property(getLandProperties, setLandProperties)
110 def addLandProperties(self, *LandProperties):
111 for obj in LandProperties:
112 if self not in obj._AssetContainers:
113 obj._AssetContainers.append(self)
114 self._LandProperties.append(obj)
116 def removeLandProperties(self, *LandProperties):
117 for obj in LandProperties:
118 if self in obj._AssetContainers:
119 obj._AssetContainers.remove(self)
120 self._LandProperties.remove(obj)