當前位置: 首頁>>代碼示例>>Java>>正文


Java ResourceTable.getTableReadiness方法代碼示例

本文整理匯總了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());
}
 
開發者ID:dimagi,項目名稱:commcare-j2me,代碼行數:10,代碼來源:ResourceManager.java

示例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;
}
 
開發者ID:dimagi,項目名稱:commcare-android,代碼行數:53,代碼來源:CommCareApp.java


注:本文中的org.commcare.resources.model.ResourceTable.getTableReadiness方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。