source: mauRepo/MolesManager/trunk/src/ea_model/iso_19115_2006_metadata_corrigendum/extent_information/ex_extent.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19115_2006_metadata_corrigendum/extent_information/ex_extent.py@8091
Revision 8091, 2.9 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:12
25
26@author: mnagni
27'''
28
29class EX_Extent(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._geographicElement_ex_boundingpolygon = []
43        self._geographicElement_ex_geographicdescription = []
44        self._geographicElement_ex_geographicboundingbox = []
45        self.verticalElement = []
46        self.temporalElement = []
47        self.description = None
48        super(EX_Extent, self).__init__()
49
50    @property
51    def geographicElement(self):       
52        ret = []
53        for item in self._geographicElement_ex_boundingpolygon:
54            ret.append(item)
55        for item in self._geographicElement_ex_geographicdescription:
56            ret.append(item)
57        for item in self._geographicElement_ex_geographicboundingbox:
58            ret.append(item)
59        return ret
60
61    @geographicElement.setter
62    def geographicElement(self, value): 
63        if isinstance(value, list):
64            self._geographicElement_ex_boundingpolygon[:]
65            self._geographicElement_ex_geographicdescription[:]
66            self._geographicElement_ex_geographicboundingbox[:]
67            for item in value:
68                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
69                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_boundingpolygon.EX_BoundingPolygon":
70                    self._geographicElement_ex_boundingpolygon.append(item)
71                    continue
72                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_geographicdescription.EX_GeographicDescription":
73                    self._geographicElement_ex_geographicdescription.append(item)
74                    continue
75                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_geographicboundingbox.EX_GeographicBoundingBox":
76                    self._geographicElement_ex_geographicboundingbox.append(item)
77                    continue
78
79    def __key(self):
80        return (self.geographicElement, self.verticalElement, self.temporalElement, self.description)
81
82    def __eq__(self, y):
83        '''
84        Cannot compare classes which do not define a "__key" attribute
85        '''
86        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
87            return self.__key() == y.__key()
88        return id(self) == id(y)
89
90    def __hash__(self):
91        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.