source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19136_gml/basictypes/coordinates.py @ 8437

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19136_gml/basictypes/coordinates.py@8437
Revision 8437, 1.9 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 sqlalchemy.types import  Text
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 06-Jul-2012 07:43:06
26
27@author: mnagni
28'''
29
30class Coordinates(Text):
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._characterstring = Text() 
43
44                self.cs = None
45                self.size = None
46                self.decimal = None
47                self.ts = None
48                self.characterSet = None
49                self.elements = None
50                self.maxLength = None
51                super(Coordinates, self).__init__()
52        @property
53        def size(self):
54                return self._characterstring.size
55
56        @size.setter
57        def size(self, value): 
58                        self._characterstring.size = value
59        @property
60        def characterSet(self):
61                return self._characterstring.characterSet
62
63        @characterSet.setter
64        def characterSet(self, value): 
65                        self._characterstring.characterSet = value
66        @property
67        def elements(self):     
68                return self._characterstring.elements
69
70        @elements.setter
71        def elements(self, value):     
72                        self._characterstring.elements = value
73        @property
74        def maxLength(self):   
75                return self._characterstring.maxLength
76
77        @maxLength.setter
78        def maxLength(self, value):     
79                        self._characterstring.maxLength = value
80
81        def synchronize(self):
82                pass
83
84        def __key(self):
85                return (self.cs, self.size, self.decimal, self.ts, self.characterSet, self.elements, self.maxLength)
86
87        def __eq__(self, y):
88                if type(self) != type(y):
89                        return False
90                '''
91                Cannot compare classes which do not define a "__key" attribute
92                '''
93                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
94                        return self.__key() == y.__key()
95                return id(self) == id(y)
96
97        def __hash__(self):
98                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.