registerWidgetSecuritySettings(widgetHandle);
}
-void WidgetDAO::registerOrUpdateWidget(
- const TizenAppId & widgetName,
- const WidgetRegisterInfo &widgetRegInfo,
- const IWidgetSecurity &widgetSecurity)
-{
- LogDebug("Reregistering widget");
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- DPL::DB::ORM::wrt::ScopedTransaction transaction(
- &WrtDatabase::interface());
-
- unregisterWidgetInternal(widgetName);
- registerWidgetInternal(widgetName, widgetRegInfo, widgetSecurity);
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to reregister widget")
-}
-
-void WidgetDAO::backupAndUpdateWidget(
- const TizenAppId & oldAppId,
- const TizenAppId & newAppId,
- const WidgetRegisterInfo &widgetRegInfo,
- const IWidgetSecurity &widgetSecurity)
-{
- LogDebug("Backup and Register widget");
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- DPL::DB::ORM::wrt::ScopedTransaction transaction(
- &WrtDatabase::interface());
-
- updateWidgetAppIdInternal(newAppId, oldAppId);
- registerWidgetInternal(newAppId, widgetRegInfo, widgetSecurity);
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to reregister widget")
-}
-
-void WidgetDAO::restoreUpdateWidget(
- const TizenAppId & oldAppId,
- const TizenAppId & newAppId)
-{
- LogDebug("restore widget");
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- DPL::DB::ORM::wrt::ScopedTransaction transaction(
- &WrtDatabase::interface());
-
- unregisterWidgetInternal(newAppId);
- updateWidgetAppIdInternal(oldAppId, newAppId);
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to reregister widget")
-}
-
#define DO_INSERT(row, table) \
{ \
WRT_DB_INSERT(insert, table, &WrtDatabase::interface()) \
// Deleting in other tables is done via "delete cascade" in SQL
}
-void WidgetDAO::updateWidgetAppIdInternal(
- const TizenAppId & fromAppId,
- const TizenAppId & toAppId)
-{
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
-
- ScopedTransaction transaction(&WrtDatabase::interface());
- if (!isWidgetInstalled(fromAppId)) {
- ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist,
- "Cannot find widget. tzAppId: " << fromAppId);
- }
-
- WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
- select->Where(Equals<WidgetInfo::tizen_appid>(fromAppId));
-
- WidgetInfo::Row row = select->GetSingleRow();
-
- //WidgetInfo::Row row;
- row.Set_tizen_appid(toAppId);
-
- WRT_DB_UPDATE(update, WidgetInfo, &WrtDatabase::interface())
- update->Where(Equals<WidgetInfo::tizen_appid>(fromAppId));
- update->Values(row);
- update->Execute();
-
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to update appid")
-}
-
#undef DO_INSERT
#undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
static void updateTizenAppId(const TizenAppId & fromAppId,
const TizenAppId & toAppId);
-
- /**
- * This method re-registers the widget information to the DB when it is
- * installed.
- *
- * It performs unregistration and new registration of widget in db in one
- * transaction.
- *
- * @see WidgetRegisterInfo
- * @param[in] tzAppId Widget tizen app id that will be registered.
- * @param[in] pWidgetRegisterInfo Specified the widget's information
- * needed to be registered.
- * @param[in] widgetSecurity Widget's security certificates.
- */
- static void registerOrUpdateWidget(
- const TizenAppId & tzAppId,
- const WidgetRegisterInfo &widgetRegInfo,
- const IWidgetSecurity &widgetSecurity) __attribute__((deprecated));
-
- /* This method backup widget information and update new widget information
- * for restore widget information
- */
- static void backupAndUpdateWidget(
- const TizenAppId & oldAppId,
- const TizenAppId & newAppId,
- const WidgetRegisterInfo &widgetRegInfo,
- const IWidgetSecurity &widgetSecurity) __attribute__((deprecated));
-
- static void restoreUpdateWidget(
- const TizenAppId & oldAppId,
- const TizenAppId & newAppId) __attribute__((deprecated));
-
/**
* This method removes a widget's information from EmDB.
*
const IWidgetSecurity &widgetSecurity,
const DPL::Optional<DbWidgetHandle> handle =
DPL::Optional<DbWidgetHandle>());
- static void unregisterWidgetInternal(
- const TizenAppId & tzAppId);
-
- static void updateWidgetAppIdInternal(
- const TizenAppId & fromAppId,
- const TizenAppId & toAppId) __attribute__((deprecated));
-
+ static void unregisterWidgetInternal(const TizenAppId & tzAppId);
static void insertAppControlInfo(DbWidgetHandle handle,
- DPL::String src,
- DPL::String operation,
- DPL::String uri,
- DPL::String mime,
- unsigned index,
- unsigned disposition);
+ DPL::String src,
+ DPL::String operation,
+ DPL::String uri,
+ DPL::String mime,
+ unsigned index,
+ unsigned disposition);
};
} // namespace WrtDB
tizenAppId), "Widget is not registered");
//success full update
- WidgetDAO::registerOrUpdateWidget(tizenAppId, regInfo2, sec);
+ WidgetDAO::updateTizenAppId(tizenAppId, L"backup");
+ WidgetDAO::registerWidget(tizenAppId, regInfo2, sec);
+ WidgetDAO::unregisterWidget(L"backup");
RUNNER_ASSERT_MSG(WidgetDAO::isWidgetInstalled(
tizenAppId), "Widget is not reregistered");
WidgetDAO dao(tizenAppId);
RUNNER_ASSERT_MSG(
*dao.getAuthorName() == L"BBB", "Data widget was not updated");
+
WidgetDAO::unregisterWidget(tizenAppId);
}