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.
18 #include <dpl/log/log.h>
19 #include <Commons/Exception.h>
20 #include "CalendarEvent.h"
26 CalendarEvent::CalendarEvent() :
27 m_calendarId(UNDEFINED_CALENDAR_ID),
28 m_status(UNDEFINED_STATUS),
29 m_categories(new CategoryList()),
33 m_geolocation(new CalendarItemGeo()),
34 m_calendarType(EVENT_TYPE)
38 CalendarEvent::~CalendarEvent()
42 bool CalendarEvent::getIdIsSet() const
44 return !m_id.IsNull();
47 int CalendarEvent::getCalendarId() const
52 void CalendarEvent::setCalendarId(int value)
57 int CalendarEvent::getId() const
62 void CalendarEvent::setId(int value)
67 void CalendarEvent::resetId()
69 m_id = DPL::Optional<int>();
72 std::string CalendarEvent::getDescription() const
77 void CalendarEvent::setDescription(const std::string &value)
79 m_description = value;
82 std::string CalendarEvent::getSubject() const
87 void CalendarEvent::setSubject(const std::string &value)
92 std::time_t CalendarEvent::getStartTime() const
97 void CalendarEvent::setStartTime(std::time_t value)
102 std::time_t CalendarEvent::getEndTime() const
107 void CalendarEvent::setEndTime(std::time_t value)
112 std::string CalendarEvent::getLocation() const
117 void CalendarEvent::setLocation(const std::string &value)
122 EventRecurrenceRulePtr CalendarEvent::getRecurrenceRule() const
127 void CalendarEvent::setRecurrenceRule(EventRecurrenceRulePtr value)
129 m_recurrence = value;
132 CalendarEvent::EventStatus CalendarEvent::getStatus() const
134 return m_status == UNDEFINED_STATUS ? TENTATIVE_STATUS : m_status;
137 void CalendarEvent::setStatus(EventStatus value)
142 std::vector<long> CalendarEvent::getAlarmsTick() const
147 void CalendarEvent::setAlarmsTick(std::vector<long> &value)
149 m_alarmsTick = value;
152 std::vector<CalendarEvent::EventAlarmType> CalendarEvent::getAlarmsType() const
157 void CalendarEvent::setAlarmsType(std::vector<EventAlarmType> &value)
159 m_alarmsType = value;
162 CategoryListPtr CalendarEvent::getCategories() const
166 void CalendarEvent::setCategories(const CategoryListPtr &value)
168 m_categories = value;
171 void CalendarEvent::display() const
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);
190 bool CalendarEvent::validate() const
192 if (m_status == INVALID_STATUS) {
193 LogError("Incorrect status value detected");
199 bool CalendarEvent::getIsAllDay() const
204 void CalendarEvent::setIsAllDay(bool value)
209 std::string CalendarEvent::getOrganizer() const
214 void CalendarEvent::setOrganizer(const std::string &value)
219 std::time_t CalendarEvent::getLastModifiedDate() const
221 return m_lastModifiedDate;
224 void CalendarEvent::setLastModifiedDate(std::time_t value)
226 m_lastModifiedDate = value;
229 CalendarEvent::EventVisibility CalendarEvent::getVisibility() const
231 return m_visibility == UNDEFINED_VISIBILITY ? PUBLIC_VISIBILITY : m_visibility;
234 void CalendarEvent::setVisibility(EventVisibility value)
236 m_visibility = value;
239 CalendarEvent::EventAvailability CalendarEvent::getAvailability() const
241 return m_availability == UNDEFINED_AVAILABILITY ? FREE_FB : m_availability;
244 void CalendarEvent::setAvailability(EventAvailability value)
246 m_availability = value;
249 std::string CalendarEvent::getUId() const
254 void CalendarEvent::setUId(const std::string &value)
259 std::time_t CalendarEvent::getRecurrenceId() const
261 return m_recurrenceId;
264 void CalendarEvent::setRecurrenceId(std::time_t value)
266 m_recurrenceId = value;
269 EventAttendeeListPtr CalendarEvent::getAttendees() const
274 void CalendarEvent::setAttendees(const EventAttendeeListPtr &value)
279 bool CalendarEvent::getIsDetached() const
284 void CalendarEvent::setIsDetached(bool value)
286 m_isDetached = value;
289 AttributeListPtr CalendarEvent::getAttributesOfInterest() const
291 return m_attributesOfInterest;
294 void CalendarEvent::setAttributesOfInterest(AttributeListPtr value)
296 m_attributesOfInterest = value;
299 CalendarItemGeoPtr CalendarEvent::getGeolocation() const
301 return m_geolocation;
304 void CalendarEvent::setGeolocation(CalendarItemGeoPtr value)
306 m_geolocation = value;
309 std::string CalendarEvent::getTimeZone() const
314 void CalendarEvent::setTimeZone(std::string value)
319 CalendarEvent::TaskPriority CalendarEvent::getPriority() const
324 void CalendarEvent::setPriority(TaskPriority value)
329 std::time_t CalendarEvent::getCreatedDate() const
331 return m_createdDate;
334 void CalendarEvent::setCreatedDate(std::time_t value)
336 m_createdDate = value;
339 std::time_t CalendarEvent::getCompletedDate() const
341 return m_completedDate;
344 void CalendarEvent::setCompletedDate(std::time_t value)
346 m_completedDate = value;
349 int CalendarEvent::getProgress() const
354 void CalendarEvent::setProgress(int value)
359 CalendarEvent::CalendarType CalendarEvent::getCalendarType() const
361 return m_calendarType;
364 void CalendarEvent::setCalendarType(CalendarType type)
366 m_calendarType = type;