1 | |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | from ascore.utils import has_value |
---|
22 | |
---|
23 | ''' |
---|
24 | Created on 16-Feb-2012 16:18:07 |
---|
25 | |
---|
26 | @author: mnagni |
---|
27 | ''' |
---|
28 | |
---|
29 | class RE_RegisterManager(object): |
---|
30 | ''' |
---|
31 | Represents a data entity defined in a UML diagram and supposed to |
---|
32 | be persisted in a relational database. |
---|
33 | |
---|
34 | This class has been genererated automatically using the Apache Velocity project. |
---|
35 | ''' |
---|
36 | ''' |
---|
37 | Please note that any access to the inner attributes should be done using |
---|
38 | the given get/set methods and NOT accessing them directly. |
---|
39 | ''' |
---|
40 | def __init__(self): |
---|
41 | |
---|
42 | self.name = None |
---|
43 | self._register_cl_classificationregister = [] |
---|
44 | self._register_cl_classificationregister = [] |
---|
45 | self.subregister = [] |
---|
46 | self.contact = None |
---|
47 | super(RE_RegisterManager, self).__init__() |
---|
48 | |
---|
49 | @property |
---|
50 | def register(self): |
---|
51 | ret = [] |
---|
52 | for item in self._register_cl_classificationregister: |
---|
53 | ret.append(item) |
---|
54 | for item in self._register_cl_classificationregister: |
---|
55 | ret.append(item) |
---|
56 | return ret |
---|
57 | |
---|
58 | @register.setter |
---|
59 | def register(self, value): |
---|
60 | if isinstance(value, list): |
---|
61 | self._register_cl_classificationregister[:] |
---|
62 | self._register_cl_classificationregister[:] |
---|
63 | for item in value: |
---|
64 | valueClass = "%s.%s" % (type(item).__module__,type(item).__name__) |
---|
65 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationregister.CL_ClassificationRegister": |
---|
66 | self._register_cl_classificationregister.append(item) |
---|
67 | continue |
---|
68 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationregister.CL_ClassificationRegister": |
---|
69 | self._register_cl_classificationregister.append(item) |
---|
70 | continue |
---|
71 | |
---|
72 | def __key(self): |
---|
73 | return (self.name, self.register, self.subregister, self.contact) |
---|
74 | |
---|
75 | def __eq__(self, y): |
---|
76 | ''' |
---|
77 | Cannot compare classes which do not define a "__key" attribute |
---|
78 | ''' |
---|
79 | if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): |
---|
80 | return self.__key() == y.__key() |
---|
81 | return id(self) == id(y) |
---|
82 | |
---|
83 | def __hash__(self): |
---|
84 | return hash(self.__key()) |
---|