Esempio n. 1
0
 /** Fetch all metadata that are unattached to the task */
 public TodorooCursor<Metadata> fetchDangling(Property<?>... properties) {
   Query sql =
       Query.select(properties)
           .from(Metadata.TABLE)
           .join(Join.left(Task.TABLE, Metadata.TASK.eq(Task.ID)))
           .where(Task.TITLE.isNull());
   Cursor cursor = database.rawQuery(sql.toString(), null);
   return new TodorooCursor<Metadata>(cursor, properties);
 }
Esempio n. 2
0
 /**
  * Gets a listing of all alarms that are active
  *
  * @param properties
  * @return todoroo cursor. PLEASE CLOSE THIS CURSOR!
  */
 private TodorooCursor<Metadata> getActiveAlarms() {
   return PluginServices.getMetadataService()
       .query(
           Query.select(AlarmFields.TIME)
               .join(Join.inner(Task.TABLE, Metadata.TASK.eq(Task.ID)))
               .where(
                   Criterion.and(
                       TaskCriteria.isActive(),
                       MetadataCriteria.withKey(AlarmFields.METADATA_KEY))));
 }
Esempio n. 3
0
 private void titleMatchWithActFm(Task task) {
   String title = task.getValue(Task.TITLE);
   TodorooCursor<Task> match =
       taskService.query(
           Query.select(Task.ID)
               .join(
                   Join.left(
                       Metadata.TABLE,
                       Criterion.and(
                           Metadata.KEY.eq(GtasksMetadata.METADATA_KEY),
                           Metadata.TASK.eq(Task.ID))))
               .where(Criterion.and(Task.TITLE.eq(title), GtasksMetadata.ID.isNull())));
   try {
     if (match.getCount() > 0) {
       match.moveToFirst();
       task.setId(match.get(Task.ID));
     }
   } finally {
     match.close();
   }
 }
Esempio n. 4
0
 /** Returns all metadata associated with a given task */
 public static Criterion byTask(long taskId) {
   return Metadata.TASK.eq(taskId);
 }