source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19112_location_by_identifier/referencesystem_by_identifier/si_locationtype.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19112_location_by_identifier/referencesystem_by_identifier/si_locationtype.py@8457
Revision 8457, 2.9 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:13
25
26@author: mnagni
27'''
28
29class SI_LocationType(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.identifier = None
43                self.name = None
44                self.child = []
45                self.referenceSystem = []
46                self.parent = []
47                self.owner = None
48                self._territoryOfUse_ex_geographicdescription = None
49                self._territoryOfUse_ex_geographicboundingbox = None
50                self._territoryOfUse_ex_boundingpolygon = None
51                self._territoryOfUse = None
52                self.theme = None
53                self.definition = None
54                super(SI_LocationType, self).__init__()
55        @property
56        def territoryOfUse(self):       
57                if(has_value(self._territoryOfUse_ex_geographicdescription)):
58                        return self._territoryOfUse_ex_geographicdescription
59                if(has_value(self._territoryOfUse_ex_geographicboundingbox)):
60                        return self._territoryOfUse_ex_geographicboundingbox
61                if(has_value(self._territoryOfUse_ex_boundingpolygon)):
62                        return self._territoryOfUse_ex_boundingpolygon
63                return  None
64
65        @territoryOfUse.setter
66        def territoryOfUse(self, value):       
67                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
68                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_geographicdescription.EX_GeographicDescription":
69                        self._territoryOfUse_ex_geographicdescription = value
70                        self._territoryOfUse_ex_geographicboundingbox = None
71                        self._territoryOfUse_ex_boundingpolygon = None
72                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_geographicboundingbox.EX_GeographicBoundingBox":
73                        self._territoryOfUse_ex_geographicboundingbox = value
74                        self._territoryOfUse_ex_geographicdescription = None
75                        self._territoryOfUse_ex_boundingpolygon = None
76                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_boundingpolygon.EX_BoundingPolygon":
77                        self._territoryOfUse_ex_boundingpolygon = value
78                        self._territoryOfUse_ex_geographicdescription = None
79                        self._territoryOfUse_ex_geographicboundingbox = None
80
81        def synchronize(self):
82                pass
83
84        def __key(self):
85                return (self.identifier, self.name, self.child, self.referenceSystem, self.parent, self.owner, self.territoryOfUse, self.theme, self.definition)
86
87        def __eq__(self, y):
88                if type(self) != type(y):
89                        return False
90                '''
91                Cannot compare classes which do not define a "__key" attribute
92                '''
93                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
94                        return self.__key() == y.__key()
95                return id(self) == id(y)
96
97        def __hash__(self):
98                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.