source: mauRepo/MolesManager/trunk/src/ea_model/iso_19135_2005_procedures_for_registration/re_itemclass.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19135_2005_procedures_for_registration/re_itemclass.py@8091
Revision 8091, 4.9 KB checked in by mnagni, 8 years ago (diff)

The migration process now includes
1) deployment_data files
2) XML document hash
3) full Dojo support


Line 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from ascore.utils import has_value
22
23'''
24Created on 16-Feb-2012 16:18:02
25
26@author: mnagni
27'''
28
29class RE_ItemClass(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.alternativeName = []
44        self._register_cl_classificationregister = []
45        self._register_cl_classificationregister = []
46        self._describedItem_cl_classificationlegenditem = []
47        self._describedItem_cl_classificationruleitem = []
48        self._describedItem_cl_classificationruleitem = []
49        self._describedItem_cl_classificationlegenditem = []
50        self._describedItem_re_subregisterdescription = []
51        self.technicalStandard = None
52        self.subregister = []
53        super(RE_ItemClass, self).__init__()
54
55    @property
56    def register(self): 
57        ret = []
58        for item in self._register_cl_classificationregister:
59            ret.append(item)
60        for item in self._register_cl_classificationregister:
61            ret.append(item)
62        return ret
63
64    @register.setter
65    def register(self, value): 
66        if isinstance(value, list):
67            self._register_cl_classificationregister[:]
68            self._register_cl_classificationregister[:]
69            for item in value:
70                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
71                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationregister.CL_ClassificationRegister":
72                    self._register_cl_classificationregister.append(item)
73                    continue
74                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationregister.CL_ClassificationRegister":
75                    self._register_cl_classificationregister.append(item)
76                    continue
77
78    @property
79    def describedItem(self):   
80        ret = []
81        for item in self._describedItem_cl_classificationlegenditem:
82            ret.append(item)
83        for item in self._describedItem_cl_classificationruleitem:
84            ret.append(item)
85        for item in self._describedItem_cl_classificationruleitem:
86            ret.append(item)
87        for item in self._describedItem_cl_classificationlegenditem:
88            ret.append(item)
89        for item in self._describedItem_re_subregisterdescription:
90            ret.append(item)
91        return ret
92
93    @describedItem.setter
94    def describedItem(self, value):     
95        if isinstance(value, list):
96            self._describedItem_cl_classificationlegenditem[:]
97            self._describedItem_cl_classificationruleitem[:]
98            self._describedItem_cl_classificationruleitem[:]
99            self._describedItem_cl_classificationlegenditem[:]
100            self._describedItem_re_subregisterdescription[:]
101            for item in value:
102                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
103                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegenditem.CL_ClassificationLegendItem":
104                    self._describedItem_cl_classificationlegenditem.append(item)
105                    continue
106                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleitem.CL_ClassificationRuleItem":
107                    self._describedItem_cl_classificationruleitem.append(item)
108                    continue
109                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleitem.CL_ClassificationRuleItem":
110                    self._describedItem_cl_classificationruleitem.append(item)
111                    continue
112                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegenditem.CL_ClassificationLegendItem":
113                    self._describedItem_cl_classificationlegenditem.append(item)
114                    continue
115                if valueClass == "ea_model.iso_19135_2005_procedures_for_registration.re_subregisterdescription.RE_SubregisterDescription":
116                    self._describedItem_re_subregisterdescription.append(item)
117                    continue
118
119    def __key(self):
120        return (self.name, self.alternativeName, self.register, self.describedItem, self.technicalStandard, self.subregister)
121
122    def __eq__(self, y):
123        '''
124        Cannot compare classes which do not define a "__key" attribute
125        '''
126        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
127            return self.__key() == y.__key()
128        return id(self) == id(y)
129
130    def __hash__(self):
131        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.