Removed contacts_db_delete_record and added DeleteContactRecord in AddressbookUtil...
[framework/osp/social.git] / src / FScl_AddressbookManagerImpl.cpp
index 9d61c18..3698b66 100644 (file)
@@ -249,13 +249,10 @@ _AddressbookManagerImpl::CreateAddressbookN(AccountId accountId, const String& n
 result
 _AddressbookManagerImpl::DeleteAddressbook(AddressbookId addressbookId)
 {
-       SysTryReturn(NID_SCL, addressbookId > 0, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The addressbook ID is invalid or the default addressbook ID.", GetErrorMessage(E_INVALID_ARG));
+       SysTryReturn(NID_SCL, addressbookId > 0, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument used.The addressbook ID is invalid or the default addressbook ID.", GetErrorMessage(E_INVALID_ARG));
        SysTryReturn(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
-       int ret = contacts_db_delete_record(_contacts_address_book._uri, addressbookId);
-       SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
-       SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] The addressbook is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
-//     SysTryReturnResult(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OPERATION_FAILED, "Failed to delete an addressbook.(%d)", ret); // temp
+       result r = _AddressbookUtil::DeleteContactRecord(_contacts_address_book._uri, addressbookId);
+       SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
 }