16a043ca48ae2b3e22eddf444db2cf2f1a1741d6
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Calendar / CalendarEvent.cpp
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #include <dpl/log/log.h>
19 #include <Commons/Exception.h>
20 #include "CalendarEvent.h"
21
22 namespace TizenApis {
23 namespace Api {
24 namespace Calendar {
25
26 CalendarEvent::CalendarEvent() :
27     m_calendarId(UNDEFINED_CALENDAR_ID),
28     m_status(UNDEFINED_STATUS),
29     m_categories(new CategoryList()),
30     m_isAllDay(false),
31     m_recurrenceId(0),
32     m_isDetached(false),
33     m_geolocation(new CalendarItemGeo()),
34     m_calendarType(EVENT_TYPE)
35 {
36 }
37
38 CalendarEvent::~CalendarEvent()
39 {
40 }
41
42 bool CalendarEvent::getIdIsSet() const
43 {
44     return !m_id.IsNull();
45 }
46
47 int CalendarEvent::getCalendarId() const
48 {
49     return m_calendarId;
50 }
51
52 void CalendarEvent::setCalendarId(int value)
53 {
54     m_calendarId = value;
55 }
56
57 int CalendarEvent::getId() const
58 {
59     return *m_id;
60 }
61
62 void CalendarEvent::setId(int value)
63 {
64     m_id = value;
65 }
66
67 void CalendarEvent::resetId()
68 {
69     m_id = DPL::Optional<int>();
70 }
71
72 std::string CalendarEvent::getDescription() const
73 {
74     return m_description;
75 }
76
77 void CalendarEvent::setDescription(const std::string &value)
78 {
79     m_description = value;
80 }
81
82 std::string CalendarEvent::getSubject() const
83 {
84     return m_subject;
85 }
86
87 void CalendarEvent::setSubject(const std::string &value)
88 {
89     m_subject = value;
90 }
91
92 std::time_t CalendarEvent::getStartTime() const
93 {
94     return m_startTime;
95 }
96
97 void CalendarEvent::setStartTime(std::time_t value)
98 {
99     m_startTime = value;
100 }
101
102 std::time_t CalendarEvent::getEndTime() const
103 {
104     return m_endTime;
105 }
106
107 void CalendarEvent::setEndTime(std::time_t value)
108 {
109     m_endTime = value;
110 }
111
112 std::string CalendarEvent::getLocation() const
113 {
114     return m_location;
115 }
116
117 void CalendarEvent::setLocation(const std::string &value)
118 {
119     m_location = value;
120 }
121
122 EventRecurrenceRulePtr CalendarEvent::getRecurrenceRule() const
123 {
124     return m_recurrence;
125 }
126
127 void CalendarEvent::setRecurrenceRule(EventRecurrenceRulePtr value)
128 {
129     m_recurrence = value;
130 }
131
132 CalendarEvent::EventStatus CalendarEvent::getStatus() const
133 {
134     return m_status == UNDEFINED_STATUS ? TENTATIVE_STATUS : m_status;
135 }
136
137 void CalendarEvent::setStatus(EventStatus value)
138 {
139     m_status = value;
140 }
141
142 std::vector<long> CalendarEvent::getAlarmsTick() const
143 {
144     return m_alarmsTick;
145 }
146
147 void CalendarEvent::setAlarmsTick(std::vector<long> &value)
148 {
149     m_alarmsTick = value;
150 }
151
152 std::vector<CalendarEvent::EventAlarmType> CalendarEvent::getAlarmsType() const
153 {
154     return m_alarmsType;
155 }
156
157 void CalendarEvent::setAlarmsType(std::vector<EventAlarmType> &value)
158 {
159     m_alarmsType = value;
160 }
161
162 CategoryListPtr CalendarEvent::getCategories() const
163 {
164     return m_categories;
165 }
166 void CalendarEvent::setCategories(const CategoryListPtr &value)
167 {
168     m_categories = value;
169 }
170
171 void CalendarEvent::display() const
172 {
173     LogDebug("m_id " << m_id);
174     LogDebug("m_calendarId " << m_calendarId);
175     LogDebug("m_calendarType " << m_calendarType);
176     LogDebug("m_description " << m_description);
177     LogDebug("m_subject " << m_subject);
178     LogDebug("m_startTime " << m_startTime);
179     LogDebug("m_endTime " << m_endTime);
180     LogDebug("m_location " << m_location);
181     LogDebug("m_recurrence " << m_recurrence);
182     LogDebug("m_status " << m_status);
183     LogDebug("m_isAllDay " << m_isAllDay);
184     LogDebug("m_organizer " << m_organizer);
185     LogDebug("m_lastModifiedDate " << m_lastModifiedDate);
186     LogDebug("m_visibility " << m_visibility);
187     LogDebug("m_availability " << m_availability);
188 }
189
190 bool CalendarEvent::validate() const
191 {
192     if (m_status == INVALID_STATUS) {
193         LogError("Incorrect status value detected");
194         return false;
195     }
196     return true;
197 }
198
199 bool CalendarEvent::getIsAllDay() const
200 {
201     return m_isAllDay;
202 }
203
204 void CalendarEvent::setIsAllDay(bool value)
205 {
206     m_isAllDay = value;
207 }
208
209 std::string CalendarEvent::getOrganizer() const
210 {
211     return m_organizer;
212 }
213
214 void CalendarEvent::setOrganizer(const std::string &value)
215 {
216     m_organizer = value;
217 }
218
219 std::time_t CalendarEvent::getLastModifiedDate() const
220 {
221     return m_lastModifiedDate;
222 }
223
224 void CalendarEvent::setLastModifiedDate(std::time_t value)
225 {
226     m_lastModifiedDate = value;
227 }
228
229 CalendarEvent::EventVisibility CalendarEvent::getVisibility() const
230 {
231     return m_visibility == UNDEFINED_VISIBILITY ? PUBLIC_VISIBILITY : m_visibility;
232 }
233
234 void CalendarEvent::setVisibility(EventVisibility value)
235 {
236     m_visibility = value;
237 }
238
239 CalendarEvent::EventAvailability CalendarEvent::getAvailability() const
240 {
241     return m_availability == UNDEFINED_AVAILABILITY ? FREE_FB : m_availability;
242 }
243
244 void CalendarEvent::setAvailability(EventAvailability value)
245 {
246     m_availability = value;
247 }
248
249 std::string CalendarEvent::getUId() const
250 {
251     return m_uid;
252 }
253
254 void CalendarEvent::setUId(const std::string &value)
255 {
256     m_uid = value;
257 }
258
259 std::time_t CalendarEvent::getRecurrenceId() const
260 {
261     return m_recurrenceId;
262 }
263
264 void CalendarEvent::setRecurrenceId(std::time_t value)
265 {
266     m_recurrenceId = value;
267 }
268
269 EventAttendeeListPtr CalendarEvent::getAttendees() const
270 {
271     return m_attendees;
272 }
273
274 void CalendarEvent::setAttendees(const EventAttendeeListPtr &value)
275 {
276     m_attendees = value;
277 }
278
279 bool CalendarEvent::getIsDetached() const
280 {
281     return m_isDetached;
282 }
283
284 void CalendarEvent::setIsDetached(bool value)
285 {
286     m_isDetached = value;
287 }
288
289 AttributeListPtr CalendarEvent::getAttributesOfInterest() const
290 {
291     return m_attributesOfInterest;
292 }
293
294 void CalendarEvent::setAttributesOfInterest(AttributeListPtr value)
295 {
296     m_attributesOfInterest = value;
297 }
298
299 CalendarItemGeoPtr CalendarEvent::getGeolocation() const
300 {
301     return m_geolocation;
302 }
303
304 void CalendarEvent::setGeolocation(CalendarItemGeoPtr value)
305 {
306     m_geolocation = value;
307 }
308
309 std::string CalendarEvent::getTimeZone() const
310 {
311     return m_timeZone;
312 }
313
314 void CalendarEvent::setTimeZone(std::string value)
315 {
316     m_timeZone = value;
317 }
318
319 CalendarEvent::TaskPriority CalendarEvent::getPriority() const
320 {
321     return m_priority;
322 }
323
324 void CalendarEvent::setPriority(TaskPriority value)
325 {
326     m_priority = value;
327 }
328
329 std::time_t CalendarEvent::getCreatedDate() const
330 {
331     return m_createdDate;
332 }
333
334 void CalendarEvent::setCreatedDate(std::time_t value)
335 {
336     m_createdDate = value;
337 }
338
339 std::time_t CalendarEvent::getCompletedDate() const
340 {
341     return m_completedDate;
342 }
343
344 void CalendarEvent::setCompletedDate(std::time_t value)
345 {
346     m_completedDate = value;
347 }
348
349 int CalendarEvent::getProgress() const
350 {
351     return m_progress;
352 }
353
354 void CalendarEvent::setProgress(int value)
355 {
356     m_progress = value;
357 }
358
359 CalendarEvent::CalendarType CalendarEvent::getCalendarType() const
360 {
361     return m_calendarType;
362 }
363
364 void CalendarEvent::setCalendarType(CalendarType type)
365 {
366     m_calendarType = type;
367 }
368
369 }
370 }
371 }