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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19136_gml/dynamicfeature/dynamicfeature.py@8457
Revision 8457, 3.3 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.feature.abstractfeature import  AbstractFeature
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 10-Jul-2012 14:15:11
26
27@author: mnagni
28'''
29
30class DynamicFeature(AbstractFeature):
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._abstractfeature = AbstractFeature()       
43
44                self.identifier = None
45                self.boundedBy = None
46                self.history = []
47                self.dataSource = None
48                self._validTime_tm_topologicalprimitive = None
49                self._validTime_tm_geometricprimitive = None
50                self._validTime = None
51                self.description = None
52                self.descriptionReference = None
53                self.dataSourceReference = None
54                super(DynamicFeature, self).__init__()
55        @property
56        def identifier(self):   
57                return self._abstractfeature.identifier
58
59        @identifier.setter
60        def identifier(self, value):   
61                        self._abstractfeature.identifier = value
62        @property
63        def boundedBy(self):   
64                return self._abstractfeature.boundedBy
65
66        @boundedBy.setter
67        def boundedBy(self, value):     
68                        self._abstractfeature.boundedBy = value
69        @property
70        def name(self):
71                return self._abstractfeature.name
72
73        @name.setter
74        def name(self, value): 
75                        self._abstractfeature.name = value
76        @property
77        def validTime(self):   
78                if(has_value(self._validTime_tm_topologicalprimitive)):
79                        return self._validTime_tm_topologicalprimitive
80                if(has_value(self._validTime_tm_geometricprimitive)):
81                        return self._validTime_tm_geometricprimitive
82                return  None
83
84        @validTime.setter
85        def validTime(self, value):     
86                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
87                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_topologicalprimitive.TM_TopologicalPrimitive":
88                        self._validTime_tm_topologicalprimitive = value
89                        self._validTime_tm_geometricprimitive = None
90                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_geometricprimitive.TM_GeometricPrimitive":
91                        self._validTime_tm_geometricprimitive = value
92                        self._validTime_tm_topologicalprimitive = None
93        @property
94        def description(self): 
95                return self._abstractfeature.description
96
97        @description.setter
98        def description(self, value):   
99                        self._abstractfeature.description = value
100        @property
101        def descriptionReference(self):
102                return self._abstractfeature.descriptionReference
103
104        @descriptionReference.setter
105        def descriptionReference(self, value): 
106                        self._abstractfeature.descriptionReference = value
107
108        def synchronize(self):
109                pass
110
111        def __key(self):
112                return (self.identifier, self.boundedBy, self.name, self.history, self.dataSource, self.validTime, self.description, self.descriptionReference, self.dataSourceReference)
113
114        def __eq__(self, y):
115                if type(self) != type(y):
116                        return False
117                '''
118                Cannot compare classes which do not define a "__key" attribute
119                '''
120                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
121                        return self.__key() == y.__key()
122                return id(self) == id(y)
123
124        def __hash__(self):
125                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.