本文整理汇总了Java中org.commcare.resources.model.ResourceTable.getTableReadiness方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceTable.getTableReadiness方法的具体用法?Java ResourceTable.getTableReadiness怎么用?Java ResourceTable.getTableReadiness使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.commcare.resources.model.ResourceTable
的用法示例。
在下文中一共展示了ResourceTable.getTableReadiness方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTableStagedForUpgrade
import org.commcare.resources.model.ResourceTable; //导入方法依赖的package包/类
/**
* @return Is the table non-empty, marked for upgrade, with all ready
* resources?
*/
public static boolean isTableStagedForUpgrade(ResourceTable table) {
return (table.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UPGRADE &&
table.isReady() &&
!table.isEmpty());
}
示例2: initializeApplicationHelper
import org.commcare.resources.model.ResourceTable; //导入方法依赖的package包/类
private boolean initializeApplicationHelper() {
setupSandbox();
ResourceTable global = platform.getGlobalResourceTable();
ResourceTable upgrade = platform.getUpgradeResourceTable();
ResourceTable recovery = platform.getRecoveryTable();
logTable("Global", global);
logTable("Upgrade", upgrade);
logTable("Recovery", recovery);
// See if any of our tables got left in a weird state
if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) {
global.rollbackCommits(platform);
logTable("Global after rollback", global);
}
if (upgrade.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) {
upgrade.rollbackCommits(platform);
logTable("Upgrade after rollback", upgrade);
}
// See if we got left in the middle of an update
if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNSTAGED) {
// If so, repair the global table. (Always takes priority over maintaining the update)
global.repairTable(upgrade, platform);
}
Resource profile = global.getResourceWithId(CommCarePlatform.APP_PROFILE_RESOURCE_ID);
if (profile != null && profile.getStatus() == Resource.RESOURCE_STATUS_INSTALLED) {
platform.initialize(global, false);
try {
Localization.setLocale(
getAppPreferences().getString(MainConfigurablePreferences.PREFS_LOCALE_KEY, "default"));
} catch (UnregisteredLocaleException urle) {
Localization.setLocale(Localization.getGlobalLocalizerAdvanced().getAvailableLocales()[0]);
}
initializeStylizer();
try {
HybridFileBackedSqlHelpers.removeOrphanedFiles(buildAndroidDbHelper().getHandle());
} catch (SessionUnavailableException e) {
Logger.log(LogTypes.SOFT_ASSERT,
"Unable to get app db handle to clear orphaned files");
}
return true;
}
String failureReason = profile == null ? "profle being null" : "profile status value " + String.valueOf(profile.getStatus());
Logger.log(LogTypes.TYPE_RESOURCES, "Initializing application failed because of " + failureReason);
return false;
}