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


Java FlowManager.getModelAdapter方法代碼示例

本文整理匯總了Java中com.raizlabs.android.dbflow.config.FlowManager.getModelAdapter方法的典型用法代碼示例。如果您正苦於以下問題:Java FlowManager.getModelAdapter方法的具體用法?Java FlowManager.getModelAdapter怎麽用?Java FlowManager.getModelAdapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.raizlabs.android.dbflow.config.FlowManager的用法示例。


在下文中一共展示了FlowManager.getModelAdapter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: performIndividualAdapterOperations

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void performIndividualAdapterOperations() {
    for (int i = 0; i < mModelList.size(); i++) {
        @ModelOperation int operation = mOperationList.get(i);
        Object model = mModelList.get(i);
        ModelAdapter modelAdapter = FlowManager.getModelAdapter(model.getClass());

        if (operation == MODEL_OPERATION_SAVE) {
            modelAdapter.save(model);
        } else if (operation == MODEL_OPERATION_DELETE) {
            modelAdapter.delete(model);
        } else if (operation == MODEL_OPERATION_INSERT) {
            modelAdapter.insert(model);
        } else if (operation == MODEL_OPERATION_UPDATE) {
            modelAdapter.update(model);
        }
    }
}
 
開發者ID:roadhouse-dev,項目名稱:RxDbflow,代碼行數:19,代碼來源:RxModelOperationTransaction.java

示例2: migrateSurveyTable

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
private void migrateSurveyTable(SQLiteDatabase database) {
    ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);

    //Create temporal table
    String sql=myAdapter.getCreationQuery();
    Log.d("DBMIGRATION", "old table " + sql);
    sql=sql.replace("Survey", "Survey_temp");
    Log.d("DBMIGRATION", "create temp table " + sql);
    database.execSQL(sql);

    //Insert the data in temporal table
    String sqlCopy="INSERT INTO Survey_temp(id_survey, id_tab_group, id_org_unit, id_user, creation_date, completion_date, upload_date, schedule_date, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid FROM Survey";
    database.execSQL(sqlCopy);

    //Replace old table by new table with the new column name.
    database.execSQL("DROP TABLE IF EXISTS Survey");
    database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:19,代碼來源:Migration9RenameTables.java

示例3: migrateProgramTable

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
private void migrateProgramTable(SQLiteDatabase database) {

        ModelAdapter myAdapter = FlowManager.getModelAdapter(Program.class);
        String programTable = "Program";
        String programTempTable = "Program_temp";
        //Create temporal table
        String sql = myAdapter.getCreationQuery();
        Log.d("DBMIGRATION", "old table " + sql);
        sql = sql.replace(programTable, programTempTable);
        Log.d("DBMIGRATION", "create temp table " + sql);
        database.execSQL(sql);
        //Insert the data in temporal table
        String sqlCopy = "INSERT INTO " + programTempTable
                + "(id_program, uid, name, stage_uid) SELECT id_program, uid, name, programStage "
                + "FROM "
                + programTable;
        database.execSQL(sqlCopy);

        //Replace old table by new table with the new column name.
        database.execSQL("DROP TABLE IF EXISTS " + programTable);
        database.execSQL("ALTER TABLE " + programTempTable + " RENAME TO " + programTable);
    }
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:23,代碼來源:Migration12UpdateEdsTables.java

示例4: migrateSurveyTable

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
private void migrateSurveyTable(SQLiteDatabase database) {
    ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);

    //Create temporal table
    String sql = myAdapter.getCreationQuery();
    Log.d("DBMIGRATION", "old table " + sql);
    sql = sql.replace("Survey", "Survey_temp");
    Log.d("DBMIGRATION", "create temp table " + sql);
    database.execSQL(sql);

    //Insert the data in temporal table
    String sqlCopy =
            "INSERT INTO Survey_temp(id_survey, id_program, id_org_unit, id_user, "
                    + "creation_date, completion_date, upload_date, scheduled_date, status, "
                    + "eventuid) SELECT id_survey, id_program, id_org_unit, id_user, "
                    + "creation_date, completion_date, upload_date, schedule_date, status, "
                    + "eventuid FROM Survey";
    database.execSQL(sqlCopy);

    //Replace old table by new table with the new column name.
    database.execSQL("DROP TABLE IF EXISTS Survey");
    database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:24,代碼來源:Migration12UpdateEdsTables.java

示例5: migrate

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
@Override
public void migrate(SQLiteDatabase database) {
    //The column name can't be renamed in sqlite. It is needed create a temporal table with the new column name.
    ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);

    //Create temporal table
    String sql=myAdapter.getCreationQuery();
    Log.d("DBMIGRATION", "old table " + sql);
    sql=sql.replace("Survey", "Survey_temp");
    Log.d("DBMIGRATION", "create temp table " + sql);
    database.execSQL(sql);

    //Insert the data in temporal table
    String sqlCopy="INSERT INTO Survey_temp(id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, eventDate, scheduledDate, status, eventuid FROM Survey";
    database.execSQL(sqlCopy);

    //Replace old table by new table with the new column name.
    database.execSQL("DROP TABLE IF EXISTS Survey");
    database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:21,代碼來源:Migration7RenameEventDate.java

示例6: migrateSurveyTable

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
private void migrateSurveyTable(SQLiteDatabase database) {
    ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);

    //Create temporal table
    String sql=myAdapter.getCreationQuery();
    Log.d("DBMIGRATION", "old table " + sql);
    sql=sql.replace("Survey", "Survey_temp");
    Log.d("DBMIGRATION", "create temp table " + sql);
    database.execSQL(sql);

    //Insert the data in temporal table
    String sqlCopy="INSERT INTO Survey_temp(id_survey, id_program, id_org_unit, id_user, creation_date, completion_date, upload_date, scheduled_date, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid FROM Survey";
    database.execSQL(sqlCopy);

    //Replace old table by new table with the new column name.
    database.execSQL("DROP TABLE IF EXISTS Survey");
    database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:19,代碼來源:Migration10RenameTables.java

示例7: migrate

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
@Override
public void migrate(DatabaseWrapper database) {
    //The column name can't be renamed in sqlite. It is needed create a temporal table with the new column name.
    ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);

    //Create temporal table
    String sql=myAdapter.getCreationQuery();
    Log.d("DBMIGRATION", "old table " + sql);
    sql=sql.replace("Survey", "Survey_temp");
    Log.d("DBMIGRATION", "create temp table " + sql);
    database.execSQL(sql);

    //Insert the data in temporal table
    String sqlCopy="INSERT INTO Survey_temp(id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, eventDate, scheduledDate, status, eventuid FROM Survey";
    database.execSQL(sqlCopy);

    //Replace old table by new table with the new column name.
    database.execSQL("DROP TABLE IF EXISTS Survey");
    database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
 
開發者ID:EyeSeeTea,項目名稱:malariapp,代碼行數:21,代碼來源:Migration7RenameEventDate.java

示例8: migrateSurveyTable

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
private void migrateSurveyTable(DatabaseWrapper database) {
    ModelAdapter myAdapter = FlowManager.getModelAdapter(Survey.class);

    //Create temporal table
    String sql=myAdapter.getCreationQuery();
    Log.d("DBMIGRATION", "old table " + sql);
    sql=sql.replace("Survey", "Survey_temp");
    Log.d("DBMIGRATION", "create temp table " + sql);
    database.execSQL(sql);

    //Insert the data in temporal table
    String sqlCopy="INSERT INTO Survey_temp(id_survey, id_program, id_org_unit, id_user, creation_date, completion_date, upload_date, scheduled_date, status, eventuid) SELECT id_survey, id_tab_group, id_org_unit, id_user, creationDate, completionDate, uploadedDate, scheduledDate, status, eventuid FROM Survey";
    database.execSQL(sqlCopy);

    //Replace old table by new table with the new column name.
    database.execSQL("DROP TABLE IF EXISTS Survey");
    database.execSQL("ALTER TABLE Survey_temp RENAME TO Survey");
}
 
開發者ID:EyeSeeTea,項目名稱:malariapp,代碼行數:19,代碼來源:Migration10RenameTables.java

示例9: performBatchOperation

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void performBatchOperation(@ModelOperation int batchOperation) {
    ModelAdapter adapter = FlowManager.getModelAdapter(mModelList.get(0).getClass());
    if (batchOperation == MODEL_OPERATION_SAVE) {
        adapter.saveAll(mModelList);
    } else if (batchOperation == MODEL_OPERATION_INSERT) {
        adapter.insertAll(mModelList);
    } else if (batchOperation == MODEL_OPERATION_UPDATE) {
        adapter.updateAll(mModelList);
    }
}
 
開發者ID:roadhouse-dev,項目名稱:RxDbflow,代碼行數:12,代碼來源:RxModelOperationTransaction.java

示例10: migrateServerMetadataTable

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
private void migrateServerMetadataTable(SQLiteDatabase database) {
    ModelAdapter myAdapter = FlowManager.getModelAdapter(ServerMetadata.class);

    //Insert the data in new table
    String sqlCopy="INSERT INTO ServerMetadata(id_control_dataelement, name, code, uid, value_type) SELECT id_control_dataelement, name, code, uid, valueType FROM ControlDataelement";
    database.execSQL(sqlCopy);

    //Replace old table by new table with the new column name.
    database.execSQL("DROP TABLE IF EXISTS ControlDataelement");
}
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:11,代碼來源:Migration9RenameTables.java

示例11: migrateServerMetadataTable

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
private void migrateServerMetadataTable(SQLiteDatabase database) {
    ModelAdapter myAdapter = FlowManager.getModelAdapter(ServerMetadata.class);

    //Insert the data in new table
    String sqlCopy =
            "INSERT INTO ServerMetadata(id_control_dataelement, name, code, uid, value_type) "
                    + "SELECT id_control_dataelement, name, code, uid, valueType FROM "
                    + "ControlDataelement";
    database.execSQL(sqlCopy);

    //Replace old table by new table with the new column name.
    database.execSQL("DROP TABLE IF EXISTS ControlDataelement");
}
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:14,代碼來源:Migration12UpdateEdsTables.java

示例12: recreateTables

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
public static void recreateTables(SQLiteDatabase database,Class[] tables){
    for(int i=0;i<tables.length;i++){
        ModelAdapter myAdapter = FlowManager.getModelAdapter(tables[i]);
        database.execSQL(DROP_TABLE_IF_EXISTS + myAdapter.getTableName());
        database.execSQL(myAdapter.getCreationQuery());
    }
}
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:8,代碼來源:MigrationUtils.java

示例13: recreateTables

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
public static void recreateTables(DatabaseWrapper database,Class[] tables){
    for(int i=0;i<tables.length;i++){
        ModelAdapter myAdapter = FlowManager.getModelAdapter(tables[i]);
        database.execSQL(DROP_TABLE_IF_EXISTS + myAdapter.getTableName());
        database.execSQL(myAdapter.getCreationQuery());
    }
}
 
開發者ID:EyeSeeTea,項目名稱:malariapp,代碼行數:8,代碼來源:MigrationUtils.java

示例14: getModelAdapter

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
/**
 * @return The associated {@link ModelAdapter}. The {@link FlowManager}
 * may throw a {@link InvalidDBConfiguration} for this call if this class
 * is not associated with a table, so be careful when using this method.
 */
public ModelAdapter getModelAdapter() {
    if (modelAdapter == null) {
        modelAdapter = FlowManager.getModelAdapter(getClass());
    }
    return modelAdapter;
}
 
開發者ID:Raizlabs,項目名稱:DBFlow,代碼行數:12,代碼來源:BaseModel.java

示例15: getModelAdapter

import com.raizlabs.android.dbflow.config.FlowManager; //導入方法依賴的package包/類
private ModelAdapter<TModel> getModelAdapter() {
    if (modelAdapter == null) {
        //noinspection unchecked
        modelAdapter = (ModelAdapter<TModel>) FlowManager.getModelAdapter(model.getClass());
    }
    return modelAdapter;
}
 
開發者ID:Raizlabs,項目名稱:DBFlow,代碼行數:8,代碼來源:AsyncModel.java


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