use of com.squareup.sqlbrite2.BriteDatabase in project Shuttle by timusus.
the class InclExclHelper method addToInclExcl.
public static void addToInclExcl(List<InclExclItem> inclExclItems) {
BriteDatabase db = DataManager.getInstance().getInclExclDatabase();
BriteDatabase.Transaction transaction = db.newTransaction();
try {
Stream.of(inclExclItems).map(inclExclItem -> {
ContentValues contentValues = new ContentValues(2);
contentValues.put(InclExclDbOpenHelper.COLUMN_PATH, inclExclItem.path);
contentValues.put(InclExclDbOpenHelper.COLUMN_TYPE, inclExclItem.type);
return contentValues;
}).forEach(contentValues -> db.insert(InclExclDbOpenHelper.TABLE_NAME, contentValues));
transaction.markSuccessful();
} finally {
transaction.end();
}
}
Aggregations