tizen 2.4 release
[framework/web/wrt-commons.git] / modules / widget_dao / dao / property_dao.cpp
similarity index 89%
rename from modules_wearable/widget_dao/dao/property_dao.cpp
rename to modules/widget_dao/dao/property_dao.cpp
index fa6412a..ca8269f 100644 (file)
@@ -22,7 +22,7 @@
 #include <stddef.h>
 #include <dpl/wrt-dao-rw/property_dao.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <dpl/log/log.h>
+#include <dpl/log/wrt_log.h>
 #include <dpl/foreach.h>
 #include <dpl/wrt-dao-ro/webruntime_database.h>
 #include <dpl/wrt-dao-ro/WrtDatabase.h>
@@ -37,7 +37,8 @@ void RemoveProperty(TizenAppId tzAppid,
     // First query asks if given property can be removed,
     // Second removes it. Maybe it should be combined two one.
 
-    LogDebug("Removing Property. appid: " << tzAppid << ", key: " << key);
+    WrtLogD("Removing Property. appid: %ls, key: %ls",
+        tzAppid.c_str(), key.c_str());
     Try {
         DPL::DB::ORM::wrt::ScopedTransaction transaction(
             &WrtDatabase::interface());
@@ -45,9 +46,9 @@ void RemoveProperty(TizenAppId tzAppid,
         DPL::OptionalInt readonly = PropertyDAOReadOnly::CheckPropertyReadFlag(
                 tzAppid,
                 key);
-        if (!readonly.IsNull() && *readonly == 1) {
-            LogError("'" << key <<
-                     "' key is readonly. Cannot remove property !");
+        if (!!readonly && *readonly == 1) {
+            WrtLogE("'%ls' key is readonly. Cannot remove property !",
+                key.c_str());
             ThrowMsg(PropertyDAOReadOnly::Exception::ReadOnlyProperty,
                      "Property is readonly");
         }
@@ -85,8 +86,8 @@ void SetProperty(TizenAppId tzAppid,
                  const PropertyDAOReadOnly::WidgetPropertyValue &value,
                  bool readOnly)
 {
-    LogDebug("Setting/updating Property. appid: " << tzAppid <<
-             ", key: " << key);
+    WrtLogD("Setting/updating Property. appid: %ls, key: %ls",
+        tzAppid.c_str(), key.c_str());
     Try {
         using namespace DPL::DB::ORM;
         using namespace DPL::DB::ORM::wrt;
@@ -96,15 +97,15 @@ void SetProperty(TizenAppId tzAppid,
         DPL::OptionalInt readonly = PropertyDAOReadOnly::CheckPropertyReadFlag(
                 tzAppid,
                 key);
-        if (!readonly.IsNull() && *readonly == 1) {
-            LogError("'" << key <<
-                     "' key is readonly. Cannot remove property !");
+        if (!!readonly && *readonly == 1) {
+            WrtLogE("'%ls' key is readonly. Cannot remove property !",
+                key.c_str());
             ThrowMsg(PropertyDAOReadOnly::Exception::ReadOnlyProperty,
                      "Property is readonly");
         }
         DbWidgetHandle widgetHandle(WidgetDAOReadOnly::getHandle(tzAppid));
 
-        if (readonly.IsNull()) {
+        if (!readonly) {
             WidgetPreference::Row row;
             row.Set_app_id(widgetHandle);
             row.Set_tizen_appid(tzAppid);
@@ -138,7 +139,7 @@ void SetProperty(TizenAppId tzAppid,
 void RegisterProperties(DbWidgetHandle widgetHandle, TizenAppId tzAppid,
                         const WidgetRegisterInfo &regInfo)
 {
-    LogDebug("Registering proferences for widget. appid: " << tzAppid);
+    WrtLogD("Registering proferences for widget. appid: %ls", tzAppid.c_str());
 
     // Try-Catch in WidgetDAO