source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19115_2_2009_metadata___imagery/spatial_representation_information___imagery/mi_gcp.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19115_2_2009_metadata___imagery/spatial_representation_information___imagery/mi_gcp.py@8457
Revision 8457, 3.6 KB checked in by mnagni, 7 years ago (diff)

Corrected an error in the generation of the classes "synchronize" method.

  • 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 10-Jul-2012 14:15:08
25
26@author: mnagni
27'''
28
29class MI_GCP(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._accuracyReport_dq_thematicaccuracy = []
43                self._accuracyReport_dq_positionalaccuracy = []
44                self._accuracyReport_qe_usability = []
45                self._accuracyReport_dq_completeness = []
46                self._accuracyReport_dq_logicalconsistency = []
47                self._accuracyReport_dq_temporalaccuracy = []
48                self._accuracyReport = []
49                self.geographicCoordinates = None
50                super(MI_GCP, self).__init__()
51        @property
52        def accuracyReport(self):       
53                try:
54                        ret = []
55                        ret.extend(self._accuracyReport_dq_thematicaccuracy)
56                        ret.extend(self._accuracyReport_dq_positionalaccuracy)
57                        ret.extend(self._accuracyReport_qe_usability)
58                        ret.extend(self._accuracyReport_dq_completeness)
59                        ret.extend(self._accuracyReport_dq_logicalconsistency)
60                        ret.extend(self._accuracyReport_dq_temporalaccuracy)
61                        if not hasattr(self, '_accuracyReport'):
62                                self._accuracyReport = []
63                        if self._accuracyReport is not None:
64                                ret.extend(self._accuracyReport)
65                        del self._accuracyReport[:]
66                        self._accuracyReport.extend(set(ret))
67                except Exception as e:
68                        pass
69                return self._accuracyReport
70
71
72        def synchronize(self):
73                int_accuracyReport = self.accuracyReport       
74                del self._accuracyReport_dq_thematicaccuracy[:]
75                del self._accuracyReport_dq_positionalaccuracy[:]
76                del self._accuracyReport_qe_usability[:]
77                del self._accuracyReport_dq_completeness[:]
78                del self._accuracyReport_dq_logicalconsistency[:]
79                del self._accuracyReport_dq_temporalaccuracy[:]
80                for item in int_accuracyReport:
81                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
82                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_thematicaccuracy.DQ_ThematicAccuracy":
83                                self._accuracyReport_dq_thematicaccuracy.append(item)
84                                continue
85                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_positionalaccuracy.DQ_PositionalAccuracy":
86                                self._accuracyReport_dq_positionalaccuracy.append(item)
87                                continue
88                        if valueClass == "ea_model.iso_19115_2_2009_metadata___imagery.data_quality_information___imagery.qe_usability.QE_Usability":
89                                self._accuracyReport_qe_usability.append(item)
90                                continue
91                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_completeness.DQ_Completeness":
92                                self._accuracyReport_dq_completeness.append(item)
93                                continue
94                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_logicalconsistency.DQ_LogicalConsistency":
95                                self._accuracyReport_dq_logicalconsistency.append(item)
96                                continue
97                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_temporalaccuracy.DQ_TemporalAccuracy":
98                                self._accuracyReport_dq_temporalaccuracy.append(item)
99                                continue
100                pass
101
102        def __key(self):
103                return (self.accuracyReport, self.geographicCoordinates)
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.