source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/iso_gdf/gdf_feature/gdf_relationshiptype.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/iso_gdf/gdf_feature/gdf_relationshiptype.py@8457
Revision 8457, 2.7 KB checked in by mnagni, 7 years ago (diff)

Corrected an error in the generation of the classes "synchronize" method.

  • Property svn:mime-type set to text/plain
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, collectionProofHash
22
23'''
24Created on 10-Jul-2012 14:15:14
25
26@author: mnagni
27'''
28
29class GDF_RelationshipType(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._attributeType_gdf_restrictedsubattributetype = None
44                self._attributeType_gdf_complexattributetype = None
45                self._attributeType_gdf_simpleattributetype = None
46                self._attributeType = None
47                self.code = None
48                super(GDF_RelationshipType, self).__init__()
49        @property
50        def attributeType(self):       
51                if(has_value(self._attributeType_gdf_restrictedsubattributetype)):
52                        return self._attributeType_gdf_restrictedsubattributetype
53                if(has_value(self._attributeType_gdf_complexattributetype)):
54                        return self._attributeType_gdf_complexattributetype
55                if(has_value(self._attributeType_gdf_simpleattributetype)):
56                        return self._attributeType_gdf_simpleattributetype
57                return  None
58
59        @attributeType.setter
60        def attributeType(self, value):
61                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
62                if valueClass == "ea_model.informative.iso_gdf.gdf_feature.gdf_restrictedsubattributetype.GDF_RestrictedSubAttributeType":
63                        self._attributeType_gdf_restrictedsubattributetype = value
64                        self._attributeType_gdf_complexattributetype = None
65                        self._attributeType_gdf_simpleattributetype = None
66                if valueClass == "ea_model.informative.iso_gdf.gdf_feature.gdf_complexattributetype.GDF_ComplexAttributeType":
67                        self._attributeType_gdf_complexattributetype = value
68                        self._attributeType_gdf_restrictedsubattributetype = None
69                        self._attributeType_gdf_simpleattributetype = None
70                if valueClass == "ea_model.informative.iso_gdf.gdf_feature.gdf_simpleattributetype.GDF_SimpleAttributeType":
71                        self._attributeType_gdf_simpleattributetype = value
72                        self._attributeType_gdf_restrictedsubattributetype = None
73                        self._attributeType_gdf_complexattributetype = None
74
75        def synchronize(self):
76                pass
77
78        def __key(self):
79                return (self.name, self.attributeType, self.code)
80
81        def __eq__(self, y):
82                if type(self) != type(y):
83                        return False
84                '''
85                Cannot compare classes which do not define a "__key" attribute
86                '''
87                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
88                        return self.__key() == y.__key()
89                return id(self) == id(y)
90
91        def __hash__(self):
92                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.