Undo all changes to Update class; it's been deprecated and needs to be the same as it used to be for legacy reasons

pull/14/head
Sam Bosley 12 years ago
parent 701bd6f79b
commit 5bfd9f7b61

@ -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

@ -191,7 +191,7 @@ public class AstridNewSyncMigrator {
// --------------
try {
TodorooCursor<Update> 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));

Loading…
Cancel
Save