2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 * @file FScl_CategoryImpl.cpp
18 * @brief This is the implementation for _CategoryImpl class.
20 * This file contains definitions of _CategoryImpl class.
24 #include <FBaseString.h>
25 #include <FBaseColHashMap.h>
26 #include <FBaseColArrayListT.h>
27 #include <FBaseUtilStringUtil.h>
28 #include <FBaseUtilStringTokenizer.h>
29 #include <FSclAddressbook.h>
30 #include <FSclCategory.h>
31 #include <FBaseSysLog.h>
33 #include <FBase_StringConverter.h>
34 #include <FApp_AppInfo.h>
35 #include "FScl_RecordImpl.h"
36 #include "FScl_AddressbookImpl.h"
37 #include "FScl_AddressbookUtil.h"
38 #include "FScl_CategoryImpl.h"
39 #include "FScl_ContactDbConnector.h"
41 using namespace Tizen::App;
42 using namespace Tizen::Base;
43 using namespace Tizen::Base::Utility;
44 using namespace Tizen::Base::Collection;
45 using namespace Tizen::Io;
47 static const wchar_t CATEGORY_EXT_DATA_GROUP_NAME_ID_KEY[] = L"group_name_id";
49 namespace Tizen { namespace Social
51 _CategoryImpl::_CategoryImpl(void)
52 : __hasMemberList(false)
55 , __pAddedMembers(null)
56 , __pRemovedMembers(null)
59 int ret = CONTACTS_ERROR_NONE;
60 contacts_record_h recordHandle = null;
62 _AddressbookUtil::InitContactViews();
64 std::unique_ptr< ArrayListT<int> > pMembers (new (std::nothrow) ArrayListT<int>());
65 SysTryReturnVoidResult(NID_SCL, pMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
67 r = pMembers->Construct();
68 SysTryReturnVoidResult(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
70 std::unique_ptr< ArrayListT<int> > pAddedMembers (new (std::nothrow) ArrayListT<int>());
71 SysTryReturnVoidResult(NID_SCL, pAddedMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
73 r = pAddedMembers->Construct();
74 SysTryReturnVoidResult(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
76 std::unique_ptr< ArrayListT<int> > pRemovedMembers (new (std::nothrow) ArrayListT<int>());
77 SysTryReturnVoidResult(NID_SCL, pRemovedMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
79 r = pRemovedMembers->Construct();
80 SysTryReturnVoidResult(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
82 ret = contacts_record_create(_contacts_group._uri, &recordHandle);
83 SysTryReturnVoidResult(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
85 __pMembers = std::move(pMembers);
86 __pAddedMembers = std::move(pAddedMembers);
87 __pRemovedMembers = std::move(pRemovedMembers);
89 __recordHandle = recordHandle;
94 _CategoryImpl::_CategoryImpl(const _CategoryImpl& rhs)
95 : __hasMemberList(false)
98 , __pAddedMembers(null)
99 , __pRemovedMembers(null)
101 int ret = CONTACTS_ERROR_NONE;
102 contacts_record_h recordHandle = null;
104 _AddressbookUtil::InitContactViews();
106 std::unique_ptr< IListT<int> > pMembers (rhs.GetMembersN());
107 SysTryReturnVoidResult(NID_SCL, pMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
109 std::unique_ptr< IListT<int> > pAddedMembers (rhs.GetAddedMembersN());
110 SysTryReturnVoidResult(NID_SCL, pAddedMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
112 std::unique_ptr< IListT<int> > pRemovedMembers (rhs.GetRemovedMembersN());
113 SysTryReturnVoidResult(NID_SCL, pRemovedMembers != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
115 ret = contacts_record_clone(rhs.__recordHandle, &recordHandle);
116 SysTryReturnVoidResult(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
118 __hasMemberList = rhs.__hasMemberList;
119 __memberCount = rhs.__memberCount;
121 __pMembers = std::move(pMembers);
122 __pAddedMembers = std::move(pAddedMembers);
123 __pRemovedMembers = std::move(pRemovedMembers);
125 __recordHandle = recordHandle;
130 _CategoryImpl::~_CategoryImpl(void)
132 if (__recordHandle != null)
134 contacts_record_destroy(__recordHandle, true);
139 _CategoryImpl::operator =(const _CategoryImpl& rhs)
146 int ret = CONTACTS_ERROR_NONE;
147 contacts_record_h recordHandle = null;
149 std::unique_ptr< IListT<int> > pMembers (rhs.GetMembersN());
150 SysTryReturn(NID_SCL, pMembers != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
152 std::unique_ptr< IListT<int> > pAddedMembers (rhs.GetAddedMembersN());
153 SysTryReturn(NID_SCL, pAddedMembers != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
155 std::unique_ptr< IListT<int> > pRemovedMembers (rhs.GetRemovedMembersN());
156 SysTryReturn(NID_SCL, pRemovedMembers != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
158 ret = contacts_record_clone(rhs.__recordHandle, &recordHandle);
159 SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
161 __hasMemberList = rhs.__hasMemberList;
162 __memberCount = rhs.__memberCount;
164 __pMembers = std::move(pMembers);
165 __pAddedMembers = std::move(pAddedMembers);
166 __pRemovedMembers = std::move(pRemovedMembers);
169 contacts_record_destroy(__recordHandle, true);
170 __recordHandle = recordHandle;
176 _CategoryImpl::Equals(const Tizen::Base::Object& rhs) const
178 const _CategoryImpl* pCategoryImpl = dynamic_cast<const _CategoryImpl*>(&rhs);
179 if (pCategoryImpl == null)
184 if (GetName() != pCategoryImpl->GetName())
189 if (GetRingtonePath() != pCategoryImpl->GetRingtonePath())
194 if (GetThumbnailPath() != pCategoryImpl->GetThumbnailPath())
203 _CategoryImpl::IsDefault(void) const
205 bool isReadOnly = false;
207 contacts_record_get_bool(__recordHandle, _contacts_group.is_read_only, &isReadOnly);
217 _CategoryImpl::IsReadOnly(void) const
219 bool isReadOnly = false;
221 contacts_record_get_bool(__recordHandle, _contacts_group.is_read_only, &isReadOnly);
231 _CategoryImpl::GetExtraDataN(void) const
233 std::unique_ptr<HashMap, AllElementsDeleter> pExtraData(new (std::nothrow) HashMap());
234 SysTryReturn(NID_SCL, pExtraData != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
236 result r = pExtraData->Construct();
237 SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
239 char* pCharValue = null;
240 contacts_record_get_str_p(__recordHandle, _contacts_group.extra_data, &pCharValue);
242 if (pCharValue == null)
244 return pExtraData.release();
248 String extraData(pCharValue);
249 String decodedString(L"");
250 std::unique_ptr<ByteBuffer> pByteBuffer(null);
252 StringTokenizer tokerizer(extraData, delim);
255 if (tokerizer.GetTokenCount() == 1) // utf8
257 if (GetAddressbookId() == DEFAULT_ADDRESSBOOK_ID)
259 if (tokerizer.GetNextToken(token) == E_SUCCESS)
261 std::unique_ptr<String> pKey(new (std::nothrow) String(CATEGORY_EXT_DATA_GROUP_NAME_ID_KEY));
262 SysTryReturn(NID_SCL, pKey != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
264 std::unique_ptr<String> pValue(new (std::nothrow) String(token));
265 SysTryReturn(NID_SCL, pValue != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
267 r = pExtraData->Add(pKey.get(), pValue.get());
268 SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
277 while (tokerizer.HasMoreTokens())
280 r = tokerizer.GetNextToken(token);
286 pByteBuffer.reset(StringUtil::DecodeBase64StringN(token));
287 SysTryReturn(NID_SCL, pByteBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
289 std::unique_ptr<String> pKey(new (std::nothrow) String());
290 SysTryReturn(NID_SCL, pKey != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
292 StringUtil::Utf8ToString((const char*)pByteBuffer->GetPointer(), *pKey);
295 r = tokerizer.GetNextToken(token);
301 pByteBuffer.reset(StringUtil::DecodeBase64StringN(token));
302 SysTryReturn(NID_SCL, pByteBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
304 std::unique_ptr<String> pValue(new (std::nothrow) String());
305 SysTryReturn(NID_SCL, pValue != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
306 StringUtil::Utf8ToString((const char*)pByteBuffer->GetPointer(), *pValue);
308 r = pExtraData->Add(pKey.get(), pValue.get());
309 SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
316 return pExtraData.release();
320 _CategoryImpl::SetRecordHandle(contacts_record_h recordHandle)
322 contacts_record_destroy(__recordHandle, true);
324 __recordHandle = recordHandle;
328 _CategoryImpl::GetRecordHandle(void) const
330 return __recordHandle;
334 _CategoryImpl::AddMember(RecordId contactId)
336 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);
338 result r = E_SUCCESS;
339 int tableId = contactId;
341 if (!__hasMemberList)
343 r = LoadMemberList();
344 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
347 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));
349 r = __pMembers->Add(tableId);
350 SysTryReturnResult(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
352 if (__pRemovedMembers->Contains(tableId))
354 __pRemovedMembers->Remove(tableId);
358 result r = __pAddedMembers->Add(tableId);
361 __pMembers->Remove(tableId);
363 SysLogException(NID_SCL, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
375 _CategoryImpl::GetMemberCount(void) const
377 return __memberCount;
381 _CategoryImpl::SetMemberCount(int memberCount)
383 __memberCount = memberCount;
387 _CategoryImpl::GetName(void) const
389 char* pCharValue = null;
391 contacts_record_get_str_p(__recordHandle, _contacts_group.name, &pCharValue);
393 return String(pCharValue);
397 _CategoryImpl::HasMember(RecordId contactId) const
399 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);
401 result r = E_SUCCESS;
402 int tableId = contactId;
404 if (!__hasMemberList)
406 _CategoryImpl* pThis = const_cast<_CategoryImpl*>(this);
407 r = pThis->LoadMemberList();
408 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
411 return __pMembers->Contains(tableId);
415 _CategoryImpl::RemoveMember(RecordId contactId)
417 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);
419 result r = E_SUCCESS;
420 int tableId = contactId;
422 if (!__hasMemberList)
424 r = LoadMemberList();
425 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
428 if (!_AppInfo::IsOspCompat())
430 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));
433 // check pended delete list
434 if (__pRemovedMembers->Contains(tableId))
439 if (!HasMember(contactId))
444 r = __pMembers->Remove(tableId);
445 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
447 if (__pAddedMembers->Contains(tableId))
449 __pAddedMembers->Remove(tableId);
453 result r = __pRemovedMembers->Add(tableId);
456 __pMembers->Add(tableId);
457 SysLogException(NID_SCL, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
469 _CategoryImpl::SetName(const String& name)
471 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
473 SysTryReturn(NID_SCL, !IsReadOnly(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. This category is a default category.", GetErrorMessage(E_INVALID_ARG));
474 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));
478 SysTryReturn(NID_SCL, !IsReadOnly(), E_INVALID_OPERATION, E_INVALID_OPERATION, "[%s] This category is a default category.", GetErrorMessage(E_INVALID_OPERATION));
481 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));
483 std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(name));
484 SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
485 contacts_record_set_str(__recordHandle, _contacts_group.name, pCharArray.get());
491 _CategoryImpl::SetRingtonePath(const String& filePath)
493 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 if (!filePath.IsEmpty())
497 std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(filePath));
498 SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
500 contacts_record_set_str(__recordHandle, _contacts_group.ringtone_path, pCharArray.get());
504 contacts_record_set_str(__recordHandle, _contacts_group.ringtone_path, null);
511 _CategoryImpl::GetRingtonePath(void) const
513 char* pCharValue = null;
515 contacts_record_get_str_p(__recordHandle, _contacts_group.ringtone_path, &pCharValue);
517 return String(pCharValue);
521 _CategoryImpl::GetMembersN(void) const
523 std::unique_ptr<ArrayListT<int> > pList(new (std::nothrow) ArrayListT<int>());
524 SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
526 result r = pList->Construct(*__pMembers);
527 SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
529 return pList.release();
533 _CategoryImpl::GetAddedMembersN(void) const
535 std::unique_ptr<ArrayListT<int> > pList(new (std::nothrow) ArrayListT<int>());
536 SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
538 result r = pList->Construct(*__pAddedMembers);
539 SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
541 return pList.release();
545 _CategoryImpl::GetRemovedMembersN(void) const
547 std::unique_ptr<ArrayListT<int> > pList(new (std::nothrow) ArrayListT<int>());
548 SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
550 result r = pList->Construct(*__pRemovedMembers);
551 SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
553 return pList.release();
557 _CategoryImpl::LoadMemberList(void)
559 _AddressbookUtil::InitContactViews();
562 result r = E_SUCCESS;
563 std::unique_ptr< ArrayListT<RecordId> > pMembers;
565 contacts_record_get_int(__recordHandle, _contacts_group.id, &intValue);
568 __hasMemberList = true;
573 contacts_record_h currentRecord = null;
575 __Filter<__ContactsContactGroupRel> filter;
577 filter.AddInt(_contacts_contact_grouprel.group_id, CONTACTS_MATCH_EQUAL, intValue);
579 __Query<__ContactsContactGroupRel> query;
581 query.SetFilter(filter);
583 std::unique_ptr<__SearchResult<__ContactsContactGroupRel> > pSearchResult(_AddressbookUtil::ExecuteQuery(query));
584 SysTryReturn(NID_SCL, pSearchResult != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
586 while (pSearchResult->MoveNext() == E_SUCCESS)
588 currentRecord = pSearchResult->GetCurrentRecord();
589 SysTryReturn(NID_SCL, currentRecord != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
591 contacts_record_get_int(currentRecord, _contacts_contact_grouprel.contact_id, &intValue);
595 r = __pMembers->Add(intValue);
596 SysTryReturn(NID_SCL, !IsFailed(r), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
600 __memberCount = __pMembers->GetCount();
601 __hasMemberList = true;
607 _CategoryImpl::ClearAddedMemberList(void)
609 __pAddedMembers->RemoveAll();
613 _CategoryImpl::ClearRemovedMemberList(void)
615 __pRemovedMembers->RemoveAll();
619 _CategoryImpl::GetAddressbookId(void) const
623 contacts_record_get_int(__recordHandle, _contacts_group.address_book_id, &intValue);
629 _CategoryImpl::SetThumbnail(const String& filePath)
631 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));
633 if (!filePath.IsEmpty())
635 std::unique_ptr<char[]> pCharArray( _StringConverter::CopyToCharArrayN(filePath));
636 SysTryReturnResult(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
638 contacts_record_set_str(__recordHandle, _contacts_group.image_path, pCharArray.get());
642 contacts_record_set_str(__recordHandle, _contacts_group.image_path, null);
649 _CategoryImpl::GetThumbnailPath(void) const
651 char* pCharValue = null;
653 contacts_record_get_str_p(__recordHandle, _contacts_group.image_path, &pCharValue);
655 return String(pCharValue);
659 _CategoryImpl::Invalidate(void)
661 contacts_record_h recordHandle = null;
662 int ret = CONTACTS_ERROR_NONE;
663 char* pCharValue = null;
665 ret = contacts_record_create(_contacts_group._uri, &recordHandle);
666 SysTryReturnResult(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
668 contacts_record_get_str_p(__recordHandle, _contacts_group.name, &pCharValue);
669 contacts_record_set_str(recordHandle, _contacts_group.name, pCharValue);
671 contacts_record_get_str_p(__recordHandle, _contacts_group.ringtone_path, &pCharValue);
672 contacts_record_set_str(recordHandle, _contacts_group.ringtone_path, pCharValue);
674 contacts_record_get_str_p(__recordHandle, _contacts_group.image_path, &pCharValue);
675 contacts_record_set_str(recordHandle, _contacts_group.image_path, pCharValue);
677 contacts_record_get_str_p(__recordHandle, _contacts_group.vibration, &pCharValue);
678 contacts_record_set_str(recordHandle, _contacts_group.vibration, pCharValue);
680 contacts_record_destroy(__recordHandle, true);
681 __recordHandle = recordHandle;
687 _CategoryImpl::GetInstance(const Category& category)
689 return category.__pCategoryImpl;
693 _CategoryImpl::GetInstance(Category& category)
695 return category.__pCategoryImpl;