source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/ceda_metadatamodel/ceda_acquisition/ceda_platform.py @ 8437

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/ceda_metadatamodel/ceda_acquisition/ceda_platform.py@8437
Revision 8437, 2.5 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.moles3_4.acquisition.mo_platform import  MO_Platform
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 06-Jul-2012 07:43:09
26
27@author: mnagni
28'''
29
30class CEDA_Platform(MO_Platform):
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._mo_platform = MO_Platform()       
43
44                self.metadataManagement = []
45                self.type = None
46                self.location = None
47                self.description = None
48                super(CEDA_Platform, self).__init__()
49        @property
50        def identifier(self):   
51                return self._mo_platform.identifier
52
53        @identifier.setter
54        def identifier(self, value):   
55                        self._mo_platform.identifier = value
56        @property
57        def type(self):
58                return self._mo_platform.type
59
60        @type.setter
61        def type(self, value): 
62                        self._mo_platform.type = value
63        @property
64        def relatedParty(self):
65                return self._mo_platform.relatedParty
66
67        @relatedParty.setter
68        def relatedParty(self, value): 
69                        self._mo_platform.relatedParty = value
70        @property
71        def documentation(self):       
72                return self._mo_platform.documentation
73
74        @documentation.setter
75        def documentation(self, value):
76                        self._mo_platform.documentation = value
77        @property
78        def location(self):     
79                return self._mo_platform.location
80
81        @location.setter
82        def location(self, value):     
83                        self._mo_platform.location = value
84        @property
85        def description(self): 
86                return self._mo_platform.description
87
88        @description.setter
89        def description(self, value):   
90                        self._mo_platform.description = value
91        @property
92        def childPlatform(self):       
93                return self._mo_platform.childPlatform
94
95        @childPlatform.setter
96        def childPlatform(self, value):
97                        self._mo_platform.childPlatform = value
98
99        def synchronize(self):
100                pass
101
102        def __key(self):
103                return (self.identifier, self.metadataManagement, self.type, self.relatedParty, self.documentation, self.location, self.description, self.childPlatform)
104
105        def __eq__(self, y):
106                if type(self) != type(y):
107                        return False
108                '''
109                Cannot compare classes which do not define a "__key" attribute
110                '''
111                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
112                        return self.__key() == y.__key()
113                return id(self) == id(y)
114
115        def __hash__(self):
116                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.