source: mauRepo/MolesManager/trunk/src/ea_model/iso_19103_2005_schema_language/basic_types/primitive/date_and_time/datetime.py @ 8089

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19103_2005_schema_language/basic_types/primitive/date_and_time/datetime.py@8089
Revision 8089, 3.0 KB checked in by mnagni, 8 years ago (diff)

Played with DOJO
New EA library
Addede CEDA_Process to the migration

Line 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from ea_model.iso_19103_2005_schema_language.basic_types.primitive.date_and_time.clocktime import  ClockTime
22from ea_model.iso_19103_2005_schema_language.basic_types.primitive.date_and_time.date import  Date
23from ascore.utils import has_value
24
25'''
26Created on 14-Feb-2012 17:19:36
27
28@author: mnagni
29'''
30
31class DateTime(ClockTime,Date):
32    '''
33        Represents a data entity defined in a UML diagram and supposed to
34        be persisted in a relational database.
35 
36        This class has been genererated automatically using the Apache Velocity project.
37    '''
38    '''
39        Please note that any access to the inner attributes should be done using
40        the given get/set methods and NOT accessing them directly.
41    '''
42    def __init__(self):
43        self._date = Date()     
44        self._clocktime = ClockTime()   
45
46        self.timeZone = None
47        self.second = None
48        self.day = None
49        self.year = None
50        self.century = None
51        self.month = None
52        self.minute = None
53        self.precision = None
54        self.hour = None
55        super(DateTime, self).__init__()
56
57    @property
58    def timeZone(self): 
59        return self._clocktime.timeZone
60
61    @timeZone.setter
62    def timeZone(self, value): 
63            self._clocktime.timeZone = value
64
65    @property
66    def second(self):   
67        return self._clocktime.second
68
69    @second.setter
70    def second(self, value):   
71            self._clocktime.second = value
72
73    @property
74    def day(self):     
75        return self._date.day
76
77    @day.setter
78    def day(self, value):       
79            self._date.day = value
80
81    @property
82    def year(self):     
83        return self._date.year
84
85    @year.setter
86    def year(self, value):     
87            self._date.year = value
88
89    @property
90    def century(self): 
91        return self._date.century
92
93    @century.setter
94    def century(self, value):   
95            self._date.century = value
96
97    @property
98    def month(self):   
99        return self._date.month
100
101    @month.setter
102    def month(self, value):     
103            self._date.month = value
104
105    @property
106    def minute(self):   
107        return self._clocktime.minute
108
109    @minute.setter
110    def minute(self, value):   
111            self._clocktime.minute = value
112
113    @property
114    def precision(self):       
115        return self._date.precision
116
117    @precision.setter
118    def precision(self, value): 
119            self._date.precision = value
120
121    @property
122    def hour(self):     
123        return self._clocktime.hour
124
125    @hour.setter
126    def hour(self, value):     
127            self._clocktime.hour = value
128
129    def __key(self):
130        return (self.timeZone, self.second, self.day, self.year, self.century, self.month, self.minute, self.precision, self.hour)
131
132    def __eq__(self, y):
133        '''
134        Cannot compare classes which do not define a "__key" attribute
135        '''
136        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
137            return self.__key() == y.__key()
138        return id(self) == id(y)
139
140    def __hash__(self):
141        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.