当前位置: 首页>>代码示例>>Java>>正文


Java RuntimeExceptionDao.callBatchTasks方法代码示例

本文整理汇总了Java中com.j256.ormlite.dao.RuntimeExceptionDao.callBatchTasks方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeExceptionDao.callBatchTasks方法的具体用法?Java RuntimeExceptionDao.callBatchTasks怎么用?Java RuntimeExceptionDao.callBatchTasks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.j256.ormlite.dao.RuntimeExceptionDao的用法示例。


在下文中一共展示了RuntimeExceptionDao.callBatchTasks方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateNextCursorSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static void updateNextCursorSync(final MyFace face) {
    final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);
    dao.callBatchTasks(new Callable<Object>() {
        @Override
        public Object call() throws Exception {
            try {
                UpdateBuilder<MyFace, Long> ub = dao.updateBuilder();
                ub.where().eq("id", face.id);
                ub.updateColumnValue("nextCursor", face.nextCursor);
                ub.update();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:18,代码来源:MyFace.java

示例2: deleteByPhotosSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static void deleteByPhotosSync(final List<Long> photoIds) {
    final RuntimeExceptionDao<MyFacePhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFacePhoto.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                DeleteBuilder<MyFacePhoto, Long> builder = dao.deleteBuilder();
                builder.where().in("photo_id", photoIds);
                builder.delete();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:17,代码来源:MyFacePhoto.java

示例3: updateSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static void updateSync(final String key, final String nextCursor) {
    final RuntimeExceptionDao<MyCursor, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyCursor.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                QueryBuilder<MyCursor, Long> cursorQb = dao.queryBuilder();
                cursorQb.where().eq("key", key);
                List<MyCursor> cursor = cursorQb.query();
                if (cursor != null && cursor.size() > 0) {
                    UpdateBuilder<MyCursor, Long> ub = dao.updateBuilder();
                    ub.where().eq("key", key);
                    ub.updateColumnValue("cursor", nextCursor);
                    ub.update();
                } else {
                    dao.create(new MyCursor(key, nextCursor));
                }
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:25,代码来源:MyCursor.java

示例4: updateNextCursorSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static void updateNextCursorSync(final MyMoment moment) {
    final RuntimeExceptionDao<MyMoment, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyMoment.class);
    dao.callBatchTasks(new Callable<Object>() {
        @Override
        public Object call() throws Exception {
            try {
                UpdateBuilder<MyMoment, Long> ub = dao.updateBuilder();
                ub.where().eq("id", moment.id);
                ub.updateColumnValue("nextCursor", moment.nextCursor);
                ub.update();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:18,代码来源:MyMoment.java

示例5: updateNextCursorSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static void updateNextCursorSync(final MyTag tag) {
    final RuntimeExceptionDao<MyTag, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyTag.class);
    dao.callBatchTasks(new Callable<Object>() {
        @Override
        public Object call() throws Exception {
            try {
                UpdateBuilder<MyTag, Long> ub = dao.updateBuilder();
                ub.where().eq("id", tag.id);
                ub.updateColumnValue("nextCursor", tag.nextCursor);
                ub.update();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:18,代码来源:MyTag.java

示例6: deleteByPhotosSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static void deleteByPhotosSync(final List<Long> photoIds) {
    final RuntimeExceptionDao<MyMomentPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyMomentPhoto.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                DeleteBuilder<MyMomentPhoto, Long> builder = dao.deleteBuilder();
                builder.where().in("photoId", photoIds);
                builder.delete();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:17,代码来源:MyMomentPhoto.java

示例7: deleteByPhotosSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static void deleteByPhotosSync(final List<Long> photoIds) {
    final RuntimeExceptionDao<MyTagPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyTagPhoto.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                DeleteBuilder<MyTagPhoto, Long> builder = dao.deleteBuilder();
                builder.where().in("photo_id", photoIds);
                builder.delete();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:17,代码来源:MyTagPhoto.java

示例8: updateSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static void updateSync(final String key, final String value) {
    final RuntimeExceptionDao<MySetting, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MySetting.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                QueryBuilder<MySetting, Long> settingQb = dao.queryBuilder();
                settingQb.where().eq("key", key);
                List<MySetting> settings = settingQb.query();
                if (settings != null && settings.size() > 0) {
                    UpdateBuilder<MySetting, Long> ub = dao.updateBuilder();
                    ub.where().eq("key", key);
                    ub.updateColumnValue("value", value);
                    ub.update();
                } else {
                    dao.create(new MySetting(key, value));
                }
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:25,代码来源:MySetting.java

示例9: updateNextCursorSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static void updateNextCursorSync(final MyAlbum album) {
    final RuntimeExceptionDao<MyAlbum, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyAlbum.class);
    dao.callBatchTasks(new Callable<Object>() {
        @Override
        public Object call() throws Exception {
            try {
                UpdateBuilder<MyAlbum, Long> ub = dao.updateBuilder();
                ub.where().eq("id", album.id);
                ub.updateColumnValue("nextCursor", album.nextCursor);
                ub.update();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:18,代码来源:MyAlbum.java

示例10: deleteByPhotosSync

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static void deleteByPhotosSync(final List<Long> photoIds) {
    final RuntimeExceptionDao<MyAlbumPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyAlbumPhoto.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                DeleteBuilder<MyAlbumPhoto, Long> builder = dao.deleteBuilder();
                builder.where().in("photoId", photoIds);
                builder.delete();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:17,代码来源:MyAlbumPhoto.java

示例11: saveMangas

import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public void saveMangas(final Manga[] mangas){
	final RuntimeExceptionDao<Manga, String> mangaDao = getMangaRunDao();
       final RuntimeExceptionDao<Chapter, String> chapterDao = getChapterRunDao();
	final RuntimeExceptionDao<Genre, String> genreDao = getGenreRunDao();
	final RuntimeExceptionDao<GenreManga, String> genremangaDao = getGenreMangaRunDao();
       final RuntimeExceptionDao<Author, String> authorDao = getAuthorRunDao();
       final RuntimeExceptionDao<AuthorManga, String> authormangaDao = getAuthorMangaRunDao();

	mangaDao.callBatchTasks(
			new Callable<Void>(){
				public Void call() throws Exception {
					for(Manga m : mangas){
						mangaDao.createIfNotExists(m);
                           if(m.chapters != null){
                               for(Chapter c: m.chapters){
                                   c.manga = m;
                                   chapterDao.createIfNotExists(c);
                               }
                           }
						if(m.genres != null){
							for(Genre g : m.genres) {
								genreDao.createIfNotExists(g);
								genremangaDao.createIfNotExists(new GenreManga(g,m));
							}
						}
                           if(m.authors != null){
                               for(Author a : m.authors){
                                   authorDao.createIfNotExists(a);
                                   authormangaDao.createIfNotExists(new AuthorManga(a,m));
                               }
                           }
					}
					return null;
				}
			}
		);
}
 
开发者ID:Vrael,项目名称:eManga,代码行数:38,代码来源:DatabaseHelper.java


注:本文中的com.j256.ormlite.dao.RuntimeExceptionDao.callBatchTasks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。