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

The following examples show how to use org.xutils.ex.DbException#printStackTrace() . These examples are extracted from open source projects. 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 Project: HHComicViewer   File: ComicDBHelper.java    License: 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 2
Source Project: HHComicViewer   File: ComicDBHelper.java    License: 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 3
@Override
public void saveOrUploadSteeing(AppSettingEntity setting) {
    try {
        DBTools.getInstance().db().saveOrUpdate(setting);
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 4
public List<ThreadInfo> findAll() {
    List<ThreadInfo> threadInfos = new ArrayList<>();
    try {
        sDb.findAll(ThreadInfo.class);
    } catch (DbException e) {
        e.printStackTrace();
        return null;
    }
    return threadInfos;
}
 
Example 5
public synchronized void update(ComicChapter comicChapter) {
    try {
        sDb.update(comicChapter);
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 6
Source Project: HHComicViewer   File: ComicDBHelper.java    License: 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 7
public synchronized void updateProgress(ComicChapter comicChapter) {
    try {
        sDb.update(comicChapter, "download_position");
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 8
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 9
@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 10
Source Project: HHComicViewer   File: ComicDBHelper.java    License: 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 11
@Override
public PlayerVideoEntity saveOrUpdata(PlayerVideoEntity video) {
    try {
        DBTools.getInstance().db().saveOrUpdate(video);
    } catch (DbException e) {
        e.printStackTrace();
    }
    return video;
}
 
Example 12
@Deprecated
public List<ComicChapter> findAll() {
    List<ComicChapter> comicChapters = new ArrayList<>();
    try {
        comicChapters = sDb.findAll(ComicChapter.class);
    } catch (DbException e) {
        e.printStackTrace();
    }
    return comicChapters;
}
 
Example 13
@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 14
Source Project: AndroidDownload   File: TaskModelImp.java    License: 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 15
Source Project: AndroidDownload   File: TaskModelImp.java    License: 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 16
public synchronized void update(ThreadInfo threadInfo) {
    try {
        sDb.update(threadInfo);
    } catch (DbException e) {
        e.printStackTrace();
    }
}
 
Example 17
Source Project: DelegateAdapter   File: PhotoManager.java    License: 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 18
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 19
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 20
Source Project: AndroidDownload   File: TaskModelImp.java    License: 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;
}