Boilerplate for TaskListMetadata

pull/14/head
Sam Bosley 13 years ago
parent 3201ba3726
commit fa3bbf3445

@ -0,0 +1,145 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.data;
import android.content.ContentValues;
import android.net.Uri;
import com.todoroo.andlib.data.AbstractModel;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.IntegerProperty;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.data.Table;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.astrid.api.AstridApiConstants;
/**
* Data Model which represents a user.
*
* @author Tim Su <tim@todoroo.com>
*
*/
@SuppressWarnings("nls")
public final class TaskListMetadata extends RemoteModel {
// --- table and uri
/** table for this model */
public static final Table TABLE = new Table("task_list_metadata", TaskListMetadata.class);
/** model class for entries in the outstanding table */
public static final Class<? extends OutstandingEntry<TaskListMetadata>> OUTSTANDING_MODEL = TaskListMetadataOutstanding.class;
/** content uri for this model */
public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
TABLE.name);
// --- properties
/** ID */
public static final LongProperty ID = new LongProperty(
TABLE, ID_PROPERTY_NAME);
/** Remote id */
public static final StringProperty UUID = new StringProperty(
TABLE, UUID_PROPERTY_NAME);
/** Pushed at date */
public static final LongProperty PUSHED_AT = new LongProperty(
TABLE, PUSHED_AT_PROPERTY_NAME);
/** Tag UUID */
public static final StringProperty TAG_UUID = new StringProperty(
TABLE, "tag_uuid");
/** Filter id (one of below) */
public static final StringProperty FILTER = new StringProperty(
TABLE, "filter");
/** Tree of task ids (serialized to json array) */
public static final StringProperty TASK_IDS = new StringProperty(
TABLE, "task_ids", Property.PROP_FLAG_JSON);
/** Sort setting (one of below) */
public static final StringProperty SORT = new StringProperty(
TABLE, "sort");
/** Settings hash */
public static final StringProperty SETTINGS = new StringProperty(
TABLE, "settings", Property.PROP_FLAG_JSON);
/** Array of child tags (for folders) */
public static final StringProperty CHILD_TAG_IDS = new StringProperty(
TABLE, "child_tags", Property.PROP_FLAG_JSON);
/** If the folder is collapsed */
public static final IntegerProperty IS_COLLAPSED = new IntegerProperty(
TABLE, "is_collapsed");
/** List of all properties for this model */
public static final Property<?>[] PROPERTIES = generateProperties(TaskListMetadata.class);
// --- defaults
/** Default values container */
private static final ContentValues defaultValues = new ContentValues();
static {
defaultValues.put(UUID.name, NO_UUID);
defaultValues.put(PUSHED_AT.name, 0);
defaultValues.put(TAG_UUID.name, NO_UUID);
defaultValues.put(FILTER.name, "");
defaultValues.put(TASK_IDS.name, "[]");
defaultValues.put(SORT.name, "");
defaultValues.put(SETTINGS.name, "{}");
defaultValues.put(CHILD_TAG_IDS.name, "[]");
defaultValues.put(IS_COLLAPSED.name, 0);
}
@Override
public ContentValues getDefaultValues() {
return defaultValues;
}
// --- data access boilerplate
public TaskListMetadata() {
super();
}
public TaskListMetadata(TodorooCursor<TaskListMetadata> cursor) {
this();
readPropertiesFromCursor(cursor);
}
public void readFromCursor(TodorooCursor<TaskListMetadata> cursor) {
super.readPropertiesFromCursor(cursor);
}
@Override
public long getId() {
return getIdHelper(ID);
}
@Override
public String getUuid() {
return getUuidHelper(UUID);
}
// --- parcelable helpers
public static final Creator<TaskListMetadata> CREATOR = new ModelCreator<TaskListMetadata>(TaskListMetadata.class);
@Override
protected Creator<? extends AbstractModel> getCreator() {
return CREATOR;
}
}

@ -0,0 +1,63 @@
package com.todoroo.astrid.data;
import android.content.ContentValues;
import com.todoroo.andlib.data.AbstractModel;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.data.Table;
@SuppressWarnings("nls")
public class TaskListMetadataOutstanding extends OutstandingEntry<TaskListMetadata> {
/** table for this model */
public static final Table TABLE = new Table("task_list_metadata_outstanding", TaskListMetadataOutstanding.class);
// --- properties
/** ID */
public static final LongProperty ID = new LongProperty(
TABLE, ID_PROPERTY_NAME);
public static final LongProperty TASK_LIST_METADATA_ID = new LongProperty(
TABLE, ENTITY_ID_PROPERTY_NAME);
public static final StringProperty COLUMN_STRING = new StringProperty(
TABLE, COLUMN_STRING_PROPERTY_NAME);
public static final StringProperty VALUE_STRING = new StringProperty(
TABLE, VALUE_STRING_PROPERTY_NAME);
public static final LongProperty CREATED_AT = new LongProperty(
TABLE, CREATED_AT_PROPERTY_NAME);
private static final ContentValues defaultValues = new ContentValues();
static {
defaultValues.put(TASK_LIST_METADATA_ID.name, 0);
defaultValues.put(COLUMN_STRING.name, "");
defaultValues.put(VALUE_STRING.name, "");
}
/** List of all properties for this model */
public static final Property<?>[] PROPERTIES = generateProperties(TaskListMetadataOutstanding.class);
@Override
public ContentValues getDefaultValues() {
return defaultValues;
}
@Override
public long getId() {
return getIdHelper(ID);
}
public static final Creator<TaskListMetadataOutstanding> CREATOR = new ModelCreator<TaskListMetadataOutstanding>(TaskListMetadataOutstanding.class);
@Override
protected Creator<? extends AbstractModel> getCreator() {
return CREATOR;
}
}

@ -34,6 +34,8 @@ import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.dao.TagOutstandingDao;
import com.todoroo.astrid.dao.TaskAttachmentDao;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.TaskListMetadataDao;
import com.todoroo.astrid.dao.TaskListMetadataOutstandingDao;
import com.todoroo.astrid.dao.TaskOutstandingDao;
import com.todoroo.astrid.dao.UserActivityDao;
import com.todoroo.astrid.dao.UserActivityOutstandingDao;
@ -43,6 +45,8 @@ import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.TagOutstanding;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskAttachment;
import com.todoroo.astrid.data.TaskListMetadata;
import com.todoroo.astrid.data.TaskListMetadataOutstanding;
import com.todoroo.astrid.data.TaskOutstanding;
import com.todoroo.astrid.data.User;
import com.todoroo.astrid.data.UserActivity;
@ -80,6 +84,12 @@ public class ActFmSyncThread {
@Autowired
private UserActivityOutstandingDao userActivityOutstandingDao;
@Autowired
private TaskListMetadataDao taskListMetadataDao;
@Autowired
private TaskListMetadataOutstandingDao taskListMetadataOutstandingDao;
private String token;
private boolean syncMigration = false;
@ -275,6 +285,7 @@ public class ActFmSyncThread {
private void replayOutstandingChanges(boolean afterErrors) {
new ReplayOutstandingEntries<Task, TaskOutstanding>(Task.class, NameMaps.TABLE_ID_TASKS, taskDao, taskOutstandingDao, this, afterErrors).execute();
new ReplayOutstandingEntries<TagData, TagOutstanding>(TagData.class, NameMaps.TABLE_ID_TAGS, tagDataDao, tagOutstandingDao, this, afterErrors).execute();
new ReplayOutstandingEntries<TaskListMetadata, TaskListMetadataOutstanding>(TaskListMetadata.class, NameMaps.TABLE_ID_TASK_LIST_METADATA, taskListMetadataDao, taskListMetadataOutstandingDao, this, afterErrors).execute();
}
private boolean timeForBackgroundSync() {

@ -29,6 +29,8 @@ public class AcknowledgeChange extends ServerToClientMessage {
dao = PluginServices.getUserActivityOutstandingDao();
else if (NameMaps.TABLE_ID_ATTACHMENTS.equals(table))
dao = PluginServices.getTaskAttachmentOutstandingDao();
else if (NameMaps.TABLE_ID_TASK_LIST_METADATA.equals(table))
dao = PluginServices.getTaskListMetadataOutstandingDao();
else
dao = null;
}

@ -245,6 +245,9 @@ public class ChangesHappened<TYPE extends RemoteModel, OE extends OutstandingEnt
return ActFmPreferenceService.userId();
if (property.checkFlag(Property.PROP_FLAG_JSON))
try {
if (value != null && value.startsWith("["))
return new JSONArray(value);
else
return new JSONObject(value);
} catch (JSONException e) {
//

@ -12,6 +12,7 @@ import com.todoroo.astrid.data.History;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskAttachment;
import com.todoroo.astrid.data.TaskListMetadata;
import com.todoroo.astrid.data.User;
import com.todoroo.astrid.data.UserActivity;
@ -31,12 +32,14 @@ public class NameMaps {
public static final String TABLE_ID_USER_ACTIVITY = "user_activities";
public static final String TABLE_ID_HISTORY = "history";
public static final String TABLE_ID_ATTACHMENTS = "task_attachments";
public static final String TABLE_ID_TASK_LIST_METADATA = "task_list_metadata";
private static final String PUSHED_AT_PREFIX = "pushed_at";
public static final String PUSHED_AT_TASKS = PUSHED_AT_PREFIX + "_" + TABLE_ID_TASKS;
public static final String PUSHED_AT_TAGS = PUSHED_AT_PREFIX + "_" + TABLE_ID_TAGS;
public static final String PUSHED_AT_USERS = PUSHED_AT_PREFIX + "_" + TABLE_ID_USERS;
public static final String PUSHED_AT_ACTIVITY = PUSHED_AT_PREFIX + "_" + TABLE_ID_USER_ACTIVITY;
public static final String PUSHED_AT_TASK_LIST_METADATA = PUSHED_AT_PREFIX + "_" + TABLE_ID_TASK_LIST_METADATA;
static {
// Hardcoded local tables mapped to corresponding server names
@ -47,6 +50,7 @@ public class NameMaps {
TABLE_LOCAL_TO_SERVER.put(History.TABLE, TABLE_ID_HISTORY);
TABLE_LOCAL_TO_SERVER.put(UserActivity.TABLE, TABLE_ID_USER_ACTIVITY);
TABLE_LOCAL_TO_SERVER.put(TaskAttachment.TABLE, TABLE_ID_ATTACHMENTS);
TABLE_LOCAL_TO_SERVER.put(TaskListMetadata.TABLE, TABLE_ID_TASK_LIST_METADATA);
// Reverse the mapping to construct the server to local map
TABLE_SERVER_TO_LOCAL = AndroidUtilities.reverseMap(TABLE_LOCAL_TO_SERVER);
@ -83,6 +87,8 @@ public class NameMaps {
return computeSyncableProperties(USER_ACTIVITY_PROPERTIES_LOCAL_TO_SERVER.keySet(), USER_ACTIVITY_PROPERTIES_EXCLUDED);
else if (TABLE_ID_ATTACHMENTS.equals(table))
return computeSyncableProperties(TASK_ATTACHMENT_PROPERTIES_LOCAL_TO_SERVER.keySet(), TASK_ATTACHMENT_PROPERTIES_EXCLUDED);
else if (TABLE_ID_TASK_LIST_METADATA.equals(table))
return computeSyncableProperties(TASK_LIST_METADATA_PROPERTIES_LOCAL_TO_SERVER.keySet(), TASK_LIST_METADATA_PROPERTIES_EXCLUDED);
return null;
}
@ -283,12 +289,45 @@ public class NameMaps {
TASK_ATTACHMENT_PROPERTIES_SERVER_TO_LOCAL = AndroidUtilities.reverseMap(TASK_ATTACHMENT_PROPERTIES_LOCAL_TO_SERVER);
}
// ----------
// TaskListMetadata
// ----------
private static final Map<Property<?>, String> TASK_LIST_METADATA_PROPERTIES_LOCAL_TO_SERVER;
private static final Map<String, Property<?>> TASK_LIST_METADATA_COLUMN_NAMES_TO_PROPERTIES;
private static final Map<String, String> TASK_LIST_METADATA_COLUMNS_LOCAL_TO_SERVER;
private static final Map<String, Property<?>> TASK_LIST_METADATA_PROPERTIES_SERVER_TO_LOCAL;
private static final Set<String> TASK_LIST_METADATA_PROPERTIES_EXCLUDED;
private static void putTaskListMetadataPropertyToServerName(Property<?> property, String serverName, boolean writeable) {
putPropertyToServerName(property, serverName, TASK_LIST_METADATA_PROPERTIES_LOCAL_TO_SERVER, TASK_LIST_METADATA_COLUMN_NAMES_TO_PROPERTIES,
TASK_LIST_METADATA_COLUMNS_LOCAL_TO_SERVER, TASK_LIST_METADATA_PROPERTIES_EXCLUDED, writeable);
}
static {
TASK_LIST_METADATA_PROPERTIES_LOCAL_TO_SERVER = new HashMap<Property<?>, String>();
TASK_LIST_METADATA_COLUMN_NAMES_TO_PROPERTIES = new HashMap<String, Property<?>>();
TASK_LIST_METADATA_COLUMNS_LOCAL_TO_SERVER = new HashMap<String, String>();
TASK_LIST_METADATA_PROPERTIES_EXCLUDED = new HashSet<String>();
putTaskListMetadataPropertyToServerName(TaskListMetadata.UUID, "uuid", false);
putTaskListMetadataPropertyToServerName(TaskListMetadata.TAG_UUID, "tag_id", true);
putTaskListMetadataPropertyToServerName(TaskListMetadata.FILTER, "filter", true);
putTaskListMetadataPropertyToServerName(TaskListMetadata.TASK_IDS, "task_ids", true);
putTaskListMetadataPropertyToServerName(TaskListMetadata.SORT, "sort", true);
putTaskListMetadataPropertyToServerName(TaskListMetadata.SETTINGS, "settings", true);
putTaskListMetadataPropertyToServerName(TaskListMetadata.CHILD_TAG_IDS, "child_tag_ids", true);
putTaskListMetadataPropertyToServerName(TaskListMetadata.IS_COLLAPSED, "is_collapsed", true);
// Reverse the mapping to construct the server to local map
TASK_LIST_METADATA_PROPERTIES_SERVER_TO_LOCAL = AndroidUtilities.reverseMap(TASK_LIST_METADATA_PROPERTIES_LOCAL_TO_SERVER);
}
// ----------
// Mapping helpers
// ----------
private static <A, B> B mapColumnName(String table, String col, Map<A, B> taskMap, Map<A, B> tagMap, Map<A, B> userMap, Map<A, B> userActivityMap, Map<A, B> taskAttachmentMap) {
private static <A, B> B mapColumnName(String table, String col, Map<A, B> taskMap, Map<A, B> tagMap, Map<A, B> userMap, Map<A, B> userActivityMap, Map<A, B> taskAttachmentMap, Map<A, B> taskListMetadataMap) {
Map<A, B> map = null;
if (TABLE_ID_TASKS.equals(table))
map = taskMap;
@ -300,6 +339,8 @@ public class NameMaps {
map = userActivityMap;
else if (TABLE_ID_ATTACHMENTS.equals(table))
map = taskAttachmentMap;
else if (TABLE_ID_TASK_LIST_METADATA.equals(table))
map = taskListMetadataMap;
if (map == null)
return null;
@ -325,15 +366,15 @@ public class NameMaps {
}
public static String localColumnNameToServerColumnName(String table, String localColumn) {
return mapColumnName(table, localColumn, TASK_COLUMNS_LOCAL_TO_SERVER, TAG_DATA_COLUMNS_LOCAL_TO_SERVER, USER_COLUMNS_LOCAL_TO_SERVER, USER_ACTIVITY_COLUMNS_LOCAL_TO_SERVER, TASK_ATTACHMENT_COLUMNS_LOCAL_TO_SERVER);
return mapColumnName(table, localColumn, TASK_COLUMNS_LOCAL_TO_SERVER, TAG_DATA_COLUMNS_LOCAL_TO_SERVER, USER_COLUMNS_LOCAL_TO_SERVER, USER_ACTIVITY_COLUMNS_LOCAL_TO_SERVER, TASK_ATTACHMENT_COLUMNS_LOCAL_TO_SERVER, TASK_LIST_METADATA_COLUMNS_LOCAL_TO_SERVER);
}
public static Property<?> localColumnNameToProperty(String table, String localColumn) {
return mapColumnName(table, localColumn, TASK_COLUMN_NAMES_TO_PROPERTIES, TAG_DATA_COLUMN_NAMES_TO_PROPERTIES, USER_COLUMN_NAMES_TO_PROPERTIES, USER_ACTIVITY_COLUMN_NAMES_TO_PROPERTIES, TASK_ATTACHMENT_COLUMN_NAMES_TO_PROPERTIES);
return mapColumnName(table, localColumn, TASK_COLUMN_NAMES_TO_PROPERTIES, TAG_DATA_COLUMN_NAMES_TO_PROPERTIES, USER_COLUMN_NAMES_TO_PROPERTIES, USER_ACTIVITY_COLUMN_NAMES_TO_PROPERTIES, TASK_ATTACHMENT_COLUMN_NAMES_TO_PROPERTIES, TASK_LIST_METADATA_COLUMN_NAMES_TO_PROPERTIES);
}
public static Property<?> serverColumnNameToLocalProperty(String table, String serverColumn) {
return mapColumnName(table, serverColumn, TASK_PROPERTIES_SERVER_TO_LOCAL, TAG_DATA_PROPERTIES_SERVER_TO_LOCAL, USER_PROPERTIES_SERVER_TO_LOCAL, USER_ACTIVITY_PROPERTIES_SERVER_TO_LOCAL, TASK_ATTACHMENT_PROPERTIES_SERVER_TO_LOCAL);
return mapColumnName(table, serverColumn, TASK_PROPERTIES_SERVER_TO_LOCAL, TAG_DATA_PROPERTIES_SERVER_TO_LOCAL, USER_PROPERTIES_SERVER_TO_LOCAL, USER_ACTIVITY_PROPERTIES_SERVER_TO_LOCAL, TASK_ATTACHMENT_PROPERTIES_SERVER_TO_LOCAL, TASK_LIST_METADATA_PROPERTIES_SERVER_TO_LOCAL);
}
}

@ -47,6 +47,8 @@ public class NowBriefed<TYPE extends RemoteModel> extends ServerToClientMessage
pushedAtKey = NameMaps.PUSHED_AT_ACTIVITY;
else if (NameMaps.TABLE_ID_USERS.equals(table))
pushedAtKey = NameMaps.PUSHED_AT_USERS;
else if (NameMaps.TABLE_ID_TASK_LIST_METADATA.equals(table))
pushedAtKey = NameMaps.PUSHED_AT_TASK_LIST_METADATA;
if (pushedAtKey != null)
Preferences.setLong(pushedAtKey, pushedAt);

@ -6,6 +6,7 @@ import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskAttachment;
import com.todoroo.astrid.data.TaskListMetadata;
import com.todoroo.astrid.data.User;
import com.todoroo.astrid.data.UserActivity;
@ -57,6 +58,8 @@ public abstract class ServerToClientMessage {
return new MakeChanges<UserActivity>(json, PluginServices.getUserActivityDao());
else if (NameMaps.TABLE_ID_ATTACHMENTS.equals(table))
return new MakeChanges<TaskAttachment>(json, PluginServices.getTaskAttachmentDao());
else if (NameMaps.TABLE_ID_TASK_LIST_METADATA.equals(table))
return new MakeChanges<TaskListMetadata>(json, PluginServices.getTaskListMetadataDao());
else
return null;
}
@ -73,6 +76,8 @@ public abstract class ServerToClientMessage {
return new NowBriefed<User>(json, PluginServices.getUserDao());
else if (NameMaps.TABLE_ID_ATTACHMENTS.equals(table))
return new NowBriefed<TaskAttachment>(json, PluginServices.getTaskAttachmentDao());
else if (NameMaps.TABLE_ID_TASK_LIST_METADATA.equals(table))
return new NowBriefed<TaskListMetadata>(json, PluginServices.getTaskListMetadataDao());
else
return null;
}

@ -20,6 +20,8 @@ import com.todoroo.astrid.dao.TagOutstandingDao;
import com.todoroo.astrid.dao.TaskAttachmentDao;
import com.todoroo.astrid.dao.TaskAttachmentOutstandingDao;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.TaskListMetadataDao;
import com.todoroo.astrid.dao.TaskListMetadataOutstandingDao;
import com.todoroo.astrid.dao.TaskOutstandingDao;
import com.todoroo.astrid.dao.UserActivityDao;
import com.todoroo.astrid.dao.UserActivityOutstandingDao;
@ -93,6 +95,12 @@ public final class PluginServices {
@Autowired
TaskAttachmentOutstandingDao taskAttachmentOutstandingDao;
@Autowired
TaskListMetadataDao taskListMetadataDao;
@Autowired
TaskListMetadataOutstandingDao taskListMetadataOutstandingDao;
private static volatile PluginServices instance;
static {
@ -188,6 +196,14 @@ public final class PluginServices {
return getInstance().taskAttachmentOutstandingDao;
}
public static TaskListMetadataDao getTaskListMetadataDao() {
return getInstance().taskListMetadataDao;
}
public static TaskListMetadataOutstandingDao getTaskListMetadataOutstandingDao() {
return getInstance().taskListMetadataOutstandingDao;
}
// -- helpers
/**

@ -24,6 +24,8 @@ import com.todoroo.astrid.data.TagOutstanding;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskAttachment;
import com.todoroo.astrid.data.TaskAttachmentOutstanding;
import com.todoroo.astrid.data.TaskListMetadata;
import com.todoroo.astrid.data.TaskListMetadataOutstanding;
import com.todoroo.astrid.data.TaskOutstanding;
import com.todoroo.astrid.data.Update;
import com.todoroo.astrid.data.User;
@ -71,11 +73,13 @@ public class Database extends AbstractDatabase {
TagMetadata.TABLE,
History.TABLE,
TaskAttachment.TABLE,
TaskListMetadata.TABLE,
TaskOutstanding.TABLE,
TagOutstanding.TABLE,
UserActivityOutstanding.TABLE,
TaskAttachmentOutstanding.TABLE
TaskAttachmentOutstanding.TABLE,
TaskListMetadataOutstanding.TABLE
};
// --- listeners
@ -348,6 +352,8 @@ public class Database extends AbstractDatabase {
database.execSQL(createTableSql(visitor, UserActivityOutstanding.TABLE.name, UserActivityOutstanding.PROPERTIES));
database.execSQL(createTableSql(visitor, History.TABLE.name, History.PROPERTIES));
database.execSQL(createTableSql(visitor, TaskAttachment.TABLE.name, TaskAttachment.PROPERTIES));
database.execSQL(createTableSql(visitor, TaskListMetadata.TABLE.name, TaskListMetadata.PROPERTIES));
database.execSQL(createTableSql(visitor, TaskListMetadataOutstanding.TABLE.name, TaskListMetadataOutstanding.PROPERTIES));
database.execSQL(addColumnSql(Task.TABLE, Task.PUSHED_AT, visitor, null));
database.execSQL(addColumnSql(Task.TABLE, Task.IS_PUBLIC, visitor, "0"));

@ -85,23 +85,5 @@ public class TaskAttachmentDao extends RemoteModelDao<TaskAttachment> {
}
}
// --- SQL clause generators
/**
* Generates SQL clauses
*/
public static class TagDataCriteria {
/** @returns tasks by id */
public static Criterion byId(long id) {
return TagData.ID.eq(id);
}
public static Criterion isTeam() {
return TagData.IS_TEAM.eq(1);
}
}
}

@ -0,0 +1,37 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.dao;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.actfm.sync.messages.NameMaps;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.TaskListMetadata;
/**
* Data Access layer for {@link TagData}-related operations.
*
* @author Tim Su <tim@todoroo.com>
*
*/
public class TaskListMetadataDao extends RemoteModelDao<TaskListMetadata> {
@Autowired Database database;
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UR_UNINIT_READ")
public TaskListMetadataDao() {
super(TaskListMetadata.class);
DependencyInjectionService.getInstance().inject(this);
setDatabase(database);
}
@Override
protected boolean shouldRecordOutstandingEntry(String columnName) {
return NameMaps.shouldRecordOutstandingColumnForTable(NameMaps.TABLE_ID_TASK_LIST_METADATA, columnName);
}
}

@ -0,0 +1,12 @@
package com.todoroo.astrid.dao;
import com.todoroo.astrid.data.TaskListMetadataOutstanding;
public class TaskListMetadataOutstandingDao extends OutstandingEntryDao<TaskListMetadataOutstanding> {
public TaskListMetadataOutstandingDao() {
super(TaskListMetadataOutstanding.class);
}
}

@ -24,6 +24,8 @@ import com.todoroo.astrid.dao.TagOutstandingDao;
import com.todoroo.astrid.dao.TaskAttachmentDao;
import com.todoroo.astrid.dao.TaskAttachmentOutstandingDao;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.TaskListMetadataDao;
import com.todoroo.astrid.dao.TaskListMetadataOutstandingDao;
import com.todoroo.astrid.dao.TaskOutstandingDao;
import com.todoroo.astrid.dao.UpdateDao;
import com.todoroo.astrid.dao.UserActivityDao;
@ -87,6 +89,8 @@ public class AstridDependencyInjector extends AbstractDependencyInjector {
injectables.put("historyDao", HistoryDao.class);
injectables.put("taskAttachmentDao", TaskAttachmentDao.class);
injectables.put("taskAttachmentOutstandingDao", TaskAttachmentOutstandingDao.class);
injectables.put("taskListMetadataDao", TaskListMetadataDao.class);
injectables.put("taskListMetadataOutstandingDao", TaskListMetadataOutstandingDao.class);
// com.todoroo.astrid.service
injectables.put("taskService", TaskService.class);

Loading…
Cancel
Save