Extra case in migration for no uuid existing

pull/14/head
Sam Bosley 12 years ago
parent 31465834d5
commit 8be30f9cec

@ -249,7 +249,6 @@ public class AstridNewSyncMigrator {
TodorooCursor<Metadata> fmCursor = metadataService.query(Query.select(Metadata.PROPERTIES) TodorooCursor<Metadata> fmCursor = metadataService.query(Query.select(Metadata.PROPERTIES)
.where(MetadataCriteria.withKey(FileMetadata.METADATA_KEY))); .where(MetadataCriteria.withKey(FileMetadata.METADATA_KEY)));
try { try {
System.err.println("FILES COUNT: " + fmCursor.getCount());
Metadata m = new Metadata(); Metadata m = new Metadata();
for (fmCursor.moveToFirst(); !fmCursor.isAfterLast(); fmCursor.moveToNext()) { for (fmCursor.moveToFirst(); !fmCursor.isAfterLast(); fmCursor.moveToNext()) {
m.clear(); m.clear();
@ -257,7 +256,6 @@ public class AstridNewSyncMigrator {
TaskAttachment attachment = new TaskAttachment(); TaskAttachment attachment = new TaskAttachment();
Task task = taskDao.fetch(m.getValue(Metadata.TASK), Task.UUID); Task task = taskDao.fetch(m.getValue(Metadata.TASK), Task.UUID);
System.err.println("TASK UUID: " + task.getUuid());
if (task == null || !RemoteModel.isValidUuid(task.getUuid())) if (task == null || !RemoteModel.isValidUuid(task.getUuid()))
continue; continue;
@ -267,7 +265,6 @@ public class AstridNewSyncMigrator {
synced = true; synced = true;
attachment.setValue(TaskAttachment.UUID, Long.toString(oldRemoteId)); attachment.setValue(TaskAttachment.UUID, Long.toString(oldRemoteId));
} }
System.err.println("ALREADY SYNCED: " + synced);
attachment.setValue(TaskAttachment.TASK_UUID, task.getUuid()); attachment.setValue(TaskAttachment.TASK_UUID, task.getUuid());
if (m.containsNonNullValue(FileMetadata.NAME)) if (m.containsNonNullValue(FileMetadata.NAME))
attachment.setValue(TaskAttachment.NAME, m.getValue(FileMetadata.NAME)); attachment.setValue(TaskAttachment.NAME, m.getValue(FileMetadata.NAME));
@ -281,7 +278,6 @@ public class AstridNewSyncMigrator {
attachment.setValue(TaskAttachment.DELETED_AT, m.getValue(FileMetadata.DELETION_DATE)); attachment.setValue(TaskAttachment.DELETED_AT, m.getValue(FileMetadata.DELETION_DATE));
if (synced) { if (synced) {
System.err.println("ATTACHMENT UUID: " + attachment.getValue(TaskAttachment.UUID));
attachment.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true); attachment.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
} }
@ -393,7 +389,7 @@ public class AstridNewSyncMigrator {
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
instance.readPropertiesFromCursor(cursor); instance.readPropertiesFromCursor(cursor);
boolean unsyncedModel = false; boolean unsyncedModel = false;
if (!instance.containsNonNullValue(RemoteModel.UUID_PROPERTY) || RemoteModel.NO_UUID.equals(instance.getValue(RemoteModel.UUID_PROPERTY))) { if (!instance.containsNonNullValue(RemoteModel.UUID_PROPERTY) || RemoteModel.NO_UUID.equals(instance.getValue(RemoteModel.UUID_PROPERTY)) || "".equals(instance.getValue(RemoteModel.UUID_PROPERTY))) {
// No remote id exists, just create a UUID // No remote id exists, just create a UUID
unsyncedModel = true; unsyncedModel = true;
instance.setValue(RemoteModel.UUID_PROPERTY, UUIDHelper.newUUID()); instance.setValue(RemoteModel.UUID_PROPERTY, UUIDHelper.newUUID());

Loading…
Cancel
Save