source: mauRepo/MolesManager/trunk/src/ea_model/iso_19156_2011_observations_and_measurements/observation_schema/observation/om_process.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19156_2011_observations_and_measurements/observation_schema/observation/om_process.py@8091
Revision 8091, 5.7 KB checked in by mnagni, 8 years ago (diff)

The migration process now includes
1) deployment_data files
2) XML document hash
3) full Dojo support


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
22
23'''
24Created on 16-Feb-2012 16:18:08
25
26@author: mnagni
27'''
28
29class OM_Process(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._generatedObservation_om_discretecoverageobservation = []
43        self._generatedObservation_om_temporalobservation = []
44        self._generatedObservation_om_measurement = []
45        self._generatedObservation_mo_observation = []
46        self._generatedObservation_om_truthobservation = []
47        self._generatedObservation_om_countobservation = []
48        self._generatedObservation_om_categoryobservation = []
49        self._generatedObservation_om_geometryobservation = []
50        self._generatedObservation_om_complexobservation = []
51        super(OM_Process, self).__init__()
52
53    @property
54    def generatedObservation(self):     
55        ret = []
56        for item in self._generatedObservation_om_discretecoverageobservation:
57            ret.append(item)
58        for item in self._generatedObservation_om_temporalobservation:
59            ret.append(item)
60        for item in self._generatedObservation_om_measurement:
61            ret.append(item)
62        for item in self._generatedObservation_mo_observation:
63            ret.append(item)
64        for item in self._generatedObservation_om_truthobservation:
65            ret.append(item)
66        for item in self._generatedObservation_om_countobservation:
67            ret.append(item)
68        for item in self._generatedObservation_om_categoryobservation:
69            ret.append(item)
70        for item in self._generatedObservation_om_geometryobservation:
71            ret.append(item)
72        for item in self._generatedObservation_om_complexobservation:
73            ret.append(item)
74        return ret
75
76    @generatedObservation.setter
77    def generatedObservation(self, value):     
78        if isinstance(value, list):
79            self._generatedObservation_om_discretecoverageobservation[:]
80            self._generatedObservation_om_temporalobservation[:]
81            self._generatedObservation_om_measurement[:]
82            self._generatedObservation_mo_observation[:]
83            self._generatedObservation_om_truthobservation[:]
84            self._generatedObservation_om_countobservation[:]
85            self._generatedObservation_om_categoryobservation[:]
86            self._generatedObservation_om_geometryobservation[:]
87            self._generatedObservation_om_complexobservation[:]
88            for item in value:
89                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
90                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.coverageobservation.om_discretecoverageobservation.OM_DiscreteCoverageObservation":
91                    self._generatedObservation_om_discretecoverageobservation.append(item)
92                    continue
93                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.temporalobservation.om_temporalobservation.OM_TemporalObservation":
94                    self._generatedObservation_om_temporalobservation.append(item)
95                    continue
96                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.measurement.om_measurement.OM_Measurement":
97                    self._generatedObservation_om_measurement.append(item)
98                    continue
99                if valueClass == "ea_model.moles3_4.observation.mo_observation.MO_Observation":
100                    self._generatedObservation_mo_observation.append(item)
101                    continue
102                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.truthobservation.om_truthobservation.OM_TruthObservation":
103                    self._generatedObservation_om_truthobservation.append(item)
104                    continue
105                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.countobservation.om_countobservation.OM_CountObservation":
106                    self._generatedObservation_om_countobservation.append(item)
107                    continue
108                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.categoryobservation.om_categoryobservation.OM_CategoryObservation":
109                    self._generatedObservation_om_categoryobservation.append(item)
110                    continue
111                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.geometryobservation.om_geometryobservation.OM_GeometryObservation":
112                    self._generatedObservation_om_geometryobservation.append(item)
113                    continue
114                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.complexobservation.om_complexobservation.OM_ComplexObservation":
115                    self._generatedObservation_om_complexobservation.append(item)
116                    continue
117
118    def __key(self):
119        return (self.generatedObservation)
120
121    def __eq__(self, y):
122        '''
123        Cannot compare classes which do not define a "__key" attribute
124        '''
125        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
126            return self.__key() == y.__key()
127        return id(self) == id(y)
128
129    def __hash__(self):
130        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.