Clean-up unused feature data
authorJihoon Chung <jihoon.chung@samsung.com>
Sat, 23 Mar 2013 07:27:01 +0000 (16:27 +0900)
committerGerrit Code Review <gerrit2@kim11>
Sat, 6 Apr 2013 04:31:45 +0000 (13:31 +0900)
[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

modules/widget_dao/dao/config_parser_data.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 [changed mode: 0755->0644]
modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h
modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h
modules/widget_dao/orm/wrt_db
tests/dao/TestCases_WidgetDAO.cpp
tests/dao/wrt_dao_tests_prepare_db.sh

index cc5253a..354238d 100644 (file)
@@ -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
index 8f65336..3c84520 100644 (file)
@@ -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<int>(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)
     }
 }
 
index f71c542..6e4feb9 100755 (executable)
@@ -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<FeatureParam::widget_feature_id>(
-                          widgetFeatureId));
-
-        WidgetParamMap resultMap;
-        typedef std::list<FeatureParam::Row> 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<WidgetFeature::app_id>(m_widgetHandle),
-                      Equals<WidgetFeature::name>(
-                          DPL::FromUTF8String(resourceId))));
-
-    std::list<WidgetFeature::Row> 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
 {
old mode 100755 (executable)
new mode 100644 (file)
index 5866b20..5f73a3c
@@ -162,24 +162,6 @@ typedef std::list<DPL::String> PrivilegeList;
 typedef std::set<EncryptedFileInfo> 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<WidgetParamKey, WidgetParamValue> 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;
 }
 
index 77a633e..7cdd25c 100644 (file)
@@ -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<Param> 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<std::pair<IconSectionType, DPL::String>> IconSet;
index 738434d..5e585c2 100755 (executable)
@@ -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(
index ba8a277..196c1cb 100755 (executable)
@@ -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,)
index 26280dd..55a140a 100644 (file)
@@ -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);
index c2bde92..ccb98f6 100755 (executable)
@@ -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)"