// Path: RxDbFlow-Rx1/src/main/java/au/com/roadhouse/rxdbflow/rx1/structure/RxBaseModel.java
// @SuppressWarnings("unchecked")
// public class RxBaseModel<M extends RxBaseModel> extends BaseModel implements RxModifications<M> {
// 
//     private RxModelAdapter<? extends RxBaseModel> mModelAdapter;
// 
//     /**
//      * Returns an observable for saving the object in the database
//      * @return An observable
//      */
//     public Observable<M> saveAsObservable(){
//         return getRxModelAdapter().saveAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable for saving the object in the database
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     @SuppressWarnings("unchecked")
//     public Observable<M> saveAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().saveAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * Returns an observable for inserting the object in the database
//      * @return An observable
//      */
//     public Observable<M> insertAsObservable(){
//         return getRxModelAdapter().insertAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable for inserting the object in the database
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     public Observable<M> insertAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().insertAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * Returns an observable for deleting the object from the database
//      * @return An observable
//      */
//     public Observable<M> deleteAsObservable(){
//         return getRxModelAdapter().deleteAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable for deleting the object from the database
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     public Observable<M> deleteAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().deleteAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * Returns an observable for update the object in the database
//      * @return An observable
//      */
//     public Observable<M> updateAsObservable(){
//         return getRxModelAdapter().updateAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable for update in object from the database
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     public Observable<M> updateAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().updateAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * Returns an observable which will refresh the model's data based on the primary key when subscribed.
//      * @return An observable
//      */
//     public Observable<M> loadAsObservable(){
//         return getRxModelAdapter().loadAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable which will refresh the model's data based on the primary key when subscribed.
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     public Observable<M> loadAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().loadAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * @return The associated {@link RxModelAdapter}. The {@link RxDbFlow}
//      * 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 RxModelAdapter getRxModelAdapter() {
//         if (mModelAdapter == null) {
//             mModelAdapter = RxDbFlow.getModelAdapter(getClass());
//         }
//         return mModelAdapter;
//     }
// }


import android.support.annotation.IntDef;
import com.raizlabs.android.dbflow.config.FlowManager;
import com.raizlabs.android.dbflow.structure.Model;
import com.raizlabs.android.dbflow.structure.ModelAdapter;
import com.raizlabs.android.dbflow.structure.database.DatabaseWrapper;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import au.com.roadhouse.rxdbflow.rx1.structure.RxBaseModel;
import rx.Observable;
import rx.Subscriber;
            this(FlowManager.getDatabaseForTable(clazz).getWritableDatabase());
        }

        /**
         * Sets a default operation, this is useful when adding a list of models to the builder.
         *
         * @param modelOperation The model operation to use when no model operation is specified
         * @return An instance of the current builder.
         */
        public Builder setDefaultOperation(@ModelOperation int modelOperation) {
            mDefaultOperation = modelOperation;

            return this;
        }

        /**
         * Adds a model and it's associated operation to be performed within the transaction
         * block
         *
         * @param model          The model to perform the transaction on
         * @param modelOperation The operation to be performed.
         * @return An instance of the current builder.
         */
        public Builder addModel(Object model, @ModelOperation int modelOperation) {
            if (mModelList.size() == 0) {
                mCanBatchTransaction = true;
                mMustUseAdapters = false;
            } else {

                if (!mMustUseAdapters) {
// Path: RxDbFlow-Rx1/src/main/java/au/com/roadhouse/rxdbflow/rx1/structure/RxBaseModel.java
// @SuppressWarnings("unchecked")
// public class RxBaseModel<M extends RxBaseModel> extends BaseModel implements RxModifications<M> {
// 
//     private RxModelAdapter<? extends RxBaseModel> mModelAdapter;
// 
//     /**
//      * Returns an observable for saving the object in the database
//      * @return An observable
//      */
//     public Observable<M> saveAsObservable(){
//         return getRxModelAdapter().saveAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable for saving the object in the database
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     @SuppressWarnings("unchecked")
//     public Observable<M> saveAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().saveAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * Returns an observable for inserting the object in the database
//      * @return An observable
//      */
//     public Observable<M> insertAsObservable(){
//         return getRxModelAdapter().insertAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable for inserting the object in the database
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     public Observable<M> insertAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().insertAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * Returns an observable for deleting the object from the database
//      * @return An observable
//      */
//     public Observable<M> deleteAsObservable(){
//         return getRxModelAdapter().deleteAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable for deleting the object from the database
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     public Observable<M> deleteAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().deleteAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * Returns an observable for update the object in the database
//      * @return An observable
//      */
//     public Observable<M> updateAsObservable(){
//         return getRxModelAdapter().updateAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable for update in object from the database
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     public Observable<M> updateAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().updateAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * Returns an observable which will refresh the model's data based on the primary key when subscribed.
//      * @return An observable
//      */
//     public Observable<M> loadAsObservable(){
//         return getRxModelAdapter().loadAsObservable(this);
//     }
// 
//     /**
//      * Returns an observable which will refresh the model's data based on the primary key when subscribed.
//      * @param databaseWrapper The database wrapper for the database holding the table
//      * @return An observable
//      */
//     public Observable<M> loadAsObservable(@Nullable final DatabaseWrapper databaseWrapper){
//         return getRxModelAdapter().loadAsObservable(this, databaseWrapper);
//     }
// 
//     /**
//      * @return The associated {@link RxModelAdapter}. The {@link RxDbFlow}
//      * 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 RxModelAdapter getRxModelAdapter() {
//         if (mModelAdapter == null) {
//             mModelAdapter = RxDbFlow.getModelAdapter(getClass());
//         }
//         return mModelAdapter;
//     }
// }


// Path: RxDbFlow-Rx1/src/main/java/au/com/roadhouse/rxdbflow/rx1/sql/transaction/RxModelOperationTransaction.java
import android.support.annotation.IntDef;
import com.raizlabs.android.dbflow.config.FlowManager;
import com.raizlabs.android.dbflow.structure.Model;
import com.raizlabs.android.dbflow.structure.ModelAdapter;
import com.raizlabs.android.dbflow.structure.database.DatabaseWrapper;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import au.com.roadhouse.rxdbflow.rx1.structure.RxBaseModel;
import rx.Observable;
import rx.Subscriber;

            this(FlowManager.getDatabaseForTable(clazz).getWritableDatabase());
        }

        /**
         * Sets a default operation, this is useful when adding a list of models to the builder.
         *
         * @param modelOperation The model operation to use when no model operation is specified
         * @return An instance of the current builder.
         */
        public Builder setDefaultOperation(@ModelOperation int modelOperation) {
            mDefaultOperation = modelOperation;

            return this;
        }

        /**
         * Adds a model and it's associated operation to be performed within the transaction
         * block
         *
         * @param model          The model to perform the transaction on
         * @param modelOperation The operation to be performed.
         * @return An instance of the current builder.
         */
        public Builder addModel(Object model, @ModelOperation int modelOperation) {
            if (mModelList.size() == 0) {
                mCanBatchTransaction = true;
                mMustUseAdapters = false;
            } else {

                if (!mMustUseAdapters) {
                    mMustUseAdapters = !(model instanceof RxBaseModel);