From: Jan Olszak Date: Mon, 22 Oct 2012 08:25:56 +0000 (+0200) Subject: Code refactoring and removal of factory_widget attribute. X-Git-Tag: submit/trunk/20121102.073532~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35f601d07a0d5589c483393a68963139e9dc77d6;p=platform%2Fframework%2Fweb%2Fwrt-commons.git Code refactoring and removal of factory_widget attribute. [Issue#] N/A [Bug] KW comments, spelling mistake in table name. Unused factory_widget property. [Cause] N/A [Solution] Removed KW comments, renamed table from SettignsList to SettingsList, removed factory_widget and related methods, error codes, exceptions. [Verification] 1. Verification of renaming SettingsList - build wrt-extra with no errors. 2. Verification of factory_widget - build and run DAO tests. Change-Id: I1b8bfba88cf494e1131dec9da26a7ba6270b6e69 --- diff --git a/modules/utils/include/dpl/utils/warp_iri.h b/modules/utils/include/dpl/utils/warp_iri.h index 901fd15..6968b66 100644 --- a/modules/utils/include/dpl/utils/warp_iri.h +++ b/modules/utils/include/dpl/utils/warp_iri.h @@ -35,16 +35,8 @@ class WarpIRI /* It also checks port and schema */ bool isSubDomain(const WarpIRI &second) const; bool isAccessDefinition() const; - // KW bool isIRIValid() const; bool getSubDomain() const; - /* This is debug function */ - // KW void print() const { - // KW LogInfo("P:" << m_port << " S:" << m_schema); - // KW for (size_t i = 0; i < m_host.size(); ++i) - // KW LogInfo(" " << m_host[i]); - // KW } - static bool isIRISchemaIgnored(const char *iri); bool operator ==(const WarpIRI &other) const diff --git a/modules/utils/src/warp_iri.cpp b/modules/utils/src/warp_iri.cpp index ba633bf..2fe65ec 100644 --- a/modules/utils/src/warp_iri.cpp +++ b/modules/utils/src/warp_iri.cpp @@ -195,10 +195,6 @@ bool WarpIRI::isAccessDefinition() const return m_isAccessDefinition; } -// KW bool WarpIRI::isIRIValid() const { -// KW return m_isIRIValid; -// KW } - bool WarpIRI::getSubDomain() const { return m_domain; diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index 4c7084a..8b20f55 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -199,7 +199,6 @@ void WidgetDAO::registerWidgetExtendedInfo(DbWidgetHandle widgetHandle, row.Set_app_id(widgetHandle); // row.Set_share_href (DPL::FromUTF8String(regInfo.shareHref)); row.Set_signature_type(regInfo.signatureType); - row.Set_factory_widget(regInfo.isFactoryWidget); row.Set_test_widget(regInfo.isTestWidget); row.Set_install_time(regInfo.installedTime); row.Set_splash_img_src(regInfo.configInfo.splashImgSrc); @@ -518,12 +517,12 @@ void WidgetDAO::registerWidgetSettings(DbWidgetHandle widgetHandle, FOREACH(pWidgetSetting, widgetConfigurationInfo.settingsList) { - SettginsList::Row row; + SettingsList::Row row; row.Set_appId(widgetHandle); row.Set_settingName(pWidgetSetting->m_name); row.Set_settingValue(pWidgetSetting->m_value); - DO_INSERT(row, SettginsList) + DO_INSERT(row, SettingsList) } } diff --git a/modules/widget_dao/dao/widget_dao_read_only.cpp b/modules/widget_dao/dao/widget_dao_read_only.cpp index e9fc3ec..8d29294 100644 --- a/modules/widget_dao/dao/widget_dao_read_only.cpp +++ b/modules/widget_dao/dao/widget_dao_read_only.cpp @@ -198,23 +198,11 @@ DPL::String WidgetDAOReadOnly::getPath() const GlobalConfig::GetUserInstalledWidgetPath()); DPL::String srcPath = DPL::FromUTF8String(GlobalConfig::GetWidgetSrcPath()); - bool isFactoryWidget = isFactory(); - - if (isFactoryWidget) { - WidgetGUID widgetGUID = getGUID(); - if (!widgetGUID) { - Throw(WidgetDAOReadOnly::Exception::GUIDisNull); - } - path += L"/" + *widgetGUID + L"/"; - } else { - // if the widget is a "downloaded widget", - // use unique package name. - DPL::OStringStream strAppId; - strAppId << m_widgetHandle; - DPL::OptionalString pkgname = getPkgname(); - path += L"/" + *pkgname; - path += srcPath + L"/"; - } + DPL::OStringStream strAppId; + strAppId << m_widgetHandle; + DPL::OptionalString pkgname = getPkgname(); + path += L"/" + *pkgname; + path += srcPath + L"/"; return path; } @@ -632,30 +620,6 @@ bool WidgetDAOReadOnly::getWebkitPluginsRequired() const if (ret.IsNull() || *ret == 0) { return false; } else { return true; } } -bool WidgetDAOReadOnly::isFactory() const -{ - SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN - { - using namespace DPL::DB::ORM; - using namespace DPL::DB::ORM::wrt; - WRT_DB_SELECT(select, WidgetExtendedInfo, &WrtDatabase::interface()) - select->Where(Equals(m_widgetHandle)); - - WidgetExtendedInfo::Select::RowList rows = select->GetRowList(); - if (rows.empty()) { - ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist, - "Cannot find widget. Handle: " << m_widgetHandle); - } - - DPL::OptionalInt ret = rows.front().Get_factory_widget(); - if (ret.IsNull()) { - return false; - } - return static_cast(*ret); - } - SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get isFactory") -} - time_t WidgetDAOReadOnly::getInstallTime() const { SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN @@ -839,11 +803,6 @@ std::string WidgetDAOReadOnly::getBaseFolder() const return baseFolder; } -bool WidgetDAOReadOnly::isDeletable() const -{ - return !WidgetDAOReadOnly::isFactory(); -} - WidgetCertificateDataList WidgetDAOReadOnly::getCertificateDataList() const { //TODO check widget existance @@ -1048,14 +1007,6 @@ std::string WidgetDAOReadOnly::getPrivateLocalStoragePath() const path << WidgetConfig::GetWidgetWebLocalStoragePath(*pkgname); path << "/"; - if (isFactory()) { - WidgetGUID widgetGUID = getGUID(); - if (!widgetGUID) { - Throw(WidgetDAOReadOnly::Exception::GUIDisNull); - } - path << DPL::ToUTF8String(*widgetGUID); - } - return path.str(); } @@ -1067,10 +1018,10 @@ void WidgetDAOReadOnly::getWidgetSettings( { using namespace DPL::DB::ORM; using namespace DPL::DB::ORM::wrt; - WRT_DB_SELECT(select, SettginsList, &WrtDatabase::interface()) - select->Where(Equals(m_widgetHandle)); + WRT_DB_SELECT(select, SettingsList, &WrtDatabase::interface()) + select->Where(Equals(m_widgetHandle)); - SettginsList::Select::RowList rows = select->GetRowList(); + SettingsList::Select::RowList rows = select->GetRowList(); FOREACH(it, rows) { diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h index a2b1402..90dbbd3 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h @@ -149,14 +149,6 @@ inline const char* GetUserWidgetDefaultIconFile() return "/usr/share/wrt-engine/wrt_widget_default_icon.png"; } -/** - * WRT downloaded widgets - */ -// KW inline const char* GetDownloadedWidgetPath() -// KW { -// KW return "/opt/share/widget/test-widgets"; -// KW } - inline const char* GetSignatureXmlSchema() { //TODO please rename, this filename is not descriptive enough 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 37229ea..3a11455 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 @@ -157,7 +157,6 @@ struct WidgetRegisterInfo WidgetRegisterInfo() : type(APP_TYPE_UNKNOWN), signatureType(SIGNATURE_TYPE_UNIDENTIFIED), - isFactoryWidget(0), isTestWidget(0), configInfo(), pType(PKG_TYPE_UNKNOWN) @@ -171,7 +170,6 @@ struct WidgetRegisterInfo std::string shareHref; std::string baseFolder; WidgetSignatureType signatureType; - int isFactoryWidget; int isTestWidget; ConfigParserData configInfo; LocalizationData localizationData; @@ -635,14 +633,6 @@ class WidgetDAOReadOnly */ std::string getShareHref() const; - /** - * This method checks whether specified widget is a factory widget. - * - * @param[in] widgetHandle widget's app id - * @return true if yes, false if no. - */ - bool isFactory() const; - /** * This method get widget installed time * @@ -660,16 +650,6 @@ class WidgetDAOReadOnly */ std::string getBaseFolder() const; - /** - * This method gets deletable property of widget. - * - * @return true: can be deleted; false: can not be deleted - * @exception WRT_CONF_ERR_GCONF_FAILURE - * @exception WRT_CONF_ERR_EMDB_FAILURE - * @exception WRT_CONF_ERR_EMDB_NO_RECORD - */ - bool isDeletable() const; - /* This method gets the parameter list for resource. */ ResourceAttributeList getResourceAttribute( diff --git a/modules/widget_dao/orm/wrt_db b/modules/widget_dao/orm/wrt_db index ecd3d04..03cc13d 100644 --- a/modules/widget_dao/orm/wrt_db +++ b/modules/widget_dao/orm/wrt_db @@ -86,7 +86,6 @@ CREATE_TABLE(WidgetExtendedInfo) COLUMN(option_state, INT, DEFAULT 0) COLUMN(share_href, VARCHAR(256), DEFAULT '') COLUMN(signature_type, INT, DEFAULT 0) - COLUMN(factory_widget, INT, DEFAULT 0) COLUMN(updated, INT, DEFAULT 0) COLUMN(update_policy, INT, DEFAULT 0) COLUMN_NOT_NULL(test_widget, INT, CHECK(test_widget between 0 and 1) DEFAULT 0) @@ -290,7 +289,7 @@ CREATE_TABLE(CRLResponseStorage) COLUMN(next_update_time, BIGINT,) CREATE_TABLE_END() -CREATE_TABLE(SettginsList) +CREATE_TABLE(SettingsList) COLUMN_NOT_NULL(appId, INT,) COLUMN_NOT_NULL(settingName, TEXT, ) COLUMN_NOT_NULL(settingValue, TEXT, )