Java Code Examples for org.xutils.ex.DbException#printStackTrace()

The following examples show how to use org.xutils.ex.DbException#printStackTrace() . 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: ComicDBHelper.java    From HHComicViewer with Apache License 2.0 6 votes vote down vote up
public synchronized void add(Comic comic) {
    try {
        if (comic.isMark() || comic.isDownload()) {
            if (comic.getChapterNameList() == null || "".equals(comic.getChapterNameList())) {
                comic.saveChapterNameList();
            }
            if (comic.getChapterIdList() == null || "".equals(comic.getChapterIdList())) {
                comic.saveChapterIdList();
            }
        }
        if (comic.isUpdate()) {
            comic.saveChapterNameList();
            comic.saveChapterIdList();
        }
        sDb.save(comic);
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: ComicDBHelper.java    From HHComicViewer with Apache License 2.0 6 votes vote down vote up
public synchronized void update(Comic comic) {
    try {
        if (comic.isMark() || comic.isDownload()) {
            if (comic.getChapterNameList() == null || "".equals(comic.getChapterNameList())) {
                comic.saveChapterNameList();
            }
            if (comic.getChapterIdList() == null || "".equals(comic.getChapterIdList())) {
                comic.saveChapterIdList();
            }
        }
        if (comic.isUpdate()) {
            comic.saveChapterNameList();
            comic.saveChapterIdList();
            comic.setUpdate(false);
        }
        sDb.update(comic);
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 3
Source File: ComicChapterDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
@Deprecated
public List<ComicChapter> findAll() {
    List<ComicChapter> comicChapters = new ArrayList<>();
    try {
        comicChapters = sDb.findAll(ComicChapter.class);
    } catch (DbException e) {
        e.printStackTrace();
    }
    return comicChapters;
}
 
Example 4
Source File: TaskModelImp.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
public DownloadTaskEntity upDataTask(DownloadTaskEntity task) {
    try {
        DBTools.getInstance().db().saveOrUpdate(task);
    } catch (DbException e) {
        e.printStackTrace();
    }
    return task;
}
 
Example 5
Source File: ComicChapterDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
public List<ComicChapter> findByComicCid(int cid) {
    List<ComicChapter> comicChapters = null;
    try {
        comicChapters = sDb.selector(ComicChapter.class).where("cid", "=", cid).findAll();
        if (comicChapters != null) {
            Collections.sort(comicChapters);
        }
    } catch (DbException e) {
        e.printStackTrace();
    }
    return comicChapters;
}
 
Example 6
Source File: ComicChapterDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
public ComicChapter findByChapterId(long chid) {
    ComicChapter chapter = null;
    try {
        chapter = sDb.selector(ComicChapter.class).where("chid", "=", chid).findFirst();
    } catch (DbException e) {
        e.printStackTrace();
    }
    return chapter;
}
 
Example 7
Source File: PhotoManager.java    From DelegateAdapter with Apache License 2.0 5 votes vote down vote up
public void onFinish (Photo photo) {
    Log.v (TAG, "onFinish photo.id=" + photo.id);
    PhotoEntity entity = new PhotoEntity(photo);
    entity.state = PhotoEntity.STATE_FINISHED;
    try {
        mDb.saveOrUpdate(entity);
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 8
Source File: DownloadThreadDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
public synchronized void update(ThreadInfo threadInfo) {
    try {
        sDb.update(threadInfo);
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 9
Source File: TaskModelImp.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
public List<DownloadTaskEntity> findTaskByUrl(String url) {
    try {
        return DBTools.getInstance().db().selector(DownloadTaskEntity.class).where("url", "=", url).findAll();
    } catch (DbException e) {
        e.printStackTrace();
    }
    return null;
}
 
Example 10
Source File: TaskModelImp.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
public DownloadTaskEntity findTaskById(int id) {
    try {
        return DBTools.getInstance().db().findById(DownloadTaskEntity.class,id);
    } catch (DbException e) {
        e.printStackTrace();
    }
    return null;
}
 
Example 11
Source File: DownLoadModelImp.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean stopTask(DownloadTaskEntity task) {
    try {
        XLTaskHelper.instance(x.app().getApplicationContext()).stopTask(task.getTaskId());
        task.setmTaskStatus(Const.DOWNLOAD_STOP);
        task.setmDownloadSpeed(0);
        task.setmDCDNSpeed(0);
        DBTools.getInstance().db().saveOrUpdate(task);
    } catch (DbException e) {
        e.printStackTrace();
        return false;
    }
    return true;
}
 
Example 12
Source File: PlayerVideoModelImp.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
public PlayerVideoEntity saveOrUpdata(PlayerVideoEntity video) {
    try {
        DBTools.getInstance().db().saveOrUpdate(video);
    } catch (DbException e) {
        e.printStackTrace();
    }
    return video;
}
 
Example 13
Source File: ComicDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
public List<Comic> findDownloadedComics() {
    List<Comic> downloadedComics = null;
    try {
        downloadedComics = sDb.selector(Comic.class).where("is_download", "=", true).findAll();
    } catch (DbException e) {
        e.printStackTrace();
    }
    return downloadedComics;
}
 
Example 14
Source File: PlayerVideoModelImp.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
public List<PlayerVideoEntity> findVideoByPath(String path) {
    try {
        return DBTools.getInstance().db().selector(PlayerVideoEntity.class).where("localPath", "=", path).findAll();
    } catch (DbException e) {
        e.printStackTrace();
    }
    return null;
}
 
Example 15
Source File: ComicChapterDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
public List<ComicChapter> findUnFinishedChapters() {
    List<ComicChapter> unFinishedChapters = null;
    try {
        unFinishedChapters = sDb.selector(ComicChapter.class)
                .where("download_status", "!=", Constants.DOWNLOAD_FINISHED).findAll();
        if (unFinishedChapters != null && unFinishedChapters.size() != 0) {
            Collections.sort(unFinishedChapters);
        }
    } catch (DbException e) {
        e.printStackTrace();
    }
    return unFinishedChapters;
}
 
Example 16
Source File: ComicChapterDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
public synchronized void updateProgress(ComicChapter comicChapter) {
    try {
        sDb.update(comicChapter, "download_position");
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 17
Source File: ComicDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
private Comic findByCidInTable(int cid) {
    Comic comic = null;
    try {
        comic = sDb.selector(Comic.class).where("cid", "=", cid).findFirst();
    } catch (DbException e) {
        e.printStackTrace();
    }
    return comic;
}
 
Example 18
Source File: ComicChapterDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
public synchronized void update(ComicChapter comicChapter) {
    try {
        sDb.update(comicChapter);
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 19
Source File: DownloadThreadDBHelper.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
public List<ThreadInfo> findAll() {
    List<ThreadInfo> threadInfos = new ArrayList<>();
    try {
        sDb.findAll(ThreadInfo.class);
    } catch (DbException e) {
        e.printStackTrace();
        return null;
    }
    return threadInfos;
}
 
Example 20
Source File: AppSettingModelImp.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
public void saveOrUploadSteeing(AppSettingEntity setting) {
    try {
        DBTools.getInstance().db().saveOrUpdate(setting);
    } catch (DbException e) {
        e.printStackTrace();
    }
}