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.
19 * @file widget_dao_read_only.h
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
27 #ifndef _WRT_SRC_CONFIGURATION_WIDGET_DAO_READ_ONLY_H_
28 #define _WRT_SRC_CONFIGURATION_WIDGET_DAO_READ_ONLY_H_
37 #include <dpl/string.h>
38 #include <dpl/exception.h>
39 #include <dpl/optional_typedefs.h>
41 #include <dpl/wrt-dao-ro/common_dao_types.h>
42 //#include "../wrt-dao-ro/common_dao_types.h"
44 typedef DPL::OptionalString WidgetGUID;
46 namespace ConfigParserData {
50 Icon(const DPL::String& src) : src(src)
54 DPL::OptionalInt width;
55 DPL::OptionalInt height;
56 bool operator==(const Icon&) const;
57 bool operator!=(const Icon&) const;
58 bool operator >(const Icon&) const;
59 bool operator>=(const Icon&) const;
60 bool operator <(const Icon&) const;
61 bool operator<=(const Icon&) const;
63 } // namespace ConfigParserData
66 typedef std::list<DPL::String> StringList;
68 struct WidgetLocalizedInfo
70 DPL::OptionalString name;
71 DPL::OptionalString shortName;
72 DPL::OptionalString description;
73 DPL::OptionalString license;
74 DPL::OptionalString licenseHref;
77 typedef std::list<DPL::String> LanguageTagList;
83 * WidgetDAO Exception classes
88 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
89 DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
90 DECLARE_EXCEPTION_TYPE(Base, ReadOnlyProperty)
91 DECLARE_EXCEPTION_TYPE(Base, GUIDisNull)
92 DECLARE_EXCEPTION_TYPE(Base, UnexpectedEmptyResult)
93 DECLARE_EXCEPTION_TYPE(Base, WidgetNotExist)
94 DECLARE_EXCEPTION_TYPE(Base, AlreadyRegistered)
98 DbWidgetHandle m_widgetHandle;
101 struct WidgetLocalizedIconRow
105 DPL::String widgetLocale;
107 typedef std::list<WidgetLocalizedIconRow> WidgetLocalizedIconList;
114 DPL::OptionalInt iconWidth;
115 DPL::OptionalInt iconHeight;
117 typedef std::list<WidgetIconRow> WidgetIconList;
119 struct WidgetStartFileRow
125 typedef std::list<WidgetStartFileRow> WidgetStartFileList;
127 struct WidgetLocalizedStartFileRow
131 DPL::String widgetLocale;
133 DPL::String encoding;
135 typedef std::list<WidgetLocalizedStartFileRow> LocalizedStartFileList;
139 * This is a constructor.
141 * @param[in] widgetHandle application id of widget.
143 WidgetDAO(DbWidgetHandle widgetHandle)
144 : m_widgetHandle(widgetHandle)
150 virtual ~WidgetDAO(){}
153 * This method returns widget handle(m_widgetHandle).
155 * @return widget handle(m_widgetHandle).
156 * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
157 * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in DB table.
159 DbWidgetHandle getHandle() const { return m_widgetHandle; }
160 DbWidgetHandle getHandle(const WidgetGUID GUID) const;
161 static DbWidgetHandle getHandle(const DPL::String pkgName);
164 * This method returns the root directory of widget resource.
166 * @return path name of root directory.
167 * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
168 * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
171 DPL::String getPath() const;
172 void setPath(const DPL::String &path) const;
175 * This method returns the defaultlocale for the widget.
177 * @return defaultlocale
178 * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
179 * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
182 DPL::OptionalString getDefaultlocale() const;
185 * This method returns list of localized icons files;
187 * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
188 * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
191 WidgetLocalizedIconList getLocalizedIconList() const;
194 * This method returns list of icons files;
196 * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
197 * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
200 WidgetIconList getIconList() const;
203 * This method returns list of localized start files;
205 * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
206 * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
209 LocalizedStartFileList getLocalizedStartFileList() const;
210 void setLocalizedStartFileList(const LocalizedStartFileList &list) const;
212 * This method returns list of start files;
214 * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
215 * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
218 WidgetStartFileList getStartFileList() const;
219 void setStartFileList(const WidgetStartFileList &list) const;
221 WidgetLocalizedInfo getLocalizedInfo(const DPL::String& languageTag) const;
223 static std::map<DbWidgetHandle,WidgetStartFileList> s_startFileMap;
224 static std::map<DbWidgetHandle,LocalizedStartFileList> s_localizedStartFileMap;
225 static std::map<DbWidgetHandle,DPL::String> s_pathMap;
230 #endif // _WRT_SRC_CONFIGURATION_WIDGET_DAO_READ_ONLY_H_