4 * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
25 #include "cal_internal.h"
26 #include "cal_typedef.h"
28 #include "cal_record.h"
30 #define __CHECK_READ_ONLY_PROPERTY() \
31 if (CAL_PROPERTY_CHECK_FLAGS(property_id, CAL_PROPERTY_FLAGS_READ_ONLY) == true) { \
32 ERR("Invalid parameter: Don't try to change read-only property."); \
33 return CALENDAR_ERROR_NOT_PERMITTED; \
36 extern cal_record_plugin_cb_s cal_record_book_plugin_cb;
37 extern cal_record_plugin_cb_s cal_record_event_plugin_cb;
38 extern cal_record_plugin_cb_s cal_record_todo_plugin_cb;
39 extern cal_record_plugin_cb_s cal_record_alarm_plugin_cb;
40 extern cal_record_plugin_cb_s cal_record_attendee_plugin_cb;
41 extern cal_record_plugin_cb_s cal_record_timezone_plugin_cb;
42 extern cal_record_plugin_cb_s cal_record_updated_info_plugin_cb;
43 extern cal_record_plugin_cb_s cal_record_instance_utime_plugin_cb;
44 extern cal_record_plugin_cb_s cal_record_instance_localtime_plugin_cb;
45 extern cal_record_plugin_cb_s cal_record_instance_utime_extended_plugin_cb;
46 extern cal_record_plugin_cb_s cal_record_instance_localtime_extended_plugin_cb;
47 extern cal_record_plugin_cb_s cal_record_search_plugin_cb;
48 extern cal_record_plugin_cb_s cal_record_extended_plugin_cb;
50 cal_record_plugin_cb_s* cal_record_get_plugin_cb(cal_record_type_e type)
53 case CAL_RECORD_TYPE_BOOK:
54 return (&cal_record_book_plugin_cb);
55 case CAL_RECORD_TYPE_EVENT:
56 return (&cal_record_event_plugin_cb);
57 case CAL_RECORD_TYPE_TODO:
58 return (&cal_record_todo_plugin_cb);
59 case CAL_RECORD_TYPE_ALARM:
60 return (&cal_record_alarm_plugin_cb);
61 case CAL_RECORD_TYPE_ATTENDEE:
62 return (&cal_record_attendee_plugin_cb);
63 case CAL_RECORD_TYPE_TIMEZONE:
64 return (&cal_record_timezone_plugin_cb);
65 case CAL_RECORD_TYPE_INSTANCE_UTIME:
66 return (&cal_record_instance_utime_plugin_cb);
67 case CAL_RECORD_TYPE_INSTANCE_LOCALTIME:
68 return (&cal_record_instance_localtime_plugin_cb);
69 case CAL_RECORD_TYPE_INSTANCE_UTIME_EXTENDED:
70 return (&cal_record_instance_utime_extended_plugin_cb);
71 case CAL_RECORD_TYPE_INSTANCE_LOCALTIME_EXTENDED:
72 return (&cal_record_instance_localtime_extended_plugin_cb);
73 case CAL_RECORD_TYPE_UPDATED_INFO:
74 return (&cal_record_updated_info_plugin_cb);
75 case CAL_RECORD_TYPE_SEARCH:
76 return (&cal_record_search_plugin_cb);
77 case CAL_RECORD_TYPE_EXTENDED:
78 return (&cal_record_extended_plugin_cb);
84 static inline void _cal_record_set_property_flag(calendar_record_h record, unsigned int property_id, cal_properties_flag_e flag)
87 cal_record_s *_record = NULL;
89 _record = (cal_record_s *)record;
90 index = property_id & 0x00000FFF;
92 if (NULL == _record->properties_flags) {
94 cal_view_get_property_info(_record->view_uri, &count);
97 _record->properties_flags = calloc(count, sizeof(char));
98 _record->properties_max_count = count;
99 if (NULL == _record->properties_flags) {
100 /* LCOV_EXCL_START */
101 ERR("calloc() Fail");
106 /* LCOV_EXCL_START */
107 ERR("get property_info_Fail");
113 _record->properties_flags[index] |= flag;
114 _record->property_flag |= flag;
117 bool cal_record_check_property_flag(calendar_record_h record, unsigned int property_id, cal_properties_flag_e flag)
120 cal_record_s *_record = NULL;
122 _record = (cal_record_s *)record;
123 index = property_id & 0x00000FFF;
125 if (NULL == _record->properties_flags) {
126 if (flag == CAL_PROPERTY_FLAG_PROJECTION)
132 if (flag == CAL_PROPERTY_FLAG_PROJECTION) {
133 if (_record->property_flag & CAL_PROPERTY_FLAG_PROJECTION) {
134 if (_record->properties_flags[index] & CAL_PROPERTY_FLAG_PROJECTION)
143 return (_record->properties_flags[index] & flag) ? true : false;
147 int cal_record_set_projection(calendar_record_h record, const unsigned int *projection, const int projection_count, int properties_max_count)
151 cal_record_s *_record = NULL;
153 RETV_IF(NULL == record, -1);
155 _record = (cal_record_s *)record;
157 CAL_FREE(_record->properties_flags);
158 _record->properties_flags = calloc(properties_max_count, sizeof(char));
160 RETVM_IF(NULL == _record->properties_flags, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc() Fail");
162 _record->properties_max_count = properties_max_count;
164 for (i = 0; i < projection_count; i++)
165 _cal_record_set_property_flag(record, projection[i], CAL_PROPERTY_FLAG_PROJECTION);
167 return CALENDAR_ERROR_NONE;
170 EXPORT_API int calendar_record_create(const char* view_uri, calendar_record_h* out_record)
172 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
174 int ret = CALENDAR_ERROR_NONE;
175 cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
177 RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
178 RETV_IF(NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER);
180 #ifdef CAL_IPC_CLIENT
181 cal_view_initialize();
183 type = cal_view_get_type(view_uri);
184 RETV_IF(CAL_RECORD_TYPE_INVALID == type, CALENDAR_ERROR_INVALID_PARAMETER);
186 cal_record_plugin_cb_s *plugin_cb = cal_record_get_plugin_cb(type);
187 RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
188 RETVM_IF(NULL == plugin_cb->create, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", view_uri);
190 ret = plugin_cb->create(out_record);
191 if (CALENDAR_ERROR_NONE == ret)
192 CAL_RECORD_INIT_COMMON((cal_record_s*)*out_record, type, plugin_cb, cal_view_get_uri(view_uri));
197 EXPORT_API int calendar_record_destroy(calendar_record_h record, bool delete_child)
199 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
201 int ret = CALENDAR_ERROR_NONE;
203 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
205 cal_record_s *temp = (cal_record_s*)(record);
207 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
208 RETVM_IF(NULL == temp->plugin_cb->destroy, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", temp->view_uri);
210 CAL_FREE(temp->properties_flags);
212 #ifdef CAL_IPC_CLIENT
215 ret = temp->plugin_cb->destroy(record, delete_child);
220 EXPORT_API int calendar_record_clone(calendar_record_h record, calendar_record_h* out_record)
222 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
224 int ret = CALENDAR_ERROR_NONE;
226 cal_record_s *temp = (cal_record_s*)(record);
228 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
229 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
230 RETV_IF(NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER);
231 RETVM_IF(NULL == temp->plugin_cb->clone, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", temp->view_uri);
233 #ifdef CAL_IPC_CLIENT
234 cal_view_initialize();
236 ret = temp->plugin_cb->clone(record, out_record);
241 EXPORT_API int calendar_record_get_uri_p(calendar_record_h record, char** out_str)
243 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
245 int ret = CALENDAR_ERROR_NONE;
247 cal_record_s *temp = (cal_record_s*)(record);
249 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
250 RETV_IF(NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER);
252 *out_str = (char*)(temp->view_uri);
257 EXPORT_API int calendar_record_get_str(calendar_record_h record, unsigned int property_id, char** out_str)
259 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
261 int ret = CALENDAR_ERROR_NONE;
263 cal_record_s *temp = (cal_record_s*)(record);
265 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
266 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
267 RETV_IF(NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER);
268 RETVM_IF(NULL == temp->plugin_cb->get_str, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
269 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
271 ret = temp->plugin_cb->get_str(record, property_id, out_str);
276 EXPORT_API int calendar_record_get_str_p(calendar_record_h record, unsigned int property_id, char** out_str)
278 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
280 int ret = CALENDAR_ERROR_NONE;
282 cal_record_s *temp = (cal_record_s*)(record);
284 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
285 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
286 RETV_IF(NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER);
287 RETVM_IF(NULL == temp->plugin_cb->get_str_p, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
288 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
290 ret = temp->plugin_cb->get_str_p(record, property_id, out_str);
295 EXPORT_API int calendar_record_get_int(calendar_record_h record, unsigned int property_id, int* out_value)
297 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
299 int ret = CALENDAR_ERROR_NONE;
301 cal_record_s *temp = (cal_record_s*)(record);
303 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
304 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
305 RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
306 RETVM_IF(NULL == temp->plugin_cb->get_int, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
307 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
309 ret = temp->plugin_cb->get_int(record, property_id, out_value);
314 EXPORT_API int calendar_record_get_double(calendar_record_h record, unsigned int property_id, double* out_value)
316 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
318 int ret = CALENDAR_ERROR_NONE;
320 cal_record_s *temp = (cal_record_s*)(record);
322 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
323 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
324 RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
325 RETVM_IF(NULL == temp->plugin_cb->get_double, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
326 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
328 ret = temp->plugin_cb->get_double(record, property_id, out_value);
333 EXPORT_API int calendar_record_get_lli(calendar_record_h record, unsigned int property_id, long long int* out_value)
335 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
337 int ret = CALENDAR_ERROR_NONE;
339 cal_record_s *temp = (cal_record_s*)(record);
341 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
342 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
343 RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
344 RETVM_IF(NULL == temp->plugin_cb->get_lli, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
345 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
347 ret = temp->plugin_cb->get_lli(record, property_id, out_value);
352 //Getters & Setters of local caltime
353 EXPORT_API calendar_time_s *cal_caltime_create(void)
355 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
356 calendar_time_s *caltime = NULL;
357 caltime = calloc(1, sizeof(calendar_time_s));
358 WARN_IF(NULL == caltime, "calloc() Fail");
363 EXPORT_API void cal_caltime_destroy(calendar_time_s *caltime)
365 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
370 EXPORT_API calendar_time_type_e cal_caltime_get_local_type(calendar_time_s *caltime)
372 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
373 return caltime->type;
377 EXPORT_API int cal_caltime_set_local_type(calendar_time_s *caltime, calendar_time_type_e type)
379 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
380 RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
381 caltime->type = type;
383 return CALENDAR_ERROR_NONE;
386 EXPORT_API long long int cal_caltime_get_local_utime(calendar_time_s *caltime)
388 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
389 RETV_IF(CALENDAR_TIME_UTIME != caltime->type, 0);
391 return caltime->time.utime;
394 EXPORT_API int cal_caltime_set_local_utime(calendar_time_s *caltime, long long int utime)
396 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
397 RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
398 RETV_IF(CALENDAR_TIME_UTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
400 caltime->time.utime = utime;
402 return CALENDAR_ERROR_NONE;
405 EXPORT_API int cal_caltime_get_local_year(calendar_time_s *caltime)
407 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
408 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
410 return caltime->time.date.year;
413 EXPORT_API int cal_caltime_set_local_year(calendar_time_s *caltime, int year)
415 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
416 RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
417 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
419 caltime->time.date.year = year;
421 return CALENDAR_ERROR_NONE;
425 EXPORT_API int cal_caltime_get_local_month(calendar_time_s *caltime)
427 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
428 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
430 return caltime->time.date.month;
433 EXPORT_API int cal_caltime_set_local_month(calendar_time_s *caltime, int month)
435 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
436 RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
437 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
439 caltime->time.date.year = month;
441 return CALENDAR_ERROR_NONE;
444 EXPORT_API int cal_caltime_get_local_mday(calendar_time_s *caltime)
446 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
447 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
449 return caltime->time.date.mday;
452 EXPORT_API int cal_caltime_set_local_mday(calendar_time_s *caltime, int mday)
454 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
455 RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
456 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
458 caltime->time.date.mday = mday;
460 return CALENDAR_ERROR_NONE;
463 EXPORT_API int cal_caltime_get_local_hour(calendar_time_s *caltime)
465 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
466 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
468 return caltime->time.date.hour;
471 EXPORT_API int cal_caltime_set_local_hour(calendar_time_s *caltime, int hour)
473 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
474 RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
475 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
477 caltime->time.date.hour = hour;
479 return CALENDAR_ERROR_NONE;
481 EXPORT_API int cal_caltime_get_local_minute(calendar_time_s *caltime)
483 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
484 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
486 return caltime->time.date.minute;
489 EXPORT_API int cal_caltime_set_local_minute(calendar_time_s *caltime, int minute)
491 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
492 RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
493 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
495 caltime->time.date.minute = minute;
497 return CALENDAR_ERROR_NONE;
500 EXPORT_API int cal_caltime_get_local_second(calendar_time_s *caltime)
502 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
503 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
505 return caltime->time.date.second;
508 EXPORT_API int cal_caltime_set_local_second(calendar_time_s *caltime, int second)
510 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
511 RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
512 RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
514 caltime->time.date.second = second;
516 return CALENDAR_ERROR_NONE;
519 EXPORT_API int cal_caltime_set_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s *value)
521 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
523 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
524 __CHECK_READ_ONLY_PROPERTY();
526 int ret = cal_record_set_caltime(record, property_id, *value);
533 EXPORT_API int cal_caltime_get_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s **out_value)
535 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
537 int ret = CALENDAR_ERROR_NONE;
539 cal_record_s *temp = (cal_record_s*)(record);
541 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
542 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
543 RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
544 RETVM_IF(NULL == temp->plugin_cb->get_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
545 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
547 *out_value = cal_caltime_create();
548 ret = temp->plugin_cb->get_caltime(record, property_id, *out_value);
553 EXPORT_API int calendar_record_get_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s *out_value)
555 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
557 int ret = CALENDAR_ERROR_NONE;
559 cal_record_s *temp = (cal_record_s*)(record);
561 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
562 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
563 RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
564 RETVM_IF(NULL == temp->plugin_cb->get_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
565 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
567 ret = temp->plugin_cb->get_caltime(record, property_id, out_value);
572 EXPORT_API int calendar_record_set_str(calendar_record_h record, unsigned int property_id, const char* value)
574 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
576 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
577 __CHECK_READ_ONLY_PROPERTY();
579 int ret = cal_record_set_str(record, property_id, value);
584 EXPORT_API int calendar_record_set_int(calendar_record_h record, unsigned int property_id, int value)
586 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
588 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
589 __CHECK_READ_ONLY_PROPERTY();
591 int ret = cal_record_set_int(record, property_id, value);
596 EXPORT_API int calendar_record_set_double(calendar_record_h record, unsigned int property_id, double value)
598 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
600 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
601 __CHECK_READ_ONLY_PROPERTY();
603 int ret = cal_record_set_double(record, property_id, value);
608 EXPORT_API int calendar_record_set_lli(calendar_record_h record, unsigned int property_id, long long int value)
610 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
612 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
613 __CHECK_READ_ONLY_PROPERTY();
615 int ret = cal_record_set_lli(record, property_id, value);
620 EXPORT_API int calendar_record_set_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s value)
622 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
624 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
625 __CHECK_READ_ONLY_PROPERTY();
627 int ret = cal_record_set_caltime(record, property_id, value);
632 EXPORT_API int calendar_record_add_child_record(calendar_record_h record, unsigned int property_id, calendar_record_h child_record)
634 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
636 int ret = CALENDAR_ERROR_NONE;
638 cal_record_s *temp = (cal_record_s*)(record);
640 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
641 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
642 RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
643 RETVM_IF(NULL == temp->plugin_cb->add_child_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
644 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
646 ret = temp->plugin_cb->add_child_record(record, property_id, child_record);
651 EXPORT_API int calendar_record_remove_child_record(calendar_record_h record, unsigned int property_id, calendar_record_h child_record)
653 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
655 int ret = CALENDAR_ERROR_NONE;
657 cal_record_s *temp = (cal_record_s*)(record);
659 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
660 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
661 RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
662 RETVM_IF(NULL == temp->plugin_cb->remove_child_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
663 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
665 ret = temp->plugin_cb->remove_child_record(record, property_id, child_record);
670 EXPORT_API int calendar_record_get_child_record_count(calendar_record_h record, unsigned int property_id, unsigned int* count)
672 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
674 int ret = CALENDAR_ERROR_NONE;
676 cal_record_s *temp = (cal_record_s*)(record);
678 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
679 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
680 RETV_IF(NULL == count, CALENDAR_ERROR_INVALID_PARAMETER);
681 RETVM_IF(NULL == temp->plugin_cb->get_child_record_count, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
682 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
684 ret = temp->plugin_cb->get_child_record_count(record, property_id, count);
689 EXPORT_API int calendar_record_get_child_record_at_p(calendar_record_h record, unsigned int property_id, int index, calendar_record_h* child_record)
691 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
693 int ret = CALENDAR_ERROR_NONE;
695 cal_record_s *temp = (cal_record_s*)(record);
697 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
698 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
699 RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
700 RETVM_IF(NULL == temp->plugin_cb->get_child_record_at_p, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
701 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
703 ret = temp->plugin_cb->get_child_record_at_p(record, property_id, index, child_record);
708 EXPORT_API int calendar_record_clone_child_record_list(calendar_record_h record, unsigned int property_id, calendar_list_h* out_list)
710 CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
712 int ret = CALENDAR_ERROR_NONE;
714 cal_record_s *temp = (cal_record_s*)(record);
716 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
717 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
718 RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
719 RETVM_IF(NULL == temp->plugin_cb->clone_child_record_list, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
720 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
722 ret = temp->plugin_cb->clone_child_record_list(record, property_id, out_list);
727 int cal_record_set_str(calendar_record_h record, unsigned int property_id, const char* value)
729 int ret = CALENDAR_ERROR_NONE;
731 cal_record_s *temp = (cal_record_s*)(record);
733 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
734 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
735 RETVM_IF(NULL == temp->plugin_cb->set_str, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
736 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
738 ret = temp->plugin_cb->set_str(record, property_id, value);
739 if (CALENDAR_ERROR_NONE == ret)
740 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);
745 int cal_record_set_int(calendar_record_h record, unsigned int property_id, int value)
747 int ret = CALENDAR_ERROR_NONE;
749 cal_record_s *temp = (cal_record_s*)(record);
751 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
752 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
753 RETVM_IF(NULL == temp->plugin_cb->set_int, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
754 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
756 ret = temp->plugin_cb->set_int(record, property_id, value);
757 if (CALENDAR_ERROR_NONE == ret)
758 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);
763 int cal_record_set_double(calendar_record_h record, unsigned int property_id, double value)
765 int ret = CALENDAR_ERROR_NONE;
767 cal_record_s *temp = (cal_record_s*)(record);
769 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
770 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
771 RETVM_IF(NULL == temp->plugin_cb->set_double, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
772 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
774 ret = temp->plugin_cb->set_double(record, property_id, value);
775 if (CALENDAR_ERROR_NONE == ret)
776 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);
781 int cal_record_set_lli(calendar_record_h record, unsigned int property_id, long long int value)
783 int ret = CALENDAR_ERROR_NONE;
785 cal_record_s *temp = (cal_record_s*)(record);
787 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
788 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
789 RETVM_IF(NULL == temp->plugin_cb->set_lli, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
790 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
792 ret = temp->plugin_cb->set_lli(record, property_id, value);
793 if (CALENDAR_ERROR_NONE == ret)
794 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);
799 int cal_record_set_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s value)
801 int ret = CALENDAR_ERROR_NONE;
803 cal_record_s *temp = (cal_record_s*)(record);
805 RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
806 RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
807 RETVM_IF(NULL == temp->plugin_cb->set_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
808 RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
810 ret = temp->plugin_cb->set_caltime(record, property_id, value);
811 if (CALENDAR_ERROR_NONE == ret)
812 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);