source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/other_location_services/directory/di_directoryrequest.py @ 8437

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/other_location_services/directory/di_directoryrequest.py@8437
Revision 8437, 2.2 KB checked in by mnagni, 7 years ago (diff)

Added a new function to ascore.utils in order to synchronize classes before committing to database

The following constraints has been added to the official model:

MO_ObservationCollection:member:CEDA_Observation
MO_ObservationCollection:phenomenonTime:TM_GeometricPrimitive
MO_Project:observationCollection:CEDA_ObservationCollection
MO_Observation:result:CEDA_Result
MO_Observation:inSupportOf:CEDA_Project
MO_Project:subProject:CEDA_Project
OM_Observation:procedure:CEDA_Process
OM_Observation:phenomenonTime:TM_GeometricPrimitive
MO_ResponsiblePartyFunctionValue:CEDA_RoleValue

  • 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 06-Jul-2012 07:43:15
25
26@author: mnagni
27'''
28
29class DI_DirectoryRequest(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.maxDistance = None
43                self.name = None
44                self.hotZone = None
45                self.sourceLocation = None
46                self.keywords = None
47                self.proximityType = None
48                self.minDistance = None
49                self.category = None
50                self.directoryType = None
51                self.code = None
52                self._address_ad_usaddress = None
53                self._address_ad_address = None
54                self._address = None
55                self.maxResponses = None
56                super(DI_DirectoryRequest, self).__init__()
57        @property
58        def address(self):     
59                if(has_value(self._address_ad_usaddress)):
60                        return self._address_ad_usaddress
61                if(has_value(self._address_ad_address)):
62                        return self._address_ad_address
63                return  None
64
65        @address.setter
66        def address(self, value):       
67                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
68                if valueClass == "ea_model.iso_19133_tracking_and_navigation.address_model.address.ad_usaddress.AD_USAddress":
69                        self._address_ad_usaddress = value
70                        self._address_ad_address = None
71                if valueClass == "ea_model.iso_19133_tracking_and_navigation.address_model.address.ad_address.AD_Address":
72                        self._address_ad_address = value
73                        self._address_ad_usaddress = None
74
75        def synchronize(self):
76                pass
77
78        def __key(self):
79                return (self.maxDistance, self.name, self.hotZone, self.sourceLocation, self.keywords, self.proximityType, self.minDistance, self.category, self.directoryType, self.code, self.address, self.maxResponses)
80
81        def __eq__(self, y):
82                if type(self) != type(y):
83                        return False
84                '''
85                Cannot compare classes which do not define a "__key" attribute
86                '''
87                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
88                        return self.__key() == y.__key()
89                return id(self) == id(y)
90
91        def __hash__(self):
92                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.