source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19130_sensor_data/location_model/sd_locationmodel.py @ 8437

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19130_sensor_data/location_model/sd_locationmodel.py@8437
Revision 8437, 2.8 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 ascore.utils import has_value, collectionProofHash
22
23'''
24Created on 06-Jul-2012 07:43:15
25
26@author: mnagni
27'''
28
29class SD_LocationModel(object):
30        '''
31                Represents a data entity defined in a UML diagram and supposed to
32                be persisted in a relational database.
33 
34                This class has been genererated automatically using the Apache Velocity project.
35        '''
36        '''
37                Please note that any access to the inner attributes should be done using
38                the given get/set methods and NOT accessing them directly.
39        '''
40        def __init__(self):
41
42                self._platformPosition_sd_earthmeasuredlocation = None
43                self._platformPosition_sd_referentialpositionandorientation = None
44                self._platformPosition_sd_orbitmeasuredlocation = None
45                self._platformPosition = None
46                self.dateTime = None
47                super(SD_LocationModel, self).__init__()
48        @property
49        def platformPosition(self):     
50                if(has_value(self._platformPosition_sd_earthmeasuredlocation)):
51                        return self._platformPosition_sd_earthmeasuredlocation
52                if(has_value(self._platformPosition_sd_referentialpositionandorientation)):
53                        return self._platformPosition_sd_referentialpositionandorientation
54                if(has_value(self._platformPosition_sd_orbitmeasuredlocation)):
55                        return self._platformPosition_sd_orbitmeasuredlocation
56                return  None
57
58        @platformPosition.setter
59        def platformPosition(self, value):     
60                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
61                if valueClass == "ea_model.iso_19130_sensor_data.location_model.sd_earthmeasuredlocation.SD_EarthMeasuredLocation":
62                        self._platformPosition_sd_earthmeasuredlocation = value
63                        self._platformPosition_sd_referentialpositionandorientation = None
64                        self._platformPosition_sd_orbitmeasuredlocation = None
65                if valueClass == "ea_model.iso_19130_sensor_data.location_model.sd_referentialpositionandorientation.SD_ReferentialPositionAndOrientation":
66                        self._platformPosition_sd_referentialpositionandorientation = value
67                        self._platformPosition_sd_earthmeasuredlocation = None
68                        self._platformPosition_sd_orbitmeasuredlocation = None
69                if valueClass == "ea_model.iso_19130_sensor_data.location_model.sd_orbitmeasuredlocation.SD_OrbitMeasuredLocation":
70                        self._platformPosition_sd_orbitmeasuredlocation = value
71                        self._platformPosition_sd_earthmeasuredlocation = None
72                        self._platformPosition_sd_referentialpositionandorientation = None
73
74        def synchronize(self):
75                pass
76
77        def __key(self):
78                return (self.platformPosition, self.dateTime)
79
80        def __eq__(self, y):
81                if type(self) != type(y):
82                        return False
83                '''
84                Cannot compare classes which do not define a "__key" attribute
85                '''
86                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
87                        return self.__key() == y.__key()
88                return id(self) == id(y)
89
90        def __hash__(self):
91                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.