source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19136_gml/units/conventionalunit.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19136_gml/units/conventionalunit.py@8457
Revision 8457, 2.9 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 ea_model.iso_19136_gml.units.unitdefinition import  UnitDefinition
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 10-Jul-2012 14:15:08
26
27@author: mnagni
28'''
29
30class ConventionalUnit(UnitDefinition):
31        '''
32                Represents a data entity defined in a UML diagram and supposed to
33                be persisted in a relational database.
34 
35                This class has been genererated automatically using the Apache Velocity project.
36        '''
37        '''
38                Please note that any access to the inner attributes should be done using
39                the given get/set methods and NOT accessing them directly.
40        '''
41        def __init__(self):
42                self._unitdefinition = UnitDefinition()         
43
44                self.identifier = None
45                self.roughConversionToPreferredUnit = None
46                self.derivationUnitTerm = []
47                self.conversionToPreferredUnit = None
48                self.catalogSymbol = None
49                self.description = None
50                self.quantityTypeReference = None
51                self.descriptionReference = None
52                self.quantityType = None
53                super(ConventionalUnit, self).__init__()
54        @property
55        def identifier(self):   
56                return self._unitdefinition.identifier
57
58        @identifier.setter
59        def identifier(self, value):   
60                        self._unitdefinition.identifier = value
61        @property
62        def name(self):
63                return self._unitdefinition.name
64
65        @name.setter
66        def name(self, value): 
67                        self._unitdefinition.name = value
68        @property
69        def catalogSymbol(self):       
70                return self._unitdefinition.catalogSymbol
71
72        @catalogSymbol.setter
73        def catalogSymbol(self, value):
74                        self._unitdefinition.catalogSymbol = value
75        @property
76        def description(self): 
77                return self._unitdefinition.description
78
79        @description.setter
80        def description(self, value):   
81                        self._unitdefinition.description = value
82        @property
83        def quantityTypeReference(self):       
84                return self._unitdefinition.quantityTypeReference
85
86        @quantityTypeReference.setter
87        def quantityTypeReference(self, value):
88                        self._unitdefinition.quantityTypeReference = value
89        @property
90        def descriptionReference(self):
91                return self._unitdefinition.descriptionReference
92
93        @descriptionReference.setter
94        def descriptionReference(self, value): 
95                        self._unitdefinition.descriptionReference = value
96        @property
97        def quantityType(self):
98                return self._unitdefinition.quantityType
99
100        @quantityType.setter
101        def quantityType(self, value): 
102                        self._unitdefinition.quantityType = value
103
104        def synchronize(self):
105                pass
106
107        def __key(self):
108                return (self.identifier, self.roughConversionToPreferredUnit, self.name, self.derivationUnitTerm, self.conversionToPreferredUnit, self.catalogSymbol, self.description, self.quantityTypeReference, self.descriptionReference, self.quantityType)
109
110        def __eq__(self, y):
111                if type(self) != type(y):
112                        return False
113                '''
114                Cannot compare classes which do not define a "__key" attribute
115                '''
116                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
117                        return self.__key() == y.__key()
118                return id(self) == id(y)
119
120        def __hash__(self):
121                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.