source: mauRepo/MolesManager/trunk/src/ea_model/moles3_4/acquisition/mo_operation.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/moles3_4/acquisition/mo_operation.py@8091
Revision 8091, 2.3 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:11
25
26@author: mnagni
27'''
28
29class MO_Operation(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 = []
43        self.childOperation = []
44        self.status = None
45        self._operationTime_tm_primitive = None
46        self._operationTime_tm_complex = None
47        self.documentation = []
48        self.location = None
49        self.platform = []
50        self.description = None
51        self.relatedPartyInfo = []
52        super(MO_Operation, self).__init__()
53
54    @property
55    def operationTime(self):   
56        if(has_value(self._operationTime_tm_primitive)):
57            return self._operationTime_tm_primitive
58        if(has_value(self._operationTime_tm_complex)):
59            return self._operationTime_tm_complex
60        return  None
61
62    @operationTime.setter
63    def operationTime(self, value):     
64        valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
65        if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_primitive.TM_Primitive":
66            self._operationTime_tm_primitive = value
67            self._operationTime_tm_complex = None
68        if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_complex.TM_Complex":
69            self._operationTime_tm_complex = value
70            self._operationTime_tm_primitive = None
71
72    def __key(self):
73        return (self.identifier, self.childOperation, self.status, self.operationTime, self.documentation, self.location, self.platform, self.description, self.relatedPartyInfo)
74
75    def __eq__(self, y):
76        '''
77        Cannot compare classes which do not define a "__key" attribute
78        '''
79        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
80            return self.__key() == y.__key()
81        return id(self) == id(y)
82
83    def __hash__(self):
84        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.