Add "getRootPluginHandleList()" api to PluginDAOReadOnly.
authorTaejeong Lee <taejeong.lee@samsung.com>
Thu, 23 May 2013 07:09:51 +0000 (16:09 +0900)
committerTaejeong Lee <taejeong.lee@samsung.com>
Thu, 23 May 2013 08:19:11 +0000 (17:19 +0900)
[Issue#] N/A
[Problem] Performance
[Cause] N/A
[Solution] Add "getRootPluginHandleList()" api to PluginDAOReadOnly.

Change-Id: I9624177e8349e81fade08e3b96e5d4d4cec751f0

modules/widget_dao/dao/plugin_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h

index d5acba9..045cdd6 100644 (file)
@@ -154,6 +154,35 @@ PluginHandleList PluginDAOReadOnly::getPluginHandleList()
     }
 }
 
+PluginHandleList PluginDAOReadOnly::getRootPluginHandleList()
+{
+    LogDebug("Getting root plugin handle list.");
+    Try {
+        using namespace DPL::DB::ORM;
+        using namespace DPL::DB::ORM::wrt;
+
+        WRT_DB_SELECT(select, PluginProperties, &WrtDatabase::interface())
+        PluginHandleList handleList = select->GetValueList<PluginProperties::PluginPropertiesId>();
+
+        WRT_DB_SELECT(select_2nd, PluginDependencies, &WrtDatabase::interface())
+        PluginDependencies::Select::RowList dependenciesRows = select_2nd->GetRowList();
+
+        if (!dependenciesRows.empty())
+        {
+            FOREACH(it, dependenciesRows)
+            {
+                handleList.remove(it->Get_PluginPropertiesId());
+            }
+        }
+
+        return handleList;
+    }
+    Catch(DPL::DB::SqlConnection::Exception::Base) {
+        ReThrowMsg(PluginDAOReadOnly::Exception::DatabaseError,
+                   "Failed in getRootPluginHandleList");
+    }
+}
+
 DbPluginHandle PluginDAOReadOnly::getPluginHandle() const
 {
     return m_pluginHandle;
index eb9c030..293cf13 100644 (file)
@@ -79,6 +79,7 @@ class PluginDAOReadOnly
     PluginDAOReadOnly(const std::string &libraryName);
 
     static PluginHandleList getPluginHandleList();
+    static PluginHandleList getRootPluginHandleList();
 
     static bool isPluginInstalled(const std::string &libraryName);
     static bool isPluginInstalled(DbPluginHandle pluginHandle);