2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FSclCalendarbook.cpp
19 * @brief This is the implementation for Calendarbook class.
21 * This file contains definitions of @e Calendarbook class.
25 #include <FSclCalendarbook.h>
26 #include <FBaseSysLog.h>
27 #include <FSec_AccessController.h>
28 #include "FScl_CalEventImpl.h"
29 #include "FScl_CalTodoImpl.h"
30 #include "FScl_CalendarbookImpl.h"
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Security;
36 namespace Tizen { namespace Social
39 Calendarbook::Calendarbook(void)
40 : __pCalendarbookImpl(null)
44 Calendarbook::~Calendarbook(void)
46 delete __pCalendarbookImpl;
50 Calendarbook::Construct(void)
52 SysAssertf(__pCalendarbookImpl == null,
53 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
56 _CalendarbookImpl* pCalendarbookImpl = null;
58 pCalendarbookImpl = new (std::nothrow) _CalendarbookImpl();
59 SysTryReturnResult(NID_SCL, pCalendarbookImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
61 r = pCalendarbookImpl->Construct();
62 SysTryCatch(NID_SCL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
64 __pCalendarbookImpl = pCalendarbookImpl;
69 delete pCalendarbookImpl;
75 Calendarbook::Construct(IRecordEventListener* pListener)
77 SysAssertf(__pCalendarbookImpl == null,
78 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
81 _CalendarbookImpl* pCalendarbookImpl = null;
83 pCalendarbookImpl = new (std::nothrow) _CalendarbookImpl();
84 SysTryReturnResult(NID_SCL, pCalendarbookImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
86 r = pCalendarbookImpl->Construct(pListener);
87 SysTryCatch(NID_SCL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
89 __pCalendarbookImpl = pCalendarbookImpl;
94 delete pCalendarbookImpl;
100 Calendarbook::Construct(ICalendarbookEventListener& listener)
102 SysAssertf(__pCalendarbookImpl == null,
103 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
105 result r = E_SUCCESS;
106 _CalendarbookImpl* pCalendarbookImpl = null;
108 pCalendarbookImpl = new (std::nothrow) _CalendarbookImpl();
109 SysTryReturnResult(NID_SCL, pCalendarbookImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
111 r = pCalendarbookImpl->Construct(listener);
112 SysTryCatch(NID_SCL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
114 __pCalendarbookImpl = pCalendarbookImpl;
119 delete pCalendarbookImpl;
125 Calendarbook::AddEvent(CalEvent& event)
127 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
128 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
129 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
130 SysAssertf(__pCalendarbookImpl != null,
131 "Not yet constructed. Construct() should be called before use.");
133 r = __pCalendarbookImpl->AddEvent(event);
134 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
140 Calendarbook::AddEvent(CalEvent& event, RecordId calendarId)
142 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
143 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
144 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
145 SysAssertf(__pCalendarbookImpl != null,
146 "Not yet constructed. Construct() should be called before use.");
148 r = __pCalendarbookImpl->AddEvent(event, calendarId);
149 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
155 Calendarbook::AddTodo(CalTodo& todo)
157 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
158 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
159 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
160 SysAssertf(__pCalendarbookImpl != null,
161 "Not yet constructed. Construct() should be called before use.");
163 r = __pCalendarbookImpl->AddTodo(todo);
164 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
170 Calendarbook::AddTodo(CalTodo& todo, RecordId calendarId)
172 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
173 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
174 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
175 SysAssertf(__pCalendarbookImpl != null,
176 "Not yet constructed. Construct() should be called before use.");
178 r = __pCalendarbookImpl->AddTodo(todo, calendarId);
179 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
185 Calendarbook::RemoveEvent(CalEvent& event)
187 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
188 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
189 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
190 SysAssertf(__pCalendarbookImpl != null,
191 "Not yet constructed. Construct() should be called before use.");
193 r = __pCalendarbookImpl->RemoveEvent(event);
194 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
200 Calendarbook::RemoveEvent(RecordId eventId)
202 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
203 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
204 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
205 SysAssertf(__pCalendarbookImpl != null,
206 "Not yet constructed. Construct() should be called before use.");
208 r = __pCalendarbookImpl->RemoveEvent(eventId);
209 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
215 Calendarbook::RemoveTodo(CalTodo& todo)
217 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
218 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
219 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
220 SysAssertf(__pCalendarbookImpl != null,
221 "Not yet constructed. Construct() should be called before use.");
223 r = __pCalendarbookImpl->RemoveTodo(todo);
224 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
230 Calendarbook::RemoveTodo(RecordId todoId)
232 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
233 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
234 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
235 SysAssertf(__pCalendarbookImpl != null,
236 "Not yet constructed. Construct() should be called before use.");
238 r = __pCalendarbookImpl->RemoveTodo(todoId);
239 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
245 Calendarbook::UpdateEvent(const CalEvent& event)
247 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
248 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
249 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
250 SysAssertf(__pCalendarbookImpl != null,
251 "Not yet constructed. Construct() should be called before use.");
253 r = __pCalendarbookImpl->UpdateEvent(event);
254 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
260 Calendarbook::UpdateTodo(const CalTodo& todo)
262 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
263 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
264 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
265 SysAssertf(__pCalendarbookImpl != null,
266 "Not yet constructed. Construct() should be called before use.");
268 r = __pCalendarbookImpl->UpdateTodo(todo);
269 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
275 Calendarbook::GetEventN(RecordId eventId) const
277 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
278 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
279 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
280 SysAssertf(__pCalendarbookImpl != null,
281 "Not yet constructed. Construct() should be called before use.");
283 CalEvent* pEvent = __pCalendarbookImpl->GetEventN(eventId);
285 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
291 Calendarbook::GetTodoN(RecordId todoId) const
293 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
294 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
295 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
296 SysAssertf(__pCalendarbookImpl != null,
297 "Not yet constructed. Construct() should be called before use.");
299 CalTodo* pTodo = __pCalendarbookImpl->GetTodoN(todoId);
301 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
307 Calendarbook::GetTodosN(const DateTime& start, const DateTime& end, int pageNo, int countPerPage, unsigned long status,
308 unsigned long priority) const
310 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
311 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
312 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
313 SysAssertf(__pCalendarbookImpl != null,
314 "Not yet constructed. Construct() should be called before use.");
316 IList* pList = __pCalendarbookImpl->GetTodosN(start, end, pageNo, countPerPage, status, priority);
318 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
324 Calendarbook::GetTodoCount(const DateTime& start, const DateTime& end, unsigned long status, unsigned long priority) const
326 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
327 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
328 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_COUNT, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
329 SysAssertf(__pCalendarbookImpl != null,
330 "Not yet constructed. Construct() should be called before use.");
332 int count = __pCalendarbookImpl->GetTodoCount(start, end, status, priority);
334 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_COUNT, r, "[%s] Propagating.", GetErrorMessage(r));
340 Calendarbook::GetEventInstancesN(const DateTime& start, const DateTime& end,
341 const Tizen::Locales::TimeZone& timeZone, int pageNo, int countPerPage,
342 unsigned long category) const
344 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
345 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
346 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
347 SysAssertf(__pCalendarbookImpl != null,
348 "Not yet constructed. Construct() should be called before use.");
349 IList* pList = __pCalendarbookImpl->GetEventInstancesN(start, end, timeZone, pageNo, countPerPage, category);
351 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
357 Calendarbook::GetEventInstances(const DateTime& start, const DateTime& end,
358 const Tizen::Locales::TimeZone& timeZone, int pageNo, int countPerPage, unsigned long category,
360 const IRecordListener& listener) const
362 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
363 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
364 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
365 SysAssertf(__pCalendarbookImpl != null,
366 "Not yet constructed. Construct() should be called before use.");
368 r = __pCalendarbookImpl->GetEventInstances(start, end, timeZone, pageNo, countPerPage, category, reqId, listener);
369 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
375 Calendarbook::GetAllEventsN(void) const
377 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
378 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
379 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
380 SysAssertf(__pCalendarbookImpl != null,
381 "Not yet constructed. Construct() should be called before use.");
383 IList* pList = __pCalendarbookImpl->GetAllEventsN();
385 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
391 Calendarbook::GetAllTodosN(void) const
393 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
394 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
395 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
396 SysAssertf(__pCalendarbookImpl != null,
397 "Not yet constructed. Construct() should be called before use.");
399 IList* pList = __pCalendarbookImpl->GetAllTodosN();
401 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
407 Calendarbook::GetAllCalendarsN(void) const
409 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
410 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
411 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
412 SysAssertf(__pCalendarbookImpl != null,
413 "Not yet constructed. Construct() should be called before use.");
415 IList* pList = __pCalendarbookImpl->GetAllCalendarsN();
417 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
423 Calendarbook::GetChangedEventsAfterN(int version, int& latestVersion) const
425 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
426 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
427 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
428 SysAssertf(__pCalendarbookImpl != null,
429 "Not yet constructed. Construct() should be called before use.");
431 IList* pList = __pCalendarbookImpl->GetChangedEventsAfterN(version, latestVersion);
433 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
439 Calendarbook::GetChangedTodosAfterN(int version, int& latestVersion) const
441 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
442 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
443 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
444 SysAssertf(__pCalendarbookImpl != null,
445 "Not yet constructed. Construct() should be called before use.");
447 IList* pList = __pCalendarbookImpl->GetChangedTodosAfterN(version, latestVersion);
449 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
455 Calendarbook::AddCalendar(Calendar& calendar)
457 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
458 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
459 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
460 SysAssertf(__pCalendarbookImpl != null,
461 "Not yet constructed. Construct() should be called before use.");
463 r = __pCalendarbookImpl->AddCalendar(calendar);
464 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
470 Calendarbook::AddCalendar(Calendar& calendar, AccountId accountId)
472 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
473 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
474 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
475 SysAssertf(__pCalendarbookImpl != null,
476 "Not yet constructed. Construct() should be called before use.");
478 r = __pCalendarbookImpl->AddCalendar(calendar, accountId);
479 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
485 Calendarbook::RemoveCalendar(RecordId calendarId)
487 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
488 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
489 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
490 SysAssertf(__pCalendarbookImpl != null,
491 "Not yet constructed. Construct() should be called before use.");
493 r = __pCalendarbookImpl->RemoveCalendar(calendarId);
494 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
500 Calendarbook::UpdateCalendar(const Calendar& calendar)
502 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
503 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
504 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
505 SysAssertf(__pCalendarbookImpl != null,
506 "Not yet constructed. Construct() should be called before use.");
508 r = __pCalendarbookImpl->UpdateCalendar(calendar);
509 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
515 Calendarbook::GetCalendarN(RecordId calendarId) const
517 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
518 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
519 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
520 SysAssertf(__pCalendarbookImpl != null,
521 "Not yet constructed. Construct() should be called before use.");
523 Calendar* pCalendar = __pCalendarbookImpl->GetCalendarN(calendarId);
525 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
531 Calendarbook::RemoveEventInstance(const CalEventInstance& eventInstance)
533 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
534 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
535 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
536 SysAssertf(__pCalendarbookImpl != null,
537 "Not yet constructed. Construct() should be called before use.");
539 r = __pCalendarbookImpl->RemoveEventInstance(eventInstance);
540 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
546 Calendarbook::UpdateEventInstance(const CalEventInstance& eventInstance, CalEvent& event)
548 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
549 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
550 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
551 SysAssertf(__pCalendarbookImpl != null,
552 "Not yet constructed. Construct() should be called before use.");
554 r = __pCalendarbookImpl->UpdateEventInstance(eventInstance, event);
555 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
561 Calendarbook::GetLatestVersion(void) const
563 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
564 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
565 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_VERSION, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
566 SysAssertf(__pCalendarbookImpl != null,
567 "Not yet constructed. Construct() should be called before use.");
569 int version = __pCalendarbookImpl->GetLatestVersion();
571 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_VERSION, r, "[%s] Propagating.", GetErrorMessage(r));
577 Calendarbook::SearchN(const CalendarbookFilter& filter, unsigned long propertySortedBy, SortOrder sortOrder, int offset, int maxCount) const
579 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
580 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
581 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
582 SysAssertf(__pCalendarbookImpl != null,
583 "Not yet constructed. Construct() should be called before use.");
585 IList* pList = __pCalendarbookImpl->SearchN(filter, propertySortedBy, sortOrder, offset, maxCount);
587 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
593 Calendarbook::GetMatchedItemCount(const CalendarbookFilter& filter) const
595 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
596 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
597 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_COUNT, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
598 SysAssertf(__pCalendarbookImpl != null,
599 "Not yet constructed. Construct() should be called before use.");
601 int count = __pCalendarbookImpl->GetMatchedItemCount(filter);
603 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_COUNT, r, "[%s] Propagating.", GetErrorMessage(r));
609 Calendarbook::ParseEventsFromVcalendarN(const String& vCalFilePath)
611 IList* pList = _CalendarbookImpl::ParseEventsFromVcalendarN(vCalFilePath);
612 result r = GetLastResult();
613 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
619 Calendarbook::ParseTodosFromVcalendarN(const String& vCalFilePath)
621 IList* pList = _CalendarbookImpl::ParseTodosFromVcalendarN(vCalFilePath);
622 result r = GetLastResult();
623 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
629 Calendarbook::ExportEventsToVcalendar(const IList& eventList, const String& vCalFilePath)
631 result r = _CalendarbookImpl::ExportEventsToVcalendar(eventList, vCalFilePath);
632 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
638 Calendarbook::ExportTodosToVcalendar(const IList& todoList, const String& vCalFilePath)
640 result r = _CalendarbookImpl::ExportTodosToVcalendar(todoList, vCalFilePath);
641 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
647 Calendarbook::GetMaxDateTime(void)
649 return _CalendarbookImpl::GetMaxDateTime();
652 Calendarbook::GetMinDateTime(void)
654 return _CalendarbookImpl::GetMinDateTime();