Custom Handlers DAO extended with new api
authorAndrzej Surdej <a.surdej@samsung.com>
Mon, 17 Dec 2012 15:21:33 +0000 (16:21 +0100)
committerAndrzej Surdej <a.surdej@samsung.com>
Mon, 17 Dec 2012 15:38:05 +0000 (16:38 +0100)
[Issue#] N/A
[Problem] No possible way to remove all widget handlers during widget uninstall.
[Cause] N/A
[Solution] Added new api to provide this finctions.
[Verification] To verif build repo and run some custom_handlers.wgt tests

Change-Id: I9af542a35f6098f81e69e41123c389f96fd2003a

modules/custom_handler_dao/dao/custom_handler_dao.cpp
modules/custom_handler_dao/include/wrt-commons/custom-handler-dao-rw/custom_handler_dao.h

index 89f6144..555655e 100644 (file)
@@ -268,4 +268,33 @@ void CustomHandlerDAO::unregisterProtocolHandler(const DPL::String& target,
 
 }
 
+void CustomHandlerDAO::removeWidgetProtocolHandlers()
+{
+    LogDebug("ente");
+    Try {
+        CUSTOM_HANDLER_DB_DELETE(deleteProtocol, ProtocolHandlers);
+        deleteProtocol->Where(Equals<ProtocolHandlers::app_id>(m_pkgName));
+        deleteProtocol->Execute();
+
+    } Catch(DPL::DB::SqlConnection::Exception::Base) {
+        ReThrowMsg(CustomHandlerDAO::Exception::DatabaseError,
+                   "Failed to remove widget protoc");
+    }
+}
+
+void CustomHandlerDAO::removeWidgetContentHandlers()
+{
+    LogDebug("ente");
+    Try {
+        CUSTOM_HANDLER_DB_DELETE(deleteContent, ContentHandlers);
+        deleteContent->Where(Equals<ContentHandlers::app_id>(m_pkgName));
+        deleteContent->Execute();
+
+    } Catch(DPL::DB::SqlConnection::Exception::Base) {
+        ReThrowMsg(CustomHandlerDAO::Exception::DatabaseError,
+                   "Failed to remove widget entries");
+    }
+}
+
+
 } // namespace CustomHandlerDB
index f773681..1ce61cf 100644 (file)
@@ -62,6 +62,12 @@ class CustomHandlerDAO : public CustomHandlerDAOReadOnly
     void unregisterProtocolHandler(const DPL::String& target,
                                    const DPL::String& url,
                                    const DPL::String& baseURL);
+
+    /**
+     * Removes all widget entries connected to given ID
+     */
+    void removeWidgetProtocolHandlers();
+    void removeWidgetContentHandlers();
 };
 
 } // namespace CustomHandlerDB