source: mauRepo/MolesManager/trunk/src/ea_model/iso_19130_sensor_data/sd_qualityinfo.py @ 8197

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19130_sensor_data/sd_qualityinfo.py@8197
Revision 8197, 4.1 KB checked in by mnagni, 8 years ago (diff)

New database schema where URL class is a string and MO_Project.subProject use CEDA_Project as subType

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 30-Mar-2012 16:45:24
25
26@author: mnagni
27'''
28
29class SD_QualityInfo(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 = []
43        self.scope = None
44        self._errorEstimates_dq_completeness = []
45        self._errorEstimates_dq_positionalaccuracy = []
46        self._errorEstimates_dq_logicalconsistency = []
47        self._errorEstimates_qe_usability = []
48        self._errorEstimates_dq_temporalaccuracy = []
49        self._errorEstimates_dq_thematicaccuracy = []
50        super(SD_QualityInfo, self).__init__()
51
52    @property
53    def errorEstimates(self):   
54        ret = []
55        for item in self._errorEstimates_dq_completeness:
56            ret.append(item)
57        for item in self._errorEstimates_dq_positionalaccuracy:
58            ret.append(item)
59        for item in self._errorEstimates_dq_logicalconsistency:
60            ret.append(item)
61        for item in self._errorEstimates_qe_usability:
62            ret.append(item)
63        for item in self._errorEstimates_dq_temporalaccuracy:
64            ret.append(item)
65        for item in self._errorEstimates_dq_thematicaccuracy:
66            ret.append(item)
67        return ret
68
69    @errorEstimates.setter
70    def errorEstimates(self, value):   
71        if isinstance(value, list):
72            self._errorEstimates_dq_completeness[:]
73            self._errorEstimates_dq_positionalaccuracy[:]
74            self._errorEstimates_dq_logicalconsistency[:]
75            self._errorEstimates_qe_usability[:]
76            self._errorEstimates_dq_temporalaccuracy[:]
77            self._errorEstimates_dq_thematicaccuracy[:]
78            for item in value:
79                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
80                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_completeness.DQ_Completeness":
81                    self._errorEstimates_dq_completeness.append(item)
82                    continue
83                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_positionalaccuracy.DQ_PositionalAccuracy":
84                    self._errorEstimates_dq_positionalaccuracy.append(item)
85                    continue
86                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_logicalconsistency.DQ_LogicalConsistency":
87                    self._errorEstimates_dq_logicalconsistency.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._errorEstimates_qe_usability.append(item)
91                    continue
92                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_temporalaccuracy.DQ_TemporalAccuracy":
93                    self._errorEstimates_dq_temporalaccuracy.append(item)
94                    continue
95                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_thematicaccuracy.DQ_ThematicAccuracy":
96                    self._errorEstimates_dq_thematicaccuracy.append(item)
97                    continue
98
99    def __key(self):
100        return (self.lineage, self.scope, self.errorEstimates)
101
102    def __eq__(self, y):
103        if type(self) != type(y):
104            return False
105        '''
106        Cannot compare classes which do not define a "__key" attribute
107        '''
108        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
109            return self.__key() == y.__key()
110        return id(self) == id(y)
111
112    def __hash__(self):
113        return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.