Merge "Fixed exception handling codes" into tizen_2.1
[framework/osp/social.git] / src / FScl_CategoryImpl.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file                FScl_CategoryImpl.cpp
19  * @brief               This is the implementation for _CategoryImpl class.
20  *
21  * This file contains definitions of _CategoryImpl class.
22  */
23
24 #include <new>
25 #include <FBaseString.h>
26 #include <FBaseColArrayListT.h>
27 #include <FSclAddressbook.h>
28 #include <FSclCategory.h>
29 #include <FBaseSysLog.h>
30 #include <FIoFile.h>
31 #include <FBase_StringConverter.h>
32 #include <FApp_AppInfo.h>
33 #include "FScl_RecordImpl.h"
34 #include "FScl_AddressbookImpl.h"
35 #include "FScl_AddressbookUtil.h"
36 #include "FScl_CategoryImpl.h"
37 #include "FScl_ContactDbConnector.h"
38
39 using namespace Tizen::App;
40 using namespace Tizen::Base;
41 using namespace Tizen::Base::Collection;
42 using namespace Tizen::Io;
43
44 namespace Tizen { namespace Social
45 {
46 _CategoryImpl::_CategoryImpl(void)
47         : __hasMemberList(false)
48         , __memberCount(0)
49         , __pMembers(null)
50         , __pAddedMembers(null)
51         , __pRemovedMembers(null)
52 {
53         result r = E_SUCCESS;
54         int ret = CONTACTS_ERROR_NONE;
55         contacts_record_h recordHandle = null;
56
57         SysTryReturnVoidResult(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
58
59         std::unique_ptr< ArrayListT<int> > pMembers (new (std::nothrow) ArrayListT<int>());
60         SysTryReturnVoidResult(NID_SCL, pMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
61
62         r = pMembers->Construct();
63         SysTryReturnVoidResult(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
64
65         std::unique_ptr< ArrayListT<int> > pAddedMembers (new (std::nothrow) ArrayListT<int>());
66         SysTryReturnVoidResult(NID_SCL, pAddedMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
67
68         r = pAddedMembers->Construct();
69         SysTryReturnVoidResult(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
70
71         std::unique_ptr< ArrayListT<int> > pRemovedMembers (new (std::nothrow) ArrayListT<int>());
72         SysTryReturnVoidResult(NID_SCL, pRemovedMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
73
74         r = pRemovedMembers->Construct();
75         SysTryReturnVoidResult(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
76
77         ret = contacts_record_create(_contacts_group._uri, &recordHandle);
78         SysTryReturnVoidResult(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
79
80         __pMembers = std::move(pMembers);
81         __pAddedMembers = std::move(pAddedMembers);
82         __pRemovedMembers = std::move(pRemovedMembers);
83
84         __recordHandle = recordHandle;
85
86         return;
87 }
88
89 _CategoryImpl::_CategoryImpl(const _CategoryImpl& rhs)
90         : __hasMemberList(false)
91         , __memberCount(0)
92         , __pMembers(null)
93         , __pAddedMembers(null)
94         , __pRemovedMembers(null)
95 {
96         int ret = CONTACTS_ERROR_NONE;
97         contacts_record_h recordHandle = null;
98
99         SysTryReturnVoidResult(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
100
101         std::unique_ptr< IListT<int> > pMembers (rhs.GetMembersN());
102         SysTryReturnVoidResult(NID_SCL, pMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
103
104         std::unique_ptr< IListT<int> > pAddedMembers (rhs.GetAddedMembersN());
105         SysTryReturnVoidResult(NID_SCL, pAddedMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
106
107         std::unique_ptr< IListT<int> > pRemovedMembers (rhs.GetRemovedMembersN());
108         SysTryReturnVoidResult(NID_SCL, pRemovedMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
109
110         ret = contacts_record_clone(rhs.__recordHandle, &recordHandle);
111         SysTryReturnVoidResult(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
112
113         __hasMemberList = rhs.__hasMemberList;
114         __memberCount = rhs.__memberCount;
115
116         __pMembers = std::move(pMembers);
117         __pAddedMembers = std::move(pAddedMembers);
118         __pRemovedMembers = std::move(pRemovedMembers);
119
120         __recordHandle = recordHandle;
121
122         return;
123 }
124
125 _CategoryImpl::~_CategoryImpl(void)
126 {
127         if (__recordHandle != null)
128         {
129                 contacts_record_destroy(__recordHandle, true);
130         }
131 }
132
133 _CategoryImpl&
134 _CategoryImpl::operator =(const _CategoryImpl& rhs)
135 {
136         if (this == &rhs)
137         {
138                 return *this;
139         }
140
141         int ret = CONTACTS_ERROR_NONE;
142         contacts_record_h recordHandle = null;
143
144         std::unique_ptr< IListT<int> > pMembers (rhs.GetMembersN());
145         SysTryReturn(NID_SCL, pMembers != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
146
147         std::unique_ptr< IListT<int> > pAddedMembers (rhs.GetAddedMembersN());
148         SysTryReturn(NID_SCL, pAddedMembers != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
149
150         std::unique_ptr< IListT<int> > pRemovedMembers (rhs.GetRemovedMembersN());
151         SysTryReturn(NID_SCL, pRemovedMembers != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
152
153         ret = contacts_record_clone(rhs.__recordHandle, &recordHandle);
154         SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
155
156         __hasMemberList = rhs.__hasMemberList;
157         __memberCount = rhs.__memberCount;
158
159         __pMembers = std::move(pMembers);
160         __pAddedMembers = std::move(pAddedMembers);
161         __pRemovedMembers = std::move(pRemovedMembers);
162
163
164         contacts_record_destroy(__recordHandle, true);
165         __recordHandle = recordHandle;
166
167         return *this;
168 }
169
170 bool
171 _CategoryImpl::IsDefault(void) const
172 {
173         bool isDefault = false;
174
175         contacts_record_get_bool(__recordHandle, _contacts_group.is_read_only, &isDefault);
176
177         return isDefault;
178 }
179
180 void
181 _CategoryImpl::SetRecordHandle(contacts_record_h recordHandle)
182 {
183         contacts_record_destroy(__recordHandle, true);
184
185         __recordHandle = recordHandle;
186 }
187
188 contacts_record_h
189 _CategoryImpl::GetRecordHandle(void) const
190 {
191         return __recordHandle;
192 }
193
194 result
195 _CategoryImpl::AddMember(RecordId contactId)
196 {
197         SysTryReturn(NID_SCL, contactId != INVALID_RECORD_ID, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. contactId = %d.", GetErrorMessage(E_INVALID_ARG), contactId);
198
199         result r = E_SUCCESS;
200         int tableId = contactId;
201
202         if (!__hasMemberList)
203         {
204                 r = LoadMemberList();
205                 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
206         }
207
208         SysTryReturn(NID_SCL, !HasMember(contactId), E_OBJ_ALREADY_EXIST, E_OBJ_ALREADY_EXIST, "[%s] The member already exist in the category.", GetErrorMessage(E_OBJ_ALREADY_EXIST));
209
210         r = __pMembers->Add(tableId);
211         SysTryReturnResult(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
212
213         if (__pRemovedMembers->Contains(tableId))
214         {
215                 __pRemovedMembers->Remove(tableId);
216         }
217         else
218         {
219                 result r = __pAddedMembers->Add(tableId);
220                 if (IsFailed(r))
221                 {
222                         __pMembers->Remove(tableId);
223
224                         SysLogException(NID_SCL, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
225
226                         return r;
227                 }
228         }
229
230         __memberCount++;
231
232         return E_SUCCESS;
233 }
234
235 int
236 _CategoryImpl::GetMemberCount(void) const
237 {
238         return __memberCount;
239 }
240
241 void
242 _CategoryImpl::SetMemberCount(int memberCount)
243 {
244         __memberCount = memberCount;
245 }
246
247 String
248 _CategoryImpl::GetName(void) const
249 {
250         char* pCharValue = null;
251
252         contacts_record_get_str_p(__recordHandle, _contacts_group.name, &pCharValue);
253
254         return String(pCharValue);
255 }
256
257 bool
258 _CategoryImpl::HasMember(RecordId contactId) const
259 {
260         SysTryReturn(NID_SCL, contactId != INVALID_RECORD_ID, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. contactId = %d.", GetErrorMessage(E_INVALID_ARG), contactId);
261
262         result r = E_SUCCESS;
263         int tableId = contactId;
264
265         if (!__hasMemberList)
266         {
267                 _CategoryImpl* pThis = const_cast<_CategoryImpl*>(this);
268                 r = pThis->LoadMemberList();
269                 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
270         }
271
272         return __pMembers->Contains(tableId);
273 }
274
275 result
276 _CategoryImpl::RemoveMember(RecordId contactId)
277 {
278         SysTryReturn(NID_SCL, contactId != INVALID_RECORD_ID, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. contactId = %d.", GetErrorMessage(E_INVALID_ARG), contactId);
279
280         result r = E_SUCCESS;
281         int tableId = contactId;
282
283         if (!__hasMemberList)
284         {
285                 r = LoadMemberList();
286                 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
287         }
288
289         if (!_AppInfo::IsOspCompat())
290         {
291                 SysTryReturn(NID_SCL, HasMember(contactId), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid arguemnt is used. The contact does not exist in the category.", GetErrorMessage(E_INVALID_ARG));
292         }
293
294         // check pended delete list
295         if (__pRemovedMembers->Contains(tableId))
296         {
297                 return E_SUCCESS;
298         }
299
300         if (!HasMember(contactId))
301         {
302                 return E_SUCCESS;
303         }
304
305         r = __pMembers->Remove(tableId);
306         SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
307
308         if (__pAddedMembers->Contains(tableId))
309         {
310                 __pAddedMembers->Remove(tableId);
311         }
312         else
313         {
314                 result r = __pRemovedMembers->Add(tableId);
315                 if (IsFailed(r))
316                 {
317                         __pMembers->Add(tableId);
318                         SysLogException(NID_SCL, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
319
320                         return r;
321                 }
322         }
323
324         __memberCount--;
325
326         return E_SUCCESS;
327 }
328
329 result
330 _CategoryImpl::SetName(const String& name)
331 {
332         bool isDefault = false;
333         contacts_record_get_bool(__recordHandle, _contacts_group.is_read_only, &isDefault);
334
335         if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
336         {
337                 SysTryReturn(NID_SCL, !isDefault, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. This category is a default category.", GetErrorMessage(E_INVALID_ARG));
338                 SysTryReturn(NID_SCL, name.GetLength() <= 100, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified name exceeds the max length.", GetErrorMessage(E_INVALID_ARG));
339         }
340         else
341         {
342                 SysTryReturn(NID_SCL, !isDefault, E_INVALID_OPERATION, E_INVALID_OPERATION, "[%s] This category is a default category.", GetErrorMessage(E_INVALID_OPERATION));
343         }
344
345         SysTryReturn(NID_SCL, !name.IsEmpty(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified file path is an empty string", GetErrorMessage(E_INVALID_ARG));
346
347         std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(name));
348         SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
349         contacts_record_set_str(__recordHandle, _contacts_group.name, pCharArray.get());
350
351         return E_SUCCESS;
352 }
353
354 result
355 _CategoryImpl::SetRingtonePath(const String& filePath)
356 {
357         SysTryReturn(NID_SCL, filePath.IsEmpty() || File::IsFileExist(filePath), E_FILE_NOT_FOUND, E_FILE_NOT_FOUND, "[%s] The specified file is not found.", GetErrorMessage(E_FILE_NOT_FOUND));
358
359         if (!filePath.IsEmpty())
360         {
361                 std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(filePath));
362                 SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
363
364                 contacts_record_set_str(__recordHandle, _contacts_group.ringtone_path, pCharArray.get());
365         }
366         else
367         {
368                 contacts_record_set_str(__recordHandle, _contacts_group.ringtone_path, null);
369         }
370
371         return E_SUCCESS;
372 }
373
374 String
375 _CategoryImpl::GetRingtonePath(void) const
376 {
377         char* pCharValue = null;
378
379         contacts_record_get_str_p(__recordHandle, _contacts_group.ringtone_path, &pCharValue);
380
381         return String(pCharValue);
382 }
383
384 IListT<int>*
385 _CategoryImpl::GetMembersN(void) const
386 {
387         std::unique_ptr<ArrayListT<int> > pList(new (std::nothrow) ArrayListT<int>());
388         SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
389
390         result r = pList->Construct(*__pMembers);
391         SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
392
393         return pList.release();
394 }
395
396 IListT<int>*
397 _CategoryImpl::GetAddedMembersN(void) const
398 {
399         std::unique_ptr<ArrayListT<int> > pList(new (std::nothrow) ArrayListT<int>());
400         SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
401
402         result r = pList->Construct(*__pAddedMembers);
403         SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
404
405         return pList.release();
406 }
407
408 IListT<int>*
409 _CategoryImpl::GetRemovedMembersN(void) const
410 {
411         std::unique_ptr<ArrayListT<int> > pList(new (std::nothrow) ArrayListT<int>());
412         SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
413
414         result r = pList->Construct(*__pRemovedMembers);
415         SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
416
417         return pList.release();
418 }
419
420 result
421 _CategoryImpl::LoadMemberList(void)
422 {
423         SysTryReturn(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
424
425         int intValue = 0;
426         result r = E_SUCCESS;
427         std::unique_ptr< ArrayListT<RecordId> > pMembers;
428
429         contacts_record_get_int(__recordHandle, _contacts_group.id, &intValue);
430         if (intValue <= 0)
431         {
432                 __hasMemberList = true;
433
434                 return E_SUCCESS;
435         }
436
437         contacts_record_h currentRecord = null;
438
439         __Filter<__ContactsContactGroupRel> filter;
440         filter.Construct();
441         filter.AddInt(_contacts_contact_grouprel.group_id, CONTACTS_MATCH_EQUAL, intValue);
442
443         __Query<__ContactsContactGroupRel> query;
444         query.Construct();
445         query.SetFilter(filter);
446
447         std::unique_ptr<__SearchResult<__ContactsContactGroupRel> > pSearchResult(_AddressbookUtil::ExecuteQuery(query));
448         SysTryReturn(NID_SCL, pSearchResult != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
449
450         while (pSearchResult->MoveNext() == E_SUCCESS)
451         {
452                 currentRecord = pSearchResult->GetCurrentRecord();
453                 SysTryReturn(NID_SCL, currentRecord != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
454
455                 contacts_record_get_int(currentRecord, _contacts_contact_grouprel.contact_id, &intValue);
456
457                 if (intValue > 0)
458                 {
459                         r = __pMembers->Add(intValue);
460                         SysTryReturn(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
461                 }
462         }
463
464         __memberCount = __pMembers->GetCount();
465         __hasMemberList = true;
466
467         return E_SUCCESS;
468 }
469
470 void
471 _CategoryImpl::ClearAddedMemberList(void)
472 {
473         __pAddedMembers->RemoveAll();
474 }
475
476 void
477 _CategoryImpl::ClearRemovedMemberList(void)
478 {
479         __pRemovedMembers->RemoveAll();
480 }
481
482 AddressbookId
483 _CategoryImpl::GetAddressbookId(void) const
484 {
485         int intValue = 0;
486
487         contacts_record_get_int(__recordHandle, _contacts_group.address_book_id, &intValue);
488
489         return intValue;
490 }
491
492 result
493 _CategoryImpl::SetThumbnail(const String& filePath)
494 {
495         SysTryReturn(NID_SCL, filePath.IsEmpty() || File::IsFileExist(filePath), E_FILE_NOT_FOUND, E_FILE_NOT_FOUND, "[%s] The specified file is not found.", GetErrorMessage(E_FILE_NOT_FOUND));
496
497         if (!filePath.IsEmpty())
498         {
499                 std::unique_ptr<char[]> pCharArray( _StringConverter::CopyToCharArrayN(filePath));
500                 SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
501
502                 contacts_record_set_str(__recordHandle, _contacts_group.image_path, pCharArray.get());
503         }
504         else
505         {
506                 contacts_record_set_str(__recordHandle, _contacts_group.image_path, null);
507         }
508
509         return E_SUCCESS;
510 }
511
512 String
513 _CategoryImpl::GetThumbnailPath(void) const
514 {
515         char* pCharValue = null;
516
517         contacts_record_get_str_p(__recordHandle, _contacts_group.image_path, &pCharValue);
518
519         return String(pCharValue);
520 }
521
522 result
523 _CategoryImpl::Invalidate(void)
524 {
525         contacts_record_h recordHandle = null;
526         int ret = CONTACTS_ERROR_NONE;
527         char* pCharValue = null;
528
529         ret = contacts_record_create(_contacts_group._uri, &recordHandle);
530         SysTryReturnResult(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
531
532         contacts_record_get_str_p(__recordHandle, _contacts_group.name, &pCharValue);
533         contacts_record_set_str(recordHandle, _contacts_group.name, pCharValue);
534
535         contacts_record_get_str_p(__recordHandle, _contacts_group.ringtone_path, &pCharValue);
536         contacts_record_set_str(recordHandle, _contacts_group.ringtone_path, pCharValue);
537
538         contacts_record_get_str_p(__recordHandle, _contacts_group.image_path, &pCharValue);
539         contacts_record_set_str(recordHandle, _contacts_group.image_path, pCharValue);
540
541         contacts_record_get_str_p(__recordHandle, _contacts_group.vibration, &pCharValue);
542         contacts_record_set_str(recordHandle, _contacts_group.vibration, pCharValue);
543
544         contacts_record_destroy(__recordHandle, true);
545         __recordHandle = recordHandle;
546
547         return E_SUCCESS;
548 }
549
550 const _CategoryImpl*
551 _CategoryImpl::GetInstance(const Category& category)
552 {
553         return category.__pCategoryImpl;
554 }
555
556 _CategoryImpl*
557 _CategoryImpl::GetInstance(Category& category)
558 {
559         return category.__pCategoryImpl;
560 }
561
562 }}  // Tizen::Social