From 5bfd9f7b6144eedbde7b1e35dae6dbf0c1b501df Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Wed, 13 Feb 2013 12:20:18 -0800 Subject: [PATCH] Undo all changes to Update class; it's been deprecated and needs to be the same as it used to be for legacy reasons --- api/src/com/todoroo/astrid/data/Update.java | 24 +++++++------------ .../actfm/sync/AstridNewSyncMigrator.java | 8 +++---- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/api/src/com/todoroo/astrid/data/Update.java b/api/src/com/todoroo/astrid/data/Update.java index 7a0d1b1ed..aa04bc25f 100644 --- a/api/src/com/todoroo/astrid/data/Update.java +++ b/api/src/com/todoroo/astrid/data/Update.java @@ -44,18 +44,13 @@ public class Update extends RemoteModel { TABLE, ID_PROPERTY_NAME); /** Remote ID */ - public static final StringProperty UUID = new StringProperty( + public static final LongProperty REMOTE_ID = new LongProperty( TABLE, UUID_PROPERTY_NAME); /** Associated Task remote-id (if any) */ - @Deprecated // We changed uuids to strings public static final LongProperty TASK = new LongProperty( TABLE, "task"); - /** Associated Task uuidid (if any) */ - public static final StringProperty TASK_UUID = new StringProperty( - TABLE, "taskUuid"); - /** Associated Task local-id (if any) */ public static final LongProperty TASK_LOCAL = new LongProperty( TABLE, "taskLocal"); @@ -69,15 +64,15 @@ public class Update extends RemoteModel { TABLE, "tagsLocal"); /** From user id */ - public static final StringProperty USER_ID = new StringProperty( + public static final LongProperty USER_ID = new LongProperty( TABLE, USER_ID_PROPERTY_NAME); /** From User Object (JSON) */ - @Deprecated public static final StringProperty USER = new StringProperty( + public static final StringProperty USER = new StringProperty( TABLE, USER_JSON_PROPERTY_NAME); /** Other user id */ - public static final StringProperty OTHER_USER_ID = new StringProperty( + public static final LongProperty OTHER_USER_ID = new LongProperty( TABLE, "other_user_id"); /** Other User Object (JSON) */ @@ -126,15 +121,14 @@ public class Update extends RemoteModel { } static { - defaultValues.put(UUID.name, NO_UUID); + defaultValues.put(REMOTE_ID.name, 0); defaultValues.put(TASK.name, 0); - defaultValues.put(TASK_UUID.name, NO_UUID); defaultValues.put(TASK_LOCAL.name, 0); defaultValues.put(TAGS.name, ""); defaultValues.put(TAGS_LOCAL.name, 0); - defaultValues.put(USER_ID.name, "0"); + defaultValues.put(USER_ID.name, 0); defaultValues.put(USER.name, ""); - defaultValues.put(OTHER_USER_ID.name, "0"); + defaultValues.put(OTHER_USER_ID.name, 0); defaultValues.put(OTHER_USER.name, ""); defaultValues.put(ACTION.name, ""); defaultValues.put(ACTION_CODE.name, ""); @@ -161,11 +155,11 @@ public class Update extends RemoteModel { @Override public long getId() { return getIdHelper(ID); - } + }; @Override public String getUuid() { - return getUuidHelper(UUID); + return null; } // --- parcelable helpers 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 b76de3ad4..0813c95f3 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java @@ -191,7 +191,7 @@ public class AstridNewSyncMigrator { // -------------- try { TodorooCursor updates = updateDao.query(Query.select(Update.PROPERTIES).where( - Criterion.and(Criterion.or(Update.UUID.eq(0), Update.UUID.isNull()), Criterion.or(Update.ACTION_CODE.eq(UserActivity.ACTION_TAG_COMMENT), + Criterion.and(Criterion.or(Update.REMOTE_ID.eq(0), Update.REMOTE_ID.isNull()), Criterion.or(Update.ACTION_CODE.eq(UserActivity.ACTION_TAG_COMMENT), Update.ACTION_CODE.eq(UserActivity.ACTION_TASK_COMMENT))))); try { Update update = new Update(); @@ -203,8 +203,8 @@ public class AstridNewSyncMigrator { update.readFromCursor(updates); boolean setTarget = true; - if (!RemoteModel.isUuidEmpty(update.getValue(Update.TASK_UUID))) { - userActivity.setValue(UserActivity.TARGET_ID, update.getValue(Update.TASK_UUID)); + if (!RemoteModel.isUuidEmpty(update.getValue(Update.TASK).toString())) { + userActivity.setValue(UserActivity.TARGET_ID, update.getValue(Update.TASK).toString()); } else if (update.getValue(Update.TASK_LOCAL) > 0) { Task local = taskDao.fetch(update.getValue(Update.TASK_LOCAL), Task.UUID); if (local != null && !RemoteModel.isUuidEmpty(local.getUuid())) @@ -216,7 +216,7 @@ public class AstridNewSyncMigrator { } if (setTarget) { - userActivity.setValue(UserActivity.USER_UUID, update.getValue(Update.USER_ID)); + userActivity.setValue(UserActivity.USER_UUID, update.getValue(Update.USER_ID).toString()); userActivity.setValue(UserActivity.ACTION, update.getValue(Update.ACTION_CODE)); userActivity.setValue(UserActivity.MESSAGE, update.getValue(Update.MESSAGE)); userActivity.setValue(UserActivity.CREATED_AT, update.getValue(Update.CREATION_DATE));