Changed PkgName type from DPL::Optional<DPL::String> to DPL::String.
authorJan Olszak <j.olszak@samsung.com>
Mon, 3 Dec 2012 10:09:00 +0000 (11:09 +0100)
committerGerrit Code Review <gerrit2@kim11>
Thu, 6 Dec 2012 11:18:16 +0000 (20:18 +0900)
[Issue#] PkgName could have been NULL.
[Bug] N/A
[Cause] N/A
[Solution] Changed Pkgname type, changed definition in database to NOT NULL.
[Verification] Build commons, plugins, installer,wrt. Run DAO tests.

Change-Id: Idf342238d6e290c279b2197de233b5eab57d155f

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 f533661..7c1334c 100644 (file)
@@ -65,9 +65,9 @@ std::string createDatabasePath(int widgetHandle)
     {
         std::stringstream filename;
         WrtDB::WidgetDAOReadOnly widgetDAO(widgetHandle);
-        DPL::Optional<DPL::String> pkgname = widgetDAO.getPkgname();
+        WrtDB::WidgetPkgName pkgname = widgetDAO.getPkgname_TEMPORARY_API();
 
-        filename << GetWidgetPersistentStoragePath(*pkgname)
+        filename << GetWidgetPersistentStoragePath(pkgname)
                  << "/"
                  << SECURITY_ORIGIN_DB_NAME;
         return filename.str();
index d46f378..44389c7 100644 (file)
@@ -98,6 +98,14 @@ void WidgetDAO::setProperty(
 
 void WidgetDAO::setPkgName(const DPL::OptionalString& pkgName)
 {
+
+   // if(!!pkgName)
+        setPkgName_TEMPORARY_API(*pkgName);
+}
+
+
+void WidgetDAO::setPkgName_TEMPORARY_API(const WidgetPkgName& pkgName)
+{
     SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
     {
         using namespace DPL::DB::ORM;
index 0d52aae..ca047c3 100644 (file)
@@ -375,6 +375,17 @@ DbWidgetHandleList WidgetDAOReadOnly::getHandleList()
 WidgetPkgNameList WidgetDAOReadOnly::getPkgnameList()
 {
     LogDebug("Getting Pkgname List");
+    WidgetPkgNameList_TEMPORARY_API pkgnameList_TEMPORARY_API = getPkgnameList_TEMPORARY_API();
+    WidgetPkgNameList pkgnameList;
+    FOREACH(it,pkgnameList_TEMPORARY_API ){
+        pkgnameList.push_back(DPL::Optional<WidgetPkgName>(*it));
+    }
+    return pkgnameList;
+}
+
+WidgetPkgNameList_TEMPORARY_API WidgetDAOReadOnly::getPkgnameList_TEMPORARY_API()
+{
+    LogDebug("Getting Pkgname List ");
     SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
     {
         WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
@@ -489,6 +500,11 @@ WidgetGUID WidgetDAOReadOnly::getGUID() const
 
 DPL::OptionalString WidgetDAOReadOnly::getPkgname() const
 {
+    return DPL::OptionalString(getPkgname_TEMPORARY_API());
+}
+
+WidgetPkgName WidgetDAOReadOnly::getPkgname_TEMPORARY_API() const
+{
     WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
     return row.Get_pkgname();
 }
@@ -966,9 +982,9 @@ std::string WidgetDAOReadOnly::getCookieDatabasePath() const
     using namespace WrtDB::WidgetConfig;
     std::ostringstream path;
 
-    DPL::OptionalString pkgname = getPkgname();
+    WidgetPkgName pkgname = getPkgname_TEMPORARY_API();
 
-    path << GetWidgetPersistentStoragePath(*pkgname);
+    path << GetWidgetPersistentStoragePath(pkgname);
     path << "/";
     path << GlobalConfig::GetCookieDatabaseFile();
 
@@ -978,8 +994,8 @@ std::string WidgetDAOReadOnly::getCookieDatabasePath() const
 std::string WidgetDAOReadOnly::getPrivateLocalStoragePath() const
 {
     std::ostringstream path;
-    DPL::OptionalString pkgname = getPkgname();
-    path << WidgetConfig::GetWidgetWebLocalStoragePath(*pkgname);
+    WidgetPkgName pkgname = getPkgname_TEMPORARY_API();
+    path << WidgetConfig::GetWidgetWebLocalStoragePath(pkgname);
     path << "/";
 
     return path.str();
index 57659ad..17ebf57 100644 (file)
@@ -237,6 +237,7 @@ typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
 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_TEMPORARY_API; //TODO: this cannot be null -> appropriate changes in db schema needed
 
 class WidgetDAOReadOnly; //forward declaration
 typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
index 3d33b89..d658e50 100644 (file)
@@ -175,7 +175,10 @@ struct WidgetRegisterInfo
     int isTestWidget;
     ConfigParserData configInfo;
     LocalizationData localizationData;
+
     DPL::OptionalString pkgname;
+    WidgetPkgName pkgname_TEMPORARY_API;
+
     time_t installedTime;
     PackagingType packagingType;
     EncryptedFileList encryptedFiles;
@@ -365,6 +368,7 @@ class WidgetDAOReadOnly
      * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in DB table.
      */
     DPL::OptionalString getPkgname() const;
+    WidgetPkgName getPkgname_TEMPORARY_API() const;
 
     /**
      * This method returns the defaultlocale for the widget.
@@ -559,6 +563,7 @@ class WidgetDAOReadOnly
      * @return list of pkgname of installed packages
      */
     static WidgetPkgNameList getPkgnameList();
+    static WidgetPkgNameList_TEMPORARY_API getPkgnameList_TEMPORARY_API();
 
     /**
      * This method returns a list of all the installed widgets.
index 44b9d1b..e6776d8 100644 (file)
@@ -133,6 +133,7 @@ class WidgetDAO : public WidgetDAOReadOnly
     /* set PkgName
      */
     void setPkgName(const DPL::OptionalString& pkgName);
+    void setPkgName_TEMPORARY_API(const WidgetPkgName& pkgName);
 
     /* This function will update of api-feature status.
      * If status is true (feature rejected) plugin connected with this
index 56c93a0..73d2a89 100644 (file)
@@ -38,7 +38,7 @@ CREATE_TABLE(WidgetInfo)
     COLUMN_NOT_NULL(back_supported, TINYINT,       DEFAULT 0)
     COLUMN(access_network,          TINYINT,       DEFAULT 0)
     COLUMN(defaultlocale,           VARCHAR(256),  DEFAULT 0)
-    COLUMN(pkgname,                 VARCHAR(256),  DEFAULT 0 UNIQUE)
+    COLUMN_NOT_NULL(pkgname,        VARCHAR(256),  DEFAULT 0 UNIQUE)
     COLUMN(pkg_type,                INT,  DEFAULT 0)
 CREATE_TABLE_END()