source: mauRepo/MolesManager/trunk/src/ea_model/iso_19156_2011_observations_and_measurements/sampling_features/samplingfeature/sf_samplingfeaturecollection.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19156_2011_observations_and_measurements/sampling_features/samplingfeature/sf_samplingfeaturecollection.py@8091
Revision 8091, 2.1 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:08
25
26@author: mnagni
27'''
28
29class SF_SamplingFeatureCollection(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._member_sf_spatialsamplingfeature = []
43        self._member_sf_specimen = []
44        super(SF_SamplingFeatureCollection, self).__init__()
45
46    @property
47    def member(self):   
48        ret = []
49        for item in self._member_sf_spatialsamplingfeature:
50            ret.append(item)
51        for item in self._member_sf_specimen:
52            ret.append(item)
53        return ret
54
55    @member.setter
56    def member(self, value):   
57        if isinstance(value, list):
58            self._member_sf_spatialsamplingfeature[:]
59            self._member_sf_specimen[:]
60            for item in value:
61                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
62                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.sampling_features.spatialsamplingfeature.sf_spatialsamplingfeature.SF_SpatialSamplingFeature":
63                    self._member_sf_spatialsamplingfeature.append(item)
64                    continue
65                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.sampling_features.specimen.sf_specimen.SF_Specimen":
66                    self._member_sf_specimen.append(item)
67                    continue
68
69    def __key(self):
70        return (self.member)
71
72    def __eq__(self, y):
73        '''
74        Cannot compare classes which do not define a "__key" attribute
75        '''
76        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
77            return self.__key() == y.__key()
78        return id(self) == id(y)
79
80    def __hash__(self):
81        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.