Adding CIM15 package.
[PyCIM.git] / CIM15 / IEC61970 / Informative / InfCommon / Craft.py
blobe10b27700320401e5155adb3519ac5d4e163d910
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.IEC61970.Core.IdentifiedObject import IdentifiedObject
23 class Craft(IdentifiedObject):
24 """Craft of a person or a crew. Examples include overhead electric, underground electric, high pressure gas, etc. This ensures necessary knowledge and skills before being allowed to perform certain types of work.Craft of a person or a crew. Examples include overhead electric, underground electric, high pressure gas, etc. This ensures necessary knowledge and skills before being allowed to perform certain types of work.
25 """
27 def __init__(self, category='', Skills=None, ErpPersons=None, status=None, Capabilities=None, *args, **kw_args):
28 """Initialises a new 'Craft' instance.
30 @param category: Category by utility's work mangement standards and practices.
31 @param Skills:
32 @param ErpPersons:
33 @param status:
34 @param Capabilities:
35 """
36 #: Category by utility's work mangement standards and practices.
37 self.category = category
39 self._Skills = []
40 self.Skills = [] if Skills is None else Skills
42 self._ErpPersons = []
43 self.ErpPersons = [] if ErpPersons is None else ErpPersons
45 self.status = status
47 self._Capabilities = []
48 self.Capabilities = [] if Capabilities is None else Capabilities
50 super(Craft, self).__init__(*args, **kw_args)
52 _attrs = ["category"]
53 _attr_types = {"category": str}
54 _defaults = {"category": ''}
55 _enums = {}
56 _refs = ["Skills", "ErpPersons", "status", "Capabilities"]
57 _many_refs = ["Skills", "ErpPersons", "Capabilities"]
59 def getSkills(self):
61 return self._Skills
63 def setSkills(self, value):
64 for p in self._Skills:
65 filtered = [q for q in p.Crafts if q != self]
66 self._Skills._Crafts = filtered
67 for r in value:
68 if self not in r._Crafts:
69 r._Crafts.append(self)
70 self._Skills = value
72 Skills = property(getSkills, setSkills)
74 def addSkills(self, *Skills):
75 for obj in Skills:
76 if self not in obj._Crafts:
77 obj._Crafts.append(self)
78 self._Skills.append(obj)
80 def removeSkills(self, *Skills):
81 for obj in Skills:
82 if self in obj._Crafts:
83 obj._Crafts.remove(self)
84 self._Skills.remove(obj)
86 def getErpPersons(self):
88 return self._ErpPersons
90 def setErpPersons(self, value):
91 for p in self._ErpPersons:
92 filtered = [q for q in p.Crafts if q != self]
93 self._ErpPersons._Crafts = filtered
94 for r in value:
95 if self not in r._Crafts:
96 r._Crafts.append(self)
97 self._ErpPersons = value
99 ErpPersons = property(getErpPersons, setErpPersons)
101 def addErpPersons(self, *ErpPersons):
102 for obj in ErpPersons:
103 if self not in obj._Crafts:
104 obj._Crafts.append(self)
105 self._ErpPersons.append(obj)
107 def removeErpPersons(self, *ErpPersons):
108 for obj in ErpPersons:
109 if self in obj._Crafts:
110 obj._Crafts.remove(self)
111 self._ErpPersons.remove(obj)
113 status = None
115 def getCapabilities(self):
117 return self._Capabilities
119 def setCapabilities(self, value):
120 for p in self._Capabilities:
121 filtered = [q for q in p.Crafts if q != self]
122 self._Capabilities._Crafts = filtered
123 for r in value:
124 if self not in r._Crafts:
125 r._Crafts.append(self)
126 self._Capabilities = value
128 Capabilities = property(getCapabilities, setCapabilities)
130 def addCapabilities(self, *Capabilities):
131 for obj in Capabilities:
132 if self not in obj._Crafts:
133 obj._Crafts.append(self)
134 self._Capabilities.append(obj)
136 def removeCapabilities(self, *Capabilities):
137 for obj in Capabilities:
138 if self in obj._Crafts:
139 obj._Crafts.remove(self)
140 self._Capabilities.remove(obj)