2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dpl/log/log.h>
23 #include <Commons/Exception.h>
24 #include "EventWrapper.h"
27 using namespace TizenApis::Api::Calendar;
28 using namespace WrtDeviceApis::Commons;
31 const char WEEKDAYS[] = "0111110";
32 const int NEW_EVENT_ID = -1;
39 EventWrapper::EventWrapper(Api::Calendar::CalendarEvent::CalendarType type) :
40 m_platformEvent(NULL),
41 m_abstractEvent(NULL),
45 m_abstractEvent = CalendarEventPtr(new CalendarEvent());
46 if (!m_abstractEvent) {
47 ThrowMsg(UnknownException, "abstract object is not created");
51 EventWrapper::EventWrapper(const CalendarEventPtr &event, Api::Calendar::CalendarEvent::CalendarType type) :
52 m_platformEvent(NULL),
53 m_abstractEvent(event),
59 EventWrapper::EventWrapper(cal_struct *event, Api::Calendar::CalendarEvent::CalendarType type) :
60 m_platformEvent(event),
61 m_abstractEvent(NULL),
65 m_abstractEvent = CalendarEventPtr(new CalendarEvent());
66 if (!m_abstractEvent) {
67 ThrowMsg(UnknownException, "abstract object is not created");
71 EventWrapper::~EventWrapper()
77 int EventWrapper::getIDFromPlatformEvent() const
80 if (m_platformEvent == NULL) {
81 ThrowMsg(NullPointerException, "m_platformEvent is not set");
84 return calendar_svc_struct_get_int(m_platformEvent, CAL_VALUE_INT_INDEX);
87 void EventWrapper::setCalendarId(const std::string &value)
89 LogInfo("calendar id "<<value);
91 std::istringstream stream(m_calendarId);
94 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
95 CAL_VALUE_INT_CALENDAR_ID,
98 ThrowMsg(PlatformException, "Can't set calendar id.");
102 void EventWrapper::setCalendarAccountId(const int value)
104 LogInfo("account id "<<value);
105 m_calendarAccountId = value;
106 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
107 CAL_VALUE_INT_ACCOUNT_ID,
108 m_calendarAccountId))
110 ThrowMsg(PlatformException, "Can't set calendar account id.");
114 void EventWrapper::saveEvent()
117 if (m_platformEvent == NULL) {
118 ThrowMsg(NullPointerException, "m_platformEvent is not set");
121 int eventID = getIDFromPlatformEvent();
122 LogDebug("Before saving/update eventID: " << eventID);
124 displayPlatformEvent();
126 //insert new record or update existing one
128 int returnValue = calendar_svc_insert(m_platformEvent);
129 if (CAL_SUCCESS > returnValue) {
130 LogError("Can't insert new event, error code: " << returnValue);
131 ThrowMsg(PlatformException, "Can't insert new event.");
133 m_abstractEvent->setId(returnValue);
135 //save the uid here too.
136 std::stringstream ss;
138 m_abstractEvent->setUId(ss.str());
139 LogInfo("New calendar event inserted with id "<<returnValue);
141 int errorCode = calendar_svc_update(m_platformEvent);
142 if (CAL_SUCCESS != errorCode) {
143 ThrowMsg(PlatformException, "Can't update new event with error code: "<<errorCode);
145 LogDebug("Calendar event updated");
149 void EventWrapper::loadEvent(int id)
151 LogDebug("Entered. ID of event to load: " << id);
154 const char *dataType;
155 if(getType() == CalendarEvent::TASK_TYPE) {
156 dataType = CAL_STRUCT_TODO;
158 dataType = CAL_STRUCT_SCHEDULE;
161 int errorCode = calendar_svc_get(dataType,
165 if (CAL_SUCCESS > errorCode) {
166 ThrowMsg(PlatformException,
167 "Can't get event with ID = " << id << ", error code: " <<
170 // Consider that the event is not found if the last modified date is 0.
171 if ( 0==calendar_svc_struct_get_time(
173 CAL_VALUE_GMT_LAST_MODIFIED_TIME,
175 ThrowMsg(NotFoundException, "Can't get event with provided id.");
178 convertPlatformEventToAbstractEvent();
179 m_abstractEvent->setCalendarType(m_calendarType);
180 displayAbstractEvent();
183 void EventWrapper::deleteEvent()
186 if (m_platformEvent == NULL) {
187 ThrowMsg(NullPointerException,
188 "Failed to delete event in calendar (m_platformEvent==NULL)");
191 // If the recurrenceId is set, delete the instance of recurring event only.
192 int eventID = getIDFromPlatformEvent();
193 std::time_t recurrenceId = m_abstractEvent->getRecurrenceId();
194 LogDebug("eventID to delete: " << eventID << ", recurrenceId: " << recurrenceId);
197 InvalidArgumentException,
198 "Failed to delete event in calendar (event is not saved in calendar)");
201 cal_struct *event = NULL;
202 const char *dataType;
203 if(getType() == CalendarEvent::TASK_TYPE) {
204 dataType = CAL_STRUCT_TODO;
206 dataType = CAL_STRUCT_SCHEDULE;
209 int error = calendar_svc_get(dataType, eventID, NULL, &event);
210 if (CAL_SUCCESS != error) {
212 calendar_svc_struct_free(&event);
214 ThrowMsg(PlatformException,
215 "Can't get calendar event. Error code "<< error);
217 // Consider that the event is not found if the last modified date is 0.
218 if ( 0==calendar_svc_struct_get_time(
220 CAL_VALUE_GMT_LAST_MODIFIED_TIME,
223 calendar_svc_struct_free(&event);
225 ThrowMsg(NotFoundException, "Can't get event with provided id.");
228 calendar_svc_struct_free(&event);
231 if ( 0>=recurrenceId ||
232 !(EventRecurrenceRule::DAILY_RECURRENCE <= m_abstractEvent->getRecurrenceRule()->getFrequency() && m_abstractEvent->getRecurrenceRule()->getFrequency() <= EventRecurrenceRule::MONTHLY_ON_DAY_RECURRENCE)) {
233 const char *dataType;
234 if(getType() == CalendarEvent::TASK_TYPE) {
235 dataType = CAL_STRUCT_TODO;
237 dataType = CAL_STRUCT_SCHEDULE;
239 error = calendar_svc_delete(dataType, eventID);
240 if (CAL_SUCCESS != error) {
241 ThrowMsg(PlatformException,
242 "Can't delete calendar event. Error code " << error);
244 m_abstractEvent->resetId();
245 setIDToPlatformEvent();
246 LogDebug("The event is deleted regardless of recurrence");
249 cal_value *value = calendar_svc_value_new(CAL_VALUE_LST_EXCEPTION_DATE);
250 if (CAL_SUCCESS!=calendar_svc_value_set_time(value, CAL_VALUE_GMT_EXCEPTION_DATE_TIME, CAL_TZ_FLAG_GMT, recurrenceId) ) {
252 calendar_svc_value_free(&value);
254 ThrowMsg(PlatformException, "cannot save the exception date");
256 calendar_svc_struct_get_list(m_platformEvent, CAL_VALUE_LST_EXCEPTION_DATE, &list);
257 list = g_list_append(list, value);
258 if (CAL_SUCCESS!=calendar_svc_struct_store_list(m_platformEvent, CAL_VALUE_LST_EXCEPTION_DATE, list)) {
260 calendar_svc_value_free(&value);
262 ThrowMsg(PlatformException, "cannot save the exception list");
264 calendar_svc_update(m_platformEvent);
265 m_abstractEvent->getRecurrenceRule()->getExceptions().push_back(recurrenceId);
266 LogDebug("The recurring event is updated.");
270 void EventWrapper::createEventFromString(std::string value)
273 ThrowMsg(NullPointerException,
274 "Failed to create event from string");
276 LogInfo("string to convert: "<<value);
279 if (CAL_SUCCESS != calendar_svc_util_convert_vcs_to_event(
280 value.c_str(), value.size(), &m_platformEvent)) {
281 ThrowMsg(PlatformException, "Can't convert string");
284 displayPlatformEvent();
287 std::string EventWrapper::exportEventToString()
292 if (CAL_SUCCESS != calendar_svc_util_convert_event_to_vcs(
293 m_platformEvent, &rawData, &dataSize)) {
294 ThrowMsg(PlatformException, "Can't convert event to string");
296 return std::string(rawData);
299 cal_struct* EventWrapper::getPlatformEvent() const
301 return m_platformEvent;
304 CalendarEventPtr EventWrapper::getAbstractEvent() const
306 return m_abstractEvent;
309 void EventWrapper::freePlatformEvent()
312 if (m_platformEvent != NULL) {
313 if (CAL_SUCCESS != calendar_svc_struct_free(&m_platformEvent)) {
314 LogError("Can't free calendar event struct.");
316 m_platformEvent = NULL;
320 cal_struct *EventWrapper::convertAbstractEventToPlatformEvent()
324 const char *dataType;
325 if(getType() == CalendarEvent::TASK_TYPE) {
326 dataType = CAL_STRUCT_TODO;
328 dataType = CAL_STRUCT_SCHEDULE;
330 m_platformEvent = calendar_svc_struct_new(dataType);
331 if (!m_platformEvent) {
332 ThrowMsg(UnknownException, "cannot create platform event");
334 setDescriptionToPlatformEvent();
335 setSummaryToPlatformEvent();
336 setStartTimeToPlatformEvent();
337 setEndTimeToPlatformEvent(); // replacement for duration
338 setLocationToPlatformEvent();
339 setCategoriesToPlatformEvent();
340 setStatusToPlatformEvent();
341 setAlarmsToPlatformEvent();
342 setIsAllDayToPlatformEvent();
343 setOrganizerToPlatformEvent();
344 setAttendeesToPlatformEvent();
345 setPositionToPlatformEvent();
346 setVisibilityToPlatformEvent();
347 setLastModifiedDateToPlatformEvent();
348 setAvailabilityToPlatformEvent();
349 setRecurrenceRuleToPlatformEvent();
350 setIDToPlatformEvent();
351 //setUIdToPlatformEvent(); // We don't set uid but use id field instead.
352 setPriorityToPlatformEvent();
353 setCreatedDateToPlatformEvent();
354 setCompletedDateToPlatformEvent();
355 setProgressToPlatformEvent();
357 return getPlatformEvent();
360 void EventWrapper::setDescriptionToPlatformEvent()
362 if (!m_platformEvent) {
363 ThrowMsg(UnknownException, "Null platform pointer.");
365 if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformEvent,
366 CAL_VALUE_TXT_DESCRIPTION,
368 getDescription().c_str()))
370 ThrowMsg(PlatformException, "Can't set event description.");
374 void EventWrapper::setSummaryToPlatformEvent()
376 if (!m_platformEvent) {
377 ThrowMsg(UnknownException, "Null platform pointer.");
379 if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformEvent,
380 CAL_VALUE_TXT_SUMMARY,
381 m_abstractEvent->getSubject()
383 ThrowMsg(PlatformException, "Can't set event subject.");
387 void EventWrapper::setStartTimeToPlatformEvent()
389 if (!m_platformEvent) {
390 ThrowMsg(UnknownException, "Null platform pointer.");
393 time_t time = m_abstractEvent->getStartTime();
395 time = m_abstractEvent->getEndTime();
397 if (CAL_SUCCESS != calendar_svc_struct_set_time(m_platformEvent,
398 CAL_VALUE_GMT_START_DATE_TIME,
399 CAL_TZ_FLAG_GMT, time)) {
400 ThrowMsg(PlatformException, "Can't set event start time.");
403 const char* timeZone = m_abstractEvent->getTimeZone().c_str();
404 if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformEvent,
405 CAL_VALUE_TXT_TZ_NAME,
407 ThrowMsg(PlatformException, "Can't set event time zone.");
411 void EventWrapper::setEndTimeToPlatformEvent()
413 if (!m_platformEvent) {
414 ThrowMsg(UnknownException, "Null platform pointer.");
417 time_t time = m_abstractEvent->getEndTime();
419 time = m_abstractEvent->getStartTime();
421 if (CAL_SUCCESS != calendar_svc_struct_set_time(m_platformEvent,
422 CAL_VALUE_GMT_END_DATE_TIME,
423 CAL_TZ_FLAG_GMT, time)) {
424 ThrowMsg(PlatformException, "Can't set event end time.");
428 void EventWrapper::setLocationToPlatformEvent()
430 if (!m_platformEvent) {
431 ThrowMsg(UnknownException, "Null platform pointer.");
433 if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformEvent,
434 CAL_VALUE_TXT_LOCATION,
435 m_abstractEvent->getLocation()
437 ThrowMsg(PlatformException, "Can't set event location.");
441 void convertDaysOfTheWeekToFlag(std::vector<string> daysOfTheWeek, char weekFlag[])
443 for( unsigned int i=0; i<daysOfTheWeek.size(); i++ )
445 if( daysOfTheWeek[i]=="SU" )
447 else if( daysOfTheWeek[i]=="MO" )
449 else if( daysOfTheWeek[i]=="TU" )
451 else if( daysOfTheWeek[i]=="WE" )
453 else if( daysOfTheWeek[i]=="TH" )
455 else if( daysOfTheWeek[i]=="FR" )
457 else if( daysOfTheWeek[i]=="SA" )
462 void EventWrapper::setRecurrenceRuleToPlatformEvent()
465 if (!m_platformEvent) {
466 ThrowMsg(UnknownException, "Null platform pointer.");
470 EventRecurrenceRulePtr rrule = m_abstractEvent->getRecurrenceRule();
472 LogInfo("rrule is not set.");
476 // set the recurrency frequency
477 switch (rrule->getFrequency()) {
478 case EventRecurrenceRule::NO_RECURRENCE:
479 ret = (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent,
480 CAL_VALUE_INT_REPEAT_TERM,
483 case EventRecurrenceRule::DAILY_RECURRENCE:
484 ret = (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent,
485 CAL_VALUE_INT_REPEAT_TERM,
486 CAL_REPEAT_EVERY_DAY));
488 case EventRecurrenceRule::WEEKLY_RECURRENCE:
490 char weekFlag[] = "0000000";
492 if( 0 != rrule->getDaysOfTheWeek().size() ) {
493 convertDaysOfTheWeekToFlag(rrule->getDaysOfTheWeek(), weekFlag);
495 time_t date = m_abstractEvent->getStartTime();
496 tm* time = localtime(&date);
498 LogError("localtime failed");
503 int days = time->tm_wday;
504 if (days < 0 || days > 6) {
505 LogError("invalid week day");
508 weekFlag[days] = '1';
511 ret = (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent,
512 CAL_VALUE_INT_REPEAT_TERM,
513 CAL_REPEAT_EVERY_WEEK))
515 (CAL_SUCCESS == calendar_svc_struct_set_str(m_platformEvent,
516 CAL_VALUE_TXT_WEEK_FLAG,
519 LogInfo("Applied weekFlag "<<weekFlag);
522 case EventRecurrenceRule::MONTHLY_ON_DAY_RECURRENCE:
524 char weekFlag[] = "0000000";
526 if( 0 != rrule->getDaysOfTheWeek().size() ) {
527 convertDaysOfTheWeekToFlag(rrule->getDaysOfTheWeek(), weekFlag);
529 time_t date = m_abstractEvent->getStartTime();
530 int days = localtime(&date)->tm_wday;
531 if (days < 0 || days > 6) {
532 LogError("invalid week day");
535 weekFlag[days] = '1';
539 ret = (CAL_SUCCESS == calendar_svc_struct_set_str(m_platformEvent,
540 CAL_VALUE_TXT_WEEK_FLAG,
542 LogInfo("Applied weekFlag "<<weekFlag);
545 case EventRecurrenceRule::MONTHLY_RECURRENCE:
547 char weekFlag[] = "0000000";
549 if( 0 != rrule->getDaysOfTheWeek().size() ) {
550 convertDaysOfTheWeekToFlag(rrule->getDaysOfTheWeek(), weekFlag);
552 time_t date = m_abstractEvent->getStartTime();
553 int days = localtime(&date)->tm_wday;
554 if (days < 0 || days > 6) {
555 LogError("invalid week day");
558 weekFlag[days] = '1';
562 ret = (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent,
563 CAL_VALUE_INT_REPEAT_TERM,
564 CAL_REPEAT_EVERY_MONTH))
566 (CAL_SUCCESS == calendar_svc_struct_set_str(m_platformEvent,
567 CAL_VALUE_TXT_WEEK_FLAG,
569 LogInfo("Applied weekFlag "<<weekFlag);
572 case EventRecurrenceRule::WEEKDAY_RECURRENCE:
574 ret = (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent,
575 CAL_VALUE_INT_REPEAT_TERM,
576 CAL_REPEAT_EVERY_WEEK))
578 (CAL_SUCCESS == calendar_svc_struct_set_str(m_platformEvent,
579 CAL_VALUE_TXT_WEEK_FLAG,
583 case EventRecurrenceRule::YEARLY_RECURRENCE:
585 char weekFlag[] = "0000000";
587 if( 0 != rrule->getDaysOfTheWeek().size() ) {
588 convertDaysOfTheWeekToFlag(rrule->getDaysOfTheWeek(), weekFlag);
590 time_t date = m_abstractEvent->getStartTime();
591 int days = localtime(&date)->tm_wday;
592 if (days < 0 || days > 6) {
593 LogError("invalid week day");
596 weekFlag[days] = '1';
600 ret = (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent,
601 CAL_VALUE_INT_REPEAT_TERM,
602 CAL_REPEAT_EVERY_YEAR))
604 (CAL_SUCCESS == calendar_svc_struct_set_str(m_platformEvent,
605 CAL_VALUE_TXT_WEEK_FLAG,
607 LogInfo("Applied weekFlag "<<weekFlag);
610 case EventRecurrenceRule::INVALID_RECURRENCE:
611 case EventRecurrenceRule::UNDEFINED_RECURRENCE:
613 LogError("invalid reccurence rule frequency " << rrule->getFrequency());
618 // set the recurrency interval
619 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
620 CAL_VALUE_INT_REPEAT_INTERVAL,
621 rrule->getInterval()))
623 ThrowMsg(PlatformException, "Can't set interval.");
627 // set the ocurrence count
628 if (-1 != rrule->getOccurrenceCount()) {
629 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
630 CAL_VALUE_INT_REPEAT_OCCURRENCES,
631 rrule->getOccurrenceCount()))
633 ThrowMsg(PlatformException, "Can't set occurrence count.");
637 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
638 CAL_VALUE_INT_REPEAT_OCCURRENCES,
641 ThrowMsg(PlatformException, "Can't set the ocurrence count.");
646 // set the recurrence end date
647 if (rrule->isEndDateSet()) {
648 if (CAL_SUCCESS != calendar_svc_struct_set_time(
650 CAL_VALUE_GMT_REPEAT_END_DATE,
652 m_abstractEvent->getRecurrenceRule()->getEndDate()))
654 ThrowMsg(PlatformException, "Can't set recurrence end date.");
658 // Platform needs default positive end date in the sql query statement for the recurrence event!
659 if (CAL_SUCCESS != calendar_svc_struct_set_time(
661 CAL_VALUE_GMT_REPEAT_END_DATE,
665 ThrowMsg(PlatformException, "Can't set recurrence end date.");
670 // set the exceptions
671 if ( !rrule->getExceptions().empty() )
673 LogInfo("Set the exceptions.");
675 calendar_svc_struct_get_list(m_platformEvent, CAL_VALUE_LST_EXCEPTION_DATE, &list);
677 for( unsigned int i=0; i<rrule->getExceptions().size(); i++ )
679 cal_value *value = calendar_svc_value_new(CAL_VALUE_LST_EXCEPTION_DATE);
680 if ( CAL_SUCCESS!=calendar_svc_value_set_time(value,
681 CAL_VALUE_GMT_EXCEPTION_DATE_TIME,
683 rrule->getExceptions().at(i)) ) {
685 calendar_svc_value_free(&value);
687 ThrowMsg(PlatformException, "cannot save the exception time event");
690 list = g_list_append(list, value);
692 if (CAL_SUCCESS!=calendar_svc_struct_store_list(m_platformEvent, CAL_VALUE_LST_EXCEPTION_DATE, list)) {
693 ThrowMsg(PlatformException, "cannot save the exceptions");
697 // "day_date" flag means the day of week by 0 and the date of month by 1 based on the start date,
698 // which takes effects in monthly/yearly repeat term.
699 if( true == rrule->getSetPosition() ) {
700 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
701 CAL_VALUE_INT_DAY_DATE,
704 ThrowMsg(PlatformException, "Can't set the day date.");
708 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
709 CAL_VALUE_INT_DAY_DATE,
712 ThrowMsg(PlatformException, "Can't set the day date.");
718 ThrowMsg(PlatformException, "Can't set event recurrence rule.");
722 void EventWrapper::setAlarmsToPlatformEvent()
724 if (!m_platformEvent) {
725 ThrowMsg(UnknownException, "Null platform pointer.");
728 if( 0 != m_abstractEvent->getAlarmsTick().size() ) {
729 LogInfo("Set the alarms.");
731 calendar_svc_struct_get_list(m_platformEvent, CAL_VALUE_LST_ALARM, &list);
733 for( unsigned int i=0; i<m_abstractEvent->getAlarmsTick().size(); i++ )
735 cal_value *value = calendar_svc_value_new(CAL_VALUE_LST_ALARM);
737 // We have to use alarm tick and tick unit for alarm creation.
738 int errorCode = calendar_svc_value_set_int(
740 CAL_VALUE_INT_ALARMS_TICK,
741 m_abstractEvent->getAlarmsTick().at(i));
742 if (CAL_SUCCESS != errorCode) {
744 calendar_svc_value_free(&value);
746 LogError("Can't set CAL_VALUE_INT_ALARMS_TICK, error: " << errorCode);
747 ThrowMsg(PlatformException, "Can't set alarm tick.");
749 errorCode = calendar_svc_value_set_int(
751 CAL_VALUE_INT_ALARMS_TICK_UNIT,
752 CAL_SCH_TIME_UNIT_MIN);
753 if (CAL_SUCCESS != errorCode) {
755 calendar_svc_value_free(&value);
757 LogError("Can't set CAL_VALUE_INT_ALARMS_TICK_UNIT, error: " << errorCode);
758 ThrowMsg(PlatformException, "Can't set alarm tick unit.");
761 // Set the alarm type.
762 cal_alert_type_t alarmType = CAL_ALERT_MELODY;
763 switch (m_abstractEvent->getAlarmsType().at(i)) {
764 case CalendarEvent::NO_ALARM:
765 alarmType = CAL_ALERT_MUTE;
767 case CalendarEvent::SOUND_ALARM:
768 alarmType = CAL_ALERT_MELODY;
770 case CalendarEvent::SILENT_ALARM:
771 alarmType = CAL_ALERT_VIBRATION;
774 LogDebug("Use the default alarm type");
777 errorCode = calendar_svc_value_set_int(
779 CAL_VALUE_INT_ALARMS_TYPE,
781 if (CAL_SUCCESS != errorCode) {
783 calendar_svc_value_free(&value);
785 LogError("Can't set CAL_VALUE_INT_ALARMS_TYPE, error: " << errorCode);
786 ThrowMsg(PlatformException, "Can't set alarm type.");
789 list = g_list_append(list, value);
792 if (CAL_SUCCESS!=calendar_svc_struct_store_list(m_platformEvent, CAL_VALUE_LST_ALARM, list)) {
793 ThrowMsg(PlatformException, "cannot save the alarms");
798 void EventWrapper::setStatusToPlatformEvent()
800 if (!m_platformEvent) {
801 ThrowMsg(UnknownException, "Null platform pointer.");
804 cals_status_t status = CALS_STATUS_NONE;
806 switch (m_abstractEvent->getStatus()) {
807 case CalendarEvent::TENTATIVE_STATUS:
808 status = CALS_EVENT_STATUS_TENTATIVE;
810 case CalendarEvent::CONFIRMED_STATUS:
811 status = CALS_EVENT_STATUS_CONFIRMED;
813 case CalendarEvent::CANCELLED_STATUS:
814 status = CALS_EVENT_STATUS_CANCELLED;
816 case CalendarEvent::NEEDS_ACTION_STATUS:
817 status = CALS_TODO_STATUS_NEEDS_ACTION;
819 case CalendarEvent::COMPLETED_STATUS:
820 status = CALS_TODO_STATUS_COMPLETED;
822 case CalendarEvent::IN_PROCESS_STATUS:
823 status = CALS_TODO_STATUS_IN_PROCESS;
826 status = CALS_STATUS_NONE;
830 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
831 CAL_VALUE_INT_TASK_STATUS,
833 ThrowMsg(PlatformException, "Can't set event status.");
837 void EventWrapper::setCategoriesToPlatformEvent()
839 if (!m_platformEvent) {
840 ThrowMsg(UnknownException, "Null platform pointer.");
842 GList *categoryList = NULL;
843 cal_value* category = NULL;
846 for (size_t i = 0; i < m_abstractEvent->getCategories()->size(); ++i) {
847 LogDebug("adding category " <<
848 m_abstractEvent->getCategories()->at(i));
849 category = calendar_svc_value_new(CAL_VALUE_LST_MEETING_CATEGORY);
850 if (NULL == category) {
851 LogError("error during creating category");
852 ThrowMsg(PlatformException,
853 "Cannot create category object");
856 calendar_svc_value_set_str(category, "category_name",
857 m_abstractEvent->getCategories()->at(
859 LogError("error during setting category name");
860 calendar_svc_value_free(&category);
861 ThrowMsg(PlatformException, "Cannot set category name");
863 //Order of categories is lost during saving, so we don't need to reverse this list.
864 categoryList = g_list_prepend(categoryList, category);
867 calendar_svc_struct_store_list(m_platformEvent,
868 CAL_VALUE_LST_MEETING_CATEGORY,
871 Catch(PlatformException)
873 LogError("error during setting categories");
874 calendar_svc_struct_store_list(m_platformEvent,
875 CAL_VALUE_LST_MEETING_CATEGORY,
877 for (; categoryList; categoryList = g_list_next(categoryList)) {
878 category = static_cast<cal_value*>(categoryList->data);
879 calendar_svc_value_free(&category);
881 g_list_free(categoryList);
882 ReThrow(PlatformException);
886 void EventWrapper::setIDToPlatformEvent()
888 if (!m_platformEvent) {
889 ThrowMsg(UnknownException, "Null platform pointer.");
891 if (m_abstractEvent->getIdIsSet()) {
892 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
894 m_abstractEvent->getId()))
896 ThrowMsg(PlatformException, "Can't set event ID.");
899 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
902 ThrowMsg(PlatformException, "Can't set event ID.");
907 void EventWrapper::setIsAllDayToPlatformEvent()
909 if (!m_platformEvent) {
910 ThrowMsg(UnknownException, "Null platform pointer.");
912 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
913 CAL_VALUE_INT_ALL_DAY_EVENT,
914 m_abstractEvent->getIsAllDay())) {
915 ThrowMsg(PlatformException, "Can't set event isAllDay.");
919 void EventWrapper::setOrganizerToPlatformEvent()
921 if (!m_platformEvent) {
922 ThrowMsg(UnknownException, "Null platform pointer.");
924 if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformEvent,
925 CAL_VALUE_TXT_ORGANIZER_NAME,
926 m_abstractEvent->getOrganizer().c_str())) {
927 ThrowMsg(PlatformException, "Can't set event organizer.");
931 void EventWrapper::setLastModifiedDateToPlatformEvent()
933 if (!m_platformEvent) {
934 ThrowMsg(UnknownException, "Null platform pointer.");
937 time_t time = m_abstractEvent->getLastModifiedDate();
939 if (CAL_SUCCESS != calendar_svc_struct_set_time(m_platformEvent,
940 CAL_VALUE_GMT_LAST_MODIFIED_TIME,
941 CAL_TZ_FLAG_GMT, time)) {
942 ThrowMsg(PlatformException, "Can't set event lastModifiedDate.");
946 void EventWrapper::setVisibilityToPlatformEvent()
948 if (!m_platformEvent) {
949 ThrowMsg(UnknownException, "Null platform pointer.");
952 int visibility = PUBLIC_VISIBILITY; // default value
953 switch (m_abstractEvent->getVisibility()) {
954 case CalendarEvent::PUBLIC_VISIBILITY:
955 visibility = PUBLIC_VISIBILITY;
957 case CalendarEvent::PRIVATE_VISIBILITY:
958 visibility = PRIVATE_VISIBILITY;
960 case CalendarEvent::CONFIDENTIAL_VISIBILITY:
961 visibility = CONFIDENTIAL_VISIBILITY;
964 LogDebug("Use the default visibility");
967 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
968 CAL_VALUE_INT_SENSITIVITY,
970 ThrowMsg(PlatformException, "Can't set visibility.");
974 void EventWrapper::setAvailabilityToPlatformEvent()
976 if (!m_platformEvent) {
977 ThrowMsg(UnknownException, "Null platform pointer.");
980 cal_event_availability_type_t availability = EVENT_FREE_FB;
981 switch (m_abstractEvent->getAvailability()) {
982 case CalendarEvent::BUSY_FB:
983 availability = EVENT_BUSY_FB;
985 case CalendarEvent::BUSY_UNAVAILABLE_FB:
986 availability = EVENT_BUSY_UNAVAILABLE_FB;
988 case CalendarEvent::FREE_FB:
989 availability = EVENT_FREE_FB;
991 case CalendarEvent::BUSY_TENTATIVE_FB:
992 availability = EVENT_BUSY_TENTATIVE_FB;
995 LogDebug("Use the default availability");
998 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
999 CAL_VALUE_INT_AVAILABILITY,
1001 ThrowMsg(PlatformException, "Can't set availability.");
1005 void EventWrapper::setUIdToPlatformEvent()
1007 if (!m_platformEvent) {
1008 ThrowMsg(UnknownException, "Null platform pointer.");
1010 if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformEvent,
1012 m_abstractEvent->getUId().c_str())) {
1013 ThrowMsg(PlatformException, "Can't set event uid.");
1017 void EventWrapper::setAttendeesToPlatformEvent()
1019 if (!m_platformEvent) {
1020 ThrowMsg(UnknownException, "Null platform pointer.");
1023 EventAttendeeListPtr attendeeList = m_abstractEvent->getAttendees();
1024 if (NULL==attendeeList) {
1025 LogInfo("attendeeList is not set.");
1029 GList *attendees = NULL;
1030 cal_value* attendee = NULL;
1033 for (size_t i = 0; i < attendeeList->size(); ++i) {
1034 LogDebug("adding attendee " << i+1 << " over " <<
1035 attendeeList->size());
1037 attendee = calendar_svc_value_new(CAL_VALUE_LST_ATTENDEE_LIST);
1038 if (NULL == attendee) {
1039 LogError("error during creating attendee");
1040 ThrowMsg(PlatformException,
1041 "Cannot create attendee object");
1046 calendar_svc_value_set_str(attendee, CAL_VALUE_TXT_ATTENDEE_DETAIL_NAME,
1047 attendeeList->at(i)->getName().c_str())) {
1048 LogError("error during setting attendee name");
1049 calendar_svc_value_free(&attendee);
1050 ThrowMsg(PlatformException, "Cannot set attendee name");
1055 calendar_svc_value_set_str(attendee, CAL_VALUE_TXT_ATTENDEE_DETAIL_EMAIL,
1056 attendeeList->at(i)->getURI().c_str())) {
1057 LogError("error during setting attendee URI");
1058 calendar_svc_value_free(&attendee);
1059 ThrowMsg(PlatformException, "Cannot set attendee URI");
1063 cal_event_attendee_role_type_t role = EVENT_ATTENDEE_CHAIR_ROLE;
1064 switch (attendeeList->at(i)->getRole()) {
1065 case EventAttendee::REQ_PARTICIPANT_ROLE:
1066 role = EVENT_ATTENDEE_REQ_PARTICIPANT_ROLE;
1068 case EventAttendee::OPT_PARTICIPANT_ROLE:
1069 role = EVENT_ATTENDEE_OPT_PARTICIPANT_ROLE;
1071 case EventAttendee::NON_PARTICIPANT_ROLE:
1072 role = EVENT_ATTENDEE_NON_PARTICIPANT_ROLE;
1074 case EventAttendee::CHAIR_ROLE:
1075 role = EVENT_ATTENDEE_CHAIR_ROLE;
1078 LogDebug("Use the default role");
1082 calendar_svc_value_set_int(attendee, CAL_VALUE_INT_ATTENDEE_ROLE,
1084 LogError("error during setting attendee role");
1085 calendar_svc_value_free(&attendee);
1086 ThrowMsg(PlatformException, "Cannot set attendee role");
1090 cal_event_attendee_status_type_t status = EVENT_ATTENDEE_PENDING_AT_STATUS;
1091 switch (attendeeList->at(i)->getStatus()) {
1092 case EventAttendee::PENDING_AT_STATUS:
1093 status = EVENT_ATTENDEE_PENDING_AT_STATUS;
1095 case EventAttendee::ACCEPTED_AT_STATUS:
1096 status = EVENT_ATTENDEE_ACCEPTED_AT_STATUS;
1098 case EventAttendee::DECLINED_AT_STATUS:
1099 status = EVENT_ATTENDEE_DECLINED_AT_STATUS;
1101 case EventAttendee::TENTATIVE_AT_STATUS:
1102 status = EVENT_ATTENDEE_TENTATIVE_AT_STATUS;
1104 case EventAttendee::DELEGATED_AT_STATUS:
1105 status = EVENT_ATTENDEE_DELEGATED_AT_STATUS;
1107 case EventAttendee::COMPLETED_AT_STATUS:
1108 status = EVENT_ATTENDEE_COMPLETED_AT_STATUS;
1110 case EventAttendee::IN_PROCESS_AT_STATUS:
1111 status = EVENT_ATTENDEE_IN_PROCESS_AT_STATUS;
1114 LogDebug("Use the default status");
1118 calendar_svc_value_set_int(attendee, CAL_VALUE_INT_ATTENDEE_DETAIL_STATUS,
1120 LogError("error during setting attendee status");
1121 calendar_svc_value_free(&attendee);
1122 ThrowMsg(PlatformException, "Cannot set attendee status");
1127 calendar_svc_value_set_int(attendee, CAL_VALUE_INT_ATTENDEE_RSVP,
1128 attendeeList->at(i)->getRSVP())) {
1129 LogError("error during setting attendee RSVP");
1130 calendar_svc_value_free(&attendee);
1131 ThrowMsg(PlatformException, "Cannot set attendee RSVP");
1135 cal_event_attendee_type_t type = EVENT_ATTENDEE_INDIVIDUAL_TYPE;
1136 switch (attendeeList->at(i)->getType()) {
1137 case EventAttendee::INDIVIDUAL_TYPE:
1138 type = EVENT_ATTENDEE_INDIVIDUAL_TYPE;
1140 case EventAttendee::GROUP_TYPE:
1141 type = EVENT_ATTENDEE_GROUP_TYPE;
1143 case EventAttendee::RESOURCE_TYPE:
1144 type = EVENT_ATTENDEE_RESOURCE_TYPE;
1146 case EventAttendee::ROOM_TYPE:
1147 type = EVENT_ATTENDEE_ROOM_TYPE;
1149 case EventAttendee::UNKNOWN_TYPE:
1150 type = EVENT_ATTENDEE_UNKNOWN_TYPE;
1153 LogDebug("Use the default type");
1157 calendar_svc_value_set_int(attendee, CAL_VALUE_INT_ATTENDEE_DETAIL_TYPE,
1159 LogError("error during setting attendee type");
1160 calendar_svc_value_free(&attendee);
1161 ThrowMsg(PlatformException, "Cannot set attendee type");
1166 calendar_svc_value_set_str(attendee, CAL_VALUE_TXT_ATTENDEE_GROUP,
1167 attendeeList->at(i)->getGroup().c_str())) {
1168 LogError("error during setting attendee group");
1169 calendar_svc_value_free(&attendee);
1170 ThrowMsg(PlatformException, "Cannot set attendee group");
1173 // save delegatorURI
1175 calendar_svc_value_set_str(attendee, CAL_VALUE_TXT_ATTENDEE_DELEGATOR_URI,
1176 attendeeList->at(i)->getDelegatorURI().c_str())) {
1177 LogError("error during setting attendee delegator uri");
1178 calendar_svc_value_free(&attendee);
1179 ThrowMsg(PlatformException, "Cannot set attendee delegator uri");
1184 calendar_svc_value_set_str(attendee, CAL_VALUE_TXT_ATTENDEE_DELEGATE_URI,
1185 attendeeList->at(i)->getDelegateURI().c_str())) {
1186 LogError("error during setting attendee delegate uri");
1187 calendar_svc_value_free(&attendee);
1188 ThrowMsg(PlatformException, "Cannot set attendee delegate uri");
1193 calendar_svc_value_set_str(attendee, CAL_VALUE_TXT_ATTENDEE_UID,
1194 attendeeList->at(i)->getPersonId().c_str())) {
1195 LogError("error during setting attendee uid");
1196 calendar_svc_value_free(&attendee);
1197 ThrowMsg(PlatformException, "Cannot set attendee uid");
1200 attendees = g_list_append(attendees, attendee);
1203 LogDebug("m_abstractEvent->getAttendees()->size() " << attendeeList->size());
1205 calendar_svc_struct_store_list(m_platformEvent,
1206 CAL_VALUE_LST_ATTENDEE_LIST,
1209 Catch(PlatformException)
1211 LogError("error during setting attendees");
1212 calendar_svc_struct_store_list(m_platformEvent,
1213 CAL_VALUE_LST_ATTENDEE_LIST,
1215 for (; attendees; attendees = g_list_next(attendees)) {
1216 attendee = static_cast<cal_value*>(attendees->data);
1217 calendar_svc_value_free(&attendee);
1219 g_list_free(attendees);
1220 ReThrow(PlatformException);
1224 void EventWrapper::setPositionToPlatformEvent()
1226 if (!m_platformEvent) {
1227 ThrowMsg(UnknownException, "Null platform pointer.");
1230 if (CAL_SUCCESS != calendar_svc_struct_set_double(m_platformEvent,
1231 CAL_VALUE_DBL_LATITUDE,
1232 m_abstractEvent->getGeolocation()->getLatitude())) {
1233 ThrowMsg(PlatformException, "Can't set latitude.");
1236 if (CAL_SUCCESS != calendar_svc_struct_set_double(m_platformEvent,
1237 CAL_VALUE_DBL_LONGITUDE,
1238 m_abstractEvent->getGeolocation()->getLongitude())) {
1239 ThrowMsg(PlatformException, "Can't set longitude.");
1243 void EventWrapper::setPriorityToPlatformEvent()
1245 if (!m_platformEvent) {
1246 ThrowMsg(UnknownException, "Null platform pointer.");
1249 cal_priority_type_t priority = (cal_priority_type_t)-1;
1251 switch (m_abstractEvent->getPriority()) {
1252 case CalendarEvent::HIGH_PRIORITY:
1253 priority = EVENT_PRIORITY_HIGH;
1255 case CalendarEvent::MEDIUM_PRIORITY:
1256 priority = EVENT_PRIORITY_NORMAL;
1258 case CalendarEvent::LOW_PRIORITY:
1259 priority = EVENT_PRIORITY_LOW;
1265 if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
1266 CAL_VALUE_INT_PRIORITY,
1269 ThrowMsg(PlatformException, "Can't set task priority.");
1273 void EventWrapper::setCreatedDateToPlatformEvent()
1275 if (!m_platformEvent) {
1276 ThrowMsg(UnknownException, "Null platform pointer.");
1279 // calendar F/W not supported
1280 // time_t time = m_abstractEvent->getCreatedDate();
1281 // if (CAL_SUCCESS != calendar_svc_struct_set_time(m_platformTask,
1282 // CAL_VALUE_GMT_CREATED_DATE_TIME,
1285 // ThrowMsg(PlatformException, "Can't set created time.");
1289 void EventWrapper::setCompletedDateToPlatformEvent()
1291 if (!m_platformEvent) {
1292 ThrowMsg(UnknownException, "Null platform pointer.");
1295 // calendar F/W not supported
1296 // time_t time = m_abstractEvent->getCompletedDate();
1297 // if (CAL_SUCCESS != calendar_svc_struct_set_time(m_platformEvent,
1298 // CAL_VALUE_GMT_COMPLETED_DATE_TIME,
1301 // ThrowMsg(PlatformException, "Can't set task completed time.");
1305 void EventWrapper::setProgressToPlatformEvent()
1307 if (!m_platformEvent) {
1308 ThrowMsg(UnknownException, "Null platform pointer.");
1311 // int progress = m_abstractEvent->getProgress();
1313 // if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent,
1314 // CAL_VALUE_INT_PROGRESS,
1316 // ThrowMsg(PlatformException, "Can't set visibility.");
1320 CalendarEventPtr EventWrapper::convertPlatformEventToAbstractEvent()
1322 LogDebug("entered");
1323 setDescriptionFromPlatformEvent();
1324 setSummaryFromPlatformEvent();
1325 setStartTimeFromPlatformEvent();
1326 setEndTimeFromPlatformEvent(); // replace for duration
1327 setLocationFromPlatformEvent();
1328 setCategoriesFromPlatformEvent();
1329 setStatusFromPlatformEvent();
1330 setAlarmsFromPlatformEvent();
1331 setIsAllDayFromPlatformEvent();
1332 setOrganizerFromPlatformEvent();
1333 setAttendeesFromPlatformEvent();
1334 setPositionFromPlatformEvent();
1335 setVisibilityFromPlatformEvent();
1336 setLastModifiedDateFromPlatformEvent();
1337 setAvailabilityFromPlatformEvent();
1338 setRecurrenceRuleFromPlatformEvent();
1339 setIDFromPlatformEvent();
1340 //setUIdFromPlatformEvent(); // We set the uid value as the same with id.
1341 //setRecurrenceIdFromPlatformEvent();
1342 setPriorityFromPlatformEvent();
1343 setCreatedDateFromPlatformEvent();
1344 setCompletedDateFromPlatformEvent();
1345 setProgressFromPlatformEvent();
1347 return getAbstractEvent();
1350 void EventWrapper::setDescriptionFromPlatformEvent()
1352 if (!m_platformEvent) {
1353 ThrowMsg(UnknownException, "Null platform pointer.");
1355 const char *description = calendar_svc_struct_get_str(
1357 CAL_VALUE_TXT_DESCRIPTION);
1359 m_abstractEvent->setDescription(description);
1363 void EventWrapper::setSummaryFromPlatformEvent()
1365 if (!m_platformEvent) {
1366 ThrowMsg(UnknownException, "Null platform pointer.");
1368 const char *summary = calendar_svc_struct_get_str(m_platformEvent,
1369 CAL_VALUE_TXT_SUMMARY);
1371 m_abstractEvent->setSubject(summary);
1375 void EventWrapper::setStartTimeFromPlatformEvent()
1377 if (!m_platformEvent) {
1378 ThrowMsg(UnknownException, "Null platform pointer.");
1380 time_t startTime = calendar_svc_struct_get_time(
1382 CAL_VALUE_GMT_START_DATE_TIME,
1384 m_abstractEvent->setStartTime(startTime);
1386 // Retrive the time zone info only when the start time is loaded.
1387 char* timeZone = calendar_svc_struct_get_str(
1389 CAL_VALUE_TXT_TZ_NAME);
1391 m_abstractEvent->setTimeZone(std::string(timeZone));
1395 void EventWrapper::setEndTimeFromPlatformEvent()
1397 if (!m_platformEvent) {
1398 ThrowMsg(UnknownException, "Null platform pointer.");
1400 time_t endTime = calendar_svc_struct_get_time(m_platformEvent,
1401 CAL_VALUE_GMT_END_DATE_TIME,
1403 m_abstractEvent->setEndTime(endTime);
1406 void EventWrapper::setLocationFromPlatformEvent()
1408 if (!m_platformEvent) {
1409 ThrowMsg(UnknownException, "Null platform pointer.");
1411 const char* location = calendar_svc_struct_get_str(m_platformEvent,
1412 CAL_VALUE_TXT_LOCATION);
1414 m_abstractEvent->setLocation(location);
1418 std::vector<std::string> convertFlagToDaysOfTheWeek(const char *daysFlag)
1420 if( strlen(daysFlag)<7 )
1421 LogError("daysFlag is too short!");
1423 std::vector<std::string> daysOfTheWeek;
1425 if( daysFlag[0]=='1' )
1426 daysOfTheWeek.push_back("SU");
1427 if( daysFlag[1]=='1' )
1428 daysOfTheWeek.push_back("MO");
1429 if( daysFlag[2]=='1' )
1430 daysOfTheWeek.push_back("TU");
1431 if( daysFlag[3]=='1' )
1432 daysOfTheWeek.push_back("WE");
1433 if( daysFlag[4]=='1' )
1434 daysOfTheWeek.push_back("TH");
1435 if( daysFlag[5]=='1' )
1436 daysOfTheWeek.push_back("FR");
1437 if( daysFlag[6]=='1' )
1438 daysOfTheWeek.push_back("SA");
1440 return daysOfTheWeek;
1443 void EventWrapper::setRecurrenceRuleFromPlatformEvent()
1445 if (!m_platformEvent) {
1446 ThrowMsg(UnknownException, "Null platform pointer.");
1449 EventRecurrenceRulePtr rrule(new EventRecurrenceRule());
1451 // load the recurrence frequency and daysOfTheWeek
1452 int frequency = calendar_svc_struct_get_int(m_platformEvent,
1453 CAL_VALUE_INT_REPEAT_TERM);
1454 LogInfo("frequency "<<frequency);
1455 switch (frequency) {
1456 case CAL_REPEAT_NONE:
1457 rrule->setFrequency(EventRecurrenceRule::NO_RECURRENCE);
1459 case CAL_REPEAT_EVERY_DAY:
1460 rrule->setFrequency(EventRecurrenceRule::DAILY_RECURRENCE);
1462 case CAL_REPEAT_EVERY_WEEK:
1464 const char *daysFlag = calendar_svc_struct_get_str(
1466 CAL_VALUE_TXT_WEEK_FLAG);
1467 if (daysFlag && strncmp(daysFlag, WEEKDAYS, 7) == 0) {
1468 rrule->setFrequency(EventRecurrenceRule::WEEKDAY_RECURRENCE);
1470 rrule->setFrequency(EventRecurrenceRule::WEEKLY_RECURRENCE);
1473 std::vector<std::string> daysOfTheWeek = convertFlagToDaysOfTheWeek(daysFlag);
1474 rrule->setDaysOfTheWeek(daysOfTheWeek);
1477 case CAL_REPEAT_EVERY_MONTH:
1479 const char *daysFlag = calendar_svc_struct_get_str(
1481 CAL_VALUE_TXT_WEEK_FLAG);
1482 if (!daysFlag || strnlen(daysFlag, 7) == 0) {
1483 rrule->setFrequency(EventRecurrenceRule::MONTHLY_RECURRENCE);
1485 rrule->setFrequency(EventRecurrenceRule::MONTHLY_ON_DAY_RECURRENCE);
1488 std::vector<std::string> daysOfTheWeek = convertFlagToDaysOfTheWeek(daysFlag);
1489 rrule->setDaysOfTheWeek(daysOfTheWeek);
1492 case CAL_REPEAT_EVERY_YEAR:
1494 const char *daysFlag = calendar_svc_struct_get_str(
1496 CAL_VALUE_TXT_WEEK_FLAG);
1497 rrule->setFrequency(EventRecurrenceRule::YEARLY_RECURRENCE);
1499 std::vector<std::string> daysOfTheWeek = convertFlagToDaysOfTheWeek(daysFlag);
1500 rrule->setDaysOfTheWeek(daysOfTheWeek);
1504 LogWarning("unknown recurrence");
1505 rrule->setFrequency(EventRecurrenceRule::NO_RECURRENCE);
1509 // load the recurrence interval
1510 int interval = calendar_svc_struct_get_int(m_platformEvent,
1511 CAL_VALUE_INT_REPEAT_INTERVAL);
1512 rrule->setInterval(interval);
1514 // load the ocurrence count
1515 int occurrrenceCount = calendar_svc_struct_get_int(m_platformEvent,
1516 CAL_VALUE_INT_REPEAT_OCCURRENCES);
1517 rrule->setOccurrenceCount(occurrrenceCount);
1519 // load the recurrence end date
1520 time_t endDate = calendar_svc_struct_get_time(m_platformEvent,
1521 CAL_VALUE_GMT_REPEAT_END_DATE,
1523 rrule->setEndDate(endDate);
1525 // load the exceptions
1526 rrule->getExceptions().clear();
1527 GList* exceptionList = NULL;
1528 calendar_svc_struct_get_list(m_platformEvent, CAL_VALUE_LST_EXCEPTION_DATE, &exceptionList);
1529 cal_value* exceptionValue = NULL;
1530 for (; exceptionList; exceptionList = g_list_next(exceptionList)) {
1531 exceptionValue = static_cast<cal_value*>(exceptionList->data);
1532 std::time_t exceptoinTime = calendar_svc_value_get_time(exceptionValue,
1533 CAL_VALUE_GMT_EXCEPTION_DATE_TIME,
1535 if (CAL_ERR_FAIL == exceptoinTime) {
1536 LogError("cannot read exceptoin time");
1539 rrule->getExceptions().push_back(exceptoinTime);
1542 // load the setPosition
1543 int day_date = calendar_svc_struct_get_int(m_platformEvent,
1544 CAL_VALUE_INT_DAY_DATE);
1545 if( 0 == day_date ) {
1546 rrule->setSetPosition(true);
1548 rrule->setSetPosition(false);
1551 // set the loaded recurrence rule
1552 m_abstractEvent->setRecurrenceRule(rrule);
1555 void EventWrapper::setAlarmsFromPlatformEvent()
1557 if (!m_platformEvent) {
1558 ThrowMsg(UnknownException, "Null platform pointer.");
1561 GList* alarmList = NULL;
1562 calendar_svc_struct_get_list(m_platformEvent, CAL_VALUE_LST_ALARM, &alarmList);
1563 cal_value* alarmValue = NULL;
1564 for (; alarmList; alarmList = g_list_next(alarmList)) {
1565 alarmValue = static_cast<cal_value*>(alarmList->data);
1567 int tick = calendar_svc_value_get_int(alarmValue, CAL_VALUE_INT_ALARMS_TICK);
1568 if (CAL_ERR_FAIL == tick) {
1569 LogError("cannot read alarm tick");
1572 m_abstractEvent->getAlarmsTick().push_back(tick);
1574 cal_alert_type_t type = static_cast<cal_alert_type_t>(calendar_svc_value_get_int(alarmValue, CAL_VALUE_INT_ALARMS_TYPE));
1576 LogError("cannot read alarm type");
1580 case CAL_ALERT_VIBRATION:
1581 m_abstractEvent->getAlarmsType().push_back(CalendarEvent::SILENT_ALARM);
1583 case CAL_ALERT_MELODY:
1584 case CAL_ALERT_INCREASING_MELODY:
1585 case CAL_ALERT_VIBRATION_THEN_MELODY:
1586 case CAL_ALERT_VIBMELODY:
1587 case CAL_ALERT_VIB_INCREASING_MELODY:
1588 m_abstractEvent->getAlarmsType().push_back(CalendarEvent::SOUND_ALARM);
1590 case CAL_ALERT_MUTE:
1592 m_abstractEvent->getAlarmsType().push_back(CalendarEvent::NO_ALARM);
1598 void EventWrapper::setStatusFromPlatformEvent()
1600 if (!m_platformEvent) {
1601 ThrowMsg(UnknownException, "Null platform pointer.");
1604 cals_status_t status = static_cast<cals_status_t>(calendar_svc_struct_get_int(m_platformEvent,
1605 CAL_VALUE_INT_TASK_STATUS));
1607 case CALS_EVENT_STATUS_TENTATIVE:
1608 m_abstractEvent->setStatus(CalendarEvent::TENTATIVE_STATUS);
1610 case CALS_EVENT_STATUS_CONFIRMED:
1611 m_abstractEvent->setStatus(CalendarEvent::CONFIRMED_STATUS);
1613 case CALS_EVENT_STATUS_CANCELLED:
1614 case CALS_TODO_STATUS_CANCELLED:
1615 m_abstractEvent->setStatus(CalendarEvent::CANCELLED_STATUS);
1617 case CALS_TODO_STATUS_NEEDS_ACTION:
1618 m_abstractEvent->setStatus(CalendarEvent::NEEDS_ACTION_STATUS);
1620 case CALS_TODO_STATUS_COMPLETED:
1621 m_abstractEvent->setStatus(CalendarEvent::COMPLETED_STATUS);
1623 case CALS_TODO_STATUS_IN_PROCESS:
1624 m_abstractEvent->setStatus(CalendarEvent::IN_PROCESS_STATUS);
1627 m_abstractEvent->setStatus(CalendarEvent::UNDEFINED_STATUS);
1632 void EventWrapper::setCategoriesFromPlatformEvent()
1634 if (!m_platformEvent) {
1635 ThrowMsg(UnknownException, "Null platform pointer.");
1637 m_abstractEvent->getCategories()->clear();
1638 GList *categoryList = NULL;
1640 calendar_svc_struct_get_list(m_platformEvent,
1641 CAL_VALUE_LST_MEETING_CATEGORY,
1643 LogError("cannot read category list");
1646 cal_value* category = NULL;
1647 for (; categoryList; categoryList = g_list_next(categoryList)) {
1648 category = static_cast<cal_value*>(categoryList->data);
1649 char* categoryName = calendar_svc_value_get_str(category,
1651 if (NULL == categoryName) {
1652 LogError("cannot read category name");
1655 m_abstractEvent->getCategories()->push_back(categoryName);
1659 void EventWrapper::setIDFromPlatformEvent()
1661 if (!m_platformEvent) {
1662 ThrowMsg(UnknownException, "Null platform pointer.");
1664 m_abstractEvent->setId(getIDFromPlatformEvent());
1666 // Set the uid here.
1667 std::stringstream ss;
1668 ss<<getIDFromPlatformEvent();
1669 m_abstractEvent->setUId(ss.str());
1672 void EventWrapper::setIsAllDayFromPlatformEvent()
1674 if (!m_platformEvent) {
1675 ThrowMsg(UnknownException, "Null platform pointer.");
1678 int isAllDay = calendar_svc_struct_get_int(m_platformEvent,
1679 CAL_VALUE_INT_ALL_DAY_EVENT);
1680 m_abstractEvent->setIsAllDay(isAllDay);
1683 void EventWrapper::setOrganizerFromPlatformEvent()
1685 if (!m_platformEvent) {
1686 ThrowMsg(UnknownException, "Null platform pointer.");
1688 const char* organizer = calendar_svc_struct_get_str(m_platformEvent,
1689 CAL_VALUE_TXT_ORGANIZER_NAME);
1691 m_abstractEvent->setOrganizer(organizer);
1695 void EventWrapper::setLastModifiedDateFromPlatformEvent()
1697 if (!m_platformEvent) {
1698 ThrowMsg(UnknownException, "Null platform pointer.");
1700 time_t lastModifiedDate = calendar_svc_struct_get_time(
1702 CAL_VALUE_GMT_LAST_MODIFIED_TIME,
1704 m_abstractEvent->setLastModifiedDate(lastModifiedDate);
1707 void EventWrapper::setVisibilityFromPlatformEvent()
1709 if (!m_platformEvent) {
1710 ThrowMsg(UnknownException, "Null platform pointer.");
1713 int visibility = calendar_svc_struct_get_int(m_platformEvent,
1714 CAL_VALUE_INT_SENSITIVITY);
1715 switch (visibility) {
1716 case PUBLIC_VISIBILITY:
1717 m_abstractEvent->setVisibility(CalendarEvent::PUBLIC_VISIBILITY);
1719 case PRIVATE_VISIBILITY:
1720 m_abstractEvent->setVisibility(CalendarEvent::PRIVATE_VISIBILITY);
1722 case CONFIDENTIAL_VISIBILITY:
1723 m_abstractEvent->setVisibility(CalendarEvent::CONFIDENTIAL_VISIBILITY);
1726 m_abstractEvent->setVisibility(CalendarEvent::PUBLIC_VISIBILITY);
1731 void EventWrapper::setAvailabilityFromPlatformEvent()
1733 if (!m_platformEvent) {
1734 ThrowMsg(UnknownException, "Null platform pointer.");
1737 cal_status_type_t availability =
1738 static_cast<cal_status_type_t>(calendar_svc_struct_get_int(
1740 CAL_VALUE_INT_AVAILABILITY));
1741 switch (availability) {
1743 m_abstractEvent->setAvailability(CalendarEvent::BUSY_FB);
1745 case EVENT_BUSY_UNAVAILABLE_FB:
1746 m_abstractEvent->setAvailability(CalendarEvent::BUSY_UNAVAILABLE_FB);
1749 m_abstractEvent->setAvailability(CalendarEvent::FREE_FB);
1751 case EVENT_BUSY_TENTATIVE_FB:
1752 m_abstractEvent->setAvailability(CalendarEvent::BUSY_TENTATIVE_FB);
1755 m_abstractEvent->setAvailability(CalendarEvent::FREE_FB);
1760 void EventWrapper::setUIdFromPlatformEvent()
1762 if (!m_platformEvent) {
1763 ThrowMsg(UnknownException, "Null platform pointer.");
1765 const char* uid = calendar_svc_struct_get_str(m_platformEvent,
1768 m_abstractEvent->setUId(uid);
1772 void EventWrapper::setRecurrenceIdFromPlatformEvent()
1774 if (!m_platformEvent) {
1775 ThrowMsg(UnknownException, "Null platform pointer.");
1778 if( (EventRecurrenceRule::DAILY_RECURRENCE <= m_abstractEvent->getRecurrenceRule()->getFrequency() && m_abstractEvent->getRecurrenceRule()->getFrequency() <= EventRecurrenceRule::MONTHLY_ON_DAY_RECURRENCE) ) {
1779 time_t recurrenceID = calendar_svc_struct_get_time(
1781 CAL_VALUE_GMT_START_DATE_TIME,
1783 m_abstractEvent->setRecurrenceId(recurrenceID);
1785 m_abstractEvent->setRecurrenceId(0);
1789 void EventWrapper::setAttendeesFromPlatformEvent()
1791 LogDebug("entered");
1793 if (!m_platformEvent) {
1794 ThrowMsg(UnknownException, "Null platform pointer.");
1797 if ( NULL != m_abstractEvent->getAttendees() )
1798 m_abstractEvent->getAttendees()->clear();
1800 GList *attendees = NULL;
1802 calendar_svc_struct_get_list(m_platformEvent,
1803 CAL_VALUE_LST_ATTENDEE_LIST,
1805 LogError("cannot read attendees list");
1808 cal_value* attendee = NULL;
1809 for (; attendees; attendees = g_list_next(attendees)) {
1810 attendee = static_cast<cal_value*>(attendees->data);
1811 EventAttendeePtr attendeePtr(new EventAttendee());
1814 char* attendeeName = calendar_svc_value_get_str(attendee, CAL_VALUE_TXT_ATTENDEE_DETAIL_NAME);
1815 if (NULL == attendeeName) {
1816 LogError("cannot read attendee name");
1819 attendeePtr->setName(attendeeName);
1822 char* attendeeURI = calendar_svc_value_get_str(attendee, CAL_VALUE_TXT_ATTENDEE_DETAIL_EMAIL);
1823 if (NULL == attendeeURI) {
1824 LogError("cannot read attendee URI");
1827 attendeePtr->setURI(attendeeURI);
1830 cal_event_attendee_role_type_t attendeeRole =
1831 static_cast<cal_event_attendee_role_type_t>(calendar_svc_struct_get_int(
1833 CAL_VALUE_INT_ATTENDEE_ROLE));
1834 if (0 > attendeeRole) {
1835 LogError("cannot read attendee role");
1838 switch (attendeeRole) {
1839 case EVENT_ATTENDEE_REQ_PARTICIPANT_ROLE:
1840 attendeePtr->setRole(EventAttendee::REQ_PARTICIPANT_ROLE);
1842 case EVENT_ATTENDEE_OPT_PARTICIPANT_ROLE:
1843 attendeePtr->setRole(EventAttendee::OPT_PARTICIPANT_ROLE);
1845 case EVENT_ATTENDEE_NON_PARTICIPANT_ROLE:
1846 attendeePtr->setRole(EventAttendee::NON_PARTICIPANT_ROLE);
1848 case EVENT_ATTENDEE_CHAIR_ROLE:
1849 attendeePtr->setRole(EventAttendee::CHAIR_ROLE);
1852 attendeePtr->setRole(EventAttendee::CHAIR_ROLE);
1857 cal_event_attendee_status_type_t attendeeStatus =
1858 static_cast<cal_event_attendee_status_type_t>(calendar_svc_struct_get_int(
1860 CAL_VALUE_INT_ATTENDEE_DETAIL_STATUS));
1861 if (0 > attendeeStatus) {
1862 LogError("cannot read attendee status");
1865 switch (attendeeStatus) {
1866 case EVENT_ATTENDEE_PENDING_AT_STATUS:
1867 attendeePtr->setStatus(EventAttendee::PENDING_AT_STATUS);
1869 case EVENT_ATTENDEE_ACCEPTED_AT_STATUS:
1870 attendeePtr->setStatus(EventAttendee::ACCEPTED_AT_STATUS);
1872 case EVENT_ATTENDEE_DECLINED_AT_STATUS:
1873 attendeePtr->setStatus(EventAttendee::DECLINED_AT_STATUS);
1875 case EVENT_ATTENDEE_TENTATIVE_AT_STATUS:
1876 attendeePtr->setStatus(EventAttendee::TENTATIVE_AT_STATUS);
1878 case EVENT_ATTENDEE_DELEGATED_AT_STATUS:
1879 attendeePtr->setStatus(EventAttendee::DELEGATED_AT_STATUS);
1881 case EVENT_ATTENDEE_COMPLETED_AT_STATUS:
1882 attendeePtr->setStatus(EventAttendee::COMPLETED_AT_STATUS);
1884 case EVENT_ATTENDEE_IN_PROCESS_AT_STATUS:
1885 attendeePtr->setStatus(EventAttendee::IN_PROCESS_AT_STATUS);
1888 attendeePtr->setStatus(EventAttendee::PENDING_AT_STATUS);
1893 int attendeeRSVP = calendar_svc_value_get_int(attendee, CAL_VALUE_INT_ATTENDEE_RSVP);
1894 if (0 > attendeeRSVP) {
1895 LogError("cannot read attendee RSVP");
1898 attendeePtr->setRSVP(attendeeRSVP>0 ? true : false);
1901 cal_event_attendee_type_t attendeeType =
1902 static_cast<cal_event_attendee_type_t>(calendar_svc_struct_get_int(
1904 CAL_VALUE_INT_ATTENDEE_DETAIL_TYPE));
1905 if (0 > attendeeType) {
1906 LogError("cannot read attendee type");
1909 switch (attendeeType) {
1910 case EVENT_ATTENDEE_INDIVIDUAL_TYPE:
1911 attendeePtr->setType(EventAttendee::INDIVIDUAL_TYPE);
1913 case EVENT_ATTENDEE_GROUP_TYPE:
1914 attendeePtr->setType(EventAttendee::GROUP_TYPE);
1916 case EVENT_ATTENDEE_RESOURCE_TYPE:
1917 attendeePtr->setType(EventAttendee::RESOURCE_TYPE);
1919 case EVENT_ATTENDEE_ROOM_TYPE:
1920 attendeePtr->setType(EventAttendee::ROOM_TYPE);
1922 case EVENT_ATTENDEE_UNKNOWN_TYPE:
1923 attendeePtr->setType(EventAttendee::UNKNOWN_TYPE);
1926 attendeePtr->setType(EventAttendee::INDIVIDUAL_TYPE);
1931 char* attendeeGroup = calendar_svc_value_get_str(attendee, CAL_VALUE_TXT_ATTENDEE_GROUP);
1932 if (NULL == attendeeGroup) {
1933 LogError("cannot read attendee group");
1936 attendeePtr->setGroup(attendeeGroup);
1938 // load delegatorURI
1939 char* attendeeDelegatorURI = calendar_svc_value_get_str(attendee, CAL_VALUE_TXT_ATTENDEE_DELEGATOR_URI);
1940 if (NULL == attendeeDelegatorURI) {
1941 LogError("cannot read attendee delegatorURI");
1944 attendeePtr->setDelegatorURI(attendeeDelegatorURI);
1947 char* attendeeDelegateURI = calendar_svc_value_get_str(attendee, CAL_VALUE_TXT_ATTENDEE_DELEGATE_URI);
1948 if (NULL == attendeeDelegateURI) {
1949 LogError("cannot read attendee delegateURI");
1952 attendeePtr->setDelegateURI(attendeeDelegateURI);
1955 char* attendeeUId = calendar_svc_value_get_str(attendee, CAL_VALUE_TXT_ATTENDEE_UID);
1956 if (NULL == attendeeUId) {
1957 LogError("cannot read attendee UId");
1960 attendeePtr->setPersonId(attendeeUId);
1962 m_abstractEvent->getAttendees()->push_back(attendeePtr);
1966 void EventWrapper::setPositionFromPlatformEvent()
1968 if (!m_platformEvent) {
1969 ThrowMsg(UnknownException, "Null platform pointer.");
1972 CalendarItemGeoPtr geoInfo(new CalendarItemGeo());
1974 double value = calendar_svc_struct_get_double(
1976 CAL_VALUE_DBL_LATITUDE);
1977 geoInfo->setLatitude(value);
1979 value = calendar_svc_struct_get_double(
1981 CAL_VALUE_DBL_LONGITUDE);
1982 geoInfo->setLongitude(value);
1984 m_abstractEvent->setGeolocation(geoInfo);
1987 void EventWrapper::setPriorityFromPlatformEvent()
1989 if (!m_platformEvent) {
1990 ThrowMsg(UnknownException, "Null platform pointer.");
1993 cal_priority_type_t priority = static_cast<cal_priority_type_t>(calendar_svc_struct_get_int(m_platformEvent,
1994 CAL_VALUE_INT_PRIORITY));
1996 case EVENT_PRIORITY_LOW:
1997 m_abstractEvent->setPriority(CalendarEvent::LOW_PRIORITY);
1999 case EVENT_PRIORITY_NORMAL:
2000 m_abstractEvent->setPriority(CalendarEvent::MEDIUM_PRIORITY);
2002 case EVENT_PRIORITY_HIGH:
2003 m_abstractEvent->setPriority(CalendarEvent::HIGH_PRIORITY);
2006 m_abstractEvent->setPriority(CalendarEvent::MEDIUM_PRIORITY);
2011 void EventWrapper::setCreatedDateFromPlatformEvent()
2013 if (!m_platformEvent) {
2014 ThrowMsg(UnknownException, "Null platform pointer.");
2017 std::time_t createdDate = 0;
2019 // calendar F/W not supported
2020 // time_t createdDate = calendar_svc_struct_get_time(m_platformEvent,
2021 // CAL_VALUE_GMT_CREATED_DATE_TIME,
2022 // CAL_TZ_FLAG_GMT);
2024 m_abstractEvent->setCreatedDate(createdDate);
2027 void EventWrapper::setCompletedDateFromPlatformEvent()
2029 if (!m_platformEvent) {
2030 ThrowMsg(UnknownException, "Null platform pointer.");
2033 std::time_t completedDate = 0;
2035 // calendar F/W not supported
2036 // time_t completedDate = calendar_svc_struct_get_time(m_platformEvent,
2037 // CAL_VALUE_GMT_COMPLETED_DATE_TIME,
2038 // CAL_TZ_FLAG_GMT);
2040 m_abstractEvent->setCompletedDate(completedDate);
2043 void EventWrapper::setProgressFromPlatformEvent()
2045 if (!m_platformEvent) {
2046 ThrowMsg(UnknownException, "Null platform pointer.");
2052 // progress = calendar_svc_struct_get_int(m_platformEvent, CAL_VALUE_INT_PROGRESS);
2054 m_abstractEvent->setProgress(progress);
2057 void EventWrapper::displayAbstractEvent()
2059 m_abstractEvent->display();
2062 void EventWrapper::displayPlatformEvent()
2064 LogDebug("event id: " << calendar_svc_struct_get_int(m_platformEvent,
2065 CAL_VALUE_INT_INDEX));
2066 LogDebug("event start time: " << calendar_svc_struct_get_time(
2067 m_platformEvent, CAL_VALUE_GMT_START_DATE_TIME,
2069 LogDebug("event end time: " << calendar_svc_struct_get_time(m_platformEvent,
2070 CAL_VALUE_GMT_END_DATE_TIME,
2072 LogDebug("event location: " << calendar_svc_struct_get_str(m_platformEvent,
2073 CAL_VALUE_TXT_LOCATION));
2074 LogDebug("event summary: " << calendar_svc_struct_get_str(m_platformEvent,
2075 CAL_VALUE_TXT_SUMMARY));
2076 LogDebug("event description: " << calendar_svc_struct_get_str(
2077 m_platformEvent, CAL_VALUE_TXT_DESCRIPTION));
2079 LogDebug("event isAllDay: " << calendar_svc_struct_get_int(
2080 m_platformEvent, CAL_VALUE_INT_ALL_DAY_EVENT));
2081 LogDebug("event organizer: " << calendar_svc_struct_get_str(m_platformEvent,
2082 CAL_VALUE_TXT_ORGANIZER_NAME));
2083 LogDebug("event lastModifiedDate: " << calendar_svc_struct_get_time(
2084 m_platformEvent, CAL_VALUE_GMT_LAST_MODIFIED_TIME,
2086 LogDebug("event visibility: " << calendar_svc_struct_get_int(
2087 m_platformEvent, CAL_VALUE_INT_SENSITIVITY));
2088 LogDebug("event availability: " << calendar_svc_struct_get_int(
2089 m_platformEvent, CAL_VALUE_INT_BUSY_STATUS));
2090 LogDebug("event alarmType: " << calendar_svc_struct_get_int(
2091 m_platformEvent, CAL_VALUE_INT_ALARM_TYPE));
2092 LogDebug("event alarm time: " << calendar_svc_struct_get_time(
2093 m_platformEvent, CAL_VALUE_GMT_ALARM_TIME,
2096 GList *categoryList = NULL;
2097 if (CAL_SUCCESS != calendar_svc_struct_get_list(m_platformEvent,
2098 CAL_VALUE_LST_MEETING_CATEGORY,
2100 LogError("cannot read category list");
2103 cal_value* category = NULL;
2104 for (; categoryList; categoryList = g_list_next(categoryList)) {
2105 category = static_cast<cal_value*>(categoryList->data);
2106 char* categoryName = calendar_svc_value_get_str(category, "category_name");
2107 if (NULL == categoryName) {
2108 LogError("cannot read category name");
2111 LogDebug("event categories: " << categoryName);
2114 LogDebug("event uid: " << calendar_svc_struct_get_str(m_platformEvent,
2115 CAL_VALUE_TXT_UID));
2116 LogDebug("event recurrenceId: " << calendar_svc_struct_get_time(
2117 m_platformEvent, CAL_VALUE_GMT_START_DATE_TIME, CAL_TZ_FLAG_GMT));
2119 GList *attendees = NULL;
2120 if (CAL_SUCCESS != calendar_svc_struct_get_list(m_platformEvent,
2121 CAL_VALUE_LST_ATTENDEE_LIST,
2123 LogError("cannot read attendee list");
2126 cal_value* attendee = NULL;
2127 for (; attendees; attendees = g_list_next(attendees)) {
2128 attendee = static_cast<cal_value*>(attendees->data);
2129 char* attendeeName = calendar_svc_value_get_str(attendee, CAL_VALUE_TXT_ATTENDEE_DETAIL_NAME);
2130 if (NULL == attendeeName) {
2131 LogError("cannot read attendee name");
2134 LogDebug("event attendees: " << attendeeName);
2137 LogDebug("event repeat frequency: " << calendar_svc_struct_get_int(
2138 m_platformEvent, CAL_VALUE_INT_REPEAT_TERM));
2139 LogDebug("event repeat occurrence count: " << calendar_svc_struct_get_int(
2140 m_platformEvent, CAL_VALUE_INT_REPEAT_OCCURRENCES));
2141 LogDebug("event repeat occurrence end date: " << calendar_svc_struct_get_time(
2142 m_platformEvent, CAL_VALUE_GMT_REPEAT_END_DATE,
2146 Api::Calendar::CalendarEvent::CalendarType EventWrapper::getType()
2148 return m_calendarType;