2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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.
17 * @file FSclCalendarbook.cpp
18 * @brief This is the implementation for Calendarbook class.
20 * This file contains definitions of @e Calendarbook class.
24 #include <FSclCalendarbook.h>
25 #include <FBaseSysLog.h>
26 #include <FSec_AccessController.h>
27 #include "FScl_CalEventImpl.h"
28 #include "FScl_CalTodoImpl.h"
29 #include "FScl_CalendarbookImpl.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Collection;
33 using namespace Tizen::Security;
35 namespace Tizen { namespace Social
38 Calendarbook::Calendarbook(void)
39 : __pCalendarbookImpl(null)
43 Calendarbook::~Calendarbook(void)
45 delete __pCalendarbookImpl;
49 Calendarbook::Construct(void)
51 SysAssertf(__pCalendarbookImpl == null,
52 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
55 _CalendarbookImpl* pCalendarbookImpl = null;
57 pCalendarbookImpl = new (std::nothrow) _CalendarbookImpl();
58 SysTryReturnResult(NID_SCL, pCalendarbookImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
60 r = pCalendarbookImpl->Construct();
61 SysTryCatch(NID_SCL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
63 __pCalendarbookImpl = pCalendarbookImpl;
68 delete pCalendarbookImpl;
74 Calendarbook::Construct(IRecordEventListener* pListener)
76 SysAssertf(__pCalendarbookImpl == null,
77 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
80 _CalendarbookImpl* pCalendarbookImpl = null;
82 pCalendarbookImpl = new (std::nothrow) _CalendarbookImpl();
83 SysTryReturnResult(NID_SCL, pCalendarbookImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
85 r = pCalendarbookImpl->Construct(pListener);
86 SysTryCatch(NID_SCL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
88 __pCalendarbookImpl = pCalendarbookImpl;
93 delete pCalendarbookImpl;
99 Calendarbook::Construct(ICalendarbookEventListener& listener)
101 SysAssertf(__pCalendarbookImpl == null,
102 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
104 result r = E_SUCCESS;
105 _CalendarbookImpl* pCalendarbookImpl = null;
107 pCalendarbookImpl = new (std::nothrow) _CalendarbookImpl();
108 SysTryReturnResult(NID_SCL, pCalendarbookImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
110 r = pCalendarbookImpl->Construct(listener);
111 SysTryCatch(NID_SCL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
113 __pCalendarbookImpl = pCalendarbookImpl;
118 delete pCalendarbookImpl;
124 Calendarbook::AddEvent(CalEvent& event)
126 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
127 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
128 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
129 SysAssertf(__pCalendarbookImpl != null,
130 "Not yet constructed. Construct() should be called before use.");
132 r = __pCalendarbookImpl->AddEvent(event);
133 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
139 Calendarbook::AddEvent(CalEvent& event, RecordId calendarId)
141 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
142 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
143 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
144 SysAssertf(__pCalendarbookImpl != null,
145 "Not yet constructed. Construct() should be called before use.");
147 r = __pCalendarbookImpl->AddEvent(event, calendarId);
148 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
154 Calendarbook::AddTodo(CalTodo& todo)
156 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
157 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
158 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
159 SysAssertf(__pCalendarbookImpl != null,
160 "Not yet constructed. Construct() should be called before use.");
162 r = __pCalendarbookImpl->AddTodo(todo);
163 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
169 Calendarbook::AddTodo(CalTodo& todo, RecordId calendarId)
171 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
172 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
173 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
174 SysAssertf(__pCalendarbookImpl != null,
175 "Not yet constructed. Construct() should be called before use.");
177 r = __pCalendarbookImpl->AddTodo(todo, calendarId);
178 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
184 Calendarbook::RemoveEvent(CalEvent& event)
186 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
187 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
188 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
189 SysAssertf(__pCalendarbookImpl != null,
190 "Not yet constructed. Construct() should be called before use.");
192 r = __pCalendarbookImpl->RemoveEvent(event);
193 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
199 Calendarbook::RemoveEvent(RecordId eventId)
201 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
202 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
203 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
204 SysAssertf(__pCalendarbookImpl != null,
205 "Not yet constructed. Construct() should be called before use.");
207 r = __pCalendarbookImpl->RemoveEvent(eventId);
208 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
214 Calendarbook::RemoveTodo(CalTodo& todo)
216 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
217 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
218 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
219 SysAssertf(__pCalendarbookImpl != null,
220 "Not yet constructed. Construct() should be called before use.");
222 r = __pCalendarbookImpl->RemoveTodo(todo);
223 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
229 Calendarbook::RemoveTodo(RecordId todoId)
231 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
232 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
233 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
234 SysAssertf(__pCalendarbookImpl != null,
235 "Not yet constructed. Construct() should be called before use.");
237 r = __pCalendarbookImpl->RemoveTodo(todoId);
238 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
244 Calendarbook::UpdateEvent(const CalEvent& event)
246 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
247 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
248 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
249 SysAssertf(__pCalendarbookImpl != null,
250 "Not yet constructed. Construct() should be called before use.");
252 r = __pCalendarbookImpl->UpdateEvent(event);
253 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
259 Calendarbook::UpdateTodo(const CalTodo& todo)
261 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
262 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
263 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
264 SysAssertf(__pCalendarbookImpl != null,
265 "Not yet constructed. Construct() should be called before use.");
267 r = __pCalendarbookImpl->UpdateTodo(todo);
268 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
274 Calendarbook::GetEventN(RecordId eventId) const
276 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
277 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
278 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
279 SysAssertf(__pCalendarbookImpl != null,
280 "Not yet constructed. Construct() should be called before use.");
282 CalEvent* pEvent = __pCalendarbookImpl->GetEventN(eventId);
284 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
290 Calendarbook::GetTodoN(RecordId todoId) const
292 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
293 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
294 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
295 SysAssertf(__pCalendarbookImpl != null,
296 "Not yet constructed. Construct() should be called before use.");
298 CalTodo* pTodo = __pCalendarbookImpl->GetTodoN(todoId);
300 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
306 Calendarbook::GetTodosN(const DateTime& start, const DateTime& end, int pageNo, int countPerPage, unsigned long status,
307 unsigned long priority) const
309 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
310 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
311 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
312 SysAssertf(__pCalendarbookImpl != null,
313 "Not yet constructed. Construct() should be called before use.");
315 IList* pList = __pCalendarbookImpl->GetTodosN(start, end, pageNo, countPerPage, status, priority);
317 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
323 Calendarbook::GetTodoCount(const DateTime& start, const DateTime& end, unsigned long status, unsigned long priority) const
325 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
326 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
327 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_COUNT, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
328 SysAssertf(__pCalendarbookImpl != null,
329 "Not yet constructed. Construct() should be called before use.");
331 int count = __pCalendarbookImpl->GetTodoCount(start, end, status, priority);
333 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_COUNT, r, "[%s] Propagating.", GetErrorMessage(r));
339 Calendarbook::GetEventInstancesN(const DateTime& start, const DateTime& end,
340 const Tizen::Locales::TimeZone& timeZone, int pageNo, int countPerPage,
341 unsigned long category) const
343 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
344 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
345 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
346 SysAssertf(__pCalendarbookImpl != null,
347 "Not yet constructed. Construct() should be called before use.");
348 IList* pList = __pCalendarbookImpl->GetEventInstancesN(start, end, timeZone, pageNo, countPerPage, category);
350 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
356 Calendarbook::GetEventInstances(const DateTime& start, const DateTime& end,
357 const Tizen::Locales::TimeZone& timeZone, int pageNo, int countPerPage, unsigned long category,
359 const IRecordListener& listener) const
361 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
362 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
363 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
364 SysAssertf(__pCalendarbookImpl != null,
365 "Not yet constructed. Construct() should be called before use.");
367 r = __pCalendarbookImpl->GetEventInstances(start, end, timeZone, pageNo, countPerPage, category, reqId, listener);
368 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
374 Calendarbook::GetAllEventsN(void) const
376 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
377 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
378 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
379 SysAssertf(__pCalendarbookImpl != null,
380 "Not yet constructed. Construct() should be called before use.");
382 IList* pList = __pCalendarbookImpl->GetAllEventsN();
384 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
390 Calendarbook::GetAllTodosN(void) const
392 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
393 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
394 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
395 SysAssertf(__pCalendarbookImpl != null,
396 "Not yet constructed. Construct() should be called before use.");
398 IList* pList = __pCalendarbookImpl->GetAllTodosN();
400 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
406 Calendarbook::GetAllCalendarsN(void) const
408 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
409 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
410 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
411 SysAssertf(__pCalendarbookImpl != null,
412 "Not yet constructed. Construct() should be called before use.");
414 IList* pList = __pCalendarbookImpl->GetAllCalendarsN();
416 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
422 Calendarbook::GetChangedEventsAfterN(int version, int& latestVersion) const
424 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
425 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
426 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
427 SysAssertf(__pCalendarbookImpl != null,
428 "Not yet constructed. Construct() should be called before use.");
430 IList* pList = __pCalendarbookImpl->GetChangedEventsAfterN(version, latestVersion);
432 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
438 Calendarbook::GetChangedTodosAfterN(int version, int& latestVersion) const
440 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
441 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
442 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
443 SysAssertf(__pCalendarbookImpl != null,
444 "Not yet constructed. Construct() should be called before use.");
446 IList* pList = __pCalendarbookImpl->GetChangedTodosAfterN(version, latestVersion);
448 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
454 Calendarbook::AddCalendar(Calendar& calendar)
456 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
457 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
458 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
459 SysAssertf(__pCalendarbookImpl != null,
460 "Not yet constructed. Construct() should be called before use.");
462 r = __pCalendarbookImpl->AddCalendar(calendar);
463 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
469 Calendarbook::AddCalendar(Calendar& calendar, AccountId accountId)
471 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
472 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
473 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
474 SysAssertf(__pCalendarbookImpl != null,
475 "Not yet constructed. Construct() should be called before use.");
477 r = __pCalendarbookImpl->AddCalendar(calendar, accountId);
478 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
484 Calendarbook::RemoveCalendar(RecordId calendarId)
486 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
487 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
488 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
489 SysAssertf(__pCalendarbookImpl != null,
490 "Not yet constructed. Construct() should be called before use.");
492 r = __pCalendarbookImpl->RemoveCalendar(calendarId);
493 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
499 Calendarbook::UpdateCalendar(const Calendar& calendar)
501 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
502 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
503 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
504 SysAssertf(__pCalendarbookImpl != null,
505 "Not yet constructed. Construct() should be called before use.");
507 r = __pCalendarbookImpl->UpdateCalendar(calendar);
508 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
514 Calendarbook::GetCalendarN(RecordId calendarId) const
516 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
517 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
518 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
519 SysAssertf(__pCalendarbookImpl != null,
520 "Not yet constructed. Construct() should be called before use.");
522 Calendar* pCalendar = __pCalendarbookImpl->GetCalendarN(calendarId);
524 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
530 Calendarbook::RemoveEventInstance(const CalEventInstance& eventInstance)
532 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
533 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
534 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
535 SysAssertf(__pCalendarbookImpl != null,
536 "Not yet constructed. Construct() should be called before use.");
538 r = __pCalendarbookImpl->RemoveEventInstance(eventInstance);
539 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
545 Calendarbook::UpdateEventInstance(const CalEventInstance& eventInstance, CalEvent& event)
547 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_WRITE);
548 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
549 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
550 SysAssertf(__pCalendarbookImpl != null,
551 "Not yet constructed. Construct() should be called before use.");
553 r = __pCalendarbookImpl->UpdateEventInstance(eventInstance, event);
554 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
560 Calendarbook::GetLatestVersion(void) const
562 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
563 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
564 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_VERSION, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
565 SysAssertf(__pCalendarbookImpl != null,
566 "Not yet constructed. Construct() should be called before use.");
568 int version = __pCalendarbookImpl->GetLatestVersion();
570 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_VERSION, r, "[%s] Propagating.", GetErrorMessage(r));
576 Calendarbook::SearchN(const CalendarbookFilter& filter, unsigned long propertySortedBy, SortOrder sortOrder, int offset, int maxCount) const
578 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
579 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
580 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
581 SysAssertf(__pCalendarbookImpl != null,
582 "Not yet constructed. Construct() should be called before use.");
584 IList* pList = __pCalendarbookImpl->SearchN(filter, propertySortedBy, sortOrder, offset, maxCount);
586 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
592 Calendarbook::GetMatchedItemCount(const CalendarbookFilter& filter) const
594 result r = _AccessController::CheckUserPrivilege(_PRV_CALENDAR_READ);
595 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
596 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_COUNT, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
597 SysAssertf(__pCalendarbookImpl != null,
598 "Not yet constructed. Construct() should be called before use.");
600 int count = __pCalendarbookImpl->GetMatchedItemCount(filter);
602 SysTryReturn(NID_SCL, r == E_SUCCESS, _INVALID_COUNT, r, "[%s] Propagating.", GetErrorMessage(r));
608 Calendarbook::ParseEventsFromVcalendarN(const String& vCalFilePath)
610 IList* pList = _CalendarbookImpl::ParseEventsFromVcalendarN(vCalFilePath);
611 result r = GetLastResult();
612 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
618 Calendarbook::ParseTodosFromVcalendarN(const String& vCalFilePath)
620 IList* pList = _CalendarbookImpl::ParseTodosFromVcalendarN(vCalFilePath);
621 result r = GetLastResult();
622 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
628 Calendarbook::ExportEventsToVcalendar(const IList& eventList, const String& vCalFilePath)
630 result r = _CalendarbookImpl::ExportEventsToVcalendar(eventList, vCalFilePath);
631 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
637 Calendarbook::ExportTodosToVcalendar(const IList& todoList, const String& vCalFilePath)
639 result r = _CalendarbookImpl::ExportTodosToVcalendar(todoList, vCalFilePath);
640 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
646 Calendarbook::GetMaxDateTime(void)
648 return _CalendarbookImpl::GetMaxDateTime();
651 Calendarbook::GetMinDateTime(void)
653 return _CalendarbookImpl::GetMinDateTime();