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:06 |
---|
25 | |
---|
26 | @author: mnagni |
---|
27 | ''' |
---|
28 | |
---|
29 | class RE_Reference(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.similarity = None |
---|
43 | self._item_cl_classificationlegenditem = [] |
---|
44 | self._item_cl_classificationruleitem = [] |
---|
45 | self._item_cl_classificationruleitem = [] |
---|
46 | self._item_cl_classificationlegenditem = [] |
---|
47 | self._item_re_subregisterdescription = [] |
---|
48 | self._specifiedItem_cl_classificationlegenditem = None |
---|
49 | self._specifiedItem_cl_classificationruleitem = None |
---|
50 | self._specifiedItem_cl_classificationruleitem = None |
---|
51 | self._specifiedItem_cl_classificationlegenditem = None |
---|
52 | self._specifiedItem_re_subregisterdescription = None |
---|
53 | self.sourceCitation = None |
---|
54 | self.referenceText = None |
---|
55 | self.notes = None |
---|
56 | self.itemIdentifierAtSource = None |
---|
57 | super(RE_Reference, self).__init__() |
---|
58 | |
---|
59 | @property |
---|
60 | def item(self): |
---|
61 | ret = [] |
---|
62 | for item in self._item_cl_classificationlegenditem: |
---|
63 | ret.append(item) |
---|
64 | for item in self._item_cl_classificationruleitem: |
---|
65 | ret.append(item) |
---|
66 | for item in self._item_cl_classificationruleitem: |
---|
67 | ret.append(item) |
---|
68 | for item in self._item_cl_classificationlegenditem: |
---|
69 | ret.append(item) |
---|
70 | for item in self._item_re_subregisterdescription: |
---|
71 | ret.append(item) |
---|
72 | return ret |
---|
73 | |
---|
74 | @item.setter |
---|
75 | def item(self, value): |
---|
76 | if isinstance(value, list): |
---|
77 | self._item_cl_classificationlegenditem[:] |
---|
78 | self._item_cl_classificationruleitem[:] |
---|
79 | self._item_cl_classificationruleitem[:] |
---|
80 | self._item_cl_classificationlegenditem[:] |
---|
81 | self._item_re_subregisterdescription[:] |
---|
82 | for item in value: |
---|
83 | valueClass = "%s.%s" % (type(item).__module__,type(item).__name__) |
---|
84 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegenditem.CL_ClassificationLegendItem": |
---|
85 | self._item_cl_classificationlegenditem.append(item) |
---|
86 | continue |
---|
87 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleitem.CL_ClassificationRuleItem": |
---|
88 | self._item_cl_classificationruleitem.append(item) |
---|
89 | continue |
---|
90 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleitem.CL_ClassificationRuleItem": |
---|
91 | self._item_cl_classificationruleitem.append(item) |
---|
92 | continue |
---|
93 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegenditem.CL_ClassificationLegendItem": |
---|
94 | self._item_cl_classificationlegenditem.append(item) |
---|
95 | continue |
---|
96 | if valueClass == "ea_model.iso_19135_2005_procedures_for_registration.re_subregisterdescription.RE_SubregisterDescription": |
---|
97 | self._item_re_subregisterdescription.append(item) |
---|
98 | continue |
---|
99 | |
---|
100 | @property |
---|
101 | def specifiedItem(self): |
---|
102 | if(has_value(self._specifiedItem_cl_classificationlegenditem)): |
---|
103 | return self._specifiedItem_cl_classificationlegenditem |
---|
104 | if(has_value(self._specifiedItem_cl_classificationruleitem)): |
---|
105 | return self._specifiedItem_cl_classificationruleitem |
---|
106 | if(has_value(self._specifiedItem_cl_classificationruleitem)): |
---|
107 | return self._specifiedItem_cl_classificationruleitem |
---|
108 | if(has_value(self._specifiedItem_cl_classificationlegenditem)): |
---|
109 | return self._specifiedItem_cl_classificationlegenditem |
---|
110 | if(has_value(self._specifiedItem_re_subregisterdescription)): |
---|
111 | return self._specifiedItem_re_subregisterdescription |
---|
112 | return None |
---|
113 | |
---|
114 | @specifiedItem.setter |
---|
115 | def specifiedItem(self, value): |
---|
116 | valueClass = "%s.%s" % (type(value).__module__,type(value).__name__) |
---|
117 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegenditem.CL_ClassificationLegendItem": |
---|
118 | self._specifiedItem_cl_classificationlegenditem = value |
---|
119 | self._specifiedItem_cl_classificationruleitem = None |
---|
120 | self._specifiedItem_cl_classificationruleitem = None |
---|
121 | self._specifiedItem_cl_classificationlegenditem = None |
---|
122 | self._specifiedItem_re_subregisterdescription = None |
---|
123 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleitem.CL_ClassificationRuleItem": |
---|
124 | self._specifiedItem_cl_classificationruleitem = value |
---|
125 | self._specifiedItem_cl_classificationlegenditem = None |
---|
126 | self._specifiedItem_cl_classificationruleitem = None |
---|
127 | self._specifiedItem_cl_classificationlegenditem = None |
---|
128 | self._specifiedItem_re_subregisterdescription = None |
---|
129 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleitem.CL_ClassificationRuleItem": |
---|
130 | self._specifiedItem_cl_classificationruleitem = value |
---|
131 | self._specifiedItem_cl_classificationlegenditem = None |
---|
132 | self._specifiedItem_cl_classificationruleitem = None |
---|
133 | self._specifiedItem_cl_classificationlegenditem = None |
---|
134 | self._specifiedItem_re_subregisterdescription = None |
---|
135 | if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegenditem.CL_ClassificationLegendItem": |
---|
136 | self._specifiedItem_cl_classificationlegenditem = value |
---|
137 | self._specifiedItem_cl_classificationlegenditem = None |
---|
138 | self._specifiedItem_cl_classificationruleitem = None |
---|
139 | self._specifiedItem_cl_classificationruleitem = None |
---|
140 | self._specifiedItem_re_subregisterdescription = None |
---|
141 | if valueClass == "ea_model.iso_19135_2005_procedures_for_registration.re_subregisterdescription.RE_SubregisterDescription": |
---|
142 | self._specifiedItem_re_subregisterdescription = value |
---|
143 | self._specifiedItem_cl_classificationlegenditem = None |
---|
144 | self._specifiedItem_cl_classificationruleitem = None |
---|
145 | self._specifiedItem_cl_classificationruleitem = None |
---|
146 | self._specifiedItem_cl_classificationlegenditem = None |
---|
147 | |
---|
148 | def __key(self): |
---|
149 | return (self.similarity, self.item, self.specifiedItem, self.sourceCitation, self.referenceText, self.notes, self.itemIdentifierAtSource) |
---|
150 | |
---|
151 | def __eq__(self, y): |
---|
152 | ''' |
---|
153 | Cannot compare classes which do not define a "__key" attribute |
---|
154 | ''' |
---|
155 | if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): |
---|
156 | return self.__key() == y.__key() |
---|
157 | return id(self) == id(y) |
---|
158 | |
---|
159 | def __hash__(self): |
---|
160 | return hash(self.__key()) |
---|