source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19115_2006_metadata_corrigendum/data_quality_information/dq_dataquality.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19115_2006_metadata_corrigendum/data_quality_information/dq_dataquality.py@8457
Revision 8457, 3.4 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:05
25
26@author: mnagni
27'''
28
29class DQ_DataQuality(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.lineage = None
43                self.scope = None
44                self._report_dq_thematicaccuracy = []
45                self._report_dq_positionalaccuracy = []
46                self._report_qe_usability = []
47                self._report_dq_completeness = []
48                self._report_dq_logicalconsistency = []
49                self._report_dq_temporalaccuracy = []
50                self._report = []
51                super(DQ_DataQuality, self).__init__()
52        @property
53        def report(self):       
54                try:
55                        ret = []
56                        ret.extend(self._report_dq_thematicaccuracy)
57                        ret.extend(self._report_dq_positionalaccuracy)
58                        ret.extend(self._report_qe_usability)
59                        ret.extend(self._report_dq_completeness)
60                        ret.extend(self._report_dq_logicalconsistency)
61                        ret.extend(self._report_dq_temporalaccuracy)
62                        if not hasattr(self, '_report'):
63                                self._report = []
64                        if self._report is not None:
65                                ret.extend(self._report)
66                        del self._report[:]
67                        self._report.extend(set(ret))
68                except Exception as e:
69                        pass
70                return self._report
71
72
73        def synchronize(self):
74                int_report = self.report       
75                del self._report_dq_thematicaccuracy[:]
76                del self._report_dq_positionalaccuracy[:]
77                del self._report_qe_usability[:]
78                del self._report_dq_completeness[:]
79                del self._report_dq_logicalconsistency[:]
80                del self._report_dq_temporalaccuracy[:]
81                for item in int_report:
82                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
83                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_thematicaccuracy.DQ_ThematicAccuracy":
84                                self._report_dq_thematicaccuracy.append(item)
85                                continue
86                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_positionalaccuracy.DQ_PositionalAccuracy":
87                                self._report_dq_positionalaccuracy.append(item)
88                                continue
89                        if valueClass == "ea_model.iso_19115_2_2009_metadata___imagery.data_quality_information___imagery.qe_usability.QE_Usability":
90                                self._report_qe_usability.append(item)
91                                continue
92                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_completeness.DQ_Completeness":
93                                self._report_dq_completeness.append(item)
94                                continue
95                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_logicalconsistency.DQ_LogicalConsistency":
96                                self._report_dq_logicalconsistency.append(item)
97                                continue
98                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_temporalaccuracy.DQ_TemporalAccuracy":
99                                self._report_dq_temporalaccuracy.append(item)
100                                continue
101                pass
102
103        def __key(self):
104                return (self.lineage, self.scope, self.report)
105
106        def __eq__(self, y):
107                if type(self) != type(y):
108                        return False
109                '''
110                Cannot compare classes which do not define a "__key" attribute
111                '''
112                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
113                        return self.__key() == y.__key()
114                return id(self) == id(y)
115
116        def __hash__(self):
117                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.