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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/ceda_metadatamodel/ceda_project/ceda_project.py@8437
Revision 8437, 3.3 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 
[8398]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.project.mo_project import  MO_Project
22from ascore.utils import has_value, collectionProofHash
23
24'''
[8437]25Created on 06-Jul-2012 07:43:12
[8398]26
27@author: mnagni
28'''
29
30class CEDA_Project(MO_Project):
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_project = MO_Project()         
43
44                self.metadataManagement = []
45                self.dmp = None
46                self.projectResource = []
47                self.publicationState = None
48                self.abstract = None
49                self.status = None
50                self.description = None
51                super(CEDA_Project, self).__init__()
52        @property
53        def relatedParty(self):
54                return self._mo_project.relatedParty
55
56        @relatedParty.setter
57        def relatedParty(self, value): 
58                        self._mo_project.relatedParty = value
59        @property
60        def dmp(self): 
61                return self._mo_project.dmp
62
63        @dmp.setter
64        def dmp(self, value):   
65                        self._mo_project.dmp = value
66        @property
67        def subProject(self):   
68                return self._mo_project.subProject
69
70        @subProject.setter
71        def subProject(self, value):   
72                        self._mo_project.subProject = value
73        @property
[8437]74        def identifier(self):   
75                return self._mo_project.identifier
76
77        @identifier.setter
78        def identifier(self, value):   
79                        self._mo_project.identifier = value
80        @property
[8398]81        def publicationState(self):     
82                return self._mo_project.publicationState
83
84        @publicationState.setter
85        def publicationState(self, value):     
86                        self._mo_project.publicationState = value
87        @property
88        def abstract(self):     
89                return self._mo_project.abstract
90
91        @abstract.setter
92        def abstract(self, value):     
93                        self._mo_project.abstract = value
94        @property
[8437]95        def status(self):       
96                return self._mo_project.status
97
98        @status.setter
99        def status(self, value):       
100                        self._mo_project.status = value
101        @property
[8398]102        def keywords(self):     
103                return self._mo_project.keywords
104
105        @keywords.setter
106        def keywords(self, value):     
107                        self._mo_project.keywords = value
108        @property
109        def documentation(self):       
110                return self._mo_project.documentation
111
112        @documentation.setter
113        def documentation(self, value):
114                        self._mo_project.documentation = value
115        @property
116        def description(self): 
117                return self._mo_project.description
118
119        @description.setter
120        def description(self, value):   
121                        self._mo_project.description = value
122        @property
123        def observationCollection(self):       
124                return self._mo_project.observationCollection
125
126        @observationCollection.setter
127        def observationCollection(self, value):
128                        self._mo_project.observationCollection = value
129
130        def synchronize(self):
131                pass
132
133        def __key(self):
[8437]134                return (self.metadataManagement, self.relatedParty, self.dmp, self.projectResource, self.subProject, self.identifier, self.publicationState, self.abstract, self.status, self.keywords, self.documentation, self.description, self.observationCollection)
[8398]135
136        def __eq__(self, y):
137                if type(self) != type(y):
138                        return False
139                '''
140                Cannot compare classes which do not define a "__key" attribute
141                '''
142                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
143                        return self.__key() == y.__key()
144                return id(self) == id(y)
145
146        def __hash__(self):
147                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.