[Commons] Modify package type
authorSoyoung Kim <sy037.kim@samsung.com>
Mon, 15 Oct 2012 07:25:24 +0000 (16:25 +0900)
committerSoyoung Kim <sy037.kim@samsung.com>
Mon, 5 Nov 2012 07:59:46 +0000 (16:59 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Modify package type
[SCMRequest] should be installed with wrt-installer

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

index 15b8b59..b26e1b5 100644 (file)
@@ -280,7 +280,15 @@ DbWidgetHandle WidgetDAO::registerWidgetInfo(
     {
         row.Set_app_id(*handle);
     }
-    row.Set_widget_type(regInfo.type.appType);
+
+    if (regInfo.webAppType == APP_TYPE_UNKNOWN && regInfo.type !=
+            APP_TYPE_UNKNOWN) {
+        // TODO : regInfo.type is temporary code for security.
+        //        This code will be removed.
+        row.Set_widget_type(regInfo.type.appType);
+    } else {
+        row.Set_widget_type(regInfo.webAppType.appType);
+    }
     row.Set_widget_id(widgetConfigurationInfo.widget_id);
     row.Set_defaultlocale(widgetConfigurationInfo.defaultlocale);
     row.Set_widget_version(widgetConfigurationInfo.version);
@@ -303,7 +311,7 @@ DbWidgetHandle WidgetDAO::registerWidgetInfo(
     row.Set_back_supported(widgetConfigurationInfo.backSupported);
     row.Set_access_network(widgetConfigurationInfo.accessNetwork);
     row.Set_pkgname(regInfo.pkgname);
-    row.Set_pkg_type(regInfo.pType.pkgType);
+    row.Set_pkg_type(regInfo.packagingType.pkgType);
 
     Try
     {
index 7e5abf2..6aba4a0 100644 (file)
@@ -1083,11 +1083,11 @@ void WidgetDAOReadOnly::getAppServiceList(
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get access host list")
 }
 
-PkgType WidgetDAOReadOnly::getPkgType() const
+PackagingType WidgetDAOReadOnly::getPackagingType() const
 {
     WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
     DPL::OptionalInt result = row.Get_pkg_type();
-    return PkgType(static_cast<PackagingType>(*result));
+    return PackagingType(static_cast<PkgType>(*result));
 }
 
 void WidgetDAOReadOnly::getEncryptedFileList(EncryptedFileList& filesList) const
index ff2fc09..36ee037 100644 (file)
@@ -272,6 +272,10 @@ class WidgetType
     {
         return appType == other;
     }
+    bool operator!= (const AppType& other) const
+    {
+        return appType != other;
+    }
     std::string getApptypeToString()
     {
         switch (appType) {
@@ -293,42 +297,48 @@ class WidgetType
  *
  * Package type describes belowed in Tizen webapp, C++ service App
  */
-enum PackagingType
+enum PkgType
 {
     PKG_TYPE_UNKNOWN = 0, // unknown
-    PKG_TYPE_TIZEN_WEBAPP, // Tizen webapp
-    PKG_TYPE_TIZEN_WITHSVCAPP // Tizen webapp with C++ service app
+    PKG_TYPE_NOMAL_WEB_APP,
+    PKG_TYPE_HOSTED_WEB_APP,    // request from browser
+    PKG_TYPE_HYBRID_WEB_APP, // Tizen webapp with C++ service app
 };
 
-class PkgType
+class PackagingType
 {
   public:
-    PkgType()
+    PackagingType()
     :pkgType(PKG_TYPE_UNKNOWN)
     {
     }
-    PkgType(const PackagingType type)
+    PackagingType(const PkgType type)
     :pkgType(type)
     {
     }
-    bool operator== (const PackagingType& other) const
+    bool operator== (const PkgType& other) const
     {
         return pkgType == other;
     }
+    bool operator!= (const PkgType& other) const
+    {
+        return pkgType != other;
+    }
     std::string getPkgtypeToString()
     {
         switch (pkgType) {
 #define X(x) case x: return #x;
         X(PKG_TYPE_UNKNOWN)
-        X(PKG_TYPE_TIZEN_WEBAPP)
-        X(PKG_TYPE_TIZEN_WITHSVCAPP)
+        X(PKG_TYPE_NOMAL_WEB_APP)
+        X(PKG_TYPE_HOSTED_WEB_APP)
+        X(PKG_TYPE_HYBRID_WEB_APP)
 #undef X
         default:
             return "UNKNOWN";
         }
     }
 
-    PackagingType pkgType;
+    PkgType pkgType;
 };
 
 } // namespace WrtDB
index 7fdefdd..3be42ed 100644 (file)
@@ -156,15 +156,16 @@ struct WidgetRegisterInfo
 
     //Constructor
     WidgetRegisterInfo() :
-        type(APP_TYPE_UNKNOWN),
+        webAppType(APP_TYPE_UNKNOWN),
         signatureType(SIGNATURE_TYPE_UNIDENTIFIED),
         isTestWidget(0),
         configInfo(),
-        pType(PKG_TYPE_UNKNOWN)
+        packagingType(PKG_TYPE_UNKNOWN)
     {
     }
 
-    WidgetType type;
+    WidgetType webAppType;
+    WidgetType type; // TODO : This type will be removed.
     DPL::OptionalString guid;
     DPL::OptionalString version;
     DPL::OptionalString minVersion;
@@ -176,7 +177,7 @@ struct WidgetRegisterInfo
     LocalizationData localizationData;
     DPL::OptionalString pkgname;
     time_t installedTime;
-    PkgType pType;
+    PackagingType packagingType;
     EncryptedFileList encryptedFiles;
     ExternalLocationList externalLocations;
 };
@@ -724,12 +725,12 @@ class WidgetDAOReadOnly
     /**
      * This method returns the type of the package.
      *
-     * @return PkgType
+     * @return PackagingType
      * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
      * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching
                                                 records in DB table.
      */
-    PkgType getPkgType() const;
+    PackagingType getPackagingType() const;
 
     void getEncryptedFileList(EncryptedFileList& filesList) const;