@Override public void loadFavoriteMoviesFromDb( List<MovieItem> items, SyncCallback<List<MovieItem>> mCallback) { LoadFavoriteMoviesFromDb loadFavoriteMoviesFromDb = new LoadFavoriteMoviesFromDb(SyncDbAction.LOAD_UPDATE_STATUS.getId(), items, mCallback); dbThread.addDatabasebSyncTask(loadFavoriteMoviesFromDb); }
@Override public void loadMovieStatusFromDb(MovieItem item, SyncCallback<MovieItem> mCallback) { AbstractInsertUpdateDeleteMovieDbSyncTask insertUpdateDeleteMovieDbSyncTask = new LoadMovieStatusDbSyncTask(SyncDbAction.LOAD_UPDATE_STATUS.getId(), item, mCallback); dbThread.addDatabasebSyncTask(insertUpdateDeleteMovieDbSyncTask); }
@Override public void loadGenres(SyncCallback<List<GenreItem>> callback) { LoadGenresSyncTaskDb loadGenres = new LoadGenresSyncTaskDb(SyncDbAction.LOAD_GENRES.getId(), callback); dbThread.addDatabasebSyncTask(loadGenres); }
@Override public void insertOrUpdateGenresToDb(List<GenreItem> genreItems) { InsertOrUpdateGenresTask insertOrUpdateGenresTask = new InsertOrUpdateGenresTask(SyncDbAction.INSERT_UPDATE_GENRE.getId(), genreItems, null); dbThread.addDatabasebSyncTask(insertOrUpdateGenresTask); }
@Override public void insertOrUpdateMovieToDb(MovieItem item, SyncCallback<MovieItem> callback) { AbstractInsertUpdateDeleteMovieDbSyncTask insertUpdateDeleteMovieDbSyncTask = new InsertOrUpdateDbSyncTask(SyncDbAction.INSERT_UPDATE_MOVIE.getId(), item, callback); dbThread.addDatabasebSyncTask(insertUpdateDeleteMovieDbSyncTask); }
@Override public void deleteMoviesFromDb(List<MovieItem> items, SyncCallback<List<MovieItem>> callback) { DeleteMoviesDbSyncTask deleteMoviesDbSyncTask = new DeleteMoviesDbSyncTask(SyncDbAction.DELETE_MOVOIES.getId(), items, callback); dbThread.addDatabasebSyncTask(deleteMoviesDbSyncTask); }
protected DataFactory() { dbThread = new DatabaseThreadObserverImpl(); dbThread.start(); }