From 2197a4fb8dc11cabda6de4eabbc24a039c040216 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Tue, 30 Jul 2013 14:26:55 +0900 Subject: [PATCH] Clean-up widget dao [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Remove deprecated API Add getPkgId API [SCMRequest] N/A Change-Id: I8bd69e6339111217d800bd8777ceeb91bf5031d5 --- modules/widget_dao/dao/widget_dao.cpp | 19 ------------- modules/widget_dao/dao/widget_dao_read_only.cpp | 31 ++++++++++++++++++++++ .../include/dpl/wrt-dao-ro/widget_dao_read_only.h | 11 ++------ .../widget_dao/include/dpl/wrt-dao-rw/widget_dao.h | 3 --- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index 1061fe0..d9d0944 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -869,25 +869,6 @@ void WidgetDAO::unregisterWidget(const TizenAppId & tzAppId) SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to unregister widget") } -void WidgetDAO::unregisterWidget(WrtDB::DbWidgetHandle handle) -{ - LogDebug("Unregistering widget from DB. Handle: " << handle); - SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN - { - using namespace DPL::DB::ORM; - using namespace DPL::DB::ORM::wrt; - ScopedTransaction transaction(&WrtDatabase::interface()); - - // Delete from table Widget Info - WRT_DB_DELETE(del, WidgetInfo, &WrtDatabase::interface()) - del->Where(Equals(handle)); - del->Execute(); - - transaction.Commit(); - } - SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to unregister widget") -} - void WidgetDAO::unregisterWidgetInternal( const TizenAppId & tzAppId) { diff --git a/modules/widget_dao/dao/widget_dao_read_only.cpp b/modules/widget_dao/dao/widget_dao_read_only.cpp index 5b3ffa1..343c29a 100644 --- a/modules/widget_dao/dao/widget_dao_read_only.cpp +++ b/modules/widget_dao/dao/widget_dao_read_only.cpp @@ -176,6 +176,27 @@ TizenPkgId getTizenPkgIdByHandle(const DbWidgetHandle handle) } SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed in getHandle") } + +TizenPkgId getTizenPkgIdByAppId(const TizenAppId tzAppid) +{ + LogDebug("Getting TizenPkgId by TizenAppId: " << tzAppid); + + SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN + { + WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface()) + select->Where(Equals(tzAppid)); + WidgetInfo::Select::RowList rowList = select->GetRowList(); + + if (rowList.empty()) { + ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist, + "Failed to get widget by tizen appId"); + } + TizenPkgId tzPkgid = rowList.front().Get_tizen_pkgid(); + + return tzPkgid; + } + SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed get pkgId") +} } // namespace IWidgetSecurity::~IWidgetSecurity() @@ -264,6 +285,16 @@ TizenPkgId WidgetDAOReadOnly::getTzPkgId() const return getTizenPkgIdByHandle(m_widgetHandle); } +TizenPkgId WidgetDAOReadOnly::getTzPkgId(const DbWidgetHandle handle) +{ + return getTizenPkgIdByHandle(handle); +} + +TizenPkgId WidgetDAOReadOnly::getTzPkgId(const TizenAppId tzAppid) +{ + return getTizenPkgIdByAppId(tzAppid); +} + PropertyDAOReadOnly::WidgetPropertyKeyList WidgetDAOReadOnly::getPropertyKeyList() const { diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h index 7cf793a..56178d4 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h @@ -334,6 +334,8 @@ class WidgetDAOReadOnly */ TizenPkgId getTzPkgId() const; + static TizenPkgId getTzPkgId(const DbWidgetHandle handle); + static TizenPkgId getTzPkgId(const TizenAppId tzAppid); /** * This method returns the root directory of widget resource. @@ -603,15 +605,6 @@ class WidgetDAOReadOnly static DbWidgetDAOReadOnlyList getWidgetList(); /** - * This method removes a widget's information from EmDB. - * - * @see RegisterWidget() - * @param[in] widgetHandle widget's app id - * @return true if succeed, false if fail. - */ - static void unregisterWidget(DbWidgetHandle widgetHandle); - - /** * This method gets author's infomation of a widget which is parsed from * configiration document. * diff --git a/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h b/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h index 42fb635..6781adc 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h +++ b/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h @@ -126,9 +126,6 @@ class WidgetDAO : public WidgetDAOReadOnly */ static void unregisterWidget(const TizenAppId & tzAppId); - static void unregisterWidget(WrtDB::DbWidgetHandle handle) __attribute__(( - deprecated)); - /* This method removes widget property */ void removeProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key); -- 2.7.4