本文整理汇总了Java中nl.qbusict.cupboard.QueryResultIterable类的典型用法代码示例。如果您正苦于以下问题:Java QueryResultIterable类的具体用法?Java QueryResultIterable怎么用?Java QueryResultIterable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryResultIterable类属于nl.qbusict.cupboard包,在下文中一共展示了QueryResultIterable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMachines
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
public static ArrayList<Machine> getMachines(ClothyScannerDBHelper clothyScannerDBHelper) {
ArrayList<Machine> machines = new ArrayList<>();
Cursor machineCursor = cupboard().withDatabase(clothyScannerDBHelper.getReadableDatabase())
.query(Machine.class).getCursor();
try {
QueryResultIterable<Machine> itr = cupboard().withCursor(machineCursor).iterate(Machine.class);
for (Machine machine : itr) {
machines.add(machine);
}
} finally {
machineCursor.close();
}
return machines;
}
开发者ID:GrenderG,项目名称:ClothyScanner,代码行数:18,代码来源:DBAccessor.java
示例2: readSavedComics
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
@Override
public void readSavedComics(@NonNull Context context, OnReadSavedComicsListener onReadSavedComicsListener) {
ArrayList<Comic> comics = new ArrayList<>();
Cursor comicCursor = cupboard().withDatabase(ComicDBHelper.getComicDBHelper(context).getReadableDatabase()).query(Comic.class).getCursor();
try {
QueryResultIterable<Comic> itr = cupboard().withCursor(comicCursor).iterate(Comic.class);
for (Comic comic : itr) {
comics.add(comic);
}
} finally {
comicCursor.close();
}
onReadSavedComicsListener.onComicsReadOk(comics);
}
开发者ID:owniz,项目名称:OzComicReader,代码行数:19,代码来源:CollectionInteractorImpl.java
示例3: retrieveFavorites
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
@Override
public ArrayList<Definition> retrieveFavorites(Context context) {
ArrayList<Definition> definitions = new ArrayList<>();
Cursor history = cupboard().withDatabase(DiccionarioDBHelper.getInstance(context)
.getReadableDatabase())
.query(Definition.class).getCursor();
try {
QueryResultIterable<Definition> itr = cupboard().withCursor(history).iterate(Definition.class);
for (Definition def : itr) {
if (def.isFavorite)
definitions.add(def);
}
} finally {
history.close();
}
return definitions;
}
开发者ID:freespanish,项目名称:Diccionario,代码行数:19,代码来源:FavInteractorImpl.java
示例4: retrieveHistory
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
@Override
public ArrayList<Definition> retrieveHistory(Context context) {
ArrayList<Definition> definitions = new ArrayList<>();
Cursor history = cupboard().withDatabase(DiccionarioDBHelper.getInstance(context)
.getReadableDatabase())
.query(Definition.class).getCursor();
try {
QueryResultIterable<Definition> itr = cupboard().withCursor(history).iterate(Definition.class);
for (Definition def : itr) {
if (def.isHistory)
definitions.add(def);
}
} finally {
history.close();
}
return definitions;
}
开发者ID:freespanish,项目名称:Diccionario,代码行数:20,代码来源:HistoryInteractorImpl.java
示例5: readWholeData
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
@Override
public long readWholeData() throws SQLException {
long start = System.nanoTime();
Cursor cursor = cupboard().withDatabase(mHelper.getWritableDatabase()).query(Message.class)
.getCursor();
QueryResultIterable<Message> iterate = null;
try {
int countMessages = 0;
iterate = cupboard().withCursor(cursor).iterate(Message.class);
for(Message message : iterate)
{
countMessages++;
}
Log.d(TAG,
"Read, " + countMessages + " rows");
} finally {
if (iterate != null) {
iterate.close();
cursor.close();
}
}
return System.nanoTime() - start;
}
开发者ID:touchlab,项目名称:android-orm-benchmark-updated,代码行数:25,代码来源:CupboardExecutor.java
示例6: checkConflict
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
public static boolean checkConflict(Context context, Workout inWorkout) {
boolean overlap = false;
if (context != null) {
final CupboardSQLiteOpenHelper dbHelper = new CupboardSQLiteOpenHelper(context);
final SQLiteDatabase mDb = dbHelper.getReadableDatabase();
long rangeStart = inWorkout.start - 1000 * 60 * 60 * 24;
long rangeEnd = inWorkout.start + inWorkout.duration;
QueryResultIterable<Workout> itr = cupboard().withDatabase(mDb).query(Workout.class).withSelection("start BETWEEN ? AND ?", "" + rangeStart, "" + rangeEnd).query();
for (Workout workout : itr) {
Log.d(TAG, workout.toString());
if (workout.type != WorkoutTypes.STILL.getValue() && workout.type != WorkoutTypes.UNKNOWN.getValue() && workout.overlaps(inWorkout)) {
overlap = true;
}
}
itr.close();
dbHelper.close();
}
return overlap;
}
开发者ID:blackcj,项目名称:GoogleFitExample,代码行数:20,代码来源:CacheManager.java
示例7: autoClose
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
private <T> FlowableTransformer<T, T> autoClose(final QueryResultIterable<T> iterable) {
return new FlowableTransformer<T, T>() {
@Override
public Publisher<T> apply(Flowable<T> upstream) {
return upstream.doOnTerminate(new Action() {
@Override
public void run() throws Exception {
// Stream terminates (completed or on error): close the cursor
iterable.close();
}
}).doOnCancel(new Action() {
@Override
public void run() throws Exception {
// Cancelled subscription (manual unsubscribe or via some operator such as take()): close the cursor
iterable.close();
}
});
}
};
}
开发者ID:erickok,项目名称:RxCupboard,代码行数:21,代码来源:RxDatabase.java
示例8: doQuery
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
@Override
protected QueryResult doQuery(final String queryString, OnProgressUpdateListener onProgressUpdateListener) throws QueryException {
QueryResult<TodoItem> result;
try {
long lKey = Long.parseLong(queryString);
TodoItem todoItem = cupboard().withDatabase(mDatabase).get(TodoItem.class, lKey);
if (todoItem != null) {
result = new QueryResult.SingletonQueryResult<TodoItem>(todoItem);
} else {
result = new EmptyQueryResult<TodoItem>();
}
} catch (NumberFormatException e) {
if ("*".equals(queryString)) {
final QueryResultIterable<TodoItem> items = cupboard().withDatabase(mDatabase).query(TodoItem.class).query();
result = new CupboardQueryResult<TodoItem>(items);
} else {
result = new EmptyQueryResult<TodoItem>();
}
}
return result;
}
开发者ID:BryceCicada,项目名称:Prevail,代码行数:22,代码来源:DatabaseChunk.java
示例9: backupCategoryWithProducts
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
private boolean backupCategoryWithProducts(Context context, Category category, JSONArray container, List<File> imageFilesContainer) {
// backup the category
JSONArray productsContainer = backupCategory(category, container);
if(productsContainer == null) {
return false;
}
// Get products with in this category
QueryResultIterable<Product> productsItr = null;
if(category._id == Products.PRODUCT_CATEGORY_NONE_ID) {
productsItr = cupboard().withContext(context).query(Products.CONTENT_URI, Product.class).withSelection(Products.SELECTION_NO_CATEGORY, (String[])null).query();
}
else productsItr = cupboard().withContext(context).query(Products.buildCategoryProductsUri(category._id), Product.class).query();
for (Product p : productsItr) {
// backup each product in this category
if(!backupProduct(p, productsContainer, imageFilesContainer)) {
productsItr.close();
return false;
}
}
productsItr.close();
return true;
}
开发者ID:luboganev,项目名称:dejalist,代码行数:23,代码来源:BackupIntentService.java
示例10: backup
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
private boolean backup() {
// clear up and init
clearBackupFolder();
mData = new JSONArray();
mProductImageFiles = new ArrayList<File>();
// first add the products with no category to backup
Category noCategory = getNoCategory();
backupCategoryWithProducts(getApplicationContext(), noCategory, mData, mProductImageFiles);
// now add all the real categories and their products
QueryResultIterable<Category> categoriesItr = cupboard().withContext(getApplicationContext()).query(Categories.CONTENT_URI, Category.class).query();
for (Category category : categoriesItr) {
backupCategoryWithProducts(getApplicationContext(), category, mData, mProductImageFiles);
}
categoriesItr.close();
// write the backup files
return writeBackup(getBackupDir());
}
开发者ID:luboganev,项目名称:dejalist,代码行数:21,代码来源:BackupIntentService.java
示例11: onLoadFinished
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
QueryResultIterable<Artwork> iterate = cupboard.withCursor(data).iterate(Artwork.class);
List<Artwork> artworks = iterate.list(true);
mAdapter.setArtworks(artworks);
}
开发者ID:tasomaniac,项目名称:MuzeiHistory,代码行数:8,代码来源:MainActivity.java
示例12: showLogs
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
private void showLogs() {
logAdapter.clear();
CupboardSQLiteOpenHelper dbHelper = new CupboardSQLiteOpenHelper(this);
db = dbHelper.getWritableDatabase();
Cursor logEntriesCursor;
if (showMqttLogs && showAppLogs) {
logEntriesCursor = cupboard().withDatabase(db).query(LogEntry.class).withSelection("logText is not NULL order by logTime desc").getCursor();
} else if (showMqttLogs && !showAppLogs) {
logEntriesCursor = cupboard().withDatabase(db).query(LogEntry.class).withSelection("logText is not NULL AND logType = '" + LogEntry.LOGTYPE_MQTT + "' order by logTime desc").getCursor();
} else if (!showMqttLogs && showAppLogs) {
logEntriesCursor = cupboard().withDatabase(db).query(LogEntry.class).withSelection("logText is not NULL AND logType = '" + LogEntry.LOGTYPE_LOG + "' order by logTime desc").getCursor();
} else {
return;
}
try {
QueryResultIterable<LogEntry> itr = cupboard().withCursor(logEntriesCursor).iterate(LogEntry.class);
for (LogEntry l : itr) {
logAdapter.add(l);
}
} finally {
// close the cursor
logEntriesCursor.close();
}
}
开发者ID:plugdio,项目名称:homie-dash,代码行数:30,代码来源:LogActivity.java
示例13: onHandleIntent
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
ResultReceiver resultReceiver = intent.getParcelableExtra(MainActivity.RECEIVER_TAG);
mReceiver = new WeakReference<>(resultReceiver);
final CupboardSQLiteOpenHelper dbHelper = new CupboardSQLiteOpenHelper(this);
final SQLiteDatabase mDb = dbHelper.getReadableDatabase();
Utilities.TimeFrame mTimeFrame = (Utilities.TimeFrame) intent.getSerializableExtra("TimeFrame");
ArrayList<Workout> report;
if (mockData) {
switch (mTimeFrame) {
case BEGINNING_OF_DAY: // 1 day
report = MockData.getDailyMockData().getWorkoutData();
break;
case BEGINNING_OF_WEEK: // 1 week
report = MockData.getWeeklyMockData().getWorkoutData();
break;
case BEGINNING_OF_MONTH: // 1 month
report = MockData.getMonthlyMockData().getWorkoutData();
break;
case LAST_MONTH: // 1 month
report = MockData.getMonthlyMockData().getWorkoutData();
break;
default:
report = MockData.getDailyMockData().getWorkoutData();
break;
}
} else {
long startTime = Utilities.getTimeFrameStart(mTimeFrame);
long endTime = Utilities.getTimeFrameEnd(mTimeFrame);
workoutReport.clearWorkoutData();
if (!mDb.isOpen()) {
Log.w(TAG, "db is closed!");
return;
}
QueryResultIterable<Workout> itr = cupboard().withDatabase(mDb).query(Workout.class).withSelection("start >= ? AND start <= ?", "" + startTime, "" + endTime).query();
for (Workout workout : itr) {
if (workout.start > startTime && workout.start <= endTime) {
workoutReport.addWorkoutData(workout);
}
}
itr.close();
report = workoutReport.getWorkoutData();
}
ResultReceiver receiver = mReceiver.get();
if(receiver != null) {
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("workoutList", report);
receiver.send(200, bundle);
}else {
Log.w(TAG, "Weak listener is NULL.");
}
dbHelper.close();
}
开发者ID:blackcj,项目名称:GoogleFitExample,代码行数:55,代码来源:ReadCacheIntentService.java
示例14: query
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
public <T> Flowable<T> query(Class<T> entityClass) {
QueryResultIterable<T> iterable = dc.query(entityClass).query();
return Flowable.fromIterable(iterable).compose(autoClose(iterable));
}
开发者ID:erickok,项目名称:RxCupboard,代码行数:5,代码来源:RxDatabase.java
示例15: CupboardQueryResult
import nl.qbusict.cupboard.QueryResultIterable; //导入依赖的package包/类
private CupboardQueryResult(final QueryResultIterable<T> items) {
mItems = items;
}
开发者ID:BryceCicada,项目名称:Prevail,代码行数:4,代码来源:DatabaseChunk.java
注:本文中的nl.qbusict.cupboard.QueryResultIterable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论