示例#1
0
 /**
  * Gets a listing of all tasks that are active &
  *
  * @param properties
  * @return todoroo cursor. PLEASE CLOSE THIS CURSOR!
  */
 private TodorooCursor<Task> getTasksWithReminders(Property<?>... properties) {
   return taskDao.query(
       Query.select(properties)
           .where(
               Criterion.and(
                   TaskCriteria.isActive(),
                   TaskCriteria.ownedByMe(),
                   Criterion.or(Task.REMINDER_FLAGS.gt(0), Task.REMINDER_PERIOD.gt(0)))));
 }
示例#2
0
 private int countTasks(Filter filter) {
   String queryTemplate = PermaSql.replacePlaceholders(filter.getSqlQuery());
   TodorooCursor<Task> cursor =
       taskDao.query(Query.select(Task.ID).withQueryTemplate(queryTemplate));
   try {
     return cursor.getCount();
   } finally {
     cursor.close();
   }
 }
示例#3
0
  /** Clean up tasks. Typically called on startup */
  public void deleteTasksWithEmptyTitles() {
    TodorooCursor<Task> cursor =
        taskDao.query(Query.select(Task.ID).where(TaskDao.TaskCriteria.hasNoTitle()));
    try {
      if (cursor.getCount() == 0) {
        return;
      }

      for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
        long id = cursor.getLong(0);
        taskDao.delete(id);
      }
    } finally {
      cursor.close();
    }
  }