From 45351cca66227363e5096b28d1a6ae53e8d898f9 Mon Sep 17 00:00:00 2001 From: Soyoung Kim Date: Mon, 15 Oct 2012 16:25:24 +0900 Subject: [PATCH] [Commons] Modify package type [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 | 12 ++++++-- .../widget_dao/dao/widget_dao_read_only.cpp | 4 +-- .../include/dpl/wrt-dao-ro/common_dao_types.h | 30 ++++++++++++------- .../dpl/wrt-dao-ro/widget_dao_read_only.h | 13 ++++---- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index 15b8b59..b26e1b5 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -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 { diff --git a/modules/widget_dao/dao/widget_dao_read_only.cpp b/modules/widget_dao/dao/widget_dao_read_only.cpp index 7e5abf2..6aba4a0 100644 --- a/modules/widget_dao/dao/widget_dao_read_only.cpp +++ b/modules/widget_dao/dao/widget_dao_read_only.cpp @@ -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(*result)); + return PackagingType(static_cast(*result)); } void WidgetDAOReadOnly::getEncryptedFileList(EncryptedFileList& filesList) const diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h index ff2fc09..36ee037 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h @@ -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 diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h index 7fdefdd..3be42ed 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h @@ -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; -- 2.34.1