source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/iso_gdf/gdf_feature/gdf_pointfeature.py @ 8437

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/iso_gdf/gdf_feature/gdf_pointfeature.py@8437
Revision 8437, 3.6 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
Line 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from ea_model.informative.iso_gdf.gdf_feature.gdf_simplefeature import  GDF_SimpleFeature
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 06-Jul-2012 07:43:07
26
27@author: mnagni
28'''
29
30class GDF_PointFeature(GDF_SimpleFeature):
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._gdf_simplefeature = GDF_SimpleFeature()   
43
44                self.attribute = None
45                self.id = None
46                self.bounds = []
47                self.category = None
48                self._theGDF_Node_gdf_nonisolatednode = []
49                self._theGDF_Node_gdf_isolatednode = []
50                self._theGDF_Node = []
51                self.class_ = None
52                self.theGDF_Dot = None
53                super(GDF_PointFeature, self).__init__()
54        @property
55        def attribute(self):   
56                return self._gdf_simplefeature.attribute
57
58        @attribute.setter
59        def attribute(self, value):     
60                        self._gdf_simplefeature.attribute = value
61        @property
62        def theGDF_SemanticRelationship(self): 
63                return self._gdf_simplefeature.theGDF_SemanticRelationship
64
65        @theGDF_SemanticRelationship.setter
66        def theGDF_SemanticRelationship(self, value):   
67                        self._gdf_simplefeature.theGDF_SemanticRelationship = value
68        @property
69        def id(self):   
70                return self._gdf_simplefeature.id
71
72        @id.setter
73        def id(self, value):   
74                        self._gdf_simplefeature.id = value
75        @property
76        def category(self):     
77                return self._gdf_simplefeature.category
78
79        @category.setter
80        def category(self, value):     
81                        self._gdf_simplefeature.category = value
82        @property
83        def container(self):   
84                return self._gdf_simplefeature.container
85
86        @container.setter
87        def container(self, value):     
88                        self._gdf_simplefeature.container = value
89        @property
90        def theGDF_Node(self): 
91                try:
92                        ret = []
93                        ret.extend(self._theGDF_Node_gdf_nonisolatednode)
94                        ret.extend(self._theGDF_Node_gdf_isolatednode)
95                        if not hasattr(self, '_theGDF_Node'):
96                                self._theGDF_Node = []
97                        if self._theGDF_Node is not None:
98                                ret.extend(self._theGDF_Node)
99                        del self._theGDF_Node[:]
100                        self._theGDF_Node.extend(set(ret))
101                except Exception as e:
102                        pass
103                return self._theGDF_Node
104
105        @property
106        def class_(self):       
107                return self._gdf_simplefeature.class_
108
109        @class_.setter
110        def class_(self, value):       
111                        self._gdf_simplefeature.class_ = value
112
113        def synchronize(self):
114                del self._theGDF_Node_gdf_nonisolatednode[:]
115                del self._theGDF_Node_gdf_isolatednode[:]
116                for item in self.theGDF_Node:   
117                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
118                        if valueClass == "ea_model.informative.iso_gdf.gdf_topology.gdf_nonisolatednode.GDF_NonIsolatedNode":
119                                self._theGDF_Node_gdf_nonisolatednode.append(item)
120                                continue
121                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
122                        if valueClass == "ea_model.informative.iso_gdf.gdf_topology.gdf_isolatednode.GDF_IsolatedNode":
123                                self._theGDF_Node_gdf_isolatednode.append(item)
124                                continue
125                pass
126
127        def __key(self):
128                return (self.attribute, self.theGDF_SemanticRelationship, self.id, self.bounds, self.category, self.container, self.theGDF_Node, self.class_, self.theGDF_Dot)
129
130        def __eq__(self, y):
131                if type(self) != type(y):
132                        return False
133                '''
134                Cannot compare classes which do not define a "__key" attribute
135                '''
136                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
137                        return self.__key() == y.__key()
138                return id(self) == id(y)
139
140        def __hash__(self):
141                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.