2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 ace_client_helper.h
18 * @author Tomasz Swierczek (t.swierczek@samsung.com)
20 * @brief This file contains definitions of AceClient helper types and
23 #ifndef WRT_ACE_CLIENT_HELPER_H
24 #define WRT_ACE_CLIENT_HELPER_H
28 #include <dpl/foreach.h>
30 #include <ace-dao-ro/IRequest.h>
31 #include <ace-dao-ro/PreferenceTypes.h>
33 #include "ace_client_types.h"
37 AcePreference toAcePreference(AceDB::PreferenceTypes preference)
40 case AceDB::PreferenceTypes::PREFERENCE_PERMIT: {
41 return PREFERENCE_PERMIT; }
42 case AceDB::PreferenceTypes::PREFERENCE_DENY: {
43 return PREFERENCE_DENY; }
44 case AceDB::PreferenceTypes::PREFERENCE_DEFAULT: {
45 return PREFERENCE_DEFAULT; }
46 case AceDB::PreferenceTypes::PREFERENCE_BLANKET_PROMPT: {
47 return PREFERENCE_BLANKET_PROMPT; }
48 case AceDB::PreferenceTypes::PREFERENCE_SESSION_PROMPT: {
49 return PREFERENCE_SESSION_PROMPT; }
50 case AceDB::PreferenceTypes::PREFERENCE_ONE_SHOT_PROMPT: {
51 return PREFERENCE_ONE_SHOT_PROMPT; }
53 return PREFERENCE_DEFAULT;
56 typedef std::vector<std::string> AceParamKeys;
57 typedef std::vector<std::string> AceParamValues;
59 class AceFunctionParam
62 virtual ~AceFunctionParam()
66 void addAttribute(const std::string& key,
67 const std::string& value)
69 m_paramMap.insert(std::make_pair(key, value));
72 AceParamKeys getKeys() const
75 FOREACH (it, m_paramMap) {
76 out.push_back(it->first);
81 AceParamValues getValues() const
84 FOREACH (it, m_paramMap) {
85 out.push_back(it->second);
90 static std::string aceFunctionParamToken;
93 typedef std::multimap<std::string, std::string> ParamMap;
97 typedef std::vector <AceFunctionParam> AceFunctionParams;
99 class AceBasicRequest : public AceDB::IRequest {
101 AceBasicRequest(const AceSubject& subject,
102 const AceResource& resource) :
108 AceBasicRequest(const AceSubject& subject,
109 const AceResource& resource,
110 const AceFunctionParam& param) :
112 m_resource(resource),
116 virtual const std::string& getSubjectId() const
120 virtual const std::string& getResourceId() const
124 virtual const AceFunctionParam& getFunctionParam() const
130 AceSubject m_subject;
131 AceResource m_resource;
132 AceFunctionParam m_param;
135 typedef std::vector <AceBasicRequest> AceBasicRequests;
137 } // namespace AceClient
139 #endif // WRT_ACE_CLIENT_HELPER_H