From: Jihoon Chung Date: Sat, 23 Mar 2013 07:27:01 +0000 (+0900) Subject: Clean-up unused feature data X-Git-Tag: submit/tizen_2.2/20130927.091100^2~137 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4094de26481f695dacf8132539ff07eaa7a0f12;p=platform%2Fframework%2Fweb%2Fwrt-commons.git Clean-up unused feature data [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Current WRT uses Privilege instead of Feature As this changes, "param" isn't used in the source code. Deprecated : ConfigParserData::Param required field in the feature data struct unused function (getResourceAttribute, getFeatureParams) unused typedef (WidgetParamMap, WidgetParamKey, WidgetParamValue) remove Test case [SCMRequest] N/A Change-Id: I9eeb80844bf55af31c3c4417b5a1124714aa0a82 --- diff --git a/modules/widget_dao/dao/config_parser_data.cpp b/modules/widget_dao/dao/config_parser_data.cpp index cc5253a..354238d 100644 --- a/modules/widget_dao/dao/config_parser_data.cpp +++ b/modules/widget_dao/dao/config_parser_data.cpp @@ -203,104 +203,34 @@ void NormalizeAndTrimSpaceString(DPL::OptionalString& txt) NormalizeString(txt, true); } -bool ConfigParserData::Param::operator==(const Param& other) const -{ - return name == other.name && value == other.value; -} - -bool ConfigParserData::Param::operator!=(const Param& other) const -{ - return name != other.name || value != other.value; -} - -bool ConfigParserData::Param::operator >(const Param& other) const -{ - if (name == other.name) { - return value > other.value; - } else { - return name > other.name; - } -} - -bool ConfigParserData::Param::operator>=(const Param& other) const -{ - if (name >= other.name) { - return true; - } else { - return value >= other.value; - } -} - -bool ConfigParserData::Param::operator <(const Param& other) const -{ - if (name == other.name) { - return value < other.value; - } else { - return name < other.name; - } -} - -bool ConfigParserData::Param::operator<=(const Param& other) const -{ - if (name <= other.name) { - return true; - } else { - return value <= other.value; - } -} - bool ConfigParserData::Feature::operator==(const Feature& other) const { - return name == other.name && paramsList == other.paramsList; + return name == other.name; } bool ConfigParserData::Feature::operator!=(const Feature& other) const { - return name != other.name || paramsList != other.paramsList; + return name != other.name; } bool ConfigParserData::Feature::operator >(const Feature& other) const { - if (name > other.name) { - return true; - } - if (name < other.name) { - return false; - } - return paramsList > other.paramsList; + return name > other.name; } bool ConfigParserData::Feature::operator>=(const Feature& other) const { - if (name > other.name) { - return true; - } - if (name < other.name) { - return false; - } - return paramsList >= other.paramsList; + return name >= other.name; } bool ConfigParserData::Feature::operator <(const Feature& other) const { - if (name < other.name) { - return true; - } - if (name > other.name) { - return false; - } - return paramsList < other.paramsList; + return name < other.name; } bool ConfigParserData::Feature::operator<=(const Feature& other) const { - if (name < other.name) { - return true; - } - if (name > other.name) { - return false; - } - return paramsList <= other.paramsList; + return name <= other.name; } bool ConfigParserData::Privilege::operator==(const Privilege& other) const diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index 8f65336..3c84520 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -531,27 +531,9 @@ void WidgetDAO::registerWidgetFeatures(DbWidgetHandle widgetHandle, wrt::WidgetFeature::Row widgetFeature; widgetFeature.Set_app_id(widgetHandle); widgetFeature.Set_name(pWidgetFeature->name); - widgetFeature.Set_required(pWidgetFeature->required); widgetFeature.Set_rejected(false); - wrt::WidgetFeature::widget_feature_id::ColumnType widgetFeatureID; - { - WRT_DB_INSERT(insert, wrt::WidgetFeature, &WrtDatabase::interface()) - insert->Values(widgetFeature); - widgetFeatureID = static_cast(insert->Execute()); - } - - // Insert into table FeatureParam - wrt::FeatureParam::Row featureParam; - featureParam.Set_widget_feature_id(widgetFeatureID); - - FOREACH(iter, pWidgetFeature->paramsList) - { - featureParam.Set_name(iter->name); - featureParam.Set_value(iter->value); - - DO_INSERT(featureParam, wrt::FeatureParam) - } + DO_INSERT(widgetFeature, wrt::WidgetFeature) } } diff --git a/modules/widget_dao/dao/widget_dao_read_only.cpp b/modules/widget_dao/dao/widget_dao_read_only.cpp index f71c542..6e4feb9 100755 --- a/modules/widget_dao/dao/widget_dao_read_only.cpp +++ b/modules/widget_dao/dao/widget_dao_read_only.cpp @@ -339,9 +339,7 @@ DbWidgetFeatureSet WidgetDAOReadOnly::getFeaturesList() const for (RowList::iterator i = list.begin(); i != list.end(); ++i) { DbWidgetFeature feature; feature.name = i->Get_name(); - feature.required = i->Get_required(); feature.rejected = i->Get_rejected(); - feature.params = getFeatureParams(i->Get_widget_feature_id()); FeatureDAOReadOnly featureDao(DPL::ToUTF8String(i->Get_name())); feature.pluginId = featureDao.GetPluginHandle(); resultSet.insert(feature); @@ -352,28 +350,6 @@ DbWidgetFeatureSet WidgetDAOReadOnly::getFeaturesList() const SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get features list") } -WidgetParamMap WidgetDAOReadOnly::getFeatureParams(int id) -{ - WidgetFeatureId widgetFeatureId(id); - LogDebug("Getting feature Params. featureId: " << widgetFeatureId); - SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN - { - WRT_DB_SELECT(select, FeatureParam, &WrtDatabase::interface()) - select->Where(Equals( - widgetFeatureId)); - - WidgetParamMap resultMap; - typedef std::list RowList; - RowList list = select->GetRowList(); - - FOREACH(i, list) - resultMap.insert(std::make_pair(i->Get_name(), i->Get_value())); - - return resultMap; - } - SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get feature params") -} - bool WidgetDAOReadOnly::hasFeature(const std::string& featureName) const { LogDebug( @@ -993,26 +969,6 @@ WidgetCertificateCNList WidgetDAOReadOnly::getKeyCommonNameList( SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get key common name") } -ResourceAttributeList WidgetDAOReadOnly::getResourceAttribute( - const std::string &resourceId) const -{ - WRT_DB_SELECT(select, WidgetFeature, &WrtDatabase::interface()) - select->Where(And(Equals(m_widgetHandle), - Equals( - DPL::FromUTF8String(resourceId)))); - - std::list list = select->GetRowList(); - ResourceAttributeList result; - if (!list.empty()) { - int widgetFeatureId = list.begin()->Get_widget_feature_id(); - WidgetParamMap map = getFeatureParams(widgetFeatureId); - - FOREACH(i, map) - result.push_back(DPL::ToUTF8String(i->first)); - } - return result; -} - void WidgetDAOReadOnly::getWidgetAccessInfo( WidgetAccessInfoList& outAccessInfoList) 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 old mode 100755 new mode 100644 index 5866b20..5f73a3c --- 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 @@ -162,24 +162,6 @@ typedef std::list PrivilegeList; typedef std::set EncryptedFileList; /** - * @brief Widget configuration parameter key - */ -typedef DPL::String WidgetParamKey; - -/** - * @brief Widget configuration parameter value - */ -typedef DPL::String WidgetParamValue; - -/** - * @brief A map of widget configuration parameters. - * - * Widget configuration parameters are read from database and are stored - * along with feature that they describe. - */ -typedef std::multimap WidgetParamMap; - -/** * @brief Widget feature host information about possible javascript extensions * that widget may use * @@ -201,13 +183,10 @@ typedef int DbPluginHandle; struct DbWidgetFeature { DPL::String name; /// Feature name - bool required; /// Whether feature is required bool rejected; /// Api feature was rejected by ace DbPluginHandle pluginId; /// Plugin id that implement this feature - WidgetParamMap params; /// Widget's params DbWidgetFeature() : - required(false), pluginId(INVALID_PLUGIN_HANDLE) {} }; @@ -222,7 +201,6 @@ inline bool operator==(const DbWidgetFeature &featureA, const DbWidgetFeature &featureB) { return featureA.name == featureB.name && - featureA.required == featureB.required && featureA.pluginId == featureB.pluginId; } diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h index 77a633e..7cdd25c 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h @@ -41,30 +41,11 @@ class WidgetConfigurationManager; class ConfigParserData { public: - struct Param - { - Param(const DPL::String& _name) : name(_name) - {} - DPL::String name; - DPL::String value; - bool operator==(const Param&) const; - bool operator!=(const Param&) const; - bool operator >(const Param&) const; - bool operator>=(const Param&) const; - bool operator <(const Param&) const; - bool operator<=(const Param&) const; - }; - typedef std::set ParamsList; - struct Feature { - Feature(const DPL::String& _name, - bool _required = true) : name(_name), - required(_required) + Feature(const DPL::String& _name) : name(_name) {} DPL::String name; - bool required; - ParamsList paramsList; bool operator==(const Feature&) const; bool operator!=(const Feature&) const; @@ -264,7 +245,7 @@ class ConfigParserData enum IconSectionType { DefaultIcon =0, - SmallIcon, + SmallIcon }; typedef std::set> IconSet; 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 738434d..5e585c2 100755 --- 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 @@ -549,7 +549,6 @@ class WidgetDAOReadOnly */ DbWidgetFeatureSet getFeaturesList() const; - static WidgetParamMap getFeatureParams(int widgetFeatureId); /** * This method checks whether widget has specified feature. * @@ -703,11 +702,6 @@ class WidgetDAOReadOnly */ std::string getBaseFolder() const; - /* This method gets the parameter list for resource. - */ - ResourceAttributeList getResourceAttribute( - const std::string &resourceId) const; - /* This method checks read only flag for given property */ DPL::OptionalInt checkPropertyReadFlag( diff --git a/modules/widget_dao/orm/wrt_db b/modules/widget_dao/orm/wrt_db index ba8a277..196c1cb 100755 --- a/modules/widget_dao/orm/wrt_db +++ b/modules/widget_dao/orm/wrt_db @@ -116,22 +116,12 @@ CREATE_TABLE(WidgetFeature) COLUMN_NOT_NULL(widget_feature_id, INTEGER, primary key autoincrement) COLUMN_NOT_NULL(app_id, INT,) COLUMN_NOT_NULL(name, TEXT,) - COLUMN_NOT_NULL(required, INT,) COLUMN_NOT_NULL(rejected, INT,) TABLE_CONSTRAINTS( FOREIGN KEY (app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE ) CREATE_TABLE_END() -CREATE_TABLE(FeatureParam) - COLUMN_NOT_NULL(widget_feature_id, INTEGER,) - COLUMN_NOT_NULL(name, TEXT,) - COLUMN_NOT_NULL(value, TEXT,) - TABLE_CONSTRAINTS( - FOREIGN KEY (widget_feature_id) REFERENCES WidgetFeature (widget_feature_id) ON DELETE CASCADE - ) -CREATE_TABLE_END() - CREATE_TABLE(WidgetPrivilege) COLUMN_NOT_NULL(widget_privilege_id, INTEGER, primary key autoincrement) COLUMN_NOT_NULL(app_id, INT,) diff --git a/tests/dao/TestCases_WidgetDAO.cpp b/tests/dao/TestCases_WidgetDAO.cpp index 26280dd..55a140a 100644 --- a/tests/dao/TestCases_WidgetDAO.cpp +++ b/tests/dao/TestCases_WidgetDAO.cpp @@ -215,8 +215,7 @@ RUNNER_TEST(widget_dao_test_register_widget_empty_strings) regInfo.configInfo.preferencesList.insert(pref); //widget feature - ConfigParserData::Feature feat(DPL::FromUTF8String(""), false); - ConfigParserData::Param par(DPL::FromUTF8String((""))); + ConfigParserData::Feature feat(DPL::FromUTF8String("")); par.value = DPL::FromUTF8String(""); feat.paramsList.insert(par); regInfo.configInfo.featuresList.insert(feat); diff --git a/tests/dao/wrt_dao_tests_prepare_db.sh b/tests/dao/wrt_dao_tests_prepare_db.sh index c2bde92..ccb98f6 100755 --- a/tests/dao/wrt_dao_tests_prepare_db.sh +++ b/tests/dao/wrt_dao_tests_prepare_db.sh @@ -67,8 +67,7 @@ if [ "x$1" == "xstart" ]; then INS_ALL_WIDGET_LOC_STARTFILE="insert into WidgetLocalizedStartFile(app_id, start_file_id, widget_locale, type, encoding)" INS_ALL_WIDGET_DEFPREF="insert into WidgetDefaultPreference(app_id, key_name, key_value, readonly)" INS_ALL_WIDGET_PREF="insert into WidgetPreference(tizen_appid, key_name, key_value, readonly)" - INS_ALL_WIDGET_FEATURE="insert into WidgetFeature(app_id, name, required)" - INS_ALL_WIDGET_FEATURE_PARAM="insert into FeatureParam(widget_feature_id, name, value)" + INS_ALL_WIDGET_FEATURE="insert into WidgetFeature(app_id, name)" INS_ALL_WIDGET_WINMODES="insert into WidgetWindowModes(app_id, window_mode)" INS_ALL_WIDGET_WARP="insert into WidgetWARPInfo(app_id, iri, subdomain_access)" INS_ALL_WIDGET_CERT="insert into WidgetCertificateFingerprint(app_id, owner, chainid, type, md5_fingerprint, sha1_fingerprint, common_name)"