Revert "Pkgname (tizen id) - not null"
authorSoyoung Kim <sy037.kim@samsung.com>
Fri, 30 Nov 2012 08:37:22 +0000 (17:37 +0900)
committerSoyoung Kim <sy037.kim@samsung.com>
Fri, 30 Nov 2012 08:37:29 +0000 (17:37 +0900)
This reverts commit 1800f55be353602203725d82c392f5af0c98e3c8.

modules/security_origin_dao/dao/security_origin_dao.cpp
modules/widget_dao/dao/widget_dao.cpp
modules/widget_dao/dao/widget_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h
modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h
modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h
modules/widget_dao/orm/wrt_db

index d6df4f0..c1bb112 100644 (file)
@@ -65,9 +65,9 @@ std::string createDatabasePath(int widgetHandle)
     {
         std::stringstream filename;
         WrtDB::WidgetDAOReadOnly widgetDAO(widgetHandle);
-        DPL::String pkgname = widgetDAO.getPkgname_NOTNULL();
+        DPL::Optional<DPL::String> pkgname = widgetDAO.getPkgname();
 
-        filename << GetWidgetPersistentStoragePath(pkgname)
+        filename << GetWidgetPersistentStoragePath(*pkgname)
                  << "/"
                  << SECURITY_ORIGIN_DB_NAME;
         return filename.str();
index 9327806..d46f378 100644 (file)
@@ -53,7 +53,6 @@ namespace WrtDB {
 
 WidgetDAO::WidgetDAO(DPL::OptionalString widgetGUID) :
     WidgetDAOReadOnly(WidgetDAOReadOnly::getHandle(widgetGUID))
-// TODO THIS WILL BE DELETED
 {
 }
 
@@ -120,29 +119,6 @@ void WidgetDAO::setPkgName(const DPL::OptionalString& pkgName)
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register widget")
 }
 
-void WidgetDAO::setPkgName_NOTNULL(const DPL::String& pkgName)
-{
-    SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
-    {
-        using namespace DPL::DB::ORM;
-        wrt::ScopedTransaction transaction(&WrtDatabase::interface());
-
-        isWidgetInstalled(getHandle());
-
-        wrt::WidgetInfo::Row row;
-        row.Set_pkgname(pkgName);
-
-        WRT_DB_UPDATE(update, wrt::WidgetInfo, &WrtDatabase::interface())
-        update->Where(
-            Equals<wrt::WidgetInfo::app_id>(getHandle()));
-
-        update->Values(row);
-        update->Execute();
-        transaction.Commit();
-    }
-    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register widget")
-}
-
 void WidgetDAO::setSecurityPopupUsage(const SettingsType value)
 {
     SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
index b23eaa6..0d52aae 100644 (file)
@@ -383,19 +383,6 @@ WidgetPkgNameList WidgetDAOReadOnly::getPkgnameList()
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get Pkgname list")
 }
 
-WidgetPkgNameList_NOTNULL WidgetDAOReadOnly::getPkgnameList_NOTNULL()
-{
-    LogDebug("Getting Pkgname List");
-    SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
-    {
-        using namespace DPL::DB::ORM;
-        using namespace DPL::DB::ORM::wrt;
-        WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
-        return select->GetValueList<WidgetInfo::pkgname_NOTNULL>();
-    }
-    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get Pkgname list")
-}
-
 DbWidgetDAOReadOnlyList WidgetDAOReadOnly::getWidgetList()
 {
     LogDebug("Getting DbWidget List");
@@ -506,12 +493,6 @@ DPL::OptionalString WidgetDAOReadOnly::getPkgname() const
     return row.Get_pkgname();
 }
 
-DPL::String WidgetDAOReadOnly::getPkgname_NOTNULL() const
-{
-    WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
-    return *row.Get_pkgname();
-}
-
 DPL::OptionalString WidgetDAOReadOnly::getDefaultlocale() const
 {
     WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
@@ -985,9 +966,9 @@ std::string WidgetDAOReadOnly::getCookieDatabasePath() const
     using namespace WrtDB::WidgetConfig;
     std::ostringstream path;
 
-    DPL::String pkgname = getPkgname_NOTNULL();
+    DPL::OptionalString pkgname = getPkgname();
 
-    path << GetWidgetPersistentStoragePath(pkgname);
+    path << GetWidgetPersistentStoragePath(*pkgname);
     path << "/";
     path << GlobalConfig::GetCookieDatabaseFile();
 
@@ -997,8 +978,8 @@ std::string WidgetDAOReadOnly::getCookieDatabasePath() const
 std::string WidgetDAOReadOnly::getPrivateLocalStoragePath() const
 {
     std::ostringstream path;
-    DPL::String pkgname = getPkgname_NOTNULL();
-    path << WidgetConfig::GetWidgetWebLocalStoragePath(pkgname);
+    DPL::OptionalString pkgname = getPkgname();
+    path << WidgetConfig::GetWidgetWebLocalStoragePath(*pkgname);
     path << "/";
 
     return path.str();
index 6b69d17..c40e396 100644 (file)
@@ -238,8 +238,6 @@ typedef std::list<DbWidgetHandle> DbWidgetHandleList;
 
 typedef std::list<DPL::Optional<WidgetPkgName> > WidgetPkgNameList; //TODO: this cannot be null -> appropriate changes in db schema needed
 
-typedef std::list<WidgetPkgName > WidgetPkgNameList_NOTNULL; //TODO: this cannot be null -> appropriate changes in db schema needed
-
 class WidgetDAOReadOnly; //forward declaration
 typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
 /**
index d427ce1..3d33b89 100644 (file)
@@ -175,10 +175,7 @@ struct WidgetRegisterInfo
     int isTestWidget;
     ConfigParserData configInfo;
     LocalizationData localizationData;
-
     DPL::OptionalString pkgname;
-    DPL::String pkgname_NOTNULL;
-
     time_t installedTime;
     PackagingType packagingType;
     EncryptedFileList encryptedFiles;
@@ -369,8 +366,6 @@ class WidgetDAOReadOnly
      */
     DPL::OptionalString getPkgname() const;
 
-    DPL::String getPkgname_NOTNULL() const;
-
     /**
      * This method returns the defaultlocale for the widget.
      *
@@ -564,7 +559,6 @@ class WidgetDAOReadOnly
      * @return list of pkgname of installed packages
      */
     static WidgetPkgNameList getPkgnameList();
-    static WidgetPkgNameList_NOTNULL getPkgnameList_NOTNULL();
 
     /**
      * This method returns a list of all the installed widgets.
@@ -575,6 +569,7 @@ class WidgetDAOReadOnly
      *  DB table.
      */
     static DbWidgetDAOReadOnlyList getWidgetList();
+
    /**
      * This method removes a widget's information from EmDB.
      *
index 9888852..44b9d1b 100644 (file)
@@ -134,8 +134,6 @@ class WidgetDAO : public WidgetDAOReadOnly
      */
     void setPkgName(const DPL::OptionalString& pkgName);
 
-    void setPkgName_NOTNULL(const DPL::String& pkgName);
-
     /* This function will update of api-feature status.
      * If status is true (feature rejected) plugin connected with this
      * api feature mustn't be loaded durign widget launch.
index 9167222..56c93a0 100644 (file)
@@ -39,7 +39,6 @@ CREATE_TABLE(WidgetInfo)
     COLUMN(access_network,          TINYINT,       DEFAULT 0)
     COLUMN(defaultlocale,           VARCHAR(256),  DEFAULT 0)
     COLUMN(pkgname,                 VARCHAR(256),  DEFAULT 0 UNIQUE)
-    COLUMN_NOT_NULL(pkgname_NOTNULL,VARCHAR(256),  DEFAULT 0 UNIQUE)
     COLUMN(pkg_type,                INT,  DEFAULT 0)
 CREATE_TABLE_END()