add comment LCOV_EXCL
[platform/core/pim/calendar-service.git] / common / cal_record.c
1 /*
2  * Calendar Service
3  *
4  * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20
21 #include <stdlib.h>
22 #include <stdbool.h>
23 #include <string.h>
24
25 #include "cal_internal.h"
26 #include "cal_typedef.h"
27 #include "cal_view.h"
28 #include "cal_record.h"
29
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; \
34         }
35
36 extern cal_record_plugin_cb_s cal_record_calendar_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_normal_plugin_cb;
44 extern cal_record_plugin_cb_s cal_record_instance_allday_plugin_cb;
45 extern cal_record_plugin_cb_s cal_record_instance_normal_extended_plugin_cb;
46 extern cal_record_plugin_cb_s cal_record_instance_allday_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;
49
50 cal_record_plugin_cb_s* cal_record_get_plugin_cb(cal_record_type_e type)
51 {
52         switch (type) {
53         case CAL_RECORD_TYPE_CALENDAR:
54                 return (&cal_record_calendar_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_NORMAL:
66                 return (&cal_record_instance_normal_plugin_cb);
67         case CAL_RECORD_TYPE_INSTANCE_ALLDAY:
68                 return (&cal_record_instance_allday_plugin_cb);
69         case CAL_RECORD_TYPE_INSTANCE_NORMAL_EXTENDED:
70                 return (&cal_record_instance_normal_extended_plugin_cb);
71         case CAL_RECORD_TYPE_INSTANCE_ALLDAY_EXTENDED:
72                 return (&cal_record_instance_allday_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);
79         default:
80                 return NULL;
81         }
82 }
83
84 static inline void _cal_record_set_property_flag(calendar_record_h record, unsigned int property_id, cal_properties_flag_e flag)
85 {
86         int index;
87         cal_record_s *_record = NULL;
88
89         _record = (cal_record_s *)record;
90         index = property_id & 0x00000FFF;
91
92         if (NULL == _record->properties_flags) {
93                 int count = 0;
94                 cal_view_get_property_info(_record->view_uri, &count);
95
96                 if (0 < 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");
102                                 return ;
103                                 /* LCOV_EXCL_STOP */
104                         }
105                 } else {
106                         /* LCOV_EXCL_START */
107                         ERR("get property_info_Fail");
108                         return ;
109                         /* LCOV_EXCL_STOP */
110                 }
111         }
112
113         _record->properties_flags[index] |= flag;
114         _record->property_flag |= flag;
115 }
116
117 bool cal_record_check_property_flag(calendar_record_h record, unsigned int property_id, cal_properties_flag_e flag)
118 {
119         int index;
120         cal_record_s *_record = NULL;
121
122         _record = (cal_record_s *)record;
123         index = property_id & 0x00000FFF;
124
125         if (NULL == _record->properties_flags) {
126                 if (flag == CAL_PROPERTY_FLAG_PROJECTION)
127                         return true;
128                 else
129                         return false;
130         }
131
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)
135                                 return true;
136                         else
137                                 return false;
138                 }
139
140                 return true;
141         }
142
143         return (_record->properties_flags[index] & flag) ? true : false;
144
145 }
146
147 int cal_record_set_projection(calendar_record_h record, const unsigned int *projection, const int projection_count, int properties_max_count)
148 {
149         int i;
150
151         cal_record_s *_record = NULL;
152
153         RETV_IF(NULL == record, -1);
154
155         _record = (cal_record_s *)record;
156
157         CAL_FREE(_record->properties_flags);
158         _record->properties_flags  = calloc(properties_max_count, sizeof(char));
159
160         RETVM_IF(NULL == _record->properties_flags, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc() Fail");
161
162         _record->properties_max_count = properties_max_count;
163
164         for (i = 0; i < projection_count; i++)
165                 _cal_record_set_property_flag(record, projection[i], CAL_PROPERTY_FLAG_PROJECTION);
166
167         return CALENDAR_ERROR_NONE;
168 }
169
170 API int calendar_record_create(const char* view_uri, calendar_record_h* out_record)
171 {
172         int ret = CALENDAR_ERROR_NONE;
173         cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
174
175         RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
176         RETV_IF(NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER);
177
178         type = cal_view_get_type(view_uri);
179         RETV_IF(CAL_RECORD_TYPE_INVALID == type, CALENDAR_ERROR_INVALID_PARAMETER);
180
181         cal_record_plugin_cb_s *plugin_cb = cal_record_get_plugin_cb(type);
182         RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
183         RETVM_IF(NULL == plugin_cb->create, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", view_uri);
184
185         ret = plugin_cb->create(out_record);
186
187         if (CALENDAR_ERROR_NONE == ret)
188                 CAL_RECORD_INIT_COMMON((cal_record_s*)*out_record, type, plugin_cb, cal_view_get_uri(view_uri));
189
190         return ret;
191 }
192
193 API int calendar_record_destroy(calendar_record_h record, bool delete_child)
194 {
195         int ret = CALENDAR_ERROR_NONE;
196
197         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
198
199         cal_record_s *temp = (cal_record_s*)(record);
200
201         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
202         RETVM_IF(NULL == temp->plugin_cb->destroy, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", temp->view_uri);
203
204         CAL_FREE(temp->properties_flags);
205
206         ret = temp->plugin_cb->destroy(record, delete_child);
207
208         return ret;
209 }
210
211 API int calendar_record_clone(calendar_record_h record, calendar_record_h* out_record)
212 {
213         int ret = CALENDAR_ERROR_NONE;
214
215         cal_record_s *temp = (cal_record_s*)(record);
216
217         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
218         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
219         RETV_IF(NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER);
220         RETVM_IF(NULL == temp->plugin_cb->clone, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", temp->view_uri);
221
222         ret = temp->plugin_cb->clone(record, out_record);
223
224         return ret;
225 }
226
227 API int calendar_record_get_uri_p(calendar_record_h record, char** out_str)
228 {
229         int ret = CALENDAR_ERROR_NONE;
230
231         cal_record_s *temp = (cal_record_s*)(record);
232
233         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
234         RETV_IF(NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER);
235
236         *out_str = (char*)(temp->view_uri);
237
238         return ret;
239 }
240
241 API int calendar_record_get_str(calendar_record_h record, unsigned int property_id, char** out_str)
242 {
243         int ret = CALENDAR_ERROR_NONE;
244
245         cal_record_s *temp = (cal_record_s*)(record);
246
247         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
248         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
249         RETV_IF(NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER);
250         RETVM_IF(NULL == temp->plugin_cb->get_str, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
251         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
252
253         ret = temp->plugin_cb->get_str(record, property_id, out_str);
254
255         return ret;
256 }
257
258 API int calendar_record_get_str_p(calendar_record_h record, unsigned int property_id, char** out_str)
259 {
260         int ret = CALENDAR_ERROR_NONE;
261
262         cal_record_s *temp = (cal_record_s*)(record);
263
264         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
265         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
266         RETV_IF(NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER);
267         RETVM_IF(NULL == temp->plugin_cb->get_str_p, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
268         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
269
270         ret = temp->plugin_cb->get_str_p(record, property_id, out_str);
271
272         return ret;
273 }
274 API int calendar_record_get_int(calendar_record_h record, unsigned int property_id, int* out_value)
275 {
276         int ret = CALENDAR_ERROR_NONE;
277
278         cal_record_s *temp = (cal_record_s*)(record);
279
280         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
281         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
282         RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
283         RETVM_IF(NULL == temp->plugin_cb->get_int, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
284         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
285
286         ret = temp->plugin_cb->get_int(record, property_id, out_value);
287
288         return ret;
289 }
290
291 API int calendar_record_get_double(calendar_record_h record, unsigned int property_id, double* out_value)
292 {
293         int ret = CALENDAR_ERROR_NONE;
294
295         cal_record_s *temp = (cal_record_s*)(record);
296
297         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
298         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
299         RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
300         RETVM_IF(NULL == temp->plugin_cb->get_double, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
301         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
302
303         ret = temp->plugin_cb->get_double(record, property_id, out_value);
304
305         return ret;
306 }
307 API int calendar_record_get_lli(calendar_record_h record, unsigned int property_id, long long int* out_value)
308 {
309         int ret = CALENDAR_ERROR_NONE;
310
311         cal_record_s *temp = (cal_record_s*)(record);
312
313         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
314         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
315         RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
316         RETVM_IF(NULL == temp->plugin_cb->get_lli, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
317         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
318
319         ret = temp->plugin_cb->get_lli(record, property_id, out_value);
320
321         return ret;
322 }
323
324 API int calendar_record_get_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s *out_value)
325 {
326         int ret = CALENDAR_ERROR_NONE;
327
328         cal_record_s *temp = (cal_record_s*)(record);
329
330         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
331         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
332         RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
333         RETVM_IF(NULL == temp->plugin_cb->get_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
334         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
335
336         ret = temp->plugin_cb->get_caltime(record, property_id, out_value);
337
338         return ret;
339 }
340
341 API int calendar_record_set_str(calendar_record_h record, unsigned int property_id, const char* value)
342 {
343         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
344         __CHECK_READ_ONLY_PROPERTY();
345
346         int ret = cal_record_set_str(record, property_id, value);
347
348         return ret;
349 }
350
351 API int calendar_record_set_int(calendar_record_h record, unsigned int property_id, int value)
352 {
353         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
354         __CHECK_READ_ONLY_PROPERTY();
355
356         int ret = cal_record_set_int(record, property_id, value);
357
358         return ret;
359 }
360
361 API int calendar_record_set_double(calendar_record_h record, unsigned int property_id, double value)
362 {
363         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
364         __CHECK_READ_ONLY_PROPERTY();
365
366         int ret = cal_record_set_double(record, property_id, value);
367
368         return ret;
369 }
370
371 API int calendar_record_set_lli(calendar_record_h record, unsigned int property_id, long long int value)
372 {
373         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
374         __CHECK_READ_ONLY_PROPERTY();
375
376         int ret = cal_record_set_lli(record, property_id, value);
377
378         return ret;
379 }
380
381 API int calendar_record_set_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s value)
382 {
383         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
384         __CHECK_READ_ONLY_PROPERTY();
385
386         int ret = cal_record_set_caltime(record, property_id, value);
387
388         return ret;
389 }
390
391 API int calendar_record_add_child_record(calendar_record_h record, unsigned int property_id, calendar_record_h child_record)
392 {
393         int ret = CALENDAR_ERROR_NONE;
394
395         cal_record_s *temp = (cal_record_s*)(record);
396
397         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
398         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
399         RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
400         RETVM_IF(NULL == temp->plugin_cb->add_child_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
401         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
402
403         ret = temp->plugin_cb->add_child_record(record, property_id, child_record);
404
405         return ret;
406 }
407 API int calendar_record_remove_child_record(calendar_record_h record, unsigned int property_id, calendar_record_h child_record)
408 {
409         int ret = CALENDAR_ERROR_NONE;
410
411         cal_record_s *temp = (cal_record_s*)(record);
412
413         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
414         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
415         RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
416         RETVM_IF(NULL == temp->plugin_cb->remove_child_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
417         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
418
419         ret = temp->plugin_cb->remove_child_record(record, property_id, child_record);
420
421         return ret;
422 }
423
424 API int calendar_record_get_child_record_count(calendar_record_h record, unsigned int property_id, unsigned int* count)
425 {
426         int ret = CALENDAR_ERROR_NONE;
427
428         cal_record_s *temp = (cal_record_s*)(record);
429
430         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
431         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
432         RETV_IF(NULL == count, CALENDAR_ERROR_INVALID_PARAMETER);
433         RETVM_IF(NULL == temp->plugin_cb->get_child_record_count, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
434         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
435
436         ret = temp->plugin_cb->get_child_record_count(record, property_id, count);
437
438         return ret;
439 }
440 API int calendar_record_get_child_record_at_p(calendar_record_h record, unsigned int property_id, int index, calendar_record_h* child_record)
441 {
442         int ret = CALENDAR_ERROR_NONE;
443
444         cal_record_s *temp = (cal_record_s*)(record);
445
446         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
447         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
448         RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
449         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);
450         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
451
452         ret = temp->plugin_cb->get_child_record_at_p(record, property_id, index, child_record);
453
454         return ret;
455 }
456
457 API int calendar_record_clone_child_record_list(calendar_record_h record, unsigned int property_id, calendar_list_h* out_list)
458 {
459         int ret = CALENDAR_ERROR_NONE;
460
461         cal_record_s *temp = (cal_record_s*)(record);
462
463         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
464         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
465         RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
466         RETVM_IF(NULL == temp->plugin_cb->clone_child_record_list, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
467         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
468
469         ret = temp->plugin_cb->clone_child_record_list(record, property_id, out_list);
470
471         return ret;
472 }
473
474 int cal_record_set_str(calendar_record_h record, unsigned int property_id, const char* value)
475 {
476         int ret = CALENDAR_ERROR_NONE;
477
478         cal_record_s *temp = (cal_record_s*)(record);
479
480         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
481         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
482         RETVM_IF(NULL == temp->plugin_cb->set_str, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
483         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
484
485         ret = temp->plugin_cb->set_str(record, property_id, value);
486         if (CALENDAR_ERROR_NONE == ret)
487                 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);
488
489         return ret;
490 }
491
492 int cal_record_set_int(calendar_record_h record, unsigned int property_id, int value)
493 {
494         int ret = CALENDAR_ERROR_NONE;
495
496         cal_record_s *temp = (cal_record_s*)(record);
497
498         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
499         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
500         RETVM_IF(NULL == temp->plugin_cb->set_int, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
501         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
502
503         ret = temp->plugin_cb->set_int(record, property_id, value);
504         if (CALENDAR_ERROR_NONE == ret)
505                 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);
506
507         return ret;
508 }
509
510 int cal_record_set_double(calendar_record_h record, unsigned int property_id, double value)
511 {
512         int ret = CALENDAR_ERROR_NONE;
513
514         cal_record_s *temp = (cal_record_s*)(record);
515
516         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
517         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
518         RETVM_IF(NULL == temp->plugin_cb->set_double, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
519         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
520
521         ret = temp->plugin_cb->set_double(record, property_id, value);
522         if (CALENDAR_ERROR_NONE == ret)
523                 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);
524
525         return ret;
526 }
527
528 int cal_record_set_lli(calendar_record_h record, unsigned int property_id, long long int value)
529 {
530         int ret = CALENDAR_ERROR_NONE;
531
532         cal_record_s *temp = (cal_record_s*)(record);
533
534         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
535         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
536         RETVM_IF(NULL == temp->plugin_cb->set_lli, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
537         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
538
539         ret = temp->plugin_cb->set_lli(record, property_id, value);
540         if (CALENDAR_ERROR_NONE == ret)
541                 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);
542
543         return ret;
544 }
545
546 int cal_record_set_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s value)
547 {
548         int ret = CALENDAR_ERROR_NONE;
549
550         cal_record_s *temp = (cal_record_s*)(record);
551
552         RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
553         RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
554         RETVM_IF(NULL == temp->plugin_cb->set_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
555         RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
556
557         ret = temp->plugin_cb->set_caltime(record, property_id, value);
558         if (CALENDAR_ERROR_NONE == ret)
559                 _cal_record_set_property_flag(record, property_id, CAL_PROPERTY_FLAG_DIRTY);
560
561         return ret;
562 }