source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/open_gis_consortium/features/fe_containerfeaturecollection.py @ 8437

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/open_gis_consortium/features/fe_containerfeaturecollection.py@8437
Revision 8437, 4.0 KB checked in by mnagni, 7 years ago (diff)

Added a new function to ascore.utils in order to synchronize classes before committing to database

The following constraints has been added to the official model:

MO_ObservationCollection:member:CEDA_Observation
MO_ObservationCollection:phenomenonTime:TM_GeometricPrimitive
MO_Project:observationCollection:CEDA_ObservationCollection
MO_Observation:result:CEDA_Result
MO_Observation:inSupportOf:CEDA_Project
MO_Project:subProject:CEDA_Project
OM_Observation:procedure:CEDA_Process
OM_Observation:phenomenonTime:TM_GeometricPrimitive
MO_ResponsiblePartyFunctionValue:CEDA_RoleValue

  • Property svn:mime-type set to text/plain
RevLine 
[8397]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from ea_model.informative.open_gis_consortium.features.fe_featurecollection import  FE_FeatureCollection
22from ascore.utils import has_value, collectionProofHash
23
24'''
[8437]25Created on 06-Jul-2012 07:43:10
[8397]26
27@author: mnagni
28'''
29
30class FE_ContainerFeatureCollection(FE_FeatureCollection):
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._fe_featurecollection = FE_FeatureCollection()     
43
44                self.attribute = None
45                self.isGlobal = None
46                self.localName = None
[8437]47                self._element_fe_queryfeaturecollection = []
[8397]48                self._element_fe_featurecollection = []
49                self._element = []
50                self.container = None
51                super(FE_ContainerFeatureCollection, self).__init__()
52        @property
53        def attribute(self):   
54                return self._fe_featurecollection.attribute
55
56        @attribute.setter
57        def attribute(self, value):     
58                        self._fe_featurecollection.attribute = value
59        @property
60        def name(self):
61                return self._fe_featurecollection.name
62
63        @name.setter
64        def name(self, value): 
65                        self._fe_featurecollection.name = value
66        @property
67        def collection(self):   
68                return self._fe_featurecollection.collection
69
70        @collection.setter
71        def collection(self, value):   
72                        self._fe_featurecollection.collection = value
73        @property
74        def isGlobal(self):     
75                return self._fe_featurecollection.isGlobal
76
77        @isGlobal.setter
78        def isGlobal(self, value):     
79                        self._fe_featurecollection.isGlobal = value
80        @property
81        def localName(self):   
82                return self._fe_featurecollection.localName
83
84        @localName.setter
85        def localName(self, value):     
86                        self._fe_featurecollection.localName = value
87        @property
88        def element(self):     
89                try:
90                        ret = []
[8437]91                        ret.extend(self._element_fe_queryfeaturecollection)
[8397]92                        ret.extend(self._element_fe_featurecollection)
93                        if not hasattr(self, '_element'):
94                                self._element = []
[8437]95                        if self._element is not None:
[8397]96                                ret.extend(self._element)
97                        del self._element[:]
98                        self._element.extend(set(ret))
99                except Exception as e:
100                        pass
101                return self._element
102
103        @property
104        def acceptableClassList(self): 
105                return self._fe_featurecollection.acceptableClassList
106
107        @acceptableClassList.setter
108        def acceptableClassList(self, value):   
109                        self._fe_featurecollection.acceptableClassList = value
110        @property
111        def container(self):   
112                return self._fe_featurecollection.container
113
114        @container.setter
115        def container(self, value):     
116                        self._fe_featurecollection.container = value
117        @property
118        def feature(self):     
119                return self._fe_featurecollection.feature
120
121        @feature.setter
122        def feature(self, value):       
123                        self._fe_featurecollection.feature = value
124
125        def synchronize(self):
[8437]126                del self._element_fe_queryfeaturecollection[:]
[8397]127                del self._element_fe_featurecollection[:]
128                for item in self.element:       
129                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
[8437]130                        if valueClass == "ea_model.informative.open_gis_consortium.features.fe_queryfeaturecollection.FE_QueryFeatureCollection":
131                                self._element_fe_queryfeaturecollection.append(item)
132                                continue
133                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
[8397]134                        if valueClass == "ea_model.informative.open_gis_consortium.features.fe_featurecollection.FE_FeatureCollection":
135                                self._element_fe_featurecollection.append(item)
136                                continue
137                pass
138
139        def __key(self):
140                return (self.attribute, self.name, self.collection, self.isGlobal, self.localName, self.element, self.acceptableClassList, self.container, self.feature)
141
142        def __eq__(self, y):
143                if type(self) != type(y):
144                        return False
145                '''
146                Cannot compare classes which do not define a "__key" attribute
147                '''
148                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
149                        return self.__key() == y.__key()
150                return id(self) == id(y)
151
152        def __hash__(self):
153                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.