tizen 2.3.1 release
[framework/web/wearable/wrt-security.git] / ace / include / ace / SettingsLogic.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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  *
18  *
19  * @file       SettingsLogic.h
20  * @author     Tomasz Swierczek (t.swierczek@samsung.com)
21  * @version    0.1
22  * @brief      Header file for class getting/setting user/global ACE settings
23  */
24
25 #ifndef WRT_SRC_ACCESS_CONTROL_LOGIC_SETTINGS_LOGIC_H_
26 #define WRT_SRC_ACCESS_CONTROL_LOGIC_SETTINGS_LOGIC_H_
27
28 #include <set>
29 #include <list>
30 #include <map>
31 #include <string>
32 #include <ace-dao-ro/PreferenceTypes.h>
33 #include <ace/Request.h>
34 #include <ace/PermissionTriple.h>
35 #include <ace-dao-rw/AceDAO.h>
36 #include <ace-dao-ro/common_dao_types.h>
37
38 class SettingsLogic
39 {
40   public:
41     class Exception
42     {
43       public:
44         DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
45         DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
46     };
47
48     // global settings
49     static AceDB::PreferenceTypes findGlobalUserSettings(
50             const std::string &resource,
51             WidgetHandle handler);
52
53     static AceDB::PreferenceTypes findGlobalUserSettings(
54             const Request &request);
55
56     // resource settings
57     static AceDB::PreferenceTypes getDevCapSetting(
58             const std::string &request);
59     static void getDevCapSettings(AceDB::PreferenceTypesMap *preferences);
60     static void setDevCapSetting(const std::string &resource,
61             AceDB::PreferenceTypes preference);
62     static void setAllDevCapSettings(
63             const std::list<std::pair<const std::string *,
64                     AceDB::PreferenceTypes> > &resourcesList);
65     static void removeDevCapSetting(const std::string &resource);
66     static void updateDevCapSetting(const std::string &resource,
67             AceDB::PreferenceTypes p);
68
69     // user settings
70     static AceDB::PreferenceTypes getWidgetDevCapSetting(
71             const std::string &resource,
72             WidgetHandle handler);
73     static void getWidgetDevCapSettings(PermissionList *permissions);
74     static void setWidgetDevCapSetting(const std::string &resource,
75             WidgetHandle handler,
76             AceDB::PreferenceTypes preference);
77     static void setWidgetDevCapSettings(const PermissionList &tripleList);
78     static void removeWidgetDevCapSetting(const std::string &resource,
79             WidgetHandle handler);
80
81   private:
82     SettingsLogic()
83     {
84     }
85
86 };
87
88 #endif /* WRT_SRC_ACCESS_CONTROL_LOGIC_SETTINGS_LOGIC_H_ */