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