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.
18 * @file FAppMapDataControl.cpp
19 * @brief This is the implementation for the %MapDataControl class.
22 #include <FAppMapDataControl.h>
24 #include <FBaseSysLog.h>
25 #include <FBase_NativeError.h>
27 #include "FApp_MapDataControlImpl.h"
28 #include <FSec_AccessController.h>
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::App;
33 using namespace Tizen::Security;
35 namespace Tizen { namespace App {
37 MapDataControl::MapDataControl(void)
38 : __pMapDataControlImpl(null)
40 __pMapDataControlImpl = new _MapDataControlImpl;
43 MapDataControl::~MapDataControl(void)
45 delete __pMapDataControlImpl;
49 MapDataControl::GetValue(const String& dataId, const String& key,
50 RequestId& reqId, int pageNo, int countPerPage)
52 result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
53 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
55 SysTryReturnResult(NID_APP, __pMapDataControlImpl, E_INVALID_STATE,
56 "This instance has not been properly constructed yet.");
58 return __pMapDataControlImpl->GetValue(dataId, key, reqId, pageNo, countPerPage);
62 MapDataControl::AddValue(const String& dataId, const String& key,
63 const String& value, RequestId& reqId)
65 result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
66 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
68 SysTryReturnResult(NID_APP, __pMapDataControlImpl, E_INVALID_STATE,
69 "This instance has not been properly constructed yet.");
71 return __pMapDataControlImpl->AddValue(dataId, key, value, reqId);
75 MapDataControl::SetValue(const String& dataId, const String& key,
76 const String& oldValue, const String& newValue, RequestId& reqId)
78 result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
79 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
81 SysTryReturnResult(NID_APP, __pMapDataControlImpl, E_INVALID_STATE,
82 "This instance has not been properly constructed yet.");
84 return __pMapDataControlImpl->SetValue(dataId, key, oldValue, newValue, reqId);
88 MapDataControl::RemoveValue(const String& dataId, const String& key,
89 const String& value, RequestId& reqId)
91 result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
92 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
94 SysTryReturnResult(NID_APP, __pMapDataControlImpl, E_INVALID_STATE,
95 "This instance has not been properly constructed yet.");
97 return __pMapDataControlImpl->RemoveValue(dataId, key, value, reqId);
101 MapDataControl::SetMapDataControlResponseListener(IMapDataControlResponseListener* pListener)
103 SysTryReturnResult(NID_APP, __pMapDataControlImpl, E_INVALID_STATE,
104 "This instance has not been properly constructed yet.");
106 return __pMapDataControlImpl->SetMapDataControlResponseListener(pListener);