diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java index 3bddeafae..aa8dc1c65 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java @@ -512,7 +512,7 @@ public class AstridNewSyncMigrator { private void updateTagUuid(Metadata m) { String tag = m.getValue(TaskToTagMetadata.TAG_NAME); - TagData tagData = tagDataService.getTag(tag, TagData.UUID); + TagData tagData = tagDataService.getTagByName(tag, TagData.UUID); if (tagData != null) { if (ActFmInvoker.SYNC_DEBUG) Log.w(LOG_TAG, "Linking with tag uuid " + tagData.getValue(TagData.UUID)); diff --git a/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarReminderActivity.java b/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarReminderActivity.java index d7e6493e1..a3c23391e 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarReminderActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarReminderActivity.java @@ -178,7 +178,7 @@ public class CalendarReminderActivity extends Activity { @Override public void onClick(View v) { String listName = getString(R.string.CRA_default_list_name, eventName); - TagData existing = tagDataService.getTag(listName, TagData.PROPERTIES); + TagData existing = tagDataService.getTagByName(listName, TagData.PROPERTIES); if (existing != null) { listExists(existing); } else { diff --git a/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksHelper.java b/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksHelper.java index 7c34a25a9..681d18170 100644 --- a/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksHelper.java +++ b/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksHelper.java @@ -60,7 +60,7 @@ public class SubtasksHelper { public static String applySubtasksToWidgetFilter(Filter filter, String query, String tagName, int limit) { if (SubtasksHelper.shouldUseSubtasksFragmentForFilter(filter)) { // care for manual ordering - TagData tagData = PluginServices.getTagDataService().getTag(tagName, TagData.UUID, TagData.TAG_ORDERING); + TagData tagData = PluginServices.getTagDataService().getTagByName(tagName, TagData.UUID, TagData.TAG_ORDERING); TaskListMetadataDao tlmd = PluginServices.getTaskListMetadataDao(); TaskListMetadata tlm = null; if (tagData != null) { diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java b/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java index af67a8e43..b77f0e09a 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java @@ -38,6 +38,7 @@ import com.todoroo.astrid.api.FilterCategory; import com.todoroo.astrid.api.FilterListItem; import com.todoroo.astrid.api.FilterWithCustomIntent; import com.todoroo.astrid.api.FilterWithUpdate; +import com.todoroo.astrid.dao.TagDataDao; import com.todoroo.astrid.dao.TaskDao.TaskCriteria; import com.todoroo.astrid.data.Metadata; import com.todoroo.astrid.data.RemoteModel; @@ -200,7 +201,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE protected String uuid; @Autowired public TagService tagService; - @Autowired public TagDataService tagDataService; + @Autowired public TagDataDao tagDataDao; static { AstridDependencyInjector.initialize(); @@ -220,7 +221,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE DependencyInjectionService.getInstance().inject(this); - TagData tagData = tagDataService.getTag(tag, TagData.MEMBER_COUNT, TagData.USER_ID); + TagData tagData = tagDataDao.fetch(uuid, TagData.MEMBER_COUNT, TagData.USER_ID); if(tagData != null && tagData.getValue(TagData.MEMBER_COUNT) > 0 && Task.USER_ID_SELF.equals(tagData.getValue(TagData.USER_ID))) { DialogUtilities.okCancelDialog(this, getString(R.string.actfm_tag_operation_owner_delete), getOkListener(), getCancelListener()); return; @@ -310,10 +311,10 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE return false; } else { int renamed = tagService.rename(tag, text); - TagData tagData = tagDataService.getTag(tag, TagData.ID, TagData.NAME); + TagData tagData = tagDataDao.fetch(uuid, TagData.ID, TagData.NAME); if (tagData != null) { tagData.setValue(TagData.NAME, text); - tagDataService.save(tagData); + tagDataDao.saveExisting(tagData); } Toast.makeText(this, getString(R.string.TEA_tags_renamed, tag, text, renamed), Toast.LENGTH_SHORT).show(); diff --git a/astrid/src/com/todoroo/astrid/service/TagDataService.java b/astrid/src/com/todoroo/astrid/service/TagDataService.java index e4713d2cc..79e7b0fda 100644 --- a/astrid/src/com/todoroo/astrid/service/TagDataService.java +++ b/astrid/src/com/todoroo/astrid/service/TagDataService.java @@ -89,7 +89,7 @@ public class TagDataService { * Find a tag by name * @return null if doesn't exist */ - public TagData getTag(String name, Property... properties) { + public TagData getTagByName(String name, Property... properties) { TodorooCursor cursor = tagDataDao.query(Query.select(properties).where(TagData.NAME.eqCaseInsensitive(name))); try { if(cursor.getCount() == 0) diff --git a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java index b1f3a4282..fab7d1489 100644 --- a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java +++ b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java @@ -428,7 +428,7 @@ public class TasksWidget extends AppWidgetProvider { } } } else { - tagData = tagDataService.getTag(filter.title, TagData.ID); + tagData = tagDataService.getTagByName(filter.title, TagData.ID); if (tagData != null) Preferences.setLong(WidgetConfigActivity.PREF_TAG_ID + widgetId, tagData.getId()); }