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 registerWidgetIcons(
134 DbWidgetHandle widgetHandle,
135 const WidgetRegisterInfo ®Info);
136 static void registerWidgetStartFile(
137 DbWidgetHandle widgetHandle,
138 const WidgetRegisterInfo ®Info);
139 static void registerWidgetPreferences(
140 DbWidgetHandle widgetHandle,
141 const WidgetRegisterInfo ®Info);
142 static void registerWidgetFeatures(
143 DbWidgetHandle widgetHandle,
144 const WidgetRegisterInfo ®Info);
145 static void registerWidgetWindowModes(
146 DbWidgetHandle widgetHandle,
147 const WidgetRegisterInfo ®Info);
148 static void registerWidgetWarpInfo(
149 DbWidgetHandle widgetHandle,
150 const WidgetRegisterInfo ®Info);
151 static void registerWidgetCertificates(
152 DbWidgetHandle widgetHandle,
153 const IWacSecurity &wacSecurity);
154 static void registerLaunchCertificates(
155 DbWidgetHandle widgetHandle,
156 const CertificateChainList &list);
157 static void registerWidgetSettings(
158 DbWidgetHandle widgetHandle,
159 const WidgetRegisterInfo ®Info);
160 static void registerAppService(
161 DbWidgetHandle widgetHandle,
162 const WidgetRegisterInfo ®Info);
167 #endif // WIDGET_DAO_H