com.raizlabs.android.dbflow.structure.Model Java Examples

The following examples show how to use com.raizlabs.android.dbflow.structure.Model. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DBBatchSaveQueue.java    From Meteorite with Apache License 2.0 5 votes vote down vote up
@Override
public void processModel(Object model, DatabaseWrapper wrapper) {
    if (model instanceof Model) {
        ((Model) model).save();
    } else if (model != null) {
        Class modelClass = model.getClass();
        //noinspection unchecked
        FlowManager.getModelAdapter(modelClass).save(model);
    }
}
 
Example #2
Source File: DbLoader.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public TrackedTable(Class<? extends Model> trackedModel) {
    this(trackedModel, Arrays.asList(
            BaseModel.Action.INSERT,
            BaseModel.Action.UPDATE,
            BaseModel.Action.DELETE,
            BaseModel.Action.SAVE));
}
 
Example #3
Source File: ModelChangeObserver.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onModelStateChanged(Class<? extends Model> aClass, BaseModel.Action action) {
    Log.d(TAG, "onModelStateChanged() " + aClass.getSimpleName() + ": " + action);

    if (notifyLoader(action)) {
        mLoader.onContentChanged();
    }
}
 
Example #4
Source File: DbLoader.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public TrackedTable(Class<? extends Model> trackedModel,
                    BaseModel.Action action) {
    this(trackedModel, Arrays.asList(action));
}
 
Example #5
Source File: DbLoader.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public TrackedTable(Class<? extends Model> trackedModel,
                    List<BaseModel.Action> actions) {
    mTrackedModel = trackedModel;
    mActions = actions;
}
 
Example #6
Source File: DbLoader.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public Class<? extends Model> getTrackedModel() {
    return mTrackedModel;
}
 
Example #7
Source File: PerfTestDbFlow.java    From android-database-performance with Apache License 2.0 4 votes vote down vote up
@NonNull
private <TModel extends Model> ITransaction insertTransaction(Collection entities, Class<TModel> clazz) {
    ModelAdapter<? extends Model> modelAdapter = FlowManager.getModelAdapter(clazz);
    return FastStoreModelTransaction.insertBuilder(modelAdapter).addAll(entities).build();
}
 
Example #8
Source File: PerfTestDbFlow.java    From android-database-performance with Apache License 2.0 4 votes vote down vote up
@NonNull
private <TModel extends Model> ITransaction updateTransaction(Collection entities, Class<TModel> clazz) {
    ModelAdapter<? extends Model> modelAdapter = FlowManager.getModelAdapter(clazz);
    return FastStoreModelTransaction.updateBuilder(modelAdapter).addAll(entities).build();
}