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 * This file contains the declaration of widget dao class.
20 * @author Yang Jie (jie2.yang@samsung.com)
21 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
22 * @author Pawel Sikorski (p.sikorski@samsung.com)
24 * @brief This file contains the declaration of widget dao
29 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
35 #include <dpl/availability.h>
36 #include <dpl/exception.h>
37 #include <dpl/platform.h>
38 #include <dpl/db/orm.h>
39 #include <dpl/wrt-dao-ro/config_parser_data.h>
40 #include <dpl/wrt-dao-rw/property_dao.h>
43 class WidgetDAO : public WidgetDAOReadOnly
46 typedef std::list<DPL::String> LanguageTagsList;
48 WidgetDAO(DPL::OptionalString widgetGUID);
49 WidgetDAO(DPL::String tzAppId);
57 * This method registers the widget information in the DB when it is
60 * @see WidgetRegisterInfo
61 * @see UnRegisterWidget()
62 * @param[in] TizenAppId Widget app id that will be registered.
63 * @param[in] pWidgetRegisterInfo Specified the widget's information
64 * needed to be registered.
65 * @param[in] widgetSecurity Widget's security certificates.
67 static void registerWidget(
68 const TizenAppId& tzAppId,
69 const WidgetRegisterInfo &widgetRegInfo,
70 const IWidgetSecurity &widgetSecurity);
72 static void registerService(
73 const ConfigParserData::ServiceAppInfo &serviceAppInfo,
74 const WidgetRegisterInfo &widgetRegInfo,
75 const IWidgetSecurity &widgetSecurity);
78 * @brief registerWidgetGenerateTizenId Registers widget with auto-generated
81 * This function is disadviced and should be used only in tests.
82 * Function is not thread-safe.
84 * @param pWidgetRegisterInfo registeration information
85 * @param widgetSecurity Widget's security certificates.
86 * @return tzAppId generated
88 static TizenAppId registerWidgetGeneratePkgId(
89 const WidgetRegisterInfo &pWidgetRegisterInfo,
90 const IWidgetSecurity &widgetSecurity);
92 static void updateTizenAppId(const TizenAppId & fromAppId,
93 const TizenAppId & toAppId);
95 * This method removes a widget's information from EmDB.
97 * @see RegisterWidget()
98 * @param[in] tzAppId widgets name to be unregistered
100 static void unregisterWidget(const TizenAppId & tzAppId);
102 /* This method removes widget property
104 void removeProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key);
107 * @brief registerExternalLocations Removes rows from
108 * WidgetExternalLocations
110 void unregisterAllExternalLocations();
112 /* This method sets widget property
114 void setProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key,
115 const PropertyDAOReadOnly::WidgetPropertyValue &value,
116 bool readOnly = false);
120 void setTizenAppId(const DPL::OptionalString& tzAppId);
122 /* This function will update of api-feature status.
123 * If status is true (feature rejected) plugin connected with this
124 * api feature mustn't be loaded durign widget launch.
126 void updateFeatureRejectStatus(const DbWidgetFeature &widgetFeature);
129 //Methods used during widget registering
130 static DbWidgetHandle registerWidgetInfo(
131 const TizenAppId & tzAppId,
132 const TizenPkgId & tzPkgId,
133 const std::string & baseFolder,
136 const ConfigParserData &widgetConfigurationInfo,
137 const IWidgetSecurity &widgetSecurity,
138 const boost::optional<DbWidgetHandle> handle =
139 boost::optional<DbWidgetHandle>());
140 static void registerWidgetExtendedInfo(
141 DbWidgetHandle widgetHandle,
142 time_t installedTime,
143 const DPL::OptionalString & splashImgSrc,
144 const DPL::OptionalString & backgroundPage,
145 const DPL::OptionalString & widgetInstalledPath);
146 static void registerWidgetLocalizedInfo(
147 DbWidgetHandle widgetHandle,
148 const ConfigParserData::LocalizedDataSet &localizedDataSet);
149 static void registerWidgetIcons(
150 DbWidgetHandle widgetHandle,
151 const WidgetRegisterInfo::LocalizedIconList &icons);
152 static void registerWidgetStartFile(
153 DbWidgetHandle widgetHandle,
154 const WidgetRegisterInfo::LocalizedStartFileList &startFiles);
155 static void registerWidgetPreferences(
156 DbWidgetHandle widgetHandle,
157 const WidgetRegisterInfo ®Info);
158 static void registerWidgetFeatures(
159 DbWidgetHandle widgetHandle,
160 const ConfigParserData::FeaturesList &featuresList);
161 static void registerWidgetPrivilege(
162 DbWidgetHandle widgetHandle,
163 const ConfigParserData::PrivilegeList &privilegeList);
164 static void registerWidgetWindowModes(
165 DbWidgetHandle widgetHandle,
166 const ConfigParserData::StringsList &windowModes);
167 static void registerWidgetWarpInfo(
168 DbWidgetHandle widgetHandle,
169 const ConfigParserData::AccessInfoSet &accessInfoSet);
170 static void registerWidgetAllowNavigationInfo(
171 DbWidgetHandle widgetHandle,
172 const ConfigParserData::AllowNavigationInfoList &allowNavigationInfoList);
173 static void registerWidgetCertificates(
174 DbWidgetHandle widgetHandle,
175 const IWidgetSecurity &widgetSecurity);
176 static void registerCertificatesChains(
177 DbWidgetHandle widgetHandle,
178 CertificateSource certificateSource,
179 const CertificateChainList &list);
180 static void registerWidgetSettings(
181 DbWidgetHandle widgetHandle,
182 const ConfigParserData::SettingsList &settingsList);
183 static void registerAppControl(
184 DbWidgetHandle widgetHandle,
185 const ConfigParserData::AppControlInfoList &appControlList);
186 static void registerEncryptedResouceInfo(
187 DbWidgetHandle widgetHandle,
188 const EncryptedFileList &encryptedFiles);
191 * @brief registerExternalLocations Inserts new rows to
192 * WidgetExternalLocations
193 * @param externals list of files
195 static void registerExternalLocations(
196 DbWidgetHandle widgetHandle,
197 const ExternalLocationList &
200 static void registerServiceInternal(
201 const ConfigParserData::ServiceAppInfo &serviceAppInfo,
202 const WidgetRegisterInfo &widgetRegInfo,
203 const IWidgetSecurity &widgetSecurity);
205 #if USE(WEB_PROVIDER)
206 static void registerLiveBoxInfo(
207 DbWidgetHandle widgetHandle,
208 const WidgetRegisterInfo ®Info);
210 static void registerWidgetInternal(
211 const TizenAppId & tzAppId,
212 const WidgetRegisterInfo &widgetRegInfo,
213 const IWidgetSecurity &widgetSecurity,
214 const boost::optional<DbWidgetHandle> handle =
215 boost::optional<DbWidgetHandle>());
216 static void unregisterWidgetInternal(const TizenAppId & tzAppId);
217 static void insertAppControlInfo(DbWidgetHandle handle,
219 DPL::String operation,
226 #endif // WIDGET_DAO_H