예제 #1
0
  @Nullable
  public Ganga getGanga(UUID id) {
    GangaCursorWrapper cursor =
        queryGangas(GangaTable.Column.UUID + " = ?", new String[] {id.toString()});

    try {
      if (cursor.getCount() == 0) return null;

      cursor.moveToFirst();
      return cursor.getGanga();
    } finally {
      cursor.close();
    }
  }
예제 #2
0
  public List<Ganga> getGangas() {
    List<Ganga> gangas = new ArrayList<>();
    GangaCursorWrapper cursor = queryGangas(null, null);

    try {
      cursor.moveToFirst();

      while (!cursor.isAfterLast()) {
        gangas.add(cursor.getGanga());
        cursor.moveToNext();
      }
    } finally {
      cursor.close();
    }

    return gangas;
  }