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;
48 * This is a constructor.
50 * @param[in] widgetHandle application id of widget.
51 * @param[in] widgetGUID application guid of widget.
53 WidgetDAO(DbWidgetHandle widgetHandle);
54 WidgetDAO(DPL::OptionalString widgetGUID);
62 * This method registers the widget information to the DB when it is installed.
64 * @see WidgetRegisterInfo
65 * @see UnRegisterWidget()
66 * @param[in] widgetHandle Widget ID that will be registered.
67 * @param[in] pWidgetRegisterInfo Specified the widget's information needed to be registered.
68 * @param[in] wacSecurity Widget's security certificates.
70 static void registerWidget(
71 const DbWidgetHandle& widgetHandle,
72 const WidgetRegisterInfo &pWidgetRegisterInfo,
73 const IWacSecurity &wacSecurity);
75 static DbWidgetHandle registerWidget(
76 const WidgetRegisterInfo &pWidgetRegisterInfo,
77 const IWacSecurity &wacSecurity) __attribute__((deprecated))
79 //make it more precise due to very fast tests
81 gettimeofday(&tv, NULL);
82 srand(time(NULL) + tv.tv_usec);
83 DbWidgetHandle widgetHandle;
85 widgetHandle = rand();
86 } while (isWidgetInstalled(widgetHandle));
88 registerWidget(widgetHandle, pWidgetRegisterInfo, wacSecurity);
93 * This method removes a widget's information from EmDB.
95 * @see RegisterWidget()
96 * @param[in] widgetHandle widget's app id
97 * @return true if succeed, false if fail.
99 static void unregisterWidget(DbWidgetHandle widgetHandle);
101 /* This method removes widget property
103 void removeProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key);
105 /* This method sets widget property
107 void setProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key,
108 const PropertyDAOReadOnly::WidgetPropertyValue &value,
109 bool readOnly = false);
113 void setPkgName(const DPL::OptionalString& pkgName);
115 /* This function will update of api-feature status.
116 * If status is true (feature rejected) plugin connected with this
117 * api feature mustn't be loaded durign widget launch.
119 void updateFeatureRejectStatus(const DbWidgetFeature &widgetFeature);
122 //Methods used during widget registering
123 static void registerWidgetInfo(
124 const DbWidgetHandle& widgetHandle,
125 const WidgetRegisterInfo ®Info,
126 const IWacSecurity &wacSecurity);
127 static void registerWidgetExtendedInfo(
128 DbWidgetHandle widgetHandle,
129 const WidgetRegisterInfo ®Info);
130 static void registerWidgetLocalizedInfo(
131 DbWidgetHandle widgetHandle,
132 const WidgetRegisterInfo ®Info);
133 static void registerWidgetUserAgentLocales(
134 DbWidgetHandle widgetHandle,
135 const WidgetRegisterInfo &rInf,
136 const LanguageTagsList& languageTags);
137 static void registerWidgetIcons(
138 DbWidgetHandle widgetHandle,
139 const WidgetRegisterInfo ®Info);
140 static void registerWidgetStartFile(
141 DbWidgetHandle widgetHandle,
142 const WidgetRegisterInfo ®Info);
143 static void registerWidgetPreferences(
144 DbWidgetHandle widgetHandle,
145 const WidgetRegisterInfo ®Info);
146 static void registerWidgetFeatures(
147 DbWidgetHandle widgetHandle,
148 const WidgetRegisterInfo ®Info);
149 static void registerWidgetWindowModes(
150 DbWidgetHandle widgetHandle,
151 const WidgetRegisterInfo ®Info);
152 static void registerWidgetWarpInfo(
153 DbWidgetHandle widgetHandle,
154 const WidgetRegisterInfo ®Info);
155 static void registerWidgetCertificates(
156 DbWidgetHandle widgetHandle,
157 const IWacSecurity &wacSecurity);
158 static void registerLaunchCertificates(
159 DbWidgetHandle widgetHandle,
160 const CertificateChainList &list);
161 static void registerWidgetSettings(
162 DbWidgetHandle widgetHandle,
163 const WidgetRegisterInfo ®Info);
164 static void registerAppService(
165 DbWidgetHandle widgetHandle,
166 const WidgetRegisterInfo ®Info);
171 #endif // WIDGET_DAO_H