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/exception.h>
36 #include <dpl/db/orm.h>
37 #include <dpl/wrt-dao-ro/config_parser_data.h>
38 #include <dpl/wrt-dao-rw/property_dao.h>
42 class WidgetDAO : public WidgetDAOReadOnly
45 typedef std::list<DPL::String> LanguageTagsList;
47 WidgetDAO(DbWidgetHandle handle);
48 WidgetDAO(DPL::OptionalString widgetGUID);
49 WidgetDAO(DPL::String pkgName);
57 * This method registers the widget information in the DB when it is installed.
59 * @see WidgetRegisterInfo
60 * @see UnRegisterWidget()
61 * @param[in] widgetPkgname Widget Pkgname that will be registered.
62 * @param[in] pWidgetRegisterInfo Specified the widget's information needed to be registered.
63 * @param[in] wacSecurity Widget's security certificates.
65 static void registerWidget(
66 const WidgetPkgName & widgetPkgname,
67 const WidgetRegisterInfo &widgetRegInfo,
68 const IWacSecurity &wacSecurity);
70 static void registerWidget(
71 WrtDB::DbWidgetHandle handle,
72 const WidgetRegisterInfo &widgetRegInfo,
73 const IWacSecurity &wacSecurity) __attribute__((deprecated));
75 static DbWidgetHandle registerWidget(
76 const WidgetRegisterInfo &pWidgetRegisterInfo,
77 const IWacSecurity &wacSecurity) __attribute__((deprecated));
80 * This method re-registers the widget information to the DB when it is installed.
82 * It performs unregistration and new registration of widget in db in one transaction.
84 * @see WidgetRegisterInfo
85 * @param[in] widgetName Widget pkgname that will be registered.
86 * @param[in] pWidgetRegisterInfo Specified the widget's information needed to be registered.
87 * @param[in] wacSecurity Widget's security certificates.
89 static void registerOrUpdateWidget(
90 const WidgetPkgName & widgetName,
91 const WidgetRegisterInfo &widgetRegInfo,
92 const IWacSecurity &wacSecurity);
95 * This method removes a widget's information from EmDB.
97 * @see RegisterWidget()
98 * @param[in] pkgName widgets name to be unregistered
100 static void unregisterWidget(const WidgetPkgName & pkgName);
102 static void unregisterWidget(WrtDB::DbWidgetHandle handle) __attribute__((deprecated));
104 /* This method removes widget property
106 void removeProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key);
109 * @brief registerExternalLocations Removes rows from WidgetExternalLocations
111 void unregisterAllExternalLocations();
113 /* This method sets widget property
115 void setProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key,
116 const PropertyDAOReadOnly::WidgetPropertyValue &value,
117 bool readOnly = false);
121 void setPkgName(const DPL::OptionalString& pkgName);
123 /* This function will update of api-feature status.
124 * If status is true (feature rejected) plugin connected with this
125 * api feature mustn't be loaded durign widget launch.
127 void updateFeatureRejectStatus(const DbWidgetFeature &widgetFeature);
129 void registerExternalLocations(const ExternalLocationList & externals) __attribute__((deprecated));
132 //Methods used during widget registering
133 static DbWidgetHandle registerWidgetInfo(
134 const WidgetPkgName & widgetName,
135 const WidgetRegisterInfo ®Info,
136 const IWacSecurity &wacSecurity,
137 const DPL::Optional<DbWidgetHandle> handle = DPL::Optional<DbWidgetHandle>());
138 static void registerWidgetExtendedInfo(
139 DbWidgetHandle widgetHandle,
140 const WidgetRegisterInfo ®Info);
141 static void registerWidgetLocalizedInfo(
142 DbWidgetHandle widgetHandle,
143 const WidgetRegisterInfo ®Info);
144 static void registerWidgetIcons(
145 DbWidgetHandle widgetHandle,
146 const WidgetRegisterInfo ®Info);
147 static void registerWidgetStartFile(
148 DbWidgetHandle widgetHandle,
149 const WidgetRegisterInfo ®Info);
150 static void registerWidgetPreferences(
151 DbWidgetHandle widgetHandle,
152 const WidgetRegisterInfo ®Info);
153 static void registerWidgetFeatures(
154 DbWidgetHandle widgetHandle,
155 const WidgetRegisterInfo ®Info);
156 static void registerWidgetWindowModes(
157 DbWidgetHandle widgetHandle,
158 const WidgetRegisterInfo ®Info);
159 static void registerWidgetWarpInfo(
160 DbWidgetHandle widgetHandle,
161 const WidgetRegisterInfo ®Info);
162 static void registerWidgetCertificates(
163 DbWidgetHandle widgetHandle,
164 const IWacSecurity &wacSecurity);
165 static void registerCertificatesChains(
166 DbWidgetHandle widgetHandle,
167 CertificateSource certificateSource,
168 const CertificateChainList &list);
169 static void registerWidgetSettings(
170 DbWidgetHandle widgetHandle,
171 const WidgetRegisterInfo ®Info);
172 static void registerAppService(
173 DbWidgetHandle widgetHandle,
174 const WidgetRegisterInfo ®Info);
175 static void registerEncryptedResouceInfo(
176 DbWidgetHandle widgetHandle,
177 const WidgetRegisterInfo ®Info);
179 * @brief registerExternalLocations Inserts new rows to WidgetExternalLocations
180 * @param externals list of files
182 static void registerExternalLocations(DbWidgetHandle widgetHandle,
183 const ExternalLocationList & externals);
185 static DbWidgetHandle registerWidgetInternal(
186 const WidgetPkgName & widgetName,
187 const WidgetRegisterInfo &widgetRegInfo,
188 const IWacSecurity &wacSecurity,
189 const DPL::Optional<DbWidgetHandle> handle = DPL::Optional<DbWidgetHandle>());
190 static void unregisterWidgetInternal(
191 const WidgetPkgName & pkgName);
196 #endif // WIDGET_DAO_H