[Issue#] It was possible for pkgname to be null.
[Bug] N/A
[Cause] N/A
[Solution] Changed Column deffinition in db file and replaced DPL:Optional<DPL::String> with DPL::String.
[Verification] Build commons, wrt-installer, wrt-plugin-commons.
Change-Id: I635cbe9f20843ff8cf180e980b21d0b07619def2
{
std::stringstream filename;
WrtDB::WidgetDAOReadOnly widgetDAO(widgetHandle);
- DPL::Optional<DPL::String> pkgname = widgetDAO.getPkgname();
+ DPL::String pkgname = widgetDAO.getPkgname_NOTNULL();
- filename << GetWidgetPersistentStoragePath(*pkgname)
+ filename << GetWidgetPersistentStoragePath(pkgname)
<< "/"
<< SECURITY_ORIGIN_DB_NAME;
return filename.str();
WidgetDAO::WidgetDAO(DPL::OptionalString widgetGUID) :
WidgetDAOReadOnly(WidgetDAOReadOnly::getHandle(widgetGUID))
+// TODO THIS WILL BE DELETED
{
}
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register widget")
}
+void WidgetDAO::setPkgName_NOTNULL(const DPL::String& pkgName)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ using namespace DPL::DB::ORM;
+ wrt::ScopedTransaction transaction(&WrtDatabase::interface());
+
+ isWidgetInstalled(getHandle());
+
+ wrt::WidgetInfo::Row row;
+ row.Set_pkgname(pkgName);
+
+ WRT_DB_UPDATE(update, wrt::WidgetInfo, &WrtDatabase::interface())
+ update->Where(
+ Equals<wrt::WidgetInfo::app_id>(getHandle()));
+
+ update->Values(row);
+ update->Execute();
+ transaction.Commit();
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register widget")
+}
+
void WidgetDAO::setSecurityPopupUsage(const SettingsType value)
{
SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get Pkgname list")
}
+WidgetPkgNameList_NOTNULL WidgetDAOReadOnly::getPkgnameList_NOTNULL()
+{
+ LogDebug("Getting Pkgname List");
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ using namespace DPL::DB::ORM;
+ using namespace DPL::DB::ORM::wrt;
+ WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
+ return select->GetValueList<WidgetInfo::pkgname_NOTNULL>();
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get Pkgname list")
+}
+
DbWidgetDAOReadOnlyList WidgetDAOReadOnly::getWidgetList()
{
LogDebug("Getting DbWidget List");
return row.Get_pkgname();
}
+DPL::String WidgetDAOReadOnly::getPkgname_NOTNULL() const
+{
+ WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
+ return *row.Get_pkgname();
+}
+
DPL::OptionalString WidgetDAOReadOnly::getDefaultlocale() const
{
WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
using namespace WrtDB::WidgetConfig;
std::ostringstream path;
- DPL::OptionalString pkgname = getPkgname();
+ DPL::String pkgname = getPkgname_NOTNULL();
- path << GetWidgetPersistentStoragePath(*pkgname);
+ path << GetWidgetPersistentStoragePath(pkgname);
path << "/";
path << GlobalConfig::GetCookieDatabaseFile();
std::string WidgetDAOReadOnly::getPrivateLocalStoragePath() const
{
std::ostringstream path;
- DPL::OptionalString pkgname = getPkgname();
- path << WidgetConfig::GetWidgetWebLocalStoragePath(*pkgname);
+ DPL::String pkgname = getPkgname_NOTNULL();
+ path << WidgetConfig::GetWidgetWebLocalStoragePath(pkgname);
path << "/";
return path.str();
typedef std::list<DPL::Optional<WidgetPkgName> > WidgetPkgNameList; //TODO: this cannot be null -> appropriate changes in db schema needed
+typedef std::list<WidgetPkgName > WidgetPkgNameList_NOTNULL; //TODO: this cannot be null -> appropriate changes in db schema needed
+
class WidgetDAOReadOnly; //forward declaration
typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
/**
int isTestWidget;
ConfigParserData configInfo;
LocalizationData localizationData;
+
DPL::OptionalString pkgname;
+ DPL::String pkgname_NOTNULL;
+
time_t installedTime;
PackagingType packagingType;
EncryptedFileList encryptedFiles;
*/
DPL::OptionalString getPkgname() const;
+ DPL::String getPkgname_NOTNULL() const;
+
/**
* This method returns the defaultlocale for the widget.
*
* @return list of pkgname of installed packages
*/
static WidgetPkgNameList getPkgnameList();
+ static WidgetPkgNameList_NOTNULL getPkgnameList_NOTNULL();
/**
* This method returns a list of all the installed widgets.
* DB table.
*/
static DbWidgetDAOReadOnlyList getWidgetList();
-
/**
* This method removes a widget's information from EmDB.
*
*/
void setPkgName(const DPL::OptionalString& pkgName);
+ void setPkgName_NOTNULL(const DPL::String& pkgName);
+
/* This function will update of api-feature status.
* If status is true (feature rejected) plugin connected with this
* api feature mustn't be loaded durign widget launch.
COLUMN(access_network, TINYINT, DEFAULT 0)
COLUMN(defaultlocale, VARCHAR(256), DEFAULT 0)
COLUMN(pkgname, VARCHAR(256), DEFAULT 0 UNIQUE)
+ COLUMN_NOT_NULL(pkgname_NOTNULL,VARCHAR(256), DEFAULT 0 UNIQUE)
COLUMN(pkg_type, INT, DEFAULT 0)
CREATE_TABLE_END()