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/db/orm.h>
38 #include <dpl/wrt-dao-ro/config_parser_data.h>
39 #include <dpl/wrt-dao-rw/property_dao.h>
42 class WidgetDAO : public WidgetDAOReadOnly
45 typedef std::list<DPL::String> LanguageTagsList;
47 WidgetDAO(DPL::OptionalString widgetGUID);
48 WidgetDAO(DPL::String tzAppId);
56 * This method registers the widget information in the DB when it is
59 * @see WidgetRegisterInfo
60 * @see UnRegisterWidget()
61 * @param[in] TizenAppId Widget app id that will be registered.
62 * @param[in] pWidgetRegisterInfo Specified the widget's information
63 * needed to be registered.
64 * @param[in] widgetSecurity Widget's security certificates.
66 static void registerWidget(
67 const TizenAppId& tzAppId,
68 const WidgetRegisterInfo &widgetRegInfo,
69 const IWidgetSecurity &widgetSecurity);
71 static void registerService(
72 const ConfigParserData::ServiceAppInfo &serviceAppInfo,
73 const WidgetRegisterInfo &widgetRegInfo,
74 const IWidgetSecurity &widgetSecurity);
77 * @brief registerWidgetGenerateTizenId Registers widget with auto-generated
80 * This function is disadviced and should be used only in tests.
81 * Function is not thread-safe.
83 * @param pWidgetRegisterInfo registeration information
84 * @param widgetSecurity Widget's security certificates.
85 * @return tzAppId generated
87 static TizenAppId registerWidgetGeneratePkgId(
88 const WidgetRegisterInfo &pWidgetRegisterInfo,
89 const IWidgetSecurity &widgetSecurity);
91 static void updateTizenAppId(const TizenAppId & fromAppId,
92 const TizenAppId & toAppId);
94 * This method removes a widget's information from EmDB.
96 * @see RegisterWidget()
97 * @param[in] tzAppId widgets name to be unregistered
99 static void unregisterWidget(const TizenAppId & tzAppId);
101 /* This method removes widget property
103 void removeProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key);
106 * @brief registerExternalLocations Removes rows from
107 * WidgetExternalLocations
109 void unregisterAllExternalLocations();
111 /* This method sets widget property
113 void setProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key,
114 const PropertyDAOReadOnly::WidgetPropertyValue &value,
115 bool readOnly = false);
119 void setTizenAppId(const DPL::OptionalString& tzAppId);
121 /* This function will update of api-feature status.
122 * If status is true (feature rejected) plugin connected with this
123 * api feature mustn't be loaded durign widget launch.
125 void updateFeatureRejectStatus(const DbWidgetFeature &widgetFeature);
128 //Methods used during widget registering
129 static DbWidgetHandle registerWidgetInfo(
130 const TizenAppId & tzAppId,
131 const TizenPkgId & tzPkgId,
132 const std::string & baseFolder,
135 const ConfigParserData &widgetConfigurationInfo,
136 const IWidgetSecurity &widgetSecurity,
137 const DPL::Optional<DbWidgetHandle> handle =
138 DPL::Optional<DbWidgetHandle>());
139 static void registerWidgetExtendedInfo(DbWidgetHandle widgetHandle,
140 time_t installedTime,
141 const DPL::OptionalString & splashImgSrc, const DPL::OptionalString & backgroundPage,
142 const DPL::OptionalString & widgetInstalledPath);
143 static void registerWidgetLocalizedInfo(
144 DbWidgetHandle widgetHandle,
145 const ConfigParserData::LocalizedDataSet &localizedDataSet);
146 static void registerWidgetIcons(
147 DbWidgetHandle widgetHandle,
148 const WidgetRegisterInfo::LocalizedIconList &icons);
149 static void registerWidgetStartFile(
150 DbWidgetHandle widgetHandle,
151 const WidgetRegisterInfo::LocalizedStartFileList &startFiles);
152 static void registerWidgetFeatures(
153 DbWidgetHandle widgetHandle,
154 const ConfigParserData::FeaturesList &featuresList);
155 static void registerWidgetPrivilege(
156 DbWidgetHandle widgetHandle,
157 const ConfigParserData::PrivilegeList &privilegeList);
158 static void registerWidgetWindowModes(
159 DbWidgetHandle widgetHandle,
160 const ConfigParserData::StringsList &windowModes);
161 static void registerWidgetWarpInfo(
162 DbWidgetHandle widgetHandle,
163 const ConfigParserData::AccessInfoSet &accessInfoSet);
164 static void registerWidgetAllowNavigationInfo(
165 DbWidgetHandle widgetHandle,
166 const ConfigParserData::AllowNavigationInfoList &allowNavigationInfoList);
167 static void registerWidgetCertificates(
168 DbWidgetHandle widgetHandle,
169 const IWidgetSecurity &widgetSecurity);
170 static void registerCertificatesChains(
171 DbWidgetHandle widgetHandle,
172 CertificateSource certificateSource,
173 const CertificateChainList &list);
174 static void registerWidgetSettings(
175 DbWidgetHandle widgetHandle,
176 const ConfigParserData::SettingsList &settingsList);
177 static void registerAppControl(
178 DbWidgetHandle widgetHandle,
179 const ConfigParserData::AppControlInfoList &appControlList);
180 static void registerEncryptedResouceInfo(
181 DbWidgetHandle widgetHandle,
182 const EncryptedFileList &encryptedFiles);
185 * @brief registerExternalLocations Inserts new rows to
186 * WidgetExternalLocations
187 * @param externals list of files
189 static void registerExternalLocations(
190 DbWidgetHandle widgetHandle,
191 const ExternalLocationList &
194 static void registerServiceInternal(const ConfigParserData::ServiceAppInfo &serviceAppInfo,
195 const WidgetRegisterInfo &widgetRegInfo, const IWidgetSecurity &widgetSecurity);
197 static void registerWidgetInternal(
198 const TizenAppId & tzAppId,
199 const WidgetRegisterInfo &widgetRegInfo,
200 const IWidgetSecurity &widgetSecurity,
201 const DPL::Optional<DbWidgetHandle> handle =
202 DPL::Optional<DbWidgetHandle>());
203 static void unregisterWidgetInternal(const TizenAppId & tzAppId);
204 static void insertAppControlInfo(DbWidgetHandle handle,
206 DPL::String operation,
210 unsigned disposition);
214 #endif // WIDGET_DAO_H